Merge pull request #44 from mipt-npm/dev

0.11.5-kotlin-1.7.0
This commit is contained in:
Alexander Nozik 2022-06-09 19:44:46 +03:00 committed by GitHub
commit 53c399d542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 110 additions and 123 deletions

View File

@ -7,14 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added ### Added
- Coroutine tests as default dependency for tests
- Context receiver flag
### Changed ### Changed
- Separate release tasks for each target
- Kotlin 1.6.20
- Context receivers enabled
- Ktor 2.0
### Deprecated ### Deprecated
@ -22,33 +16,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
### Security
## [0.11.5-kotlin-1.7.0]
### Added
- Coroutine tests as default dependency for tests
- Context receiver flag
### Changed
- Separate release tasks for each target
- Kotlin 1.7.0
- Ktor 2.0.1
- ExplicitAPI does not override existing value
### Deprecated
### Removed
- Ktor specific artifacts from version catalog
### Fixed
- Moved signing out of sonatype block
### Security ### Security
## [0.11.1-kotlin-1.6.10] ## [0.11.1-kotlin-1.6.10]
### Added ### Added
- Default templates for README and ARTIFACT - Default templates for README and ARTIFACT
### Changed ### Changed
- Replaced Groovy templates by FreeMarker - Replaced Groovy templates by FreeMarker
### Deprecated
### Removed
### Fixed ### Fixed
- JS publication sources jar - JS publication sources jar
### Security
## [0.10.9-kotlin-1.6.10] ## [0.10.9-kotlin-1.6.10]
### Added ### Added
- html builders for readme - html builders for readme
### Changed ### Changed
- Kotlin 1.6.0 - Kotlin 1.6.0
- Use indy lambdas by default #32 - Use indy lambdas by default #32
- Change version scheme to `<version>-kotlin-<kotlin version>` - Change version scheme to `<version>-kotlin-<kotlin version>`
### Fixed ### Fixed
- remove `nativeMain` dependency from `nativeTest` - remove `nativeMain` dependency from `nativeTest`
@ -56,6 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Kotlin 1.6 - Kotlin 1.6
### Fixed ### Fixed
- Some issues with opt-ins - Some issues with opt-ins
@ -63,9 +81,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Experimental automatic JS project bundling in MPP - Experimental automatic JS project bundling in MPP
### Changed ### Changed
- Remove vcs requirement for Space publication - Remove vcs requirement for Space publication
### Fixed ### Fixed
-Release task (#19) -Release task (#19)
@ -75,10 +95,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- BOM for kotlin-wrappers on JS - BOM for kotlin-wrappers on JS
- Jupyter loader - Jupyter loader
### Changed ### Changed
- API validation disabled for dev versions - API validation disabled for dev versions
- Kotlin plugins are propagated downstream - Kotlin plugins are propagated downstream
### Removed ### Removed
- bson support - bson support
@ -87,15 +109,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Disable API validation for snapshots - Disable API validation for snapshots
- `-Xjvm-default=all` on JVM - `-Xjvm-default=all` on JVM
### Changed ### Changed
- `publication.platform` changed to `publishing.platform` - `publication.platform` changed to `publishing.platform`
- Dokka version to `1.4.30` - Dokka version to `1.4.30`
- `useDateTime` in extension - `useDateTime` in extension
- Kotlin 1.5 - Kotlin 1.5
### Removed ### Removed
- Publish plugin. Use MavenPublish instead - Publish plugin. Use MavenPublish instead
### Fixed ### Fixed
- Removed unnecessary `afterEvaluate` for compatibility with gradle 7.0 - Removed unnecessary `afterEvaluate` for compatibility with gradle 7.0
@ -103,13 +128,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Skip sonatype publishing for dev versions - Skip sonatype publishing for dev versions
### Changed ### Changed
- Publishing repositories are explicit and defined in the top level project - Publishing repositories are explicit and defined in the top level project
- Paths to publishing properties now use dot notation like `publishing.github.user` - Paths to publishing properties now use dot notation like `publishing.github.user`
### Deprecated ### Deprecated
- Publishing plugin - Publishing plugin
### Removed ### Removed
- Bintray publishing - Bintray publishing
@ -118,10 +146,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Adaptive support for host OS in native - Adaptive support for host OS in native
- CSS support for JS targets - CSS support for JS targets
### Changed ### Changed
- Kotlin 1.4.31 - Kotlin 1.4.31
- Coroutines 1.4.3 - Coroutines 1.4.3
### Fixed ### Fixed
- Plugin loading order for publishing - Plugin loading order for publishing
- Release task - Release task
@ -133,6 +163,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add sonatype publishing - Add sonatype publishing
- Per-platform release publishing - Per-platform release publishing
### Changed ### Changed
- Kotlin to 1.4.30 stable. - Kotlin to 1.4.30 stable.
- Added intermediate jsCommon main/test sourcesSet for node plugin. - Added intermediate jsCommon main/test sourcesSet for node plugin.
@ -140,9 +171,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Common plugin id changed to `common` - Common plugin id changed to `common`
- Plugins group changed to `ru.mipt.npm` with `gradle` prefix - Plugins group changed to `ru.mipt.npm` with `gradle` prefix
### Removed ### Removed
- kaml - kaml
### Fixed ### Fixed
- Fix publishing load order for sonatype - Fix publishing load order for sonatype
- Fix root project readme - Fix root project readme
@ -156,6 +189,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Moved all logic to a common plugin, leaving only proxies for platform plugins - Moved all logic to a common plugin, leaving only proxies for platform plugins
- Suppress API validation for modules with maturity below DEVELOPMENT - Suppress API validation for modules with maturity below DEVELOPMENT
### Changed ### Changed
- Remove node plugin. Node binaries should be turned on manually. - Remove node plugin. Node binaries should be turned on manually.
- Use default webpack distribution path. - Use default webpack distribution path.
@ -166,10 +200,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Moved internals to internals - Moved internals to internals
- Kotlin 1.4.30-RC - Kotlin 1.4.30-RC
### Deprecated ### Deprecated
- Support of `kaml` and `snake-yaml` in favor of `yamlKt` - Support of `kaml` and `snake-yaml` in favor of `yamlKt`
- Publish plugin - Publish plugin
### Removed ### Removed
- `useDokka` method. Documentation jar should be added manually if needed. - `useDokka` method. Documentation jar should be added manually if needed.
@ -180,6 +216,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `application()` toggle in plugin configuration to produce binaries on JS and applicaion plugin on jvm. - Add `application()` toggle in plugin configuration to produce binaries on JS and applicaion plugin on jvm.
- Add `publish` to expose publishing configuration. - Add `publish` to expose publishing configuration.
### Changed ### Changed
-Publishing in bintray now is automatic. -Publishing in bintray now is automatic.

View File

@ -1,6 +1,7 @@
plugins { plugins {
alias(libs.plugins.changelog) alias(libs.plugins.changelog)
alias(libs.plugins.dokka) alias(libs.plugins.dokka)
alias(libs.plugins.kotlin.jvm)
`java-gradle-plugin` `java-gradle-plugin`
`kotlin-dsl` `kotlin-dsl`
`maven-publish` `maven-publish`

View File

@ -1,24 +1,23 @@
[versions] [versions]
tools = "0.11.3-kotlin-1.6.20" tools = "0.11.5-kotlin-1.7.0"
kotlin = "1.6.20" kotlin = "1.7.0"
atomicfu = "0.17.1" atomicfu = "0.17.3"
binary-compatibility-validator = "0.8.0" binary-compatibility-validator = "0.9.0"
changelog = "1.3.1" changelog = "1.3.1"
dokka = "1.6.10" dokka = "1.6.21"
kotlin-jupyter = "0.11.0-71" kotlin-jupyter = "0.11.0-106"
kotlinx-benchmark = "0.4.2" kotlinx-benchmark = "0.4.2"
kotlinx-cli = "0.3.4" kotlinx-cli = "0.3.4"
kotlinx-collections-immutable = "0.3.5" kotlinx-coroutines = "1.6.2"
kotlinx-coroutines = "1.6.1" kotlinx-datetime = "0.3.3"
kotlinx-datetime = "0.3.2" kotlinx-html = "0.7.5"
kotlinx-html = "0.7.3" kotlinx-knit = "0.4.0"
kotlinx-knit = "0.3.0"
kotlinx-nodejs = "0.0.7" kotlinx-nodejs = "0.0.7"
kotlinx-serialization = "1.3.2" kotlinx-serialization = "1.3.3"
ktor = "2.0.0" ktor = "2.0.2"
xmlutil = "0.84.1" xmlutil = "0.84.2"
yamlkt = "0.10.2" yamlkt = "0.11.0"
jsBom = "0.0.1-pre.313-kotlin-1.6.10" jsBom = "1.0.0-pre.343"
junit = "5.8.2" junit = "5.8.2"
[libraries] [libraries]
@ -38,8 +37,6 @@ kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-grad
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" } kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" }
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-debug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-debug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "kotlinx-coroutines" }
@ -73,60 +70,6 @@ kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-seria
kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" } kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" }
ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" } ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" }
ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor" }
ktor-client-apache = { module = "io.ktor:ktor-client-apache", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
ktor-client-auth-basic = { module = "io.ktor:ktor-client-auth-basic", version.ref = "ktor" }
ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" }
ktor-client-encoding = { module = "io.ktor:ktor-client-encoding", version.ref = "ktor" }
ktor-client-json = { module = "io.ktor:ktor-client-json", version.ref = "ktor" }
ktor-client-gson = { module = "io.ktor:ktor-client-gson", version.ref = "ktor" }
ktor-client-jackson = { module = "io.ktor:ktor-client-jackson", version.ref = "ktor" }
ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" }
ktor-client-logging = { module = "io.ktor:ktor-client-loggin", version.ref = "ktor" }
ktor-client-tracing = { module = "io.ktor:ktor-client-tracing", version.ref = "ktor" }
ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
ktor-client-jetty = { module = "io.ktor:ktor-client-jetty", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-auth-jwt = { module = "io.ktor:ktor-auth-jwt", version.ref = "ktor" }
ktor-auth-ldap = { module = "io.ktor:ktor-auth-ldap", version.ref = "ktor" }
ktor-auth = { module = "io.ktor:ktor-auth", version.ref = "ktor" }
ktor-freemaker = { module = "io.ktor:ktor-freemaker", version.ref = "ktor" }
ktor-gson = { module = "io.ktor:ktor-gson", version.ref = "ktor" }
ktor-html-builder = { module = "io.ktor:ktor-html-builder", version.ref = "ktor" }
ktor-jackson = { module = "io.ktor:ktor-jackson", version.ref = "ktor" }
ktor-locations = { module = "io.ktor:ktor-locations", version.ref = "ktor" }
ktor-metrics-micrometer = { module = "io.ktor:ktor-metrics-micrometer", version.ref = "ktor" }
ktor-metrics = { module = "io.ktor:ktor-metrics", version.ref = "ktor" }
ktor-mustache = { module = "io.ktor:ktor-mustache", version.ref = "ktor" }
ktor-pebble = { module = "io.ktor:ktor-pebble", version.ref = "ktor" }
ktor-serialization = { module = "io.ktor:ktor-serialization", version.ref = "ktor" }
ktor-server-sessions = { module = "io.ktor:ktor-server-sessions", version.ref = "ktor" }
ktor-thymeleaf = { module = "io.ktor:ktor-thymeleaf", version.ref = "ktor" }
ktor-velocity = { module = "io.ktor:ktor-velocity", version.ref = "ktor" }
ktor-webjars = { module = "io.ktor:ktor-webjars", version.ref = "ktor" }
ktor-websockets = { module = "io.ktor:ktor-websockets", version.ref = "ktor" }
ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" }
ktor-http-cio = { module = "io.ktor:ktor-http-cio", version.ref = "ktor" }
ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" }
ktor-network = { module = "io.ktor:ktor-network", version.ref = "ktor" }
ktor-network-tls = { module = "io.ktor:ktor-network-tls", version.ref = "ktor" }
ktor-network-tls-certificates = { module = "io.ktor:ktor-network-tls-certificates", version.ref = "ktor" }
ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" }
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
ktor-server-jetty = { module = "io.ktor:ktor-server-jetty", version.ref = "ktor" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
ktor-server-servlet = { module = "io.ktor:ktor-server-servlet", version.ref = "ktor" }
ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
ktor-server-tomcat = { module = "io.ktor:ktor-server-tomcat", version.ref = "ktor" }
ktor-test-dispatcher = { module = "io.ktor:ktor-test-dispatcher", version.ref = "ktor" }
ktor-utils = { module = "io.ktor:ktor-utils", version.ref = "ktor" }
xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlutil" } xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlutil" }
xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" } xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -3,9 +3,8 @@ package ru.mipt.npm.gradle
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
@Suppress("UNUSED_VARIABLE")
public open class KScienceCommonPlugin : Plugin<Project> { public open class KScienceCommonPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.configureKScience( override fun apply(project: Project): Unit = project.configureKScience(
KotlinVersion(1, 6, 10) KotlinVersion(1, 7, 0)
) )
} }

View File

@ -7,19 +7,19 @@ import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.* import org.gradle.kotlin.dsl.*
import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import ru.mipt.npm.gradle.internal.applyRepos import ru.mipt.npm.gradle.internal.applyRepos
import ru.mipt.npm.gradle.internal.applySettings import ru.mipt.npm.gradle.internal.applySettings
import ru.mipt.npm.gradle.internal.fromJsDependencies import ru.mipt.npm.gradle.internal.fromJsDependencies
private val defaultJvmArgs: List<String> = listOf("-Xjvm-default=all", "-Xlambdas=indy", "-Xcontext-receivers") private val defaultJvmArgs: List<String> = listOf("-Xjvm-default=all", "-Xlambdas=indy")
public fun Project.configureKScience( public fun Project.configureKScience(
kotlinVersion: KotlinVersion kotlinVersion: KotlinVersion,
){ ) {
//Common configuration //Common configuration
registerKScienceExtension() registerKScienceExtension()
repositories.applyRepos() repositories.applyRepos()
@ -28,8 +28,6 @@ public fun Project.configureKScience(
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
//logger.info("Applying KScience configuration for JVM project") //logger.info("Applying KScience configuration for JVM project")
configure<KotlinJvmProjectExtension> { configure<KotlinJvmProjectExtension> {
explicitApiWarning()
sourceSets.all { sourceSets.all {
languageSettings.applySettings(kotlinVersion) languageSettings.applySettings(kotlinVersion)
} }
@ -41,8 +39,10 @@ public fun Project.configureKScience(
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}")
} }
} }
if (explicitApi == null) explicitApiWarning()
} }
tasks.withType<KotlinJvmCompile> { tasks.withType<KotlinCompile> {
kotlinOptions { kotlinOptions {
jvmTarget = KScienceVersions.JVM_TARGET.toString() jvmTarget = KScienceVersions.JVM_TARGET.toString()
freeCompilerArgs = freeCompilerArgs + defaultJvmArgs freeCompilerArgs = freeCompilerArgs + defaultJvmArgs
@ -61,8 +61,6 @@ public fun Project.configureKScience(
pluginManager.withPlugin("org.jetbrains.kotlin.js") { pluginManager.withPlugin("org.jetbrains.kotlin.js") {
//logger.info("Applying KScience configuration for JS project") //logger.info("Applying KScience configuration for JS project")
configure<KotlinJsProjectExtension> { configure<KotlinJsProjectExtension> {
explicitApiWarning()
js(IR) { js(IR) {
browser { browser {
commonWebpackConfig { commonWebpackConfig {
@ -87,6 +85,8 @@ public fun Project.configureKScience(
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}")
} }
} }
if (explicitApi == null) explicitApiWarning()
} }
(tasks.findByName("processResources") as? Copy)?.apply { (tasks.findByName("processResources") as? Copy)?.apply {
@ -97,8 +97,6 @@ public fun Project.configureKScience(
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> { configure<KotlinMultiplatformExtension> {
explicitApiWarning()
jvm { jvm {
compilations.all { compilations.all {
kotlinOptions { kotlinOptions {
@ -159,6 +157,8 @@ public fun Project.configureKScience(
tasks.withType<Test> { tasks.withType<Test> {
useJUnitPlatform() useJUnitPlatform()
} }
if (explicitApi == null) explicitApiWarning()
} }
} }

View File

@ -10,6 +10,7 @@ import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin import org.gradle.plugins.signing.SigningPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.targets
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
?: System.getenv(propertyName) ?: System.getenv(propertyName)
@ -31,12 +32,15 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
from(it.kotlin) from(it.kotlin)
} }
} }
publications.create<MavenPublication>("js") {
kotlin.js().components.forEach {
from(it)
}
artifact(sourcesJar) afterEvaluate {
publications.create<MavenPublication>("js") {
kotlin.targets.flatMap { it.components }.forEach {
from(it)
}
artifact(sourcesJar)
}
} }
} }
@ -51,12 +55,14 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
} }
} }
publications.create<MavenPublication>("jvm") { afterEvaluate {
kotlin.target.components.forEach { publications.create<MavenPublication>("jvm") {
from(it) kotlin.target.components.forEach {
} from(it)
}
artifact(sourcesJar) artifact(sourcesJar)
}
} }
} }
@ -98,6 +104,23 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
mavenPomConfiguration() mavenPomConfiguration()
} }
} }
if (!plugins.hasPlugin("signing")) {
apply<SigningPlugin>()
}
extensions.configure<SigningExtension>("signing") {
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
if (!signingId.isNullOrBlank()) {
val signingKey: String = requestProperty("publishing.signing.key")
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
// if key is provided, use it
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
} // else use file signing
sign(publications)
}
} }
} }
} }
@ -194,22 +217,6 @@ internal fun Project.addSonatypePublishing() {
allprojects { allprojects {
plugins.withId("maven-publish") { plugins.withId("maven-publish") {
configure<PublishingExtension> { configure<PublishingExtension> {
if (!plugins.hasPlugin("signing")) {
apply<SigningPlugin>()
}
extensions.configure<SigningExtension>("signing") {
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
if (!signingId.isNullOrBlank()) {
val signingKey: String = requestProperty("publishing.signing.key")
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
// if key is provided, use it
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
} // else use file signing
sign(publications)
}
repositories.maven { repositories.maven {
val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2" val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
name = "sonatype" name = "sonatype"