Compare commits
20 Commits
master
...
beta/2.2.0
Author | SHA1 | Date | |
---|---|---|---|
3fb883fc0a | |||
bba1699a1e | |||
63b380ff90 | |||
3af28c3065 | |||
5a86f9c6ee | |||
7d50f5963c | |||
9544237613 | |||
95785ab5dd | |||
86e5196173 | |||
d969f14229 | |||
3506100873 | |||
3b2d609751 | |||
1698a86940 | |||
abbfe65308 | |||
093d9a628b | |||
7dc90b929d | |||
d12497ebe2 | |||
7ea16f713b | |||
e364f811af | |||
e1c946cd8f |
.space.ktsCHANGELOG.mdbuild.gradle.ktsgradle.properties
gradle
settings.gradle.ktssrc/main/kotlin/space/kscience/gradle
43
.space.kts
43
.space.kts
@ -1,43 +0,0 @@
|
|||||||
import kotlin.io.path.readText
|
|
||||||
|
|
||||||
job("Build") {
|
|
||||||
gradlew("openjdk:11", "build")
|
|
||||||
}
|
|
||||||
|
|
||||||
job("Publish"){
|
|
||||||
startOn {
|
|
||||||
gitPush { enabled = false }
|
|
||||||
}
|
|
||||||
container("openjdk:11") {
|
|
||||||
env["SPACE_USER"] = Secrets("space_user")
|
|
||||||
env["SPACE_TOKEN"] = Secrets("space_token")
|
|
||||||
kotlinScript { api ->
|
|
||||||
|
|
||||||
val spaceUser = System.getenv("SPACE_USER")
|
|
||||||
val spaceToken = System.getenv("SPACE_TOKEN")
|
|
||||||
|
|
||||||
// write version to the build directory
|
|
||||||
api.gradlew("version")
|
|
||||||
|
|
||||||
//read version from build file
|
|
||||||
val version = java.nio.file.Path.of("build/project-version.txt").readText()
|
|
||||||
|
|
||||||
api.space().projects.automation.deployments.start(
|
|
||||||
project = api.projectIdentifier(),
|
|
||||||
targetIdentifier = TargetIdentifier.Key("gradle-tools"),
|
|
||||||
version = version,
|
|
||||||
// automatically update deployment status based on a status of a job
|
|
||||||
syncWithAutomationJob = true
|
|
||||||
)
|
|
||||||
try {
|
|
||||||
api.gradlew(
|
|
||||||
"publishAllPublicationsToSpaceRepository",
|
|
||||||
"-Ppublishing.space.user=\"$spaceUser\"",
|
|
||||||
"-Ppublishing.space.token=\"$spaceToken\"",
|
|
||||||
)
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
println("Publish failed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -7,17 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- kotlinx-io dependency in version catalog
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Use the new jvm executable option for full-stack instead of gradle application plugin.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
- `application` option
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Fix readme generation
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
|
## 0.16.0-kotlin-2.1.0 - 2025-01-02
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Kotlin 2.1.0
|
||||||
|
- Publication to central via `com.vanniktech.maven.publish.base`
|
||||||
|
|
||||||
## 0.15.4-kotlin-2.0.0 - 2024-06-04
|
## 0.15.4-kotlin-2.0.0 - 2024-06-04
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-gradle-plugin`
|
`java-gradle-plugin`
|
||||||
`kotlin-dsl`
|
`kotlin-dsl`
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
// signing
|
|
||||||
`version-catalog`
|
`version-catalog`
|
||||||
alias(libs.plugins.maven.publish)
|
alias(libs.plugins.maven.publish)
|
||||||
alias(libs.plugins.jetbrains.changelog)
|
alias(libs.plugins.jetbrains.changelog)
|
||||||
alias(libs.plugins.jetbrains.dokka)
|
alias(libs.plugins.jetbrains.dokka)
|
||||||
alias(libs.plugins.versions)
|
alias(libs.plugins.versions)
|
||||||
alias(libs.plugins.versions.update)
|
alias(libs.plugins.versions.update)
|
||||||
|
alias(libs.plugins.maven.publish.base)
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "space.kscience"
|
group = "space.kscience"
|
||||||
@ -26,12 +25,13 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.kotlin.gradle)
|
api("org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlin.asProvider().get()}")
|
||||||
api(libs.foojay.resolver)
|
api("org.gradle.toolchains:foojay-resolver:0.9.0")
|
||||||
implementation(libs.binary.compatibility.validator)
|
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.17.0")
|
||||||
implementation(libs.changelog.gradle)
|
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:${libs.versions.changelog.get()}")
|
||||||
implementation(libs.dokka.gradle)
|
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${libs.versions.dokka.get()}")
|
||||||
implementation(libs.kotlin.jupyter.gradle)
|
implementation("org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin:${libs.versions.kotlin.jupyter.get()}")
|
||||||
|
implementation("com.vanniktech:gradle-maven-publish-plugin:0.31.0")
|
||||||
implementation(libs.kotlin.serialization)
|
implementation(libs.kotlin.serialization)
|
||||||
implementation(libs.kotlinx.html)
|
implementation(libs.kotlinx.html)
|
||||||
implementation(libs.tomlj)
|
implementation(libs.tomlj)
|
||||||
@ -71,7 +71,7 @@ gradlePlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.create("version") {
|
tasks.register("version") {
|
||||||
group = "publishing"
|
group = "publishing"
|
||||||
val versionFileProvider = project.layout.buildDirectory.file("project-version.txt")
|
val versionFileProvider = project.layout.buildDirectory.file("project-version.txt")
|
||||||
outputs.file(versionFileProvider)
|
outputs.file(versionFileProvider)
|
||||||
@ -89,40 +89,21 @@ catalog.versionCatalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//publishing the artifact
|
//publishing the artifact
|
||||||
|
|
||||||
val sourcesJar by tasks.creating(Jar::class) {
|
|
||||||
archiveClassifier.set("sources")
|
|
||||||
from(sourceSets.named("main").get().allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
val javadocsJar by tasks.creating(Jar::class) {
|
|
||||||
group = JavaBasePlugin.DOCUMENTATION_GROUP
|
|
||||||
archiveClassifier.set("javadoc")
|
|
||||||
from(tasks.dokkaHtml)
|
|
||||||
}
|
|
||||||
|
|
||||||
val emptyJavadocJar by tasks.creating(Jar::class) {
|
|
||||||
group = JavaBasePlugin.DOCUMENTATION_GROUP
|
|
||||||
archiveBaseName.set("empty")
|
|
||||||
archiveClassifier.set("javadoc")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
val emptySourcesJar by tasks.creating(Jar::class) {
|
|
||||||
archiveClassifier.set("sources")
|
|
||||||
archiveBaseName.set("empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
mavenPublishing {
|
mavenPublishing {
|
||||||
configure(
|
configure(
|
||||||
com.vanniktech.maven.publish.GradlePlugin(
|
com.vanniktech.maven.publish.GradlePlugin(
|
||||||
javadocJar = com.vanniktech.maven.publish.JavadocJar.Dokka("dokkaHtml"),
|
javadocJar = com.vanniktech.maven.publish.JavadocJar.Dokka("dokkaGenerate"),
|
||||||
sourcesJar = true,
|
sourcesJar = true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
project.publishing.publications.create("maven", MavenPublication::class.java) {
|
publishing.publications.create<MavenPublication>("version-catalog") {
|
||||||
from(project.components.getByName("versionCatalog"))
|
from(components["versionCatalog"])
|
||||||
|
artifactId = "version-catalog"
|
||||||
|
|
||||||
|
pom {
|
||||||
|
name.set("version-catalog")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val vcs = "https://git.sciprog.center/kscience/gradle-tools"
|
val vcs = "https://git.sciprog.center/kscience/gradle-tools"
|
||||||
@ -197,10 +178,7 @@ tasks.withType<AbstractPublishToMaven>().configureEach {
|
|||||||
|
|
||||||
versionCatalogUpdate {
|
versionCatalogUpdate {
|
||||||
sortByKey.set(false)
|
sortByKey.set(false)
|
||||||
keep {
|
|
||||||
keepUnusedVersions = true
|
keep.keepUnusedVersions = true
|
||||||
keepUnusedPlugins = true
|
|
||||||
keepUnusedLibraries = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,3 +1,5 @@
|
|||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
|
||||||
nl.littlerobots.vcu.resolver=true
|
nl.littlerobots.vcu.resolver=true
|
||||||
|
|
||||||
|
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
|
@ -1,45 +1,48 @@
|
|||||||
[versions]
|
[versions]
|
||||||
# @pin
|
# @pin
|
||||||
kotlin = "2.1.0"
|
kotlin = "2.2.0-Beta2"
|
||||||
# @pin
|
# @pin
|
||||||
tools = "0.15.8-kotlin-2.1.0"
|
tools = "0.18.0-kotlin-2.2.0-Beta2"
|
||||||
atomicfu = "0.26.1"
|
atomicfu = "0.27.0"
|
||||||
changelog = "2.2.1"
|
changelog = "2.2.1"
|
||||||
compose = "1.7.1"
|
compose = "1.8.0"
|
||||||
dokka = "2.0.0-Beta"
|
dokka = "2.0.0"
|
||||||
jsBom = "1.0.0-pre.847"
|
jsBom = "2025.5.6"
|
||||||
junit = "5.10.2"
|
junit = "5.10.2"
|
||||||
kotlin-jupyter = "0.12.0-352"
|
kotlin-jupyter = "0.12.0-426"
|
||||||
kotlinx-benchmark = "0.4.13"
|
kotlinx-benchmark = "0.4.13"
|
||||||
kotlinx-cli = "0.3.6"
|
kotlinx-cli = "0.3.6"
|
||||||
kotlinx-coroutines = "1.9.0"
|
kotlinx-coroutines = "1.10.2"
|
||||||
kotlinx-datetime = "0.6.1"
|
kotlinx-datetime = "0.6.2"
|
||||||
kotlinx-html = "0.11.0"
|
kotlinx-html = "0.12.0"
|
||||||
kotlinx-knit = "0.5.0"
|
kotlinx-knit = "0.5.0"
|
||||||
kotlinx-nodejs = "0.0.7"
|
kotlinx-nodejs = "0.0.7"
|
||||||
kotlinx-serialization = "1.7.3"
|
kotlinx-serialization = "1.8.1"
|
||||||
kover = "0.8.3"
|
kotlinx-io = "0.7.0"
|
||||||
ktor = "3.0.2"
|
kover = "0.9.1"
|
||||||
ksp = "2.1.0-1.0.29"
|
ktor = "3.1.3"
|
||||||
logback = "1.5.12"
|
ksp = "2.1.20-2.0.1"
|
||||||
slf4j = "2.0.16"
|
logback = "1.5.18"
|
||||||
xmlutil = "0.90.3"
|
slf4j = "2.0.17"
|
||||||
|
xmlutil = "0.91.0"
|
||||||
yamlkt = "0.13.0"
|
yamlkt = "0.13.0"
|
||||||
|
opensavvy-resources = "0.4.0"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" }
|
maven-publish = "com.vanniktech.maven.publish:0.31.0"
|
||||||
|
maven-publish-base = "com.vanniktech.maven.publish.base:0.31.0"
|
||||||
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" }
|
compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" }
|
||||||
jetbrains-changelog = "org.jetbrains.changelog:2.2.1"
|
jetbrains-changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
|
||||||
jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }
|
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }
|
||||||
kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:5.1.2"
|
kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:6.1.1"
|
||||||
|
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||||
|
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
|
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
|
||||||
kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" }
|
kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" }
|
||||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|
||||||
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", 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-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-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
|
||||||
kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" }
|
kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" }
|
||||||
@ -55,26 +58,15 @@ kscience-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" }
|
|||||||
kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" }
|
kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" }
|
||||||
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||||
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
|
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
|
||||||
versions = "com.github.ben-manes.versions:0.51.0"
|
opensavvy-resources-producer = { id = "dev.opensavvy.resources.producer", version.ref = "opensavvy-resources" }
|
||||||
versions-update = "nl.littlerobots.version-catalog-update:0.8.5"
|
opensavvy-resources-consumer = { id = "dev.opensavvy.resources.consumer", version.ref = "opensavvy-resources" }
|
||||||
|
versions = "com.github.ben-manes.versions:0.52.0"
|
||||||
|
versions-update = "nl.littlerobots.version-catalog-update:1.0.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
|
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
|
||||||
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
|
freemarker = "org.freemarker:freemarker:2.3.34"
|
||||||
binary-compatibility-validator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.15.0-Beta.3"
|
|
||||||
changelog-gradle = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" }
|
|
||||||
dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" }
|
|
||||||
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
|
|
||||||
dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
|
|
||||||
foojay-resolver = "org.gradle.toolchains:foojay-resolver:0.9.0"
|
|
||||||
freemarker = "org.freemarker:freemarker:2.3.33"
|
|
||||||
gradle-changelog-plugin = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" }
|
|
||||||
kotlin-assignment-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-assignment-compiler-plugin-embeddable", version.ref = "kotlin" }
|
|
||||||
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
|
||||||
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
|
||||||
kotlin-js-wrappers = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version.ref = "jsBom" }
|
kotlin-js-wrappers = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version.ref = "jsBom" }
|
||||||
kotlin-jupyter-api-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin" }
|
|
||||||
kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" }
|
|
||||||
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
|
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
|
||||||
kotlin-sam-with-receiver-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin-embeddable", version.ref = "kotlin" }
|
kotlin-sam-with-receiver-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin-embeddable", version.ref = "kotlin" }
|
||||||
kotlin-scripting-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable", version.ref = "kotlin" }
|
kotlin-scripting-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable", version.ref = "kotlin" }
|
||||||
@ -107,6 +99,9 @@ kotlinx-serialization-hocon = { module = "org.jetbrains.kotlinx:kotlinx-serializ
|
|||||||
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
|
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
|
||||||
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" }
|
||||||
kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" }
|
kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" }
|
||||||
|
kotlinx-browser = "org.jetbrains.kotlinx:kotlinx-browser:0.3"
|
||||||
|
kotlinx-io-core = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version.ref = "kotlinx-io" }
|
||||||
|
kotlinx-io-bytestring = { module = "org.jetbrains.kotlinx:kotlinx-io-bytestring", version.ref = "kotlinx-io" }
|
||||||
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
|
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
|
||||||
ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" }
|
ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" }
|
||||||
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
|
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
|
||||||
|
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.10-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
rootProject.name = "gradle-tools"
|
rootProject.name = "gradle-tools"
|
||||||
|
|
||||||
plugins {
|
pluginManagement {
|
||||||
id("org.gradle.toolchains.foojay-resolver-convention") version("0.8.0")
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://repo.kotlin.link")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("org.gradle.toolchains.foojay-resolver-convention") version("0.9.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package space.kscience.gradle
|
|||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.file.DuplicatesStrategy
|
import org.gradle.api.file.DuplicatesStrategy
|
||||||
import org.gradle.api.plugins.ApplicationPlugin
|
|
||||||
import org.gradle.api.plugins.ExtensionAware
|
import org.gradle.api.plugins.ExtensionAware
|
||||||
import org.gradle.api.provider.Property
|
import org.gradle.api.provider.Property
|
||||||
import org.gradle.api.tasks.Copy
|
import org.gradle.api.tasks.Copy
|
||||||
@ -12,10 +11,8 @@ 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.ExperimentalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
||||||
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.plugin.KotlinCompilation
|
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
|
||||||
@ -54,7 +51,7 @@ public val Project.isInDevelopment: Boolean
|
|||||||
|
|
||||||
private const val defaultJdkVersion = 17
|
private const val defaultJdkVersion = 17
|
||||||
|
|
||||||
public abstract class KScienceExtension @Inject constructor(public val project: Project): ExtensionAware {
|
public abstract class KScienceExtension @Inject constructor(public val project: Project) : ExtensionAware {
|
||||||
|
|
||||||
public val jdkVersionProperty: Property<Int> = project.objects.property<Int>().apply {
|
public val jdkVersionProperty: Property<Int> = project.objects.property<Int>().apply {
|
||||||
set(defaultJdkVersion)
|
set(defaultJdkVersion)
|
||||||
@ -105,36 +102,6 @@ public abstract class KScienceExtension @Inject constructor(public val project:
|
|||||||
SerializationTargets(sourceSet, configuration).block()
|
SerializationTargets(sourceSet, configuration).block()
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun useKtor(version: String = KScienceVersions.ktorVersion): Unit = with(project) {
|
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
|
||||||
configure<KotlinMultiplatformExtension> {
|
|
||||||
sourceSets.findByName("commonMain")?.apply {
|
|
||||||
dependencies {
|
|
||||||
api(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
|
||||||
configure<KotlinJvmProjectExtension> {
|
|
||||||
sourceSets.findByName("main")?.apply {
|
|
||||||
dependencies {
|
|
||||||
api(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
|
||||||
configure<KotlinJsProjectExtension> {
|
|
||||||
sourceSets.findByName("main")?.apply {
|
|
||||||
dependencies {
|
|
||||||
api(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply jupyter plugin and add entry point for the jupyter library.
|
* Apply jupyter plugin and add entry point for the jupyter library.
|
||||||
* If left empty applies a plugin without declaring library producers
|
* If left empty applies a plugin without declaring library producers
|
||||||
@ -195,50 +162,19 @@ public abstract class KScienceExtension @Inject constructor(public val project:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark this module as an application module. JVM application should be enabled separately
|
* Add context parameters to the project
|
||||||
*/
|
*/
|
||||||
@Deprecated("Use platform-specific applications")
|
public fun useContextParameters() {
|
||||||
public fun application() {
|
|
||||||
project.extensions.findByType<KotlinProjectExtension>()?.apply {
|
|
||||||
explicitApi = null
|
|
||||||
}
|
|
||||||
|
|
||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
|
||||||
project.apply<ApplicationPlugin>()
|
|
||||||
}
|
|
||||||
|
|
||||||
project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
|
|
||||||
js(IR) {
|
|
||||||
binaries.executable()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project.extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
|
||||||
targets.withType<KotlinJsTargetDsl> {
|
|
||||||
binaries.executable()
|
|
||||||
}
|
|
||||||
|
|
||||||
targets.withType<KotlinNativeTarget> {
|
|
||||||
binaries.executable()
|
|
||||||
}
|
|
||||||
|
|
||||||
targets.withType<KotlinWasmJsTargetDsl> {
|
|
||||||
binaries.executable()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add context receivers to this project and all subprojects
|
|
||||||
*/
|
|
||||||
public fun useContextReceivers() {
|
|
||||||
project.tasks.withType<KotlinCompile> {
|
project.tasks.withType<KotlinCompile> {
|
||||||
compilerOptions{
|
compilerOptions {
|
||||||
freeCompilerArgs.add("-Xcontext-receivers")
|
freeCompilerArgs.addAll("-Xcontext-parameters")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Use useContextParameters", ReplaceWith("useContextParameters()"))
|
||||||
|
public fun useContextReceivers(): Unit = useContextParameters()
|
||||||
|
|
||||||
public operator fun DefaultSourceSet.invoke(dependencyBlock: KotlinDependencyHandler.() -> Unit) {
|
public operator fun DefaultSourceSet.invoke(dependencyBlock: KotlinDependencyHandler.() -> Unit) {
|
||||||
dependencies(this, dependencyBlock)
|
dependencies(this, dependencyBlock)
|
||||||
}
|
}
|
||||||
@ -287,13 +223,9 @@ public class KScienceNativeConfiguration(private val project: Project) {
|
|||||||
|
|
||||||
|
|
||||||
internal companion object {
|
internal companion object {
|
||||||
private fun defaultNativeTargets(project: Project): Map<KotlinNativePreset, KScienceNativeTarget> {
|
private fun defaultNativeTargets(project: Project): Set<KScienceNativeTarget> =
|
||||||
val hostOs = System.getProperty("os.name")
|
when (val targets = project.requestPropertyOrNull("publishing.targets")) {
|
||||||
|
null -> setOf(
|
||||||
val targets = project.requestPropertyOrNull("publishing.targets")
|
|
||||||
|
|
||||||
return when {
|
|
||||||
targets == "all" -> listOf(
|
|
||||||
KScienceNativeTarget.linuxX64,
|
KScienceNativeTarget.linuxX64,
|
||||||
KScienceNativeTarget.mingwX64,
|
KScienceNativeTarget.mingwX64,
|
||||||
KScienceNativeTarget.macosX64,
|
KScienceNativeTarget.macosX64,
|
||||||
@ -303,48 +235,28 @@ public class KScienceNativeConfiguration(private val project: Project) {
|
|||||||
KScienceNativeTarget.iosSimulatorArm64,
|
KScienceNativeTarget.iosSimulatorArm64,
|
||||||
)
|
)
|
||||||
|
|
||||||
targets != null -> {
|
else -> targets.split(",").mapTo(HashSet()) {
|
||||||
targets.split(",").map { KScienceNativeTarget(KotlinNativePreset.valueOf(it)) }
|
KScienceNativeTarget(KotlinNativePreset.valueOf(it))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
hostOs.startsWith("Windows") -> listOf(
|
|
||||||
KScienceNativeTarget.linuxX64,
|
|
||||||
KScienceNativeTarget.mingwX64
|
|
||||||
)
|
|
||||||
|
|
||||||
hostOs == "Mac OS X" -> listOf(
|
|
||||||
KScienceNativeTarget.macosX64,
|
|
||||||
KScienceNativeTarget.macosArm64,
|
|
||||||
KScienceNativeTarget.iosX64,
|
|
||||||
KScienceNativeTarget.iosArm64,
|
|
||||||
KScienceNativeTarget.iosSimulatorArm64,
|
|
||||||
)
|
|
||||||
|
|
||||||
hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64)
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
emptyList()
|
|
||||||
}
|
|
||||||
}.associateBy { it.preset }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets(project)
|
internal var targets: Set<KScienceNativeTarget> = defaultNativeTargets(project)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace all targets
|
* Replace all targets
|
||||||
*/
|
*/
|
||||||
public fun setTargets(vararg target: KScienceNativeTarget) {
|
public fun setTargets(vararg target: KScienceNativeTarget) {
|
||||||
targets = target.associateBy { it.preset }
|
targets = target.toSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a native target
|
* Add a native target
|
||||||
*/
|
*/
|
||||||
public fun target(target: KScienceNativeTarget) {
|
public fun target(target: KScienceNativeTarget) {
|
||||||
targets += target.preset to target
|
targets += target
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun target(
|
public fun target(
|
||||||
@ -364,7 +276,7 @@ public abstract class KScienceMppExtension @Inject constructor(project: Project)
|
|||||||
project.configure<KotlinMultiplatformExtension> {
|
project.configure<KotlinMultiplatformExtension> {
|
||||||
jvm {
|
jvm {
|
||||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
compilerOptions{
|
compilerOptions {
|
||||||
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
||||||
}
|
}
|
||||||
block()
|
block()
|
||||||
@ -458,7 +370,7 @@ public abstract class KScienceMppExtension @Inject constructor(project: Project)
|
|||||||
) {
|
) {
|
||||||
js {
|
js {
|
||||||
browser {
|
browser {
|
||||||
commonWebpackConfig{
|
commonWebpackConfig {
|
||||||
outputFileName = bundleName
|
outputFileName = bundleName
|
||||||
}
|
}
|
||||||
browserConfig()
|
browserConfig()
|
||||||
@ -485,6 +397,32 @@ public abstract class KScienceMppExtension @Inject constructor(project: Project)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executable fullstack application
|
||||||
|
*/
|
||||||
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
public fun fullStackApplication(
|
||||||
|
mainClassName: String,
|
||||||
|
bundleName: String = "js/bundle.js",
|
||||||
|
development: Boolean = false,
|
||||||
|
jvmConfig: KotlinJvmTarget.() -> Unit = {},
|
||||||
|
jsConfig: KotlinJsTargetDsl.() -> Unit = {},
|
||||||
|
browserConfig: KotlinJsBrowserDsl.() -> Unit = {},
|
||||||
|
): Unit = fullStack(
|
||||||
|
bundleName = bundleName,
|
||||||
|
development = development,
|
||||||
|
jvmConfig = {
|
||||||
|
binaries {
|
||||||
|
executable {
|
||||||
|
mainClass.set(mainClassName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jvmConfig()
|
||||||
|
},
|
||||||
|
jsConfig = jsConfig,
|
||||||
|
browserConfig = browserConfig
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable all supported native targets
|
* Enable all supported native targets
|
||||||
*/
|
*/
|
||||||
@ -492,7 +430,7 @@ public abstract class KScienceMppExtension @Inject constructor(project: Project)
|
|||||||
val nativeConfiguration = KScienceNativeConfiguration(this).apply(block)
|
val nativeConfiguration = KScienceNativeConfiguration(this).apply(block)
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
nativeConfiguration.targets.values.forEach { nativeTarget ->
|
nativeConfiguration.targets.forEach { nativeTarget ->
|
||||||
when (nativeTarget.preset) {
|
when (nativeTarget.preset) {
|
||||||
KotlinNativePreset.linuxX64 -> linuxX64(
|
KotlinNativePreset.linuxX64 -> linuxX64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
@ -537,7 +475,7 @@ public abstract class KScienceMppExtension @Inject constructor(project: Project)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal inline fun <reified T : KScienceExtension> Project.registerKScienceExtension():T {
|
internal inline fun <reified T : KScienceExtension> Project.registerKScienceExtension(): T {
|
||||||
// extensions.findByType<T>()?.let { return it }
|
// extensions.findByType<T>()?.let { return it }
|
||||||
// return constructor(this).also {
|
// return constructor(this).also {
|
||||||
// extensions.add("kscience", it)
|
// extensions.add("kscience", it)
|
||||||
|
@ -16,7 +16,7 @@ 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.")
|
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 {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package space.kscience.gradle
|
package space.kscience.gradle
|
||||||
|
|
||||||
|
import com.vanniktech.maven.publish.MavenPublishBaseExtension
|
||||||
|
import com.vanniktech.maven.publish.MavenPublishBasePlugin
|
||||||
import kotlinx.validation.ApiValidationExtension
|
import kotlinx.validation.ApiValidationExtension
|
||||||
import kotlinx.validation.BinaryCompatibilityValidatorPlugin
|
import kotlinx.validation.BinaryCompatibilityValidatorPlugin
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
@ -16,7 +18,6 @@ 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.YarnPlugin
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
|
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
|
||||||
import space.kscience.gradle.internal.addPublishing
|
import space.kscience.gradle.internal.addPublishing
|
||||||
import space.kscience.gradle.internal.addSonatypePublishing
|
|
||||||
import space.kscience.gradle.internal.setupPublication
|
import space.kscience.gradle.internal.setupPublication
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,11 +70,32 @@ public class KSciencePublishingExtension(public val project: Project) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds Sonatype Maven repository to publishing.
|
* Adds Sonatype Maven repository to publishing.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public fun sonatype(sonatypeRoot: String = "https://s01.oss.sonatype.org") {
|
public fun sonatype(sonatypeRoot: String = "https://s01.oss.sonatype.org"): Unit = with(project) {
|
||||||
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(sonatypeRoot)
|
if (isInDevelopment) {
|
||||||
|
logger.info("Sonatype publishing skipped for development version")
|
||||||
|
} else {
|
||||||
|
addPublishing("sonatype", "$sonatypeRoot/service/local/staging/deploy/maven2")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add publishing to maven central "new" API
|
||||||
|
*/
|
||||||
|
public fun central(): Unit = with(project) {
|
||||||
|
require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" }
|
||||||
|
if (isInDevelopment) {
|
||||||
|
logger.info("Maven central publishing skipped for development version")
|
||||||
|
} else {
|
||||||
|
allprojects {
|
||||||
|
plugins.withType<MavenPublishBasePlugin> {
|
||||||
|
extensions.configure<MavenPublishBaseExtension> {
|
||||||
|
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +109,9 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
apply<DokkaPlugin>()
|
apply<DokkaPlugin>()
|
||||||
apply<BinaryCompatibilityValidatorPlugin>()
|
apply<BinaryCompatibilityValidatorPlugin>()
|
||||||
|
|
||||||
|
val ksciencePublish = KSciencePublishingExtension(this)
|
||||||
|
extensions.add("ksciencePublish", ksciencePublish)
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -113,8 +138,6 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val rootReadmeExtension = KScienceReadmeExtension(this)
|
val rootReadmeExtension = KScienceReadmeExtension(this)
|
||||||
val ksciencePublish = KSciencePublishingExtension(this)
|
|
||||||
extensions.add("ksciencePublish", ksciencePublish)
|
|
||||||
extensions.add("readme", rootReadmeExtension)
|
extensions.add("readme", rootReadmeExtension)
|
||||||
|
|
||||||
//Add readme generators to individual subprojects
|
//Add readme generators to individual subprojects
|
||||||
@ -122,11 +145,11 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
val readmeExtension = KScienceReadmeExtension(this)
|
val readmeExtension = KScienceReadmeExtension(this)
|
||||||
extensions.add("readme", readmeExtension)
|
extensions.add("readme", readmeExtension)
|
||||||
|
|
||||||
tasks.create("generateReadme") {
|
tasks.register("generateReadme") {
|
||||||
group = "documentation"
|
group = "documentation"
|
||||||
description = "Generate a README file if stub is present"
|
description = "Generate a README file if stub is present"
|
||||||
|
|
||||||
inputs.property("extension", readmeExtension)
|
inputs.property("features", readmeExtension.features)
|
||||||
|
|
||||||
if (readmeExtension.readmeTemplate.exists()) {
|
if (readmeExtension.readmeTemplate.exists()) {
|
||||||
inputs.file(readmeExtension.readmeTemplate)
|
inputs.file(readmeExtension.readmeTemplate)
|
||||||
@ -153,7 +176,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
val generateReadme by tasks.creating {
|
val generateReadme by tasks.registering{
|
||||||
group = "documentation"
|
group = "documentation"
|
||||||
description = "Generate a README file and a feature matrix if stub is present"
|
description = "Generate a README file and a feature matrix if stub is present"
|
||||||
|
|
||||||
@ -163,7 +186,13 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.property("extension", rootReadmeExtension)
|
inputs.property("features", rootReadmeExtension.features)
|
||||||
|
|
||||||
|
subprojects.forEach { subproject->
|
||||||
|
subproject.extensions.findByType<KScienceReadmeExtension>()?.let {
|
||||||
|
inputs.property("features-${subproject.name}", it.features)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rootReadmeExtension.readmeTemplate.exists()) {
|
if (rootReadmeExtension.readmeTemplate.exists()) {
|
||||||
inputs.file(rootReadmeExtension.readmeTemplate)
|
inputs.file(rootReadmeExtension.readmeTemplate)
|
||||||
@ -217,7 +246,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
dependsOn(generateReadme)
|
dependsOn(generateReadme)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.create("version") {
|
tasks.register("version") {
|
||||||
group = "publishing"
|
group = "publishing"
|
||||||
val versionFileProvider = project.layout.buildDirectory.file("project-version.txt")
|
val versionFileProvider = project.layout.buildDirectory.file("project-version.txt")
|
||||||
outputs.file(versionFileProvider)
|
outputs.file(versionFileProvider)
|
||||||
|
@ -12,10 +12,8 @@ import org.gradle.api.Project
|
|||||||
import org.gradle.kotlin.dsl.findByType
|
import org.gradle.kotlin.dsl.findByType
|
||||||
import org.intellij.lang.annotations.Language
|
import org.intellij.lang.annotations.Language
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.io.Serializable
|
||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
import kotlin.collections.component1
|
|
||||||
import kotlin.collections.component2
|
|
||||||
import kotlin.collections.set
|
|
||||||
|
|
||||||
public enum class Maturity {
|
public enum class Maturity {
|
||||||
PROTOTYPE,
|
PROTOTYPE,
|
||||||
@ -71,14 +69,14 @@ public class KScienceReadmeExtension(public val project: Project) {
|
|||||||
private val fmLoader = StringTemplateLoader().apply {
|
private val fmLoader = StringTemplateLoader().apply {
|
||||||
putTemplate(
|
putTemplate(
|
||||||
"artifact",
|
"artifact",
|
||||||
this@KScienceReadmeExtension.javaClass.getResource("/templates/ARTIFACT-TEMPLATE.md")!!.readText()
|
KScienceReadmeExtension::class.java.getResource("/templates/ARTIFACT-TEMPLATE.md")!!.readText()
|
||||||
)
|
)
|
||||||
if (readmeTemplate.exists()) {
|
if (readmeTemplate.exists()) {
|
||||||
putTemplate("readme", readmeTemplate.readText())
|
putTemplate("readme", readmeTemplate.readText())
|
||||||
} else if (useDefaultReadmeTemplate) {
|
} else if (useDefaultReadmeTemplate) {
|
||||||
putTemplate(
|
putTemplate(
|
||||||
"readme",
|
"readme",
|
||||||
this@KScienceReadmeExtension.javaClass.getResource("/templates/README-TEMPLATE.md")!!.readText()
|
KScienceReadmeExtension::class.java.getResource("/templates/README-TEMPLATE.md")!!.readText()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +86,7 @@ public class KScienceReadmeExtension(public val project: Project) {
|
|||||||
templateLoader = fmLoader
|
templateLoader = fmLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
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): Serializable
|
||||||
|
|
||||||
public val features: MutableList<Feature> = mutableListOf()
|
public val features: MutableList<Feature> = mutableListOf()
|
||||||
|
|
||||||
@ -99,7 +97,7 @@ public class KScienceReadmeExtension(public val project: Project) {
|
|||||||
id: String,
|
id: String,
|
||||||
@Language("File") ref: String? = null,
|
@Language("File") ref: String? = null,
|
||||||
name: String = id,
|
name: String = id,
|
||||||
description: () -> String,
|
@Language("markdown") description: () -> String,
|
||||||
) {
|
) {
|
||||||
features += Feature(id, description(), ref, name)
|
features += Feature(id, description(), ref, name)
|
||||||
}
|
}
|
||||||
@ -177,7 +175,7 @@ public class KScienceReadmeExtension(public val project: Project) {
|
|||||||
*/
|
*/
|
||||||
internal fun featuresString(itemPrefix: String = " - ", pathPrefix: String = ""): String = buildString {
|
internal fun featuresString(itemPrefix: String = " - ", pathPrefix: String = ""): String = buildString {
|
||||||
features.forEach {
|
features.forEach {
|
||||||
appendLine("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description}")
|
appendLine("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description.lines().firstOrNull() ?: ""}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package space.kscience.gradle.internal
|
package space.kscience.gradle.internal
|
||||||
|
|
||||||
|
import com.vanniktech.maven.publish.MavenPublishBaseExtension
|
||||||
|
import com.vanniktech.maven.publish.MavenPublishBasePlugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.publish.PublishingExtension
|
import org.gradle.api.publish.PublishingExtension
|
||||||
import org.gradle.api.publish.maven.MavenPom
|
import org.gradle.api.publish.maven.MavenPom
|
||||||
import org.gradle.api.publish.maven.MavenPublication
|
import org.gradle.api.publish.maven.MavenPublication
|
||||||
import org.gradle.api.tasks.bundling.Jar
|
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.SigningPlugin
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
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
|
||||||
?: System.getenv(propertyName)
|
?: System.getenv(propertyName)
|
||||||
@ -20,12 +19,14 @@ internal fun Project.requestProperty(propertyName: String): String = requestProp
|
|||||||
|
|
||||||
internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit = {}) = allprojects {
|
internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit = {}) = allprojects {
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
|
apply<MavenPublishBasePlugin>()
|
||||||
|
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
|
|
||||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||||
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
||||||
|
|
||||||
val sourcesJar by tasks.creating(Jar::class) {
|
val sourcesJar by tasks.registering(Jar::class) {
|
||||||
archiveClassifier.set("sources")
|
archiveClassifier.set("sources")
|
||||||
kotlin.sourceSets.forEach {
|
kotlin.sourceSets.forEach {
|
||||||
from(it.kotlin)
|
from(it.kotlin)
|
||||||
@ -54,32 +55,22 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins.withId("org.jetbrains.dokka") {
|
plugins.withId("org.jetbrains.dokka") {
|
||||||
val dokkaJar by tasks.creating(Jar::class) {
|
val dokkaJar by tasks.registering(Jar::class) {
|
||||||
group = "documentation"
|
group = "documentation"
|
||||||
archiveClassifier.set("javadoc")
|
archiveClassifier.set("javadoc")
|
||||||
from(tasks.findByName("dokkaHtml"))
|
from(tasks.findByName("dokkaGenerate"))
|
||||||
}
|
}
|
||||||
publications.withType<MavenPublication> {
|
publications.withType<MavenPublication> {
|
||||||
artifact(dokkaJar)
|
artifact(dokkaJar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestPropertyOrNull("publishing.signing.id") != null || requestPropertyOrNull("signing.gnupg.keyName") != null) {
|
//apply signing if signing configuration is available
|
||||||
|
if (requestPropertyOrNull("signing.password") != null || requestPropertyOrNull("signing.secretKeyRingFile") != null) {
|
||||||
if (!plugins.hasPlugin("signing")) {
|
plugins.withType<MavenPublishBasePlugin> {
|
||||||
apply<SigningPlugin>()
|
extensions.configure<MavenPublishBaseExtension> {
|
||||||
}
|
signAllPublications()
|
||||||
|
}
|
||||||
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 a key is provided, use it
|
|
||||||
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
|
|
||||||
} // else use agent signing
|
|
||||||
sign(publications)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Signing information is not provided. Skipping artefact signing.")
|
logger.warn("Signing information is not provided. Skipping artefact signing.")
|
||||||
@ -90,9 +81,9 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
|
|
||||||
internal fun Project.addPublishing(
|
internal fun Project.addPublishing(
|
||||||
repositoryName: String,
|
repositoryName: String,
|
||||||
urlString:String
|
urlString: String
|
||||||
){
|
) {
|
||||||
require(repositoryName.matches("\\w*".toRegex())){"Repository name must contain only letters or numbers"}
|
require(repositoryName.matches("\\w*".toRegex())) { "Repository name must contain only letters or numbers" }
|
||||||
val user: String? = requestPropertyOrNull("publishing.$repositoryName.user")
|
val user: String? = requestPropertyOrNull("publishing.$repositoryName.user")
|
||||||
val token: String? = requestPropertyOrNull("publishing.$repositoryName.token")
|
val token: String? = requestPropertyOrNull("publishing.$repositoryName.token")
|
||||||
|
|
||||||
@ -119,12 +110,3 @@ internal fun Project.addPublishing(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal fun Project.addSonatypePublishing(sonatypeRoot: String) {
|
|
||||||
if (isInDevelopment) {
|
|
||||||
logger.info("Sonatype publishing skipped for development version")
|
|
||||||
} else {
|
|
||||||
addPublishing("sonatype", "$sonatypeRoot/service/local/staging/deploy/maven2")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user