Skip to content

Commit

Permalink
Fix publications
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tiurin committed Jun 23, 2024
1 parent 28f7a74 commit 857262d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 97 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
}
Expand Down
30 changes: 5 additions & 25 deletions ultron-allure/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,16 @@ val javadocJar = tasks.create<Jar>("javadocJar") {
from(dokkaOutputDir)
}

// Создание другого arтефакта, например sourcesJar, если он нужен
val sourcesJar = tasks.create<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(android.sourceSets["main"].java.srcDirs)
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
create<MavenPublication>("mavenKotlin") {
artifact(javadocJar)
artifact(sourcesJar) // добавление sourcesJar в публикацию
artifact(sourcesJar)

pom {
name.set("ultron-allure")
Expand Down Expand Up @@ -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<PublishingExtension> {
// publications.all {
// val mavenPublication = this as? MavenPublication
// mavenPublication?.artifactId =
// "${project.name}${"-$name".takeUnless { "kotlinMultiplatform" in name }.orEmpty()}"
// }
// }
//}
14 changes: 7 additions & 7 deletions ultron-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.compose.internal.utils.getLocalProperty

plugins {
id("com.android.library")
id("kotlin-android")
Expand Down Expand Up @@ -53,9 +55,9 @@ val sourcesJar = tasks.create<Jar>("sourcesJar") {

publishing {
publications {
create<MavenPublication>("mavenJava") {
create<MavenPublication>("mavenKotlin") {
artifact(javadocJar)
artifact(sourcesJar) // добавление sourcesJar в публикацию
artifact(sourcesJar)

pom {
name.set("ultron-android")
Expand Down Expand Up @@ -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)
}
69 changes: 9 additions & 60 deletions ultron-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<MavenPublication>("android") {
create<MavenPublication>("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")
Expand Down Expand Up @@ -121,57 +109,18 @@ publishing {
}
}
}

create<MavenPublication>("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:[email protected]:open-tool/ultron.git")
developerConnection.set("scm:[email protected]:open-tool/ultron.git")
url.set("https://github.com/open-tool/ultron")
}
}
}
}
}

// Указание зависимостей для задач публикации
tasks.withType<PublishToMavenRepository>().configureEach {
dependsOn(ultronComposeJavadocJar, ultronComposeAndroidSourcesJar, ultronComposeJvmSourcesJar)
dependsOn(tasks.withType<Sign>())
dependsOn(ultronComposeJavadocJar)
dependsOn(tasks.withType<Jar>())
mustRunAfter(tasks.withType<Sign>())
}

signing {
if (project.hasProperty("signing.gnupg.keyName")) {
println("Signing lib...")
useGpgCmd()
sign(publishing.publications)
}
println("Signing lib...")
useGpgCmd()
sign(publishing.publications)
}

0 comments on commit 857262d

Please sign in to comment.