Skip to content

Commit

Permalink
ultron-common publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tiurin committed Jun 23, 2024
1 parent 857262d commit bcee87b
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 49 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ jobs:
strategy:
matrix:
include:
- target: :ultron-compose:publishMultiplatformPublicationToSonatypeRepository
- target: :ultron-compose:publishToSonatype
os: ubuntu-latest
- target: :ultron-android:publishMavenKotlinPublicationToSonatypeRepository
- target: :ultron-android:publishToSonatype
os: ubuntu-latest
- target: :ultron-compose:publishMavenKotlinPublicationToSonatypeRepository
- target: :ultron-allure:publishToSonatype
os: ubuntu-latest
- target: :ultron-common:publishToSonatype
os: ubuntu-latest
runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ kotlin.mpp.enableCInteropCommonization=true

GROUP=com.atiurin
POM_ARTIFACT_ID=ultron
VERSION_NAME=2.5.0-alpha01
VERSION_NAME=2.5.0-alpha03

POM_NAME=ultron

Expand Down
36 changes: 24 additions & 12 deletions ultron-allure/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ version = project.findProperty("VERSION_NAME")!!


android {
compileSdk = 34
namespace = "com.atiurin.ultron.allure"
compileSdk = 34
defaultConfig {
minSdk = 21
}
Expand All @@ -29,6 +29,12 @@ android {
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}
}
dependencies {
implementation(Libs.kotlinStdlib)
Expand All @@ -43,29 +49,25 @@ dependencies {
val dokkaOutputDir = buildDir.resolve("dokka")
tasks.dokkaHtml { outputDirectory.set(file(dokkaOutputDir)) }
val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") { delete(dokkaOutputDir) }
val javadocJar = tasks.create<Jar>("javadocJar") {
val javadocJar = tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
from(dokkaOutputDir)
}

val sourcesJar = tasks.create<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(android.sourceSets["main"].java.srcDirs)
}

publishing {
publications {
create<MavenPublication>("mavenKotlin") {
artifact(javadocJar)
artifact(sourcesJar)
create<MavenPublication>("release") {
artifact(javadocJar.get())
afterEvaluate {
from(components["release"])
}

pom {
name.set("ultron-allure")
name.set("Ultron Allure")
description.set("Android & Compose Multiplatform UI testing framework")
url.set("https://github.com/open-tool/ultron")
packaging = "aar"
inceptionYear.set("2021")

licenses {
Expand Down Expand Up @@ -98,6 +100,16 @@ publishing {
}
}

tasks.withType<PublishToMavenRepository>().configureEach {
dependsOn(tasks.withType<Sign>())
dependsOn(javadocJar)
mustRunAfter(tasks.withType<Sign>())
}

tasks.named("generateMetadataFileForReleasePublication") {
dependsOn(javadocJar)
}

signing {
println("Signing lib...")
useGpgCmd()
Expand Down
52 changes: 34 additions & 18 deletions ultron-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.compose.internal.utils.getLocalProperty

plugins {
id("com.android.library")
id("kotlin-android")
Expand All @@ -9,7 +7,7 @@ plugins {
}

group = project.findProperty("GROUP")!!
version = project.findProperty("VERSION_NAME")!!
version = project.findProperty("VERSION_NAME")!!

android {
namespace = "com.atiurin.ultron.android"
Expand All @@ -24,6 +22,12 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}
}

dependencies {
Expand All @@ -39,31 +43,33 @@ dependencies {
}

val dokkaOutputDir = buildDir.resolve("dokka")
tasks.dokkaHtml { outputDirectory.set(file(dokkaOutputDir)) }
val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") { delete(dokkaOutputDir) }
val javadocJar = tasks.create<Jar>("javadocJar") {

tasks.dokkaHtml.configure { outputDirectory.set(file(dokkaOutputDir)) }

val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") {
delete(dokkaOutputDir)
}

val javadocJar = tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
from(dokkaOutputDir)
}

val sourcesJar = tasks.create<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(android.sourceSets["main"].java.srcDirs)
}

publishing {
publications {
create<MavenPublication>("mavenKotlin") {
artifact(javadocJar)
artifact(sourcesJar)

create<MavenPublication>("release") {
println("Start publishing _-------------")
println(this.name)
artifact(javadocJar.get())
afterEvaluate {
from(components["release"])
}
pom {
name.set("ultron-android")
name.set("Ultron Android")
description.set("Android & Compose Multiplatform UI testing framework")
url.set("https://github.com/open-tool/ultron")
packaging = "aar"
inceptionYear.set("2021")

licenses {
Expand Down Expand Up @@ -96,8 +102,18 @@ publishing {
}
}

tasks.withType<PublishToMavenRepository>().configureEach {
dependsOn(tasks.withType<Sign>())
dependsOn(javadocJar)
mustRunAfter(tasks.withType<Sign>())
}

tasks.named("generateMetadataFileForReleasePublication") {
dependsOn(javadocJar)
}

signing {
println("Signing lib...")
useGpgCmd()
sign(publishing.publications)
}
}
115 changes: 103 additions & 12 deletions ultron-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
id("org.jetbrains.dokka")
id("maven-publish")
id("signing")
}

group = project.findProperty("GROUP")!!
version = project.findProperty("VERSION_NAME")!!

kotlin {
jvm()
androidTarget {
publishLibraryVariants("release")
compilations.all {
kotlinOptions {
jvmTarget = "17"
Expand Down Expand Up @@ -37,16 +42,6 @@ kotlin {
implementation(kotlin("stdlib-jdk8"))
}
}
// val jsMain by getting {
// dependencies {
// implementation(kotlin("stdlib-js"))
// }
// }
// val wasmJsMain by getting {
// dependencies {
// implementation(kotlin("stdlib"))
// }
// }
}
}

Expand All @@ -61,3 +56,99 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
}

val dokkaOutputDir = buildDir.resolve("dokka")

tasks.dokkaHtml.configure {
outputDirectory.set(file(dokkaOutputDir))
}

val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") {
delete(dokkaOutputDir)
}

val ultronComposeJavadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
from(dokkaOutputDir)
}

publishing {
publications {
withType<MavenPublication> {
artifact(ultronComposeJavadocJar.get())

pom {
name.set("Ultron Common")
description.set("Android & Compose Multiplatform UI testing framework")
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<PublishToMavenRepository>().configureEach {
dependsOn(tasks.withType<Sign>())
dependsOn(ultronComposeJavadocJar)
dependsOn(tasks.withType<Jar>())
mustRunAfter(tasks.withType<Sign>())
}

tasks.named("publishKotlinMultiplatformPublicationToMavenLocal") {
dependsOn("signJvmPublication")
dependsOn("signKotlinMultiplatformPublication")
mustRunAfter("signJvmPublication")
mustRunAfter("signKotlinMultiplatformPublication")
}

tasks.named("publishJvmPublicationToMavenLocal") {
dependsOn("signJvmPublication")
dependsOn("signKotlinMultiplatformPublication")
dependsOn("signAndroidReleasePublication")
mustRunAfter("signJvmPublication")
mustRunAfter("signKotlinMultiplatformPublication")
mustRunAfter("signAndroidReleasePublication")
}

tasks.withType<PublishToMavenLocal>().configureEach {
dependsOn("signJvmPublication")
dependsOn("signKotlinMultiplatformPublication")
dependsOn("signAndroidReleasePublication")
mustRunAfter("signJvmPublication")
mustRunAfter("signKotlinMultiplatformPublication")
mustRunAfter("signAndroidReleasePublication")
}

signing {
println("Signing lib...")
useGpgCmd()
sign(publishing.publications)
}
6 changes: 3 additions & 3 deletions ultron-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ kotlin {
}
val jvmMain by getting {
dependencies {
implementation(project(":ultron-common"))
implementation(kotlin("stdlib-jdk8"))
}
}
Expand Down Expand Up @@ -72,12 +73,11 @@ val ultronComposeJavadocJar by tasks.registering(Jar::class) {

publishing {
publications {
create<MavenPublication>("multiplatform") {
from(components["kotlin"])
publications.withType<MavenPublication> {
artifact(ultronComposeJavadocJar)

pom {
name.set("ultron-compose")
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

0 comments on commit bcee87b

Please sign in to comment.