From 857262d9a0cc052780180bcad2eb43f5e83900e8 Mon Sep 17 00:00:00 2001 From: Aleksei Tiurin Date: Sun, 23 Jun 2024 05:43:51 +0300 Subject: [PATCH] Fix publications --- .github/workflows/publish.yml | 6 +-- build.gradle.kts | 5 ++- ultron-allure/build.gradle.kts | 30 +++----------- ultron-android/build.gradle.kts | 14 +++---- ultron-compose/build.gradle.kts | 69 +++++---------------------------- 5 files changed, 27 insertions(+), 97 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 632bcf7..4fa8b23 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,11 +18,11 @@ jobs: strategy: matrix: include: - - target: ":ultron-compose:publishJvmJavaPublicationToSonatypeRepository" + - target: :ultron-compose:publishMultiplatformPublicationToSonatypeRepository os: ubuntu-latest - - target: ":ultron-compose:publishAndroidReleasePublicationToSonatypeRepository" + - target: :ultron-android:publishMavenKotlinPublicationToSonatypeRepository os: ubuntu-latest - - target: ":ultron-compose:publishKotlinMultiplatformPublicationToSonatypeRepository" + - target: :ultron-compose:publishMavenKotlinPublicationToSonatypeRepository os: ubuntu-latest runs-on: ${{ matrix.os }} diff --git a/build.gradle.kts b/build.gradle.kts index 9895ac2..d1187b6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,10 +34,11 @@ plugins { nexusPublishing { repositories { sonatype { + username nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) - username.set(getLocalProperty("sonatype.username") ?: System.getenv("OSSRH_USERNAME")) - password.set(getLocalProperty("sonatype.password") ?: System.getenv("OSSRH_PASSWORD")) + username.set(getLocalProperty("ossrhToken") ?: System.getenv("OSSRH_USERNAME")) + password.set(getLocalProperty("ossrhTokenPassword") ?: System.getenv("OSSRH_PASSWORD")) stagingProfileId.set(getLocalProperty("sonatype.stagingProfileId") ?: System.getenv("OSSRH_STAGING_PROFILE_ID")) } } diff --git a/ultron-allure/build.gradle.kts b/ultron-allure/build.gradle.kts index d5eb49d..cb5b01c 100644 --- a/ultron-allure/build.gradle.kts +++ b/ultron-allure/build.gradle.kts @@ -50,7 +50,6 @@ val javadocJar = tasks.create("javadocJar") { from(dokkaOutputDir) } -// Создание другого arтефакта, например sourcesJar, если он нужен val sourcesJar = tasks.create("sourcesJar") { archiveClassifier.set("sources") from(android.sourceSets["main"].java.srcDirs) @@ -58,9 +57,9 @@ val sourcesJar = tasks.create("sourcesJar") { publishing { publications { - create("mavenJava") { + create("mavenKotlin") { artifact(javadocJar) - artifact(sourcesJar) // добавление sourcesJar в публикацию + artifact(sourcesJar) pom { name.set("ultron-allure") @@ -100,26 +99,7 @@ publishing { } signing { - if (project.hasProperty("signing.gnupg.keyName")) { - println("Signing lib...") - useGpgCmd() - sign(publishing.publications) - } + println("Signing lib...") + useGpgCmd() + sign(publishing.publications) } - -//afterEvaluate { -// tasks.findByName("generateMetadataFileForMavenPublication")?.let { generateMetadataTask -> -// tasks.findByName("androidSourcesJar")?.let { androidSourcesJarTask -> -// generateMetadataTask.dependsOn(androidSourcesJarTask) -// } -// } -//} -//afterEvaluate { -// configure { -// publications.all { -// val mavenPublication = this as? MavenPublication -// mavenPublication?.artifactId = -// "${project.name}${"-$name".takeUnless { "kotlinMultiplatform" in name }.orEmpty()}" -// } -// } -//} \ No newline at end of file diff --git a/ultron-android/build.gradle.kts b/ultron-android/build.gradle.kts index 12312da..5d34fa7 100644 --- a/ultron-android/build.gradle.kts +++ b/ultron-android/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.compose.internal.utils.getLocalProperty + plugins { id("com.android.library") id("kotlin-android") @@ -53,9 +55,9 @@ val sourcesJar = tasks.create("sourcesJar") { publishing { publications { - create("mavenJava") { + create("mavenKotlin") { artifact(javadocJar) - artifact(sourcesJar) // добавление sourcesJar в публикацию + artifact(sourcesJar) pom { name.set("ultron-android") @@ -95,9 +97,7 @@ publishing { } signing { - if (project.hasProperty("signing.gnupg.keyName")) { - println("Signing lib...") - useGpgCmd() - sign(publishing.publications) - } + println("Signing lib...") + useGpgCmd() + sign(publishing.publications) } \ No newline at end of file diff --git a/ultron-compose/build.gradle.kts b/ultron-compose/build.gradle.kts index 48ee891..3efd280 100644 --- a/ultron-compose/build.gradle.kts +++ b/ultron-compose/build.gradle.kts @@ -70,26 +70,14 @@ val ultronComposeJavadocJar by tasks.registering(Jar::class) { from(dokkaOutputDir) } -val ultronComposeAndroidSourcesJar by tasks.registering(Jar::class) { - archiveClassifier.set("android-sources") - from(android.sourceSets["main"].java.srcDirs) -} - -val ultronComposeJvmSourcesJar by tasks.registering(Jar::class) { - archiveClassifier.set("jvm-sources") - from(kotlin.sourceSets["jvmMain"].kotlin.srcDirs) - dependsOn("generateResourceAccessorsForJvmMain") -} - publishing { publications { - create("android") { + create("multiplatform") { from(components["kotlin"]) artifact(ultronComposeJavadocJar) - artifact(ultronComposeAndroidSourcesJar) pom { - name.set("ultron-compose-android") + name.set("ultron-compose") description.set("Android & Compose Multiplatform UI testing framework") url.set("https://github.com/open-tool/ultron") inceptionYear.set("2021") @@ -121,57 +109,18 @@ publishing { } } } - - create("jvmJava") { - from(components["kotlin"]) - artifact(ultronComposeJavadocJar) - artifact(ultronComposeJvmSourcesJar) - - pom { - name.set("ultron-compose-jvm") - description.set("Compose Multiplatform UI testing framework for JVM") - url.set("https://github.com/open-tool/ultron") - inceptionYear.set("2021") - - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - - issueManagement { - system.set("GitHub Issues") - url.set("https://github.com/open-tool/ultron/issues") - } - - developers { - developer { - id.set("alex-tiurin") - name.set("Aleksei Tiurin") - url.set("https://github.com/open-tool") - } - } - - scm { - connection.set("scm:git@github.com:open-tool/ultron.git") - developerConnection.set("scm:git@github.com:open-tool/ultron.git") - url.set("https://github.com/open-tool/ultron") - } - } - } } } -// Указание зависимостей для задач публикации tasks.withType().configureEach { - dependsOn(ultronComposeJavadocJar, ultronComposeAndroidSourcesJar, ultronComposeJvmSourcesJar) + dependsOn(tasks.withType()) + dependsOn(ultronComposeJavadocJar) + dependsOn(tasks.withType()) + mustRunAfter(tasks.withType()) } signing { - if (project.hasProperty("signing.gnupg.keyName")) { - println("Signing lib...") - useGpgCmd() - sign(publishing.publications) - } + println("Signing lib...") + useGpgCmd() + sign(publishing.publications) } \ No newline at end of file