From 0860d6cacc87064fb426727d8a2266b1236e19e0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 5 Dec 2023 19:41:15 +0600 Subject: [PATCH] update artifacts to be published in nexus --- publish.gradle | 33 +++++++++++++++++++++++---------- publish.kpsb | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/publish.gradle b/publish.gradle index bcb7ca2..cd44567 100644 --- a/publish.gradle +++ b/publish.gradle @@ -57,18 +57,14 @@ publishing { } } - if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) { + if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) { maven { - name = "Gitea" - url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven") + name = "InmoNexus" + url = uri("https://nexus.inmo.dev/repository/maven-releases/") - credentials(HttpHeaderCredentials) { - name = "Authorization" - value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN') - } - - authentication { - header(HttpHeaderAuthentication) + credentials { + username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER') + password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD') } } @@ -109,4 +105,21 @@ if (project.hasProperty("signing.gnupg.keyName")) { def signingTasks = project.getTasks().withType(Sign.class) mustRunAfter(signingTasks) } + // Workaround to make test tasks use sign + project.getTasks().withType(Sign.class).configureEach { signTask -> + def withoutSign = (signTask.name.startsWith("sign") ? signTask.name.minus("sign") : signTask.name) + def pubName = withoutSign.endsWith("Publication") ? withoutSign.substring(0, withoutSign.length() - "Publication".length()) : withoutSign + // These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets + + // Task ':linkDebugTest' uses this output of task ':signPublication' without declaring an explicit or implicit dependency + def debugTestTask = tasks.findByName("linkDebugTest$pubName") + if (debugTestTask != null) { + signTask.mustRunAfter(debugTestTask) + } + // Task ':compileTestKotlin' uses this output of task ':signPublication' without declaring an explicit or implicit dependency + def testTask = tasks.findByName("compileTestKotlin$pubName") + if (testTask != null) { + signTask.mustRunAfter(testTask) + } + } } diff --git a/publish.kpsb b/publish.kpsb index eb28fa8..074b27e 100644 --- a/publish.kpsb +++ b/publish.kpsb @@ -1 +1 @@ -{"licenses":[{"id":"MIT","title":"MIT License","url":"https://opensource.org/licenses/MIT"}],"mavenConfig":{"name":"${project.name}","description":"Simple logging library for kotlin","url":"https://github.com/InsanusMokrassar/KSLog","vcsUrl":"https://github.com/InsanusMokrassar/KSLog.git","developers":[{"id":"Akkihi","name":"Akkihi","eMail":"akkihiguy@gmail.com"},{"id":"InsanusMokrassar","name":"InsanusMokrassar","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/KSLog"},{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file +{"licenses":[{"id":"MIT","title":"MIT License","url":"https://opensource.org/licenses/MIT"}],"mavenConfig":{"name":"${project.name}","description":"Simple logging library for kotlin","url":"https://github.com/InsanusMokrassar/KSLog","vcsUrl":"https://github.com/InsanusMokrassar/KSLog.git","developers":[{"id":"Akkihi","name":"Akkihi","eMail":"akkihiguy@gmail.com"},{"id":"InsanusMokrassar","name":"InsanusMokrassar","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/KSLog"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file