Skip to content

Commit

Permalink
Merge pull request #8 from thumbtack/fix_release_gen
Browse files Browse the repository at this point in the history
Fix release JAR generation
  • Loading branch information
brian-terczynski authored Jun 22, 2024
2 parents a6b5fb7 + 6487c25 commit 70c2b8a
Showing 1 changed file with 29 additions and 50 deletions.
79 changes: 29 additions & 50 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ val localVersionName = "local"
group = "com.github.thumbtack"
version = "0.0.3"

if (properties.containsKey("localVersion")) {
version = "local"
}

plugins {
alias(libs.plugins.kotlinMultiplatform)
id("maven-publish")
Expand All @@ -16,6 +20,31 @@ kotlin {
jvmTarget = JavaVersion.VERSION_17.toString()
}
}
publishing {
mavenPublication {
pom {
name.set("Kotlin Testing Tools by Thumbtack")
description.set("Utility functions to assist with automated testing of Kotlin code.")
url.set("https://github.com/thumbtack/kotlin-testing-tools")

licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/thumbtack/kotlin-testing-tools/blob/main/LICENSE")
}
}

scm {
connection.set("scm:git:git://github.com:thumbtack/kotlin-testing-tools.git")
developerConnection.set("scm:git:ssh://github.com:thumbtack/kotlin-testing-tools.git")
url.set("https://github.com/thumbtack/thumbprint-android")
}
}
groupId = project.group.toString()
artifactId = "kotlin-testing-tools"
version = project.version.toString()
}
}
}
// Keeping these in here so we can activate when we're ready to build other platforms
// androidTarget {
Expand Down Expand Up @@ -54,53 +83,3 @@ kotlin {
}
}
}

// Create special release target that can handle special version label to local maven,
// and disable some publish*MavenLocal tasks so Jitpack doesn't generate a bunch of these
afterEvaluate {
val taskNames = this.gradle.startParameter.taskNames

project.tasks.forEach {
if (it.name.contains("publishJvmPublicationToMavenLocal")) {
it.enabled = false
}
if (it.name.contains("publishKotlinMultiplatformPublicationToMavenLocal")) {
it.enabled = false
}
}

publishing {
publications {
create<MavenPublication>("Release") {
groupId = project.group.toString()
artifactId = "kotlin-testing-tools"
version = if (taskNames.any { name -> name.contains("MavenLocal") }) {
localVersionName
} else {
project.version.toString()
}

from(components["kotlin"])

pom {
name.set("Kotlin Testing Tools by Thumbtack")
description.set("Utility functions to assist with automated testing of Kotlin code.")
url.set("https://github.com/thumbtack/kotlin-testing-tools")

licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/thumbtack/kotlin-testing-tools/blob/main/LICENSE")
}
}

scm {
connection.set("scm:git:git://github.com:thumbtack/kotlin-testing-tools.git")
developerConnection.set("scm:git:ssh://github.com:thumbtack/kotlin-testing-tools.git")
url.set("https://github.com/thumbtack/thumbprint-android")
}
}
}
}
}
}

0 comments on commit 70c2b8a

Please sign in to comment.