Compare commits
No commits in common. "33b6de9f0eaec72b63707eb5785acebc35c7aed2" and "c249dc5ae4924b8500d8084f22ce3268c23b18b0" have entirely different histories.
33b6de9f0e
...
c249dc5ae4
@ -76,12 +76,12 @@ gradlePlugin {
|
|||||||
|
|
||||||
tasks.create("version") {
|
tasks.create("version") {
|
||||||
group = "publishing"
|
group = "publishing"
|
||||||
val versionFileProvider = project.layout.buildDirectory.file("project-version.txt")
|
val versionFile = project.buildDir.resolve("project-version.txt")
|
||||||
outputs.file(versionFileProvider)
|
outputs.file(versionFile)
|
||||||
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 +117,7 @@ val emptySourcesJar by tasks.creating(Jar::class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
val vcs = "https://github.com/SciProgCentre/gradle-tools"
|
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
||||||
|
|
||||||
// Process each publication we have in this project
|
// Process each publication we have in this project
|
||||||
publications {
|
publications {
|
||||||
@ -151,10 +151,10 @@ publishing {
|
|||||||
|
|
||||||
developers {
|
developers {
|
||||||
developer {
|
developer {
|
||||||
id.set("SPC")
|
id.set("MIPT-NPM")
|
||||||
name.set("Scientific Programming Centre")
|
name.set("MIPT nuclear physics methods laboratory")
|
||||||
organization.set("SPC")
|
organization.set("MIPT")
|
||||||
organizationUrl.set("https://sciprog.center/")
|
organizationUrl.set("https://npm.mipt.ru")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,18 +166,20 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val spaceRepo = "https://maven.sciprog.center/kscience"
|
val spaceRepo = "https://maven.pkg.jetbrains.space/spc/p/sci/maven"
|
||||||
val spcUser: String? = findProperty("publishing.spc.user") as? String
|
val spaceUser: String? = findProperty("publishing.space.user") as? String
|
||||||
val spcToken: String? = findProperty("publishing.spc.token") as? String
|
val spaceToken: String? = findProperty("publishing.space.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 = "spc"
|
name = "space"
|
||||||
url = uri(spaceRepo)
|
url = uri(spaceRepo)
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = spcUser
|
username = spaceUser
|
||||||
password = spcToken
|
password = spaceToken
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,26 @@
|
|||||||
[versions]
|
[versions]
|
||||||
tools = "0.14.11-kotlin-1.9.20-Beta"
|
tools = "0.14.10-kotlin-1.9.0"
|
||||||
kotlin = "1.9.20-Beta"
|
kotlin = "1.9.0"
|
||||||
# https://github.com/Kotlin/kotlinx-atomicfu
|
|
||||||
atomicfu = "0.22.0"
|
atomicfu = "0.22.0"
|
||||||
# https://github.com/Kotlin/binary-compatibility-validator
|
|
||||||
binary-compatibility-validator = "0.13.2"
|
binary-compatibility-validator = "0.13.2"
|
||||||
# https://github.com/JetBrains/gradle-changelog-plugin
|
changelog = "2.1.2"
|
||||||
changelog = "2.2.0"
|
dokka = "1.8.20"
|
||||||
# https://github.com/Kotlin/dokka
|
kotlin-jupyter = "0.12.0-43"
|
||||||
dokka = "1.9.0"
|
|
||||||
# https://github.com/Kotlin/kotlin-jupyter
|
|
||||||
kotlin-jupyter = "0.12.0-56"
|
|
||||||
# https://github.com/Kotlin/kotlinx-benchmark
|
|
||||||
kotlinx-benchmark = "0.4.9"
|
kotlinx-benchmark = "0.4.9"
|
||||||
# https://github.com/Kotlin/kotlinx-cli
|
kotlinx-cli = "0.3.5"
|
||||||
kotlinx-cli = "0.3.6"
|
|
||||||
# https://github.com/Kotlin/kotlinx.coroutines
|
|
||||||
kotlinx-coroutines = "1.7.3"
|
kotlinx-coroutines = "1.7.3"
|
||||||
# https://github.com/Kotlin/kotlinx-datetime
|
kotlinx-datetime = "0.4.0"
|
||||||
kotlinx-datetime = "0.4.1"
|
|
||||||
# https://github.com/Kotlin/kotlinx.html
|
|
||||||
kotlinx-html = "0.9.1"
|
kotlinx-html = "0.9.1"
|
||||||
# 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"
|
||||||
# https://github.com/Kotlin/kotlinx.serialization
|
kotlinx-serialization = "1.5.1"
|
||||||
kotlinx-serialization = "1.6.0"
|
ktor = "2.3.3"
|
||||||
# https://ktor.io/
|
|
||||||
ktor = "2.3.4"
|
|
||||||
# https://github.com/pdvrieze/xmlutil
|
|
||||||
xmlutil = "0.86.1"
|
xmlutil = "0.86.1"
|
||||||
# https://github.com/Him188/yamlkt
|
|
||||||
yamlkt = "0.13.0"
|
yamlkt = "0.13.0"
|
||||||
# https://github.com/JetBrains/kotlin-wrappers
|
jsBom = "1.0.0-pre.618"
|
||||||
jsBom = "1.0.0-pre.624"
|
|
||||||
junit = "5.9.3"
|
junit = "5.9.3"
|
||||||
# https://github.com/JetBrains/compose-multiplatform
|
compose = "1.5.0-rc01"
|
||||||
compose = "1.5.1"
|
logback = "1.4.7"
|
||||||
# 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" }
|
||||||
@ -102,8 +81,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" }
|
||||||
|
|
||||||
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
|
||||||
|
|
||||||
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
|
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
|
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.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -17,7 +17,10 @@ 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
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.*
|
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.KotlinJsTargetDsl
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmTargetDsl
|
||||||
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
|
||||||
@ -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(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
api(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(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
api(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(project.dependencies.platform("io.ktor:ktor-bom:$version"))
|
api(platform("io.ktor:ktor-bom:$version"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -232,7 +235,7 @@ public open class KScienceExtension(public val project: Project) {
|
|||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
|
|
||||||
targets.withType<KotlinWasmJsTargetDsl> {
|
targets.withType<KotlinWasmTargetDsl> {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,8 +265,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 wasmJsMain: DefaultSourceSet get() = DefaultSourceSet("wasmJsMain")
|
public val wasmMain: DefaultSourceSet get() = DefaultSourceSet("wasmMain")
|
||||||
public val wasmJsTest: DefaultSourceSet get() = DefaultSourceSet("wasmJsTest")
|
public val wasmTest: DefaultSourceSet get() = DefaultSourceSet("wasmTest")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,27 +426,27 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
|||||||
|
|
||||||
@OptIn(ExperimentalWasmDsl::class)
|
@OptIn(ExperimentalWasmDsl::class)
|
||||||
public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) {
|
public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) {
|
||||||
// if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") {
|
if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") {
|
||||||
// project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property")
|
project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property")
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
project.configure<KotlinMultiplatformExtension> {
|
project.configure<KotlinMultiplatformExtension> {
|
||||||
wasmJs {
|
wasm {
|
||||||
browser {
|
browser {
|
||||||
testTask {
|
testTask(Action {
|
||||||
useKarma {
|
useKarma {
|
||||||
this.webpackConfig.experiments.add("topLevelAwait")
|
this.webpackConfig.experiments.add("topLevelAwait")
|
||||||
useChromeHeadlessWasmGc()
|
useChromeHeadlessWasmGc()
|
||||||
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
|
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
getByName("wasmJsTest") {
|
getByName("wasmTest") {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test"))
|
implementation(kotlin("test"))
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@ import org.jetbrains.dokka.gradle.DokkaPlugin
|
|||||||
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
|
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.*
|
||||||
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.
|
||||||
@ -56,20 +54,42 @@ public class KSciencePublishingExtension(public val project: Project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a repository with [repositoryName]. Uses "publishing.$repositoryName.user" and "publishing.$repositoryName.token"
|
* Adds GitHub as VCS and adds GitHub Packages Maven repository to publishing.
|
||||||
* 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 repository(
|
public fun github(
|
||||||
repositoryName: String,
|
githubOrg: String,
|
||||||
url: String,
|
githubProject: String,
|
||||||
|
deploy: Boolean = project.requestPropertyOrNull("publishing.github") == "true",
|
||||||
) {
|
) {
|
||||||
require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" }
|
if (deploy) {
|
||||||
project.addPublishing(repositoryName, url)
|
try {
|
||||||
|
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(sonatypeRoot: String = "https://s01.oss.sonatype.org") {
|
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" }
|
||||||
@ -122,7 +142,7 @@ 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") {
|
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"
|
||||||
|
|
||||||
@ -216,12 +236,12 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
|
|
||||||
tasks.create("version") {
|
tasks.create("version") {
|
||||||
group = "publishing"
|
group = "publishing"
|
||||||
val versionFileProvider = project.layout.buildDirectory.file("project-version.txt")
|
val versionFile = project.buildDir.resolve("project-version.txt")
|
||||||
outputs.file(versionFileProvider)
|
outputs.file(versionFile)
|
||||||
doLast {
|
doLast {
|
||||||
val versionFile = versionFileProvider.get().asFile
|
|
||||||
versionFile.createNewFile()
|
versionFile.createNewFile()
|
||||||
versionFile.writeText(project.version.toString())
|
versionFile.writeText(project.version.toString())
|
||||||
|
println(project.version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
}
|
}
|
||||||
|
|
||||||
publications.create<MavenPublication>("jvm") {
|
publications.create<MavenPublication>("jvm") {
|
||||||
project.components.forEach {
|
kotlin.target.components.forEach {
|
||||||
from(it)
|
from(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,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 a key is provided, use it
|
// if 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)
|
||||||
@ -103,31 +103,30 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.addPublishing(
|
internal fun Project.addGithubPublishing(
|
||||||
repositoryName: String,
|
githubOrg: String,
|
||||||
urlString:String
|
githubProject: String,
|
||||||
){
|
) {
|
||||||
require(repositoryName.matches("\\w*".toRegex())){"Repository name must contain only letters or numbers"}
|
val githubUser: String? = requestPropertyOrNull("publishing.github.user")
|
||||||
val user: String? = requestPropertyOrNull("publishing.$repositoryName.user")
|
val githubToken: String? = requestPropertyOrNull("publishing.github.token")
|
||||||
val token: String? = requestPropertyOrNull("publishing.$repositoryName.token")
|
|
||||||
|
|
||||||
if (user == null || token == null) {
|
if (githubUser == null || githubToken == null) {
|
||||||
logger.info("Skipping $repositoryName publishing because $repositoryName credentials are not defined")
|
logger.info("Skipping Github publishing because Github credentials are not defined")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
logger.info("Adding $repositoryName publishing to project [${project.name}]")
|
logger.info("Adding Github publishing to project [${project.name}]")
|
||||||
|
|
||||||
repositories.maven {
|
repositories.maven {
|
||||||
name = repositoryName
|
name = "github"
|
||||||
url = uri(urlString)
|
url = uri("https://maven.pkg.github.com/$githubOrg/$githubProject/")
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = user
|
username = githubUser
|
||||||
password = token
|
password = githubToken
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,11 +134,62 @@ internal fun Project.addPublishing(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||||
|
val spaceUser: String? = requestPropertyOrNull("publishing.space.user")
|
||||||
|
val spaceToken: String? = requestPropertyOrNull("publishing.space.token")
|
||||||
|
|
||||||
|
if (spaceUser == null || spaceToken == null) {
|
||||||
|
logger.info("Skipping Space publishing because Space credentials are not defined")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
plugins.withId("maven-publish") {
|
||||||
|
configure<PublishingExtension> {
|
||||||
|
project.logger.info("Adding SPC Space publishing to project [${project.name}]")
|
||||||
|
|
||||||
|
repositories.maven {
|
||||||
|
name = "space"
|
||||||
|
url = uri(spaceRepo)
|
||||||
|
|
||||||
|
credentials {
|
||||||
|
username = spaceUser
|
||||||
|
password = spaceToken
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal fun Project.addSonatypePublishing(sonatypeRoot: String) {
|
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")
|
||||||
} else {
|
return
|
||||||
addPublishing("sonatype", "$sonatypeRoot/service/local/staging/deploy/maven2")
|
}
|
||||||
|
|
||||||
|
val sonatypeUser: String? = requestPropertyOrNull("publishing.sonatype.user")
|
||||||
|
val sonatypePassword: String? = requestPropertyOrNull("publishing.sonatype.password")
|
||||||
|
|
||||||
|
if (sonatypeUser == null || sonatypePassword == null) {
|
||||||
|
logger.info("Skipping Sonatype publishing because Sonatype credentials are not defined")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
plugins.withId("maven-publish") {
|
||||||
|
configure<PublishingExtension> {
|
||||||
|
repositories.maven {
|
||||||
|
val sonatypeRepo = "$sonatypeRoot/service/local/staging/deploy/maven2"
|
||||||
|
name = "sonatype"
|
||||||
|
url = uri(sonatypeRepo)
|
||||||
|
|
||||||
|
credentials {
|
||||||
|
username = sonatypeUser
|
||||||
|
password = sonatypePassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user