Skip to content

Commit

Permalink
Set up Maven publishing rules. (#706)
Browse files Browse the repository at this point in the history
Setting up to do a new release, this adds build system rules so we can
release the following libraries

- `identity`
- `identity-mdoc`
- `identity-doctypes`
- `identity-android`
- `identity-android-legacy`
- `processor-annotations`

This change also ports `identity-doctypes` to Kotlin Multiplatform.

Test: ./gradlew check
Test: ./gradlew connectedCheck
Test: Manully tested with artifacts from "./gradlew publishToMavenLocal" in out-of-tree version of samples/simple-verifier.

Signed-off-by: David Zeuthen <[email protected]>
  • Loading branch information
davidz25 authored Aug 19, 2024
1 parent d8222f5 commit 36f1103
Show file tree
Hide file tree
Showing 14 changed files with 278 additions and 140 deletions.
40 changes: 38 additions & 2 deletions identity-android-legacy/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
plugins {
alias(libs.plugins.androidLibrary)
id("kotlin-android")
id("maven-publish")
}

val projectVersionCode: Int by rootProject.extra
val projectVersionName: String by rootProject.extra

kotlin {
jvmToolchain(17)
}
Expand All @@ -13,8 +17,6 @@ android {

defaultConfig {
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -29,6 +31,12 @@ android {
excludes += listOf("/META-INF/versions/9/OSGI-INF/MANIFEST.MF")
}
}

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

dependencies {
Expand All @@ -48,3 +56,31 @@ dependencies {
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.espresso.core)
}

group = "com.android.identity"
version = projectVersionName

publishing {
repositories {
maven {
url = uri("${rootProject.rootDir}/repo")
}
}
publications {
create<MavenPublication>("release") {
afterEvaluate {
from(components["release"])
}
}
}
publications.withType(MavenPublication::class) {
pom {
licenses {
license {
name = "Apache 2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
}
}
}
40 changes: 38 additions & 2 deletions identity-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
plugins {
alias(libs.plugins.androidLibrary)
id("kotlin-android")
id("maven-publish")
}

val projectVersionCode: Int by rootProject.extra
val projectVersionName: String by rootProject.extra

kotlin {
jvmToolchain(17)
}
Expand All @@ -13,8 +17,6 @@ android {

defaultConfig {
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -29,6 +31,12 @@ android {
excludes += listOf("/META-INF/versions/9/OSGI-INF/MANIFEST.MF")
}
}

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

dependencies {
Expand All @@ -46,3 +54,31 @@ dependencies {
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.espresso.core)
}

group = "com.android.identity"
version = projectVersionName

publishing {
repositories {
maven {
url = uri("${rootProject.rootDir}/repo")
}
}
publications {
create<MavenPublication>("release") {
afterEvaluate {
from(components["release"])
}
}
}
publications.withType(MavenPublication::class) {
pom {
licenses {
license {
name = "Apache 2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
}
}
}
85 changes: 75 additions & 10 deletions identity-doctypes/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,84 @@
plugins {
id("java-library")
id("org.jetbrains.kotlin.jvm")
alias(libs.plugins.kotlinMultiplatform)
id("maven-publish")
}

val projectVersionCode: Int by rootProject.extra
val projectVersionName: String by rootProject.extra

kotlin {
jvmToolchain(17)
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
val platform = when (it.name) {
"iosX64" -> "iphonesimulator"
"iosArm64" -> "iphoneos"
"iosSimulatorArm64" -> "iphonesimulator"
else -> error("Unsupported target ${it.name}")
}
it.binaries.all {
linkerOpts(
"-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/${platform}/",
)
}
}

sourceSets {
val commonMain by getting {
dependencies {
implementation(project(":identity"))
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.io.bytestring)
}
}

val commonTest by getting {
dependencies {
implementation(libs.kotlin.test)
implementation(libs.kotlinx.coroutine.test)
}
}

val jvmMain by getting {
dependencies {
implementation(libs.bouncy.castle.bcprov)
implementation(libs.bouncy.castle.bcpkix)
implementation(libs.tink)
}
}

val jvmTest by getting {
dependencies {
implementation(libs.bouncy.castle.bcprov)
implementation(libs.bouncy.castle.bcpkix)
}
}
}
}

dependencies {
implementation(project(":identity"))
implementation(libs.kotlinx.datetime)
testImplementation(libs.junit)
group = "com.android.identity"
version = projectVersionName

publishing {
repositories {
maven {
url = uri("${rootProject.rootDir}/repo")
}
}
publications.withType(MavenPublication::class) {
pom {
licenses {
license {
name = "Apache 2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
}
}
}
Loading

0 comments on commit 36f1103

Please sign in to comment.