Compare commits
35 Commits
master
...
beta/2.0.0
Author | SHA1 | Date | |
---|---|---|---|
e55e296ab0 | |||
329d023438 | |||
cb1c6d79a7 | |||
93d881c9a4 | |||
6cd7b572d6 | |||
3a150eff69 | |||
920385e135 | |||
71f7698633 | |||
ed5faa0335 | |||
7636f37cfc | |||
b5772a2e9b | |||
dba45860f7 | |||
90762f493e | |||
54952c3da6 | |||
89af2dd644 | |||
b27624bf1c | |||
4f41d90308 | |||
33b6de9f0e | |||
2f5e053aea | |||
c3bdd8edca | |||
c249dc5ae4 | |||
8a864f97a3 | |||
72f2678f3d | |||
8272c4ae4d | |||
a62503ac41 | |||
5463c9326b | |||
4238dc5a43 | |||
021f78c510 | |||
b05617ce9a | |||
70c190d7fa | |||
d3432643e8 | |||
512954b510 | |||
9fc8d96e88 | |||
2e3b74eb63 | |||
2886b7b200 |
@ -7,12 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- Add development mode for fullstack.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Kotlin 1.9.20
|
||||||
|
- Remove publishing defaults for Space and GitHub. Now publishing repositories is configured quasi-manually. Property keys for username and tokens are generated automatically.
|
||||||
|
- All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
- JVM plugin in favor of Mpp.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
- JS plugin. It is deprecated in favor of MPP.
|
||||||
|
- Unnecessary `dependsOn` for native dependencies.
|
||||||
|
- Groovy gradle dependency notation.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -25,17 +25,18 @@ kotlin.explicitApiWarning()
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.kotlin.gradle)
|
api(libs.kotlin.gradle)
|
||||||
|
api("org.gradle.toolchains:foojay-resolver:0.8.0")
|
||||||
implementation(libs.binary.compatibility.validator)
|
implementation(libs.binary.compatibility.validator)
|
||||||
implementation(libs.changelog.gradle)
|
implementation(libs.changelog.gradle)
|
||||||
implementation(libs.dokka.gradle)
|
implementation(libs.dokka.gradle)
|
||||||
implementation(libs.kotlin.jupyter.gradle)
|
implementation(libs.kotlin.jupyter.gradle)
|
||||||
implementation(libs.kotlin.serialization)
|
implementation(libs.kotlin.serialization)
|
||||||
implementation(libs.kotlinx.html)
|
implementation(libs.kotlinx.html)
|
||||||
implementation("org.tomlj:tomlj:1.1.0")
|
implementation("org.tomlj:tomlj:1.1.1")
|
||||||
// // nexus publishing plugin
|
// // nexus publishing plugin
|
||||||
// implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
|
// implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
|
||||||
|
|
||||||
implementation("org.freemarker:freemarker:2.3.31")
|
implementation("org.freemarker:freemarker:2.3.32")
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
}
|
}
|
||||||
@ -65,23 +66,17 @@ gradlePlugin {
|
|||||||
description = "Pre-configured JVM project"
|
description = "Pre-configured JVM project"
|
||||||
implementationClass = "space.kscience.gradle.KScienceJVMPlugin"
|
implementationClass = "space.kscience.gradle.KScienceJVMPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("js") {
|
|
||||||
id = "space.kscience.gradle.js"
|
|
||||||
description = "Pre-configured JS project"
|
|
||||||
implementationClass = "space.kscience.gradle.KScienceJSPlugin"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.create("version") {
|
tasks.create("version") {
|
||||||
group = "publishing"
|
group = "publishing"
|
||||||
val versionFile = project.buildDir.resolve("project-version.txt")
|
val versionFileProvider = project.layout.buildDirectory.file("project-version.txt")
|
||||||
outputs.file(versionFile)
|
outputs.file(versionFileProvider)
|
||||||
doLast {
|
doLast {
|
||||||
|
val versionFile = versionFileProvider.get().asFile
|
||||||
versionFile.createNewFile()
|
versionFile.createNewFile()
|
||||||
versionFile.writeText(project.version.toString())
|
versionFile.writeText(project.version.toString())
|
||||||
println(project.version)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +112,7 @@ val emptySourcesJar by tasks.creating(Jar::class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
val vcs = "https://github.com/SciProgCentre/gradle-tools"
|
||||||
|
|
||||||
// Process each publication we have in this project
|
// Process each publication we have in this project
|
||||||
publications {
|
publications {
|
||||||
@ -151,10 +146,10 @@ publishing {
|
|||||||
|
|
||||||
developers {
|
developers {
|
||||||
developer {
|
developer {
|
||||||
id.set("MIPT-NPM")
|
id.set("SPC")
|
||||||
name.set("MIPT nuclear physics methods laboratory")
|
name.set("Scientific Programming Centre")
|
||||||
organization.set("MIPT")
|
organization.set("SPC")
|
||||||
organizationUrl.set("https://npm.mipt.ru")
|
organizationUrl.set("https://sciprog.center/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,20 +161,18 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val spaceRepo = "https://maven.pkg.jetbrains.space/spc/p/sci/maven"
|
val spaceRepo = "https://maven.sciprog.center/kscience"
|
||||||
val spaceUser: String? = findProperty("publishing.space.user") as? String
|
val spcUser: String? = findProperty("publishing.spc.user") as? String
|
||||||
val spaceToken: String? = findProperty("publishing.space.token") as? String
|
val spcToken: String? = findProperty("publishing.spc.token") as? String
|
||||||
|
|
||||||
if (spaceUser != null && spaceToken != null) {
|
|
||||||
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
|
|
||||||
|
|
||||||
|
if (spcUser != null && spcToken != null) {
|
||||||
repositories.maven {
|
repositories.maven {
|
||||||
name = "space"
|
name = "spc"
|
||||||
url = uri(spaceRepo)
|
url = uri(spaceRepo)
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = spaceUser
|
username = spcUser
|
||||||
password = spaceToken
|
password = spcToken
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,7 +204,6 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvmToolchain {
|
jvmToolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(11))
|
languageVersion.set(JavaLanguageVersion.of(11))
|
||||||
|
@ -1,28 +1,88 @@
|
|||||||
|
## Generated by $ ./gradlew refreshVersionsCatalog
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
|
||||||
|
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
|
||||||
|
|
||||||
|
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
|
|
||||||
|
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
|
||||||
|
|
||||||
|
ktor = {id = "io.ktor.plugin", version.ref = "ktor"}
|
||||||
|
|
||||||
|
gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" }
|
||||||
|
gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" }
|
||||||
|
gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" }
|
||||||
|
gradle-jvm = { id = "space.kscience.gradle.jvm", version.ref = "tools" }
|
||||||
|
|
||||||
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }
|
||||||
|
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
|
||||||
|
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
|
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
|
||||||
|
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||||
|
kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
|
||||||
|
|
||||||
|
kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" }
|
||||||
|
|
||||||
|
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" }
|
||||||
|
|
||||||
[versions]
|
[versions]
|
||||||
tools = "0.14.4-kotlin-1.8.20-RC"
|
|
||||||
kotlin = "1.8.20-RC"
|
tools = "0.15.2-kotlin-2.0.0-RC2"
|
||||||
atomicfu = "0.19.0"
|
kotlin = "2.0.0-RC2"
|
||||||
binary-compatibility-validator = "0.12.1"
|
# https://github.com/Kotlin/kotlinx-atomicfu
|
||||||
changelog = "2.0.0"
|
atomicfu = "0.23.1"
|
||||||
dokka = "1.7.20"
|
# https://github.com/Kotlin/binary-compatibility-validator
|
||||||
kotlin-jupyter = "0.11.0-317"
|
binary-compatibility-validator = "0.14.0"
|
||||||
kotlinx-benchmark = "0.4.7"
|
# https://github.com/JetBrains/gradle-changelog-plugin
|
||||||
kotlinx-cli = "0.3.5"
|
changelog = "2.2.0"
|
||||||
kotlinx-coroutines = "1.6.4"
|
# https://github.com/Kotlin/dokka
|
||||||
kotlinx-datetime = "0.4.0"
|
dokka = "1.9.20"
|
||||||
kotlinx-html = "0.8.0"
|
# https://github.com/Kotlin/kotlin-jupyter
|
||||||
|
kotlin-jupyter = "0.12.0-192"
|
||||||
|
# https://github.com/Kotlin/kotlinx-benchmark
|
||||||
|
kotlinx-benchmark = "0.4.9"
|
||||||
|
# https://github.com/Kotlin/kotlinx-cli
|
||||||
|
kotlinx-cli = "0.3.6"
|
||||||
|
# https://github.com/Kotlin/kotlinx.coroutines
|
||||||
|
kotlinx-coroutines = "1.8.0"
|
||||||
|
# https://github.com/Kotlin/kotlinx-datetime
|
||||||
|
kotlinx-datetime = "0.4.1"
|
||||||
|
# https://github.com/Kotlin/kotlinx.html
|
||||||
|
kotlinx-html = "0.11.0"
|
||||||
|
# https://github.com/Kotlin/kotlinx-knit
|
||||||
kotlinx-knit = "0.4.0"
|
kotlinx-knit = "0.4.0"
|
||||||
|
# https://github.com/Kotlin/kotlinx-nodejs
|
||||||
kotlinx-nodejs = "0.0.7"
|
kotlinx-nodejs = "0.0.7"
|
||||||
kotlinx-serialization = "1.4.1"
|
# https://github.com/Kotlin/kotlinx.serialization
|
||||||
ktor = "2.2.3"
|
kotlinx-serialization = "1.6.2"
|
||||||
xmlutil = "0.84.3"
|
# https://ktor.io/
|
||||||
yamlkt = "0.12.0"
|
ktor = "2.3.6"
|
||||||
jsBom = "1.0.0-pre.509"
|
# https://github.com/pdvrieze/xmlutil
|
||||||
junit = "5.9.2"
|
xmlutil = "0.86.2"
|
||||||
compose = "1.3.0"
|
# https://github.com/Him188/yamlkt
|
||||||
logback = "1.4.5"
|
yamlkt = "0.13.0"
|
||||||
|
# https://github.com/JetBrains/kotlin-wrappers
|
||||||
|
jsBom = "1.0.0-pre.732"
|
||||||
|
junit = "5.9.3"
|
||||||
|
# https://github.com/JetBrains/compose-multiplatform
|
||||||
|
compose = "1.6.2"
|
||||||
|
# https://mvnrepository.com/artifact/org.slf4j/slf4j-api
|
||||||
|
slf4j = "2.0.9"
|
||||||
|
# https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
|
||||||
|
logback = "1.4.11"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
|
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
|
||||||
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
|
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
|
||||||
|
|
||||||
@ -37,6 +97,8 @@ kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", v
|
|||||||
|
|
||||||
kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" }
|
kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" }
|
||||||
|
|
||||||
|
kotlin-js-wrappers = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version.ref = "jsBom" }
|
||||||
|
|
||||||
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-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" }
|
||||||
@ -79,38 +141,6 @@ xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", v
|
|||||||
|
|
||||||
yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" }
|
yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" }
|
||||||
|
|
||||||
logback-classic = {module = "ch.qos.logback:logback-classic", version.ref = "logback"}
|
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
||||||
|
|
||||||
[plugins]
|
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
|
||||||
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
|
|
||||||
|
|
||||||
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
|
||||||
compose = {id = "org.jetbrains.compose", version.ref = "compose"}
|
|
||||||
|
|
||||||
gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" }
|
|
||||||
gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" }
|
|
||||||
gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" }
|
|
||||||
gradle-jvm = { id = "space.kscience.gradle.jvm", version.ref = "tools" }
|
|
||||||
gradle-js = { id = "space.kscience.gradle.js", version.ref = "tools" }
|
|
||||||
gradle-native = { id = "space.kscience.gradle.native", version.ref = "tools" }
|
|
||||||
gradle-node = { id = "space.kscience.gradle.node", version.ref = "tools" }
|
|
||||||
|
|
||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
|
||||||
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }
|
|
||||||
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
|
|
||||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|
||||||
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
|
|
||||||
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
|
||||||
kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
|
|
||||||
kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
|
|
||||||
kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" }
|
|
||||||
kotlin-plugin-lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" }
|
|
||||||
kotlin-plugin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" }
|
|
||||||
kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
|
|
||||||
kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" }
|
|
||||||
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
|
||||||
kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
|
|
||||||
|
|
||||||
kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" }
|
|
||||||
|
|
||||||
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" }
|
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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-8.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1 +1,6 @@
|
|||||||
rootProject.name = "gradle-tools"
|
rootProject.name = "gradle-tools"
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("org.gradle.toolchains.foojay-resolver-convention") version("0.8.0")
|
||||||
|
id("de.fayard.refreshVersions") version "0.60.5"
|
||||||
|
}
|
||||||
|
@ -9,21 +9,24 @@ import org.gradle.api.tasks.testing.Test
|
|||||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
import org.gradle.language.jvm.tasks.ProcessResources
|
import org.gradle.language.jvm.tasks.ProcessResources
|
||||||
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
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.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
|
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBrowserDsl
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBrowserDsl
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmTargetDsl
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl
|
||||||
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask
|
import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask
|
||||||
import space.kscience.gradle.internal.defaultKotlinJvmArgs
|
import space.kscience.gradle.internal.defaultKotlinJvmArgs
|
||||||
import space.kscience.gradle.internal.fromJsDependencies
|
import space.kscience.gradle.internal.fromJsDependencies
|
||||||
|
import space.kscience.gradle.internal.requestPropertyOrNull
|
||||||
import space.kscience.gradle.internal.useCommonDependency
|
import space.kscience.gradle.internal.useCommonDependency
|
||||||
|
|
||||||
public enum class DependencyConfiguration {
|
public enum class DependencyConfiguration {
|
||||||
@ -105,7 +108,7 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
sourceSets.findByName("commonMain")?.apply {
|
sourceSets.findByName("commonMain")?.apply {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(platform("io.ktor:ktor-bom:$version"))
|
api(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +117,7 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
configure<KotlinJvmProjectExtension> {
|
configure<KotlinJvmProjectExtension> {
|
||||||
sourceSets.findByName("main")?.apply {
|
sourceSets.findByName("main")?.apply {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(platform("io.ktor:ktor-bom:$version"))
|
api(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +126,7 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
configure<KotlinJsProjectExtension> {
|
configure<KotlinJsProjectExtension> {
|
||||||
sourceSets.findByName("main")?.apply {
|
sourceSets.findByName("main")?.apply {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(platform("io.ktor:ktor-bom:$version"))
|
api(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,14 +156,6 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
|
||||||
project.configure<KotlinJsProjectExtension> {
|
|
||||||
sourceSets.getByName(sourceSet ?: "main") {
|
|
||||||
dependencies(dependencyBlock)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
project.configure<KotlinMultiplatformExtension> {
|
project.configure<KotlinMultiplatformExtension> {
|
||||||
sourceSets.getByName(sourceSet ?: "commonMain") {
|
sourceSets.getByName(sourceSet ?: "commonMain") {
|
||||||
@ -179,13 +174,6 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
|
||||||
project.configure<KotlinJsProjectExtension> {
|
|
||||||
sourceSets.getByName(sourceSet ?: "test") {
|
|
||||||
dependencies(dependencyBlock)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
project.configure<KotlinMultiplatformExtension> {
|
project.configure<KotlinMultiplatformExtension> {
|
||||||
@ -207,6 +195,7 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
/**
|
/**
|
||||||
* Mark this module as an application module. JVM application should be enabled separately
|
* Mark this module as an application module. JVM application should be enabled separately
|
||||||
*/
|
*/
|
||||||
|
@Deprecated("Use platform-specific applications")
|
||||||
public fun application() {
|
public fun application() {
|
||||||
project.extensions.findByType<KotlinProjectExtension>()?.apply {
|
project.extensions.findByType<KotlinProjectExtension>()?.apply {
|
||||||
explicitApi = null
|
explicitApi = null
|
||||||
@ -231,7 +220,7 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
|
|
||||||
targets.withType<KotlinWasmTargetDsl> {
|
targets.withType<KotlinWasmJsTargetDsl> {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,8 +231,8 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
*/
|
*/
|
||||||
public fun useContextReceivers() {
|
public fun useContextReceivers() {
|
||||||
project.tasks.withType<KotlinCompile> {
|
project.tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions {
|
compilerOptions{
|
||||||
freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers"
|
freeCompilerArgs.add("-Xcontext-receivers")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,8 +250,8 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
public val jsTest: DefaultSourceSet get() = DefaultSourceSet("jsTest")
|
public val jsTest: DefaultSourceSet get() = DefaultSourceSet("jsTest")
|
||||||
public val nativeMain: DefaultSourceSet get() = DefaultSourceSet("nativeMain")
|
public val nativeMain: DefaultSourceSet get() = DefaultSourceSet("nativeMain")
|
||||||
public val nativeTest: DefaultSourceSet get() = DefaultSourceSet("nativeTest")
|
public val nativeTest: DefaultSourceSet get() = DefaultSourceSet("nativeTest")
|
||||||
public val wasmMain: DefaultSourceSet get() = DefaultSourceSet("wasmMain")
|
public val wasmJsMain: DefaultSourceSet get() = DefaultSourceSet("wasmJsMain")
|
||||||
public val wasmTest: DefaultSourceSet get() = DefaultSourceSet("wasmTest")
|
public val wasmJsTest: DefaultSourceSet get() = DefaultSourceSet("wasmJsTest")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,21 +274,37 @@ public data class KScienceNativeTarget(
|
|||||||
public val linuxX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.linuxX64)
|
public val linuxX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.linuxX64)
|
||||||
public val mingwX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.mingwX64)
|
public val mingwX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.mingwX64)
|
||||||
public val macosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
|
public val macosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
|
||||||
public val macosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
|
public val macosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosArm64)
|
||||||
public val iosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosX64)
|
public val iosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosX64)
|
||||||
public val iosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosArm64)
|
public val iosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosArm64)
|
||||||
public val iosSimulatorArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosSimulatorArm64)
|
public val iosSimulatorArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosSimulatorArm64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class KScienceNativeConfiguration {
|
public class KScienceNativeConfiguration(private val project: Project) {
|
||||||
|
|
||||||
|
|
||||||
internal companion object {
|
internal companion object {
|
||||||
private fun defaultNativeTargets(): Map<KotlinNativePreset, KScienceNativeTarget> {
|
private fun defaultNativeTargets(project: Project): Map<KotlinNativePreset, KScienceNativeTarget> {
|
||||||
|
|
||||||
val hostOs = System.getProperty("os.name")
|
val hostOs = System.getProperty("os.name")
|
||||||
|
|
||||||
|
val targets = project.requestPropertyOrNull("publishing.targets")
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
|
targets == "all" -> listOf(
|
||||||
|
KScienceNativeTarget.linuxX64,
|
||||||
|
KScienceNativeTarget.mingwX64,
|
||||||
|
KScienceNativeTarget.macosX64,
|
||||||
|
KScienceNativeTarget.macosArm64,
|
||||||
|
KScienceNativeTarget.iosX64,
|
||||||
|
KScienceNativeTarget.iosArm64,
|
||||||
|
KScienceNativeTarget.iosSimulatorArm64,
|
||||||
|
)
|
||||||
|
|
||||||
|
targets != null -> {
|
||||||
|
targets.split(",").map { KScienceNativeTarget(KotlinNativePreset.valueOf(it)) }
|
||||||
|
}
|
||||||
|
|
||||||
hostOs.startsWith("Windows") -> listOf(
|
hostOs.startsWith("Windows") -> listOf(
|
||||||
KScienceNativeTarget.linuxX64,
|
KScienceNativeTarget.linuxX64,
|
||||||
KScienceNativeTarget.mingwX64
|
KScienceNativeTarget.mingwX64
|
||||||
@ -314,6 +319,7 @@ public class KScienceNativeConfiguration {
|
|||||||
)
|
)
|
||||||
|
|
||||||
hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64)
|
hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64)
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
@ -322,7 +328,7 @@ public class KScienceNativeConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets()
|
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets(project)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -354,10 +360,9 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
|||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
project.configure<KotlinMultiplatformExtension> {
|
project.configure<KotlinMultiplatformExtension> {
|
||||||
jvm {
|
jvm {
|
||||||
compilations.all {
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
kotlinOptions {
|
compilerOptions{
|
||||||
freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs
|
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
@ -403,14 +408,35 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Wasm/Js target
|
||||||
|
*/
|
||||||
@OptIn(ExperimentalWasmDsl::class)
|
@OptIn(ExperimentalWasmDsl::class)
|
||||||
public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) {
|
public fun wasm(block: KotlinWasmJsTargetDsl.() -> Unit = {}) {
|
||||||
|
// if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") {
|
||||||
|
// project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property")
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
project.configure<KotlinMultiplatformExtension> {
|
project.configure<KotlinMultiplatformExtension> {
|
||||||
wasm {
|
wasmJs {
|
||||||
browser()
|
browser {
|
||||||
|
testTask {
|
||||||
|
useKarma {
|
||||||
|
useChromeHeadless()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
|
sourceSets {
|
||||||
|
getByName("wasmJsTest") {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-wasm-js"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -425,26 +451,29 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
|||||||
*/
|
*/
|
||||||
public fun fullStack(
|
public fun fullStack(
|
||||||
bundleName: String = "js/bundle.js",
|
bundleName: String = "js/bundle.js",
|
||||||
|
development: Boolean = false,
|
||||||
jvmConfig: KotlinJvmTarget.() -> Unit = {},
|
jvmConfig: KotlinJvmTarget.() -> Unit = {},
|
||||||
jsConfig: KotlinJsTargetDsl.() -> Unit = {},
|
jsConfig: KotlinJsTargetDsl.() -> Unit = {},
|
||||||
browserConfig: KotlinJsBrowserDsl.() -> Unit = {},
|
browserConfig: KotlinJsBrowserDsl.() -> Unit = {},
|
||||||
) {
|
) {
|
||||||
js {
|
js {
|
||||||
binaries.executable()
|
|
||||||
browser {
|
browser {
|
||||||
webpackTask {
|
commonWebpackConfig{
|
||||||
outputFileName = bundleName
|
outputFileName = bundleName
|
||||||
}
|
}
|
||||||
browserConfig()
|
browserConfig()
|
||||||
}
|
}
|
||||||
jsConfig()
|
jsConfig()
|
||||||
|
binaries.executable()
|
||||||
}
|
}
|
||||||
jvm {
|
jvm {
|
||||||
val processResourcesTaskName =
|
val processResourcesTaskName =
|
||||||
compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME]
|
compilations[KotlinCompilation.MAIN_COMPILATION_NAME].processResourcesTaskName
|
||||||
.processResourcesTaskName
|
|
||||||
|
|
||||||
val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution")
|
|
||||||
|
val jsBrowserDistribution = project.tasks.getByName(
|
||||||
|
if (development) "jsBrowserDevelopmentExecutableDistribution" else "jsBrowserDistribution"
|
||||||
|
)
|
||||||
|
|
||||||
project.tasks.getByName<ProcessResources>(processResourcesTaskName) {
|
project.tasks.getByName<ProcessResources>(processResourcesTaskName) {
|
||||||
duplicatesStrategy = DuplicatesStrategy.WARN
|
duplicatesStrategy = DuplicatesStrategy.WARN
|
||||||
@ -459,11 +488,10 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
|||||||
* Enable all supported native targets
|
* Enable all supported native targets
|
||||||
*/
|
*/
|
||||||
public fun native(block: KScienceNativeConfiguration.() -> Unit = {}): Unit = with(project) {
|
public fun native(block: KScienceNativeConfiguration.() -> Unit = {}): Unit = with(project) {
|
||||||
val nativeConfiguration = KScienceNativeConfiguration().apply(block)
|
val nativeConfiguration = KScienceNativeConfiguration(this).apply(block)
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
val nativeTargets: List<KotlinNativeTarget> =
|
nativeConfiguration.targets.values.forEach { nativeTarget ->
|
||||||
nativeConfiguration.targets.values.map { nativeTarget ->
|
|
||||||
when (nativeTarget.preset) {
|
when (nativeTarget.preset) {
|
||||||
KotlinNativePreset.linuxX64 -> linuxX64(
|
KotlinNativePreset.linuxX64 -> linuxX64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
@ -499,41 +527,9 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
|||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
nativeTarget.targetConfiguration
|
nativeTarget.targetConfiguration
|
||||||
)
|
)
|
||||||
|
|
||||||
// else -> {
|
|
||||||
// logger.error("Native preset ${nativeTarget.preset} not recognised.")
|
|
||||||
// null
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
val commonMain by getting
|
|
||||||
val commonTest by getting
|
|
||||||
|
|
||||||
val nativeMain by creating {
|
|
||||||
dependsOn(commonMain)
|
|
||||||
}
|
|
||||||
|
|
||||||
val nativeTest by creating {
|
|
||||||
//should NOT depend on nativeMain because automatic dependency by plugin
|
|
||||||
dependsOn(commonTest)
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(nativeTargets) {
|
|
||||||
compilations["main"]?.apply {
|
|
||||||
configure(kotlinSourceSets) {
|
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compilations["test"]?.apply {
|
|
||||||
configure(kotlinSourceSets) {
|
|
||||||
dependsOn(nativeTest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
applyDefaultHierarchyTemplate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
package space.kscience.gradle
|
|
||||||
|
|
||||||
import org.gradle.api.Plugin
|
|
||||||
import org.gradle.api.Project
|
|
||||||
import org.gradle.api.tasks.Copy
|
|
||||||
import org.gradle.kotlin.dsl.apply
|
|
||||||
import org.gradle.kotlin.dsl.configure
|
|
||||||
import org.gradle.kotlin.dsl.get
|
|
||||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
|
||||||
import space.kscience.gradle.internal.applySettings
|
|
||||||
import space.kscience.gradle.internal.fromJsDependencies
|
|
||||||
|
|
||||||
public open class KScienceJSPlugin : Plugin<Project> {
|
|
||||||
override fun apply(project: Project): Unit = project.run {
|
|
||||||
if (!plugins.hasPlugin("org.jetbrains.kotlin.js")) {
|
|
||||||
plugins.apply("org.jetbrains.kotlin.js")
|
|
||||||
} else {
|
|
||||||
logger.info("Kotlin JS plugin is already present")
|
|
||||||
}
|
|
||||||
registerKScienceExtension(::KScienceExtension)
|
|
||||||
|
|
||||||
//logger.info("Applying KScience configuration for JS project")
|
|
||||||
configure<KotlinJsProjectExtension> {
|
|
||||||
js(IR) { browser { } }
|
|
||||||
|
|
||||||
sourceSets.all {
|
|
||||||
languageSettings.applySettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets["main"].apply {
|
|
||||||
dependencies {
|
|
||||||
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets["test"].apply {
|
|
||||||
dependencies {
|
|
||||||
implementation(kotlin("test-js"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (explicitApi == null) explicitApiWarning()
|
|
||||||
}
|
|
||||||
|
|
||||||
(tasks.findByName("processResources") as? Copy)?.apply {
|
|
||||||
fromJsDependencies("runtimeClasspath")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// apply dokka for all projects
|
|
||||||
if (!plugins.hasPlugin("org.jetbrains.dokka")) {
|
|
||||||
apply<DokkaPlugin>()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,12 +10,13 @@ import org.gradle.kotlin.dsl.get
|
|||||||
import org.gradle.kotlin.dsl.withType
|
import org.gradle.kotlin.dsl.withType
|
||||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
import space.kscience.gradle.internal.applySettings
|
import space.kscience.gradle.internal.applySettings
|
||||||
import space.kscience.gradle.internal.defaultKotlinJvmArgs
|
import space.kscience.gradle.internal.defaultKotlinJvmArgs
|
||||||
|
|
||||||
public open class KScienceJVMPlugin : Plugin<Project> {
|
public open class KScienceJVMPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
|
|
||||||
|
logger.warn("KSCience JVM plugin is deprecated. Use MPP.")
|
||||||
if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
|
if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
|
||||||
plugins.apply("org.jetbrains.kotlin.jvm")
|
plugins.apply("org.jetbrains.kotlin.jvm")
|
||||||
} else {
|
} else {
|
||||||
@ -27,6 +28,9 @@ public open class KScienceJVMPlugin : Plugin<Project> {
|
|||||||
configure<KotlinJvmProjectExtension> {
|
configure<KotlinJvmProjectExtension> {
|
||||||
sourceSets.all {
|
sourceSets.all {
|
||||||
languageSettings.applySettings()
|
languageSettings.applySettings()
|
||||||
|
compilerOptions{
|
||||||
|
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets["test"].apply {
|
sourceSets["test"].apply {
|
||||||
@ -42,12 +46,6 @@ public open class KScienceJVMPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<Test> {
|
tasks.withType<Test> {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,17 @@ import org.gradle.api.Plugin
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
import org.gradle.kotlin.dsl.configure
|
import org.gradle.kotlin.dsl.configure
|
||||||
import org.gradle.kotlin.dsl.hasPlugin
|
|
||||||
import org.gradle.kotlin.dsl.invoke
|
import org.gradle.kotlin.dsl.invoke
|
||||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||||
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
|
||||||
import space.kscience.gradle.internal.applySettings
|
import space.kscience.gradle.internal.applySettings
|
||||||
|
import space.kscience.gradle.internal.defaultKotlinCommonArgs
|
||||||
|
|
||||||
public open class KScienceMPPlugin : Plugin<Project> {
|
public open class KScienceMPPlugin : Plugin<Project> {
|
||||||
|
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
if (!plugins.hasPlugin(KotlinMultiplatformPlugin::class)) {
|
if (!plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
|
||||||
//apply<KotlinMultiplatformPlugin>() for some reason it does not work
|
//apply<KotlinMultiplatformPlugin>() for some reason it does not work
|
||||||
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
||||||
} else {
|
} else {
|
||||||
@ -23,24 +24,26 @@ public open class KScienceMPPlugin : Plugin<Project> {
|
|||||||
registerKScienceExtension(::KScienceMppExtension)
|
registerKScienceExtension(::KScienceMppExtension)
|
||||||
|
|
||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
getByName("commonMain"){
|
getByName("commonMain") {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getByName("commonTest"){
|
getByName("commonTest") {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-common"))
|
implementation(kotlin("test"))
|
||||||
implementation(kotlin("test-annotations-common"))
|
implementation(kotlin("test-annotations-common"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
all {
|
||||||
|
|
||||||
sourceSets.all {
|
|
||||||
languageSettings.applySettings()
|
languageSettings.applySettings()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
compilerOptions{
|
||||||
|
freeCompilerArgs.addAll(defaultKotlinCommonArgs)
|
||||||
|
}
|
||||||
|
|
||||||
if (explicitApi == null) explicitApiWarning()
|
if (explicitApi == null) explicitApiWarning()
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,12 @@ import org.jetbrains.changelog.ChangelogPlugin
|
|||||||
import org.jetbrains.changelog.ChangelogPluginExtension
|
import org.jetbrains.changelog.ChangelogPluginExtension
|
||||||
import org.jetbrains.dokka.gradle.AbstractDokkaTask
|
import org.jetbrains.dokka.gradle.AbstractDokkaTask
|
||||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||||
import space.kscience.gradle.internal.*
|
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
|
||||||
|
import space.kscience.gradle.internal.addPublishing
|
||||||
|
import space.kscience.gradle.internal.addSonatypePublishing
|
||||||
|
import space.kscience.gradle.internal.setupPublication
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simplifies adding repositories for Maven publishing, responds for releasing tasks for projects.
|
* Simplifies adding repositories for Maven publishing, responds for releasing tasks for projects.
|
||||||
@ -51,46 +56,24 @@ public class KSciencePublishingExtension(public val project: Project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds GitHub as VCS and adds GitHub Packages Maven repository to publishing.
|
* Add a repository with [repositoryName]. Uses "publishing.$repositoryName.user" and "publishing.$repositoryName.token"
|
||||||
*
|
* properties pattern to store user and token
|
||||||
* @param githubProject the GitHub project.
|
|
||||||
* @param githubOrg the GitHub user or organization.
|
|
||||||
* @param deploy publish packages in the `deploy` task to the GitHub repository.
|
|
||||||
*/
|
*/
|
||||||
public fun github(
|
public fun repository(
|
||||||
githubOrg: String,
|
repositoryName: String,
|
||||||
githubProject: String,
|
url: String,
|
||||||
deploy: Boolean = project.requestPropertyOrNull("publishing.github") == "true",
|
|
||||||
) {
|
) {
|
||||||
if (deploy) {
|
require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" }
|
||||||
try {
|
project.addPublishing(repositoryName, url)
|
||||||
project.addGithubPublishing(githubOrg, githubProject)
|
|
||||||
} catch (t: Throwable) {
|
|
||||||
project.logger.error("Failed to set up github publication", t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds Space Packages Maven repository to publishing.
|
|
||||||
*
|
|
||||||
* @param spaceRepo the repository URL.
|
|
||||||
* @param deploy publish packages in the `deploy` task to the Space repository.
|
|
||||||
*/
|
|
||||||
public fun space(
|
|
||||||
spaceRepo: String,
|
|
||||||
) {
|
|
||||||
project.addSpacePublishing(spaceRepo)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds Sonatype Maven repository to publishing.
|
* Adds Sonatype Maven repository to publishing.
|
||||||
*
|
|
||||||
* @param addToRelease publish packages in the `release` task to the Sonatype repository.
|
|
||||||
*/
|
*/
|
||||||
public fun sonatype() {
|
public fun sonatype(sonatypeRoot: String = "https://s01.oss.sonatype.org") {
|
||||||
require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" }
|
require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" }
|
||||||
project.addSonatypePublishing()
|
project.addSonatypePublishing(sonatypeRoot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,11 +87,11 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
apply<DokkaPlugin>()
|
apply<DokkaPlugin>()
|
||||||
apply<BinaryCompatibilityValidatorPlugin>()
|
apply<BinaryCompatibilityValidatorPlugin>()
|
||||||
|
|
||||||
allprojects{
|
allprojects {
|
||||||
repositories{
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://repo.kotlin.link")
|
maven("https://repo.kotlin.link")
|
||||||
maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev")
|
google()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for https://github.com/gradle/gradle/issues/15568
|
// Workaround for https://github.com/gradle/gradle/issues/15568
|
||||||
@ -139,8 +122,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
val readmeExtension = KScienceReadmeExtension(this)
|
val readmeExtension = KScienceReadmeExtension(this)
|
||||||
extensions.add("readme", readmeExtension)
|
extensions.add("readme", readmeExtension)
|
||||||
|
|
||||||
@Suppress("UNUSED_VARIABLE")
|
tasks.create("generateReadme") {
|
||||||
val generateReadme by tasks.creating {
|
|
||||||
group = "documentation"
|
group = "documentation"
|
||||||
description = "Generate a README file if stub is present"
|
description = "Generate a README file if stub is present"
|
||||||
|
|
||||||
@ -203,10 +185,11 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
val modulesString = buildString {
|
val modulesString = buildString {
|
||||||
subprojects.forEach { subproject ->
|
subprojects.forEach { subproject ->
|
||||||
// val name = subproject.name
|
// val name = subproject.name
|
||||||
subproject.extensions.findByType<KScienceReadmeExtension>()?.let { ext ->
|
subproject.extensions.findByType<KScienceReadmeExtension>()
|
||||||
|
?.let { ext: KScienceReadmeExtension ->
|
||||||
val path = subproject.path.replaceFirst(":", "").replace(":", "/")
|
val path = subproject.path.replaceFirst(":", "").replace(":", "/")
|
||||||
appendLine("\n### [$path]($path)")
|
appendLine("\n### [$path]($path)")
|
||||||
appendLine("> ${ext.description}")
|
ext.description?.let { appendLine("> ${ext.description}") }
|
||||||
appendLine(">\n> **Maturity**: ${ext.maturity}")
|
appendLine(">\n> **Maturity**: ${ext.maturity}")
|
||||||
val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/")
|
val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/")
|
||||||
if (featureString.isNotBlank()) {
|
if (featureString.isNotBlank()) {
|
||||||
@ -233,12 +216,12 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
|
|
||||||
tasks.create("version") {
|
tasks.create("version") {
|
||||||
group = "publishing"
|
group = "publishing"
|
||||||
val versionFile = project.buildDir.resolve("project-version.txt")
|
val versionFileProvider = project.layout.buildDirectory.file("project-version.txt")
|
||||||
outputs.file(versionFile)
|
outputs.file(versionFileProvider)
|
||||||
doLast {
|
doLast {
|
||||||
|
val versionFile = versionFileProvider.get().asFile
|
||||||
versionFile.createNewFile()
|
versionFile.createNewFile()
|
||||||
versionFile.writeText(project.version.toString())
|
versionFile.writeText(project.version.toString())
|
||||||
println(project.version)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,9 +233,11 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin::class.java) {
|
plugins.withType<YarnPlugin>() {
|
||||||
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension>().lockFileDirectory =
|
rootProject.configure<YarnRootExtension> {
|
||||||
rootDir.resolve("gradle")
|
lockFileDirectory = rootDir.resolve("gradle")
|
||||||
|
yarnLockMismatchReport = YarnLockMismatchReport.WARNING
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import kotlinx.html.stream.createHTML
|
|||||||
import kotlinx.validation.ApiValidationExtension
|
import kotlinx.validation.ApiValidationExtension
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.findByType
|
import org.gradle.kotlin.dsl.findByType
|
||||||
|
import org.intellij.lang.annotations.Language
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
import kotlin.collections.component1
|
import kotlin.collections.component1
|
||||||
@ -32,7 +33,8 @@ private fun Template.processToString(args: Map<String, Any?>): String {
|
|||||||
|
|
||||||
|
|
||||||
public class KScienceReadmeExtension(public val project: Project) {
|
public class KScienceReadmeExtension(public val project: Project) {
|
||||||
public var description: String = project.description ?: ""
|
public var description: String? = null
|
||||||
|
get() = field ?: project.description
|
||||||
|
|
||||||
public var maturity: Maturity = Maturity.EXPERIMENTAL
|
public var maturity: Maturity = Maturity.EXPERIMENTAL
|
||||||
set(value) {
|
set(value) {
|
||||||
@ -88,12 +90,23 @@ public class KScienceReadmeExtension(public val project: Project) {
|
|||||||
|
|
||||||
public data class Feature(val id: String, val description: String, val ref: String?, val name: String = id)
|
public data class Feature(val id: String, val description: String, val ref: String?, val name: String = id)
|
||||||
|
|
||||||
public val features: MutableList<Feature> = ArrayList()
|
public val features: MutableList<Feature> = mutableListOf()
|
||||||
|
|
||||||
public fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) {
|
/**
|
||||||
|
* A plain readme feature with description
|
||||||
|
*/
|
||||||
|
public fun feature(
|
||||||
|
id: String,
|
||||||
|
@Language("File") ref: String? = null,
|
||||||
|
name: String = id,
|
||||||
|
description: () -> String,
|
||||||
|
) {
|
||||||
features += Feature(id, description(), ref, name)
|
features += Feature(id, description(), ref, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A readme feature with HTML description
|
||||||
|
*/
|
||||||
public fun featureWithHtml(
|
public fun featureWithHtml(
|
||||||
id: String,
|
id: String,
|
||||||
ref: String? = null,
|
ref: String? = null,
|
||||||
|
@ -7,8 +7,13 @@ import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
|
|||||||
import space.kscience.gradle.KScienceVersions
|
import space.kscience.gradle.KScienceVersions
|
||||||
|
|
||||||
|
|
||||||
internal val defaultKotlinJvmArgs: List<String> =
|
internal val defaultKotlinJvmArgs: List<String> = listOf(
|
||||||
listOf("-Xjvm-default=all", "-Xlambdas=indy"/* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/)
|
"-Xjvm-default=all"
|
||||||
|
)
|
||||||
|
|
||||||
|
internal val defaultKotlinCommonArgs: List<String> = listOf(
|
||||||
|
"-Xexpect-actual-classes"
|
||||||
|
)
|
||||||
|
|
||||||
internal fun resolveKotlinVersion(): KotlinVersion {
|
internal fun resolveKotlinVersion(): KotlinVersion {
|
||||||
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
|
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
|
||||||
@ -23,6 +28,7 @@ internal fun LanguageSettingsBuilder.applySettings(
|
|||||||
apiVersion = versionString
|
apiVersion = versionString
|
||||||
progressiveMode = true
|
progressiveMode = true
|
||||||
|
|
||||||
|
|
||||||
optIn("kotlin.RequiresOptIn")
|
optIn("kotlin.RequiresOptIn")
|
||||||
optIn("kotlin.ExperimentalUnsignedTypes")
|
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||||
optIn("kotlin.ExperimentalStdlibApi")
|
optIn("kotlin.ExperimentalStdlibApi")
|
||||||
|
@ -8,9 +8,7 @@ import org.gradle.api.tasks.bundling.Jar
|
|||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
import org.gradle.plugins.signing.SigningExtension
|
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.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets
|
|
||||||
import space.kscience.gradle.isInDevelopment
|
import space.kscience.gradle.isInDevelopment
|
||||||
|
|
||||||
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
|
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
|
||||||
@ -24,26 +22,6 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
|
|
||||||
plugins.withId("org.jetbrains.kotlin.js") {
|
|
||||||
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
|
|
||||||
|
|
||||||
val sourcesJar by tasks.creating(Jar::class) {
|
|
||||||
archiveClassifier.set("sources")
|
|
||||||
kotlin.sourceSets.forEach {
|
|
||||||
from(it.kotlin)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publications.create<MavenPublication>("js") {
|
|
||||||
kotlin.targets.flatMap { it.components }.forEach {
|
|
||||||
from(it)
|
|
||||||
}
|
|
||||||
|
|
||||||
artifact(sourcesJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||||
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
||||||
|
|
||||||
@ -55,9 +33,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
}
|
}
|
||||||
|
|
||||||
publications.create<MavenPublication>("jvm") {
|
publications.create<MavenPublication>("jvm") {
|
||||||
kotlin.target.components.forEach {
|
from(project.components["java"])
|
||||||
from(it)
|
|
||||||
}
|
|
||||||
|
|
||||||
artifact(sourcesJar)
|
artifact(sourcesJar)
|
||||||
}
|
}
|
||||||
@ -100,7 +76,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
val signingKey: String = requestProperty("publishing.signing.key")
|
val signingKey: String = requestProperty("publishing.signing.key")
|
||||||
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
|
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
|
||||||
|
|
||||||
// if key is provided, use it
|
// if a key is provided, use it
|
||||||
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
|
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
|
||||||
} // else use agent signing
|
} // else use agent signing
|
||||||
sign(publications)
|
sign(publications)
|
||||||
@ -112,34 +88,31 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.addGithubPublishing(
|
internal fun Project.addPublishing(
|
||||||
githubOrg: String,
|
repositoryName: String,
|
||||||
githubProject: String,
|
urlString:String
|
||||||
) {
|
){
|
||||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
require(repositoryName.matches("\\w*".toRegex())){"Repository name must contain only letters or numbers"}
|
||||||
logger.info("Skipping github publishing because publishing is disabled")
|
val user: String? = requestPropertyOrNull("publishing.$repositoryName.user")
|
||||||
return
|
val token: String? = requestPropertyOrNull("publishing.$repositoryName.token")
|
||||||
}
|
|
||||||
if (requestPropertyOrNull("publishing.github") != "false") {
|
|
||||||
logger.info("Skipping github publishing because `publishing.github != true`")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val githubUser: String = requestProperty("publishing.github.user")
|
if (user == null || token == null) {
|
||||||
val githubToken: String = requestProperty("publishing.github.token")
|
logger.info("Skipping $repositoryName publishing because $repositoryName credentials are not defined")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
logger.info("Adding github publishing to project [${project.name}]")
|
logger.info("Adding $repositoryName publishing to project [${project.name}]")
|
||||||
|
|
||||||
repositories.maven {
|
repositories.maven {
|
||||||
name = "github"
|
name = repositoryName
|
||||||
url = uri("https://maven.pkg.github.com/$githubOrg/$githubProject/")
|
url = uri(urlString)
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = githubUser
|
username = user
|
||||||
password = githubToken
|
password = token
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,72 +120,11 @@ internal fun Project.addGithubPublishing(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.addSpacePublishing(spaceRepo: String) {
|
|
||||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
|
||||||
logger.info("Skipping space publishing because publishing is disabled")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (requestPropertyOrNull("publishing.space") == "false") {
|
|
||||||
logger.info("Skipping space publishing because `publishing.space == false`")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val spaceUser: String = requestProperty("publishing.space.user")
|
|
||||||
val spaceToken: String = requestProperty("publishing.space.token")
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
plugins.withId("maven-publish") {
|
|
||||||
configure<PublishingExtension> {
|
|
||||||
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
|
|
||||||
|
|
||||||
repositories.maven {
|
|
||||||
name = "space"
|
|
||||||
url = uri(spaceRepo)
|
|
||||||
|
|
||||||
credentials {
|
|
||||||
username = spaceUser
|
|
||||||
password = spaceToken
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun Project.addSonatypePublishing() {
|
|
||||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
|
||||||
logger.info("Skipping sonatype publishing because publishing is disabled")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
internal fun Project.addSonatypePublishing(sonatypeRoot: String) {
|
||||||
if (isInDevelopment) {
|
if (isInDevelopment) {
|
||||||
logger.info("Sonatype publishing skipped for development version")
|
logger.info("Sonatype publishing skipped for development version")
|
||||||
return
|
} else {
|
||||||
}
|
addPublishing("sonatype", "$sonatypeRoot/service/local/staging/deploy/maven2")
|
||||||
|
|
||||||
if (requestPropertyOrNull("publishing.sonatype") == "false") {
|
|
||||||
logger.info("Skipping sonatype publishing because `publishing.sonatype == false`")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val sonatypeUser: String = requestProperty("publishing.sonatype.user")
|
|
||||||
val sonatypePassword: String = requestProperty("publishing.sonatype.password")
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
plugins.withId("maven-publish") {
|
|
||||||
configure<PublishingExtension> {
|
|
||||||
repositories.maven {
|
|
||||||
val sonatypeRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
|
|
||||||
name = "sonatype"
|
|
||||||
url = uri(sonatypeRepo)
|
|
||||||
|
|
||||||
credentials {
|
|
||||||
username = sonatypeUser
|
|
||||||
password = sonatypePassword
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,17 +2,6 @@
|
|||||||
|
|
||||||
The Maven coordinates of this project are `${group}:${name}:${version}`.
|
The Maven coordinates of this project are `${group}:${name}:${version}`.
|
||||||
|
|
||||||
**Gradle Groovy:**
|
|
||||||
```groovy
|
|
||||||
repositories {
|
|
||||||
maven { url 'https://repo.kotlin.link' }
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation '${group}:${name}:${version}'
|
|
||||||
}
|
|
||||||
```
|
|
||||||
**Gradle Kotlin DSL:**
|
**Gradle Kotlin DSL:**
|
||||||
```kotlin
|
```kotlin
|
||||||
repositories {
|
repositories {
|
||||||
|
Loading…
Reference in New Issue
Block a user