Compare commits
1 Commits
beta/2.1.2
...
master
Author | SHA1 | Date | |
---|---|---|---|
36dae25531 |
43
.space.kts
Normal file
43
.space.kts
Normal file
@ -0,0 +1,43 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,8 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
- Kotlin 2.1.0
|
||||
- Publication to central via `com.vanniktech.maven.publish.base`
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
|
||||
plugins {
|
||||
`java-gradle-plugin`
|
||||
`kotlin-dsl`
|
||||
`maven-publish`
|
||||
// signing
|
||||
`version-catalog`
|
||||
alias(libs.plugins.maven.publish)
|
||||
alias(libs.plugins.jetbrains.changelog)
|
||||
alias(libs.plugins.jetbrains.dokka)
|
||||
alias(libs.plugins.versions)
|
||||
alias(libs.plugins.versions.update)
|
||||
alias(libs.plugins.maven.publish.base)
|
||||
}
|
||||
|
||||
group = "space.kscience"
|
||||
@ -25,13 +26,12 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlin.asProvider().get()}")
|
||||
api("org.gradle.toolchains:foojay-resolver:0.9.0")
|
||||
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.15.0-Beta.3")
|
||||
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:${libs.versions.changelog.get()}")
|
||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${libs.versions.dokka.get()}")
|
||||
implementation("org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin:${libs.versions.kotlin.jupyter.get()}")
|
||||
implementation("com.vanniktech:gradle-maven-publish-plugin:0.30.0")
|
||||
api(libs.kotlin.gradle)
|
||||
api(libs.foojay.resolver)
|
||||
implementation(libs.binary.compatibility.validator)
|
||||
implementation(libs.changelog.gradle)
|
||||
implementation(libs.dokka.gradle)
|
||||
implementation(libs.kotlin.jupyter.gradle)
|
||||
implementation(libs.kotlin.serialization)
|
||||
implementation(libs.kotlinx.html)
|
||||
implementation(libs.tomlj)
|
||||
@ -89,6 +89,30 @@ catalog.versionCatalog {
|
||||
}
|
||||
|
||||
//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 {
|
||||
configure(
|
||||
com.vanniktech.maven.publish.GradlePlugin(
|
||||
@ -97,13 +121,8 @@ mavenPublishing {
|
||||
)
|
||||
)
|
||||
|
||||
publishing.publications.create<MavenPublication>("version-catalog") {
|
||||
from(components["versionCatalog"])
|
||||
artifactId = "version-catalog"
|
||||
|
||||
pom {
|
||||
name.set("version-catalog")
|
||||
}
|
||||
project.publishing.publications.create("maven", MavenPublication::class.java) {
|
||||
from(project.components.getByName("versionCatalog"))
|
||||
}
|
||||
|
||||
val vcs = "https://git.sciprog.center/kscience/gradle-tools"
|
||||
|
@ -1,8 +1,8 @@
|
||||
[versions]
|
||||
# @pin
|
||||
kotlin = "2.1.20-Beta1"
|
||||
kotlin = "2.1.0"
|
||||
# @pin
|
||||
tools = "0.16.0-kotlin-2.1.20-Beta1"
|
||||
tools = "0.15.8-kotlin-2.1.0"
|
||||
atomicfu = "0.26.1"
|
||||
changelog = "2.2.1"
|
||||
compose = "1.7.1"
|
||||
@ -28,10 +28,9 @@ yamlkt = "0.13.0"
|
||||
|
||||
[plugins]
|
||||
maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" }
|
||||
maven-publish-base = { id = "com.vanniktech.maven.publish.base", version = "0.30.0" }
|
||||
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" }
|
||||
jetbrains-changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
|
||||
jetbrains-changelog = "org.jetbrains.changelog:2.2.1"
|
||||
jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }
|
||||
@ -61,8 +60,21 @@ versions-update = "nl.littlerobots.version-catalog-update:0.8.5"
|
||||
|
||||
[libraries]
|
||||
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
|
||||
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
|
||||
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-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-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" }
|
||||
|
@ -1,7 +1,5 @@
|
||||
package space.kscience.gradle
|
||||
|
||||
import com.vanniktech.maven.publish.MavenPublishBaseExtension
|
||||
import com.vanniktech.maven.publish.MavenPublishBasePlugin
|
||||
import kotlinx.validation.ApiValidationExtension
|
||||
import kotlinx.validation.BinaryCompatibilityValidatorPlugin
|
||||
import org.gradle.api.Plugin
|
||||
@ -18,6 +16,7 @@ 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
|
||||
|
||||
/**
|
||||
@ -70,32 +69,11 @@ public class KSciencePublishingExtension(public val project: Project) {
|
||||
|
||||
/**
|
||||
* Adds Sonatype Maven repository to publishing.
|
||||
*/
|
||||
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" }
|
||||
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) {
|
||||
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" }
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
project.addSonatypePublishing(sonatypeRoot)
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,9 +87,6 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
||||
apply<DokkaPlugin>()
|
||||
apply<BinaryCompatibilityValidatorPlugin>()
|
||||
|
||||
val ksciencePublish = KSciencePublishingExtension(this)
|
||||
extensions.add("ksciencePublish", ksciencePublish)
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@ -138,6 +113,8 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
val rootReadmeExtension = KScienceReadmeExtension(this)
|
||||
val ksciencePublish = KSciencePublishingExtension(this)
|
||||
extensions.add("ksciencePublish", ksciencePublish)
|
||||
extensions.add("readme", rootReadmeExtension)
|
||||
|
||||
//Add readme generators to individual subprojects
|
||||
|
@ -1,14 +1,15 @@
|
||||
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.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPom
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
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 space.kscience.gradle.isInDevelopment
|
||||
|
||||
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
|
||||
?: System.getenv(propertyName)
|
||||
@ -19,8 +20,6 @@ internal fun Project.requestProperty(propertyName: String): String = requestProp
|
||||
|
||||
internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit = {}) = allprojects {
|
||||
plugins.withId("maven-publish") {
|
||||
apply<MavenPublishBasePlugin>()
|
||||
|
||||
configure<PublishingExtension> {
|
||||
|
||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||
@ -65,12 +64,22 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
//apply signing if signing configuration is available
|
||||
if (requestPropertyOrNull("signing.password") != null || requestPropertyOrNull("signing.secretKeyRingFile") != null) {
|
||||
plugins.withType<MavenPublishBasePlugin> {
|
||||
extensions.configure<MavenPublishBaseExtension> {
|
||||
signAllPublications()
|
||||
if (requestPropertyOrNull("publishing.signing.id") != null || requestPropertyOrNull("signing.gnupg.keyName") != null) {
|
||||
|
||||
if (!plugins.hasPlugin("signing")) {
|
||||
apply<SigningPlugin>()
|
||||
}
|
||||
|
||||
extensions.configure<SigningExtension>("signing") {
|
||||
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
|
||||
if (!signingId.isNullOrBlank()) {
|
||||
val signingKey: String = requestProperty("publishing.signing.key")
|
||||
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
|
||||
|
||||
// if a key is provided, use it
|
||||
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
|
||||
} // else use agent signing
|
||||
sign(publications)
|
||||
}
|
||||
} else {
|
||||
logger.warn("Signing information is not provided. Skipping artefact signing.")
|
||||
@ -110,3 +119,12 @@ 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…
Reference in New Issue
Block a user