From 36f1103609162bd02c36c6771e40e1148bf6b3c7 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 20 Aug 2024 05:16:20 +0900 Subject: [PATCH] Set up Maven publishing rules. (#706) 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 --- identity-android-legacy/build.gradle.kts | 40 +++++++- identity-android/build.gradle.kts | 40 +++++++- identity-doctypes/build.gradle.kts | 85 +++++++++++++++-- .../documenttype/knowntypes/DrivingLicense.kt | 0 .../documenttype/knowntypes/EUPersonalID.kt | 0 .../documenttype/knowntypes/Options.kt | 0 .../documenttype/knowntypes/SampleData.kt | 0 .../knowntypes/VaccinationDocument.kt | 0 .../knowntypes/VehicleRegistration.kt | 0 .../TestDocumentTypeRepository.kt | 94 +++++++++---------- identity-mdoc/build.gradle.kts | 25 +++++ identity/build.gradle.kts | 31 ++++++ processor-annotations/build.gradle.kts | 25 +++++ publish-helper.gradle | 78 --------------- 14 files changed, 278 insertions(+), 140 deletions(-) rename identity-doctypes/src/{main/java => commonMain/kotlin}/com/android/identity/documenttype/knowntypes/DrivingLicense.kt (100%) rename identity-doctypes/src/{main/java => commonMain/kotlin}/com/android/identity/documenttype/knowntypes/EUPersonalID.kt (100%) rename identity-doctypes/src/{main/java => commonMain/kotlin}/com/android/identity/documenttype/knowntypes/Options.kt (100%) rename identity-doctypes/src/{main/java => commonMain/kotlin}/com/android/identity/documenttype/knowntypes/SampleData.kt (100%) rename identity-doctypes/src/{main/java => commonMain/kotlin}/com/android/identity/documenttype/knowntypes/VaccinationDocument.kt (100%) rename identity-doctypes/src/{main/java => commonMain/kotlin}/com/android/identity/documenttype/knowntypes/VehicleRegistration.kt (100%) rename identity-doctypes/src/{test/java => commonTest/kotlin}/com/android/identity/documenttype/TestDocumentTypeRepository.kt (83%) delete mode 100644 publish-helper.gradle diff --git a/identity-android-legacy/build.gradle.kts b/identity-android-legacy/build.gradle.kts index 8f94f559d..3154c0dbd 100644 --- a/identity-android-legacy/build.gradle.kts +++ b/identity-android-legacy/build.gradle.kts @@ -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) } @@ -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" } @@ -29,6 +31,12 @@ android { excludes += listOf("/META-INF/versions/9/OSGI-INF/MANIFEST.MF") } } + + publishing { + singleVariant("release") { + withSourcesJar() + } + } } dependencies { @@ -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("release") { + afterEvaluate { + from(components["release"]) + } + } + } + publications.withType(MavenPublication::class) { + pom { + licenses { + license { + name = "Apache 2.0" + url = "https://opensource.org/licenses/Apache-2.0" + } + } + } + } +} diff --git a/identity-android/build.gradle.kts b/identity-android/build.gradle.kts index 9b6080e96..d83ccb66a 100644 --- a/identity-android/build.gradle.kts +++ b/identity-android/build.gradle.kts @@ -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) } @@ -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" } @@ -29,6 +31,12 @@ android { excludes += listOf("/META-INF/versions/9/OSGI-INF/MANIFEST.MF") } } + + publishing { + singleVariant("release") { + withSourcesJar() + } + } } dependencies { @@ -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("release") { + afterEvaluate { + from(components["release"]) + } + } + } + publications.withType(MavenPublication::class) { + pom { + licenses { + license { + name = "Apache 2.0" + url = "https://opensource.org/licenses/Apache-2.0" + } + } + } + } +} diff --git a/identity-doctypes/build.gradle.kts b/identity-doctypes/build.gradle.kts index c14d7fb2c..95a3b2ba2 100644 --- a/identity-doctypes/build.gradle.kts +++ b/identity-doctypes/build.gradle.kts @@ -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" + } + } + } + } } diff --git a/identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/DrivingLicense.kt b/identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/DrivingLicense.kt similarity index 100% rename from identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/DrivingLicense.kt rename to identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/DrivingLicense.kt diff --git a/identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/EUPersonalID.kt b/identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/EUPersonalID.kt similarity index 100% rename from identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/EUPersonalID.kt rename to identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/EUPersonalID.kt diff --git a/identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/Options.kt b/identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/Options.kt similarity index 100% rename from identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/Options.kt rename to identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/Options.kt diff --git a/identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/SampleData.kt b/identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/SampleData.kt similarity index 100% rename from identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/SampleData.kt rename to identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/SampleData.kt diff --git a/identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/VaccinationDocument.kt b/identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/VaccinationDocument.kt similarity index 100% rename from identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/VaccinationDocument.kt rename to identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/VaccinationDocument.kt diff --git a/identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/VehicleRegistration.kt b/identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/VehicleRegistration.kt similarity index 100% rename from identity-doctypes/src/main/java/com/android/identity/documenttype/knowntypes/VehicleRegistration.kt rename to identity-doctypes/src/commonMain/kotlin/com/android/identity/documenttype/knowntypes/VehicleRegistration.kt diff --git a/identity-doctypes/src/test/java/com/android/identity/documenttype/TestDocumentTypeRepository.kt b/identity-doctypes/src/commonTest/kotlin/com/android/identity/documenttype/TestDocumentTypeRepository.kt similarity index 83% rename from identity-doctypes/src/test/java/com/android/identity/documenttype/TestDocumentTypeRepository.kt rename to identity-doctypes/src/commonTest/kotlin/com/android/identity/documenttype/TestDocumentTypeRepository.kt index bd6c058ba..df57d7865 100644 --- a/identity-doctypes/src/test/java/com/android/identity/documenttype/TestDocumentTypeRepository.kt +++ b/identity-doctypes/src/commonTest/kotlin/com/android/identity/documenttype/TestDocumentTypeRepository.kt @@ -12,8 +12,8 @@ import com.android.identity.documenttype.knowntypes.DrivingLicense import kotlinx.datetime.Instant import kotlinx.datetime.LocalDate import kotlinx.datetime.TimeZone -import org.junit.Assert -import org.junit.Test +import kotlin.test.Test +import kotlin.test.assertEquals class TestDocumentTypeRepository { @@ -22,31 +22,29 @@ class TestDocumentTypeRepository { val documentTypeRepository = DocumentTypeRepository() documentTypeRepository.addDocumentType(DrivingLicense.getDocumentType()) val documentTypes = documentTypeRepository.documentTypes - assert(documentTypes.count() == 1) - assert(documentTypes[0].displayName == "Driving License") - assert(documentTypes[0].mdocDocumentType?.docType == "org.iso.18013.5.1.mDL") - assert(documentTypes[0].vcDocumentType?.type == "Iso18013DriversLicenseCredential") - assert( - documentTypes[0].mdocDocumentType?.namespaces?.iterator() - ?.next()?.key == "org.iso.18013.5.1" - ) - assert( - documentTypes[0].mdocDocumentType?.namespaces?.iterator() - ?.next()?.value?.namespace == "org.iso.18013.5.1" - ) - assert( - documentTypes[0].mdocDocumentType?.namespaces?.get("org.iso.18013.5.1")?.dataElements?.get( - "family_name" - )?.attribute?.type == DocumentAttributeType.String - ) - assert( - documentTypes[0].mdocDocumentType?.namespaces?.values?.toList() - ?.last()?.namespace == "org.iso.18013.5.1.aamva" - ) - assert( - documentTypes[0].mdocDocumentType?.namespaces?.get("org.iso.18013.5.1.aamva")?.dataElements?.get( - "domestic_driving_privileges" - )?.attribute?.type == DocumentAttributeType.ComplexType + assertEquals(1, documentTypes.count()) + assertEquals("Driving License", documentTypes[0].displayName) + assertEquals("org.iso.18013.5.1.mDL", documentTypes[0].mdocDocumentType?.docType) + assertEquals("Iso18013DriversLicenseCredential", documentTypes[0].vcDocumentType?.type) + assertEquals( + "org.iso.18013.5.1", + documentTypes[0].mdocDocumentType?.namespaces?.iterator()?.next()?.key + ) + assertEquals( + "org.iso.18013.5.1", + documentTypes[0].mdocDocumentType?.namespaces?.iterator()?.next()?.value?.namespace + ) + assertEquals( + DocumentAttributeType.String, + documentTypes[0].mdocDocumentType?.namespaces?.get("org.iso.18013.5.1")?.dataElements?.get("family_name")?.attribute?.type + ) + assertEquals( + "org.iso.18013.5.1.aamva", + documentTypes[0].mdocDocumentType?.namespaces?.values?.toList()?.last()?.namespace + ) + assertEquals( + DocumentAttributeType.ComplexType, + documentTypes[0].mdocDocumentType?.namespaces?.get("org.iso.18013.5.1.aamva")?.dataElements?.get("domestic_driving_privileges")?.attribute?.type ) } @@ -57,75 +55,75 @@ class TestDocumentTypeRepository { val aamvaNs = ct.mdocDocumentType!!.namespaces[DrivingLicense.AAMVA_NAMESPACE]!! // CredentialAttributeType.Boolean - Assert.assertEquals( + assertEquals( "true", mdlNs.dataElements["age_over_18"]?.renderValue(Simple.TRUE) ) - Assert.assertEquals( + assertEquals( "false", mdlNs.dataElements["age_over_18"]?.renderValue(Simple.FALSE) ) - Assert.assertEquals( + assertEquals( "yes", mdlNs.dataElements["age_over_18"]?.renderValue( Simple.TRUE, trueFalseStrings = Pair("no", "yes")) ) - Assert.assertEquals( + assertEquals( "no", mdlNs.dataElements["age_over_18"]?.renderValue( Simple.FALSE, trueFalseStrings = Pair("no", "yes")) ) // CredentialAttributeType.String - Assert.assertEquals( + assertEquals( "Erika", mdlNs.dataElements["given_name"]?.renderValue(Tstr("Erika")) ) // CredentialAttributeType.Number - Assert.assertEquals( + assertEquals( "180", mdlNs.dataElements["height"]?.renderValue(Uint(180UL)) ) // CredentialAttributeType.IntegerOptions - Assert.assertEquals( + assertEquals( "Donor", aamvaNs.dataElements["organ_donor"]?.renderValue(Uint(1UL)) ) // If we don't know the enumerated value, check we render the raw value. - Assert.assertEquals( + assertEquals( "2", aamvaNs.dataElements["organ_donor"]?.renderValue(Uint(2UL)) ) // CredentialAttributeType.StringOptions - Assert.assertEquals( + assertEquals( "Asian or Pacific Islander", aamvaNs.dataElements["race_ethnicity"]?.renderValue(Tstr("AP")) ) // If we don't know the enumerated value, check we render the raw value. - Assert.assertEquals( + assertEquals( "AddedLater", aamvaNs.dataElements["race_ethnicity"]?.renderValue(Tstr("AddedLater")) ) // CredentialAttributeType.Picture - Assert.assertEquals( + assertEquals( "0 bytes", mdlNs.dataElements["portrait"]?.renderValue(Bstr(byteArrayOf())) ) - Assert.assertEquals( + assertEquals( "1 byte", mdlNs.dataElements["portrait"]?.renderValue(Bstr(byteArrayOf(1))) ) - Assert.assertEquals( + assertEquals( "3 bytes", mdlNs.dataElements["portrait"]?.renderValue(Bstr(byteArrayOf(1, 2, 3))) ) // CredentialAttributeType.DateTime - supports both tdate and full-date - Assert.assertEquals( + assertEquals( "1976-02-03T06:30:00", MdocDataElement( DocumentAttribute( @@ -144,7 +142,7 @@ class TestDocumentTypeRepository { // ... if using a full-date we render the point in time as midnight. The timezone // isn't taken into account, check a couple of different timezones for (zoneId in listOf("Europe/Copenhagen", "Australia/Brisbane", "Pacific/Honolulu")) { - Assert.assertEquals( + assertEquals( "1976-02-03T00:00:00", MdocDataElement( DocumentAttribute( @@ -164,28 +162,28 @@ class TestDocumentTypeRepository { // CredentialAttributeType.Date - supports both tdate and full-date... for tdate // the timezone is taken into account, for full-date it isn't. - Assert.assertEquals( + assertEquals( "1976-02-03", mdlNs.dataElements["birth_date"]?.renderValue( Instant.parse("1976-02-03T05:30:00Z").toDataItemDateTimeString(), timeZone = TimeZone.of("Europe/Copenhagen") ) ) - Assert.assertEquals( + assertEquals( "1976-02-02", mdlNs.dataElements["birth_date"]?.renderValue( Instant.parse("1976-02-03T05:30:00Z").toDataItemDateTimeString(), timeZone = TimeZone.of("America/Los_Angeles") ) ) - Assert.assertEquals( + assertEquals( "1976-02-03", mdlNs.dataElements["birth_date"]?.renderValue( LocalDate.parse("1976-02-03").toDataItemFullDate(), timeZone = TimeZone.of("Europe/Copenhagen") ) ) - Assert.assertEquals( + assertEquals( "1976-02-03", mdlNs.dataElements["birth_date"]?.renderValue( LocalDate.parse("1976-02-03").toDataItemFullDate(), @@ -214,7 +212,7 @@ class TestDocumentTypeRepository { // time and those could return rich text, e.g. Markup. It's not clear that this would // be an advantage of the app doing this itself. Maybe... // - Assert.assertEquals( + assertEquals( "[{\"vehicle_category_code\": \"A\", \"issue_date\": 1004(\"2018-08-09\"), " + "\"expiry_date\": 1004(\"2024-10-20\")}, {\"vehicle_category_code\": \"B\", " + "\"issue_date\": 1004(\"2017-02-23\"), \"expiry_date\": 1004(\"2024-10-20\")}]", @@ -224,7 +222,7 @@ class TestDocumentTypeRepository { // Now check that it does the right thing if a value is passed which // isn't expected by the document type - Assert.assertEquals( + assertEquals( "3 bytes", mdlNs.dataElements["portrait"]?.renderValue(Bstr(byteArrayOf(1, 2, 3))) ) diff --git a/identity-mdoc/build.gradle.kts b/identity-mdoc/build.gradle.kts index 85994a5b6..95a3b2ba2 100644 --- a/identity-mdoc/build.gradle.kts +++ b/identity-mdoc/build.gradle.kts @@ -1,7 +1,11 @@ plugins { alias(libs.plugins.kotlinMultiplatform) + id("maven-publish") } +val projectVersionCode: Int by rootProject.extra +val projectVersionName: String by rootProject.extra + kotlin { jvmToolchain(17) @@ -57,3 +61,24 @@ kotlin { } } } + +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" + } + } + } + } +} diff --git a/identity/build.gradle.kts b/identity/build.gradle.kts index 42424d12f..01e9299ac 100644 --- a/identity/build.gradle.kts +++ b/identity/build.gradle.kts @@ -3,8 +3,12 @@ import org.jetbrains.kotlin.konan.target.HostManager plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.ksp) + id("maven-publish") } +val projectVersionCode: Int by rootProject.extra +val projectVersionName: String by rootProject.extra + kotlin { jvmToolchain(17) @@ -99,3 +103,30 @@ tasks.withType().all { tasks["compileKotlinIosX64"].dependsOn("kspCommonMainKotlinMetadata") tasks["compileKotlinIosArm64"].dependsOn("kspCommonMainKotlinMetadata") tasks["compileKotlinIosSimulatorArm64"].dependsOn("kspCommonMainKotlinMetadata") + +tasks["iosX64SourcesJar"].dependsOn("kspCommonMainKotlinMetadata") +tasks["iosArm64SourcesJar"].dependsOn("kspCommonMainKotlinMetadata") +tasks["iosSimulatorArm64SourcesJar"].dependsOn("kspCommonMainKotlinMetadata") +tasks["jvmSourcesJar"].dependsOn("kspCommonMainKotlinMetadata") +tasks["sourcesJar"].dependsOn("kspCommonMainKotlinMetadata") + +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" + } + } + } + } +} diff --git a/processor-annotations/build.gradle.kts b/processor-annotations/build.gradle.kts index 948b92d65..16d8a6460 100644 --- a/processor-annotations/build.gradle.kts +++ b/processor-annotations/build.gradle.kts @@ -1,7 +1,11 @@ plugins { kotlin("multiplatform") + id("maven-publish") } +val projectVersionCode: Int by rootProject.extra +val projectVersionName: String by rootProject.extra + kotlin { jvmToolchain(17) @@ -29,3 +33,24 @@ java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + +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" + } + } + } + } +} diff --git a/publish-helper.gradle b/publish-helper.gradle deleted file mode 100644 index b97a45c15..000000000 --- a/publish-helper.gradle +++ /dev/null @@ -1,78 +0,0 @@ -apply plugin: 'maven-publish' - -task androidJavadoc(type: Javadoc) { - if (plugins.hasPlugin('android-library')) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - android.libraryVariants.all { variant -> - if (variant.name == 'release') { - owner.classpath += variant.javaCompileProvider.get().classpath - } - } - } - else { - source = sourceSets.main.allJava - classpath += configurations.runtimeClasspath - classpath += configurations.compileClasspath - } - exclude '**/R.html', '**/R.*.html', '**/index.html', '**/*.kt' - options.encoding 'utf-8' - options { - addStringOption 'docencoding', 'utf-8' - addStringOption 'charset', 'utf-8' - links 'https://docs.oracle.com/javase/7/docs/api/' - links 'https://d.android.com/reference' - links 'https://developer.android.com/reference/androidx/' - } -} - -task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { - archiveClassifier.set('javadoc') - from androidJavadoc.destinationDir - preserveFileTimestamps = false - reproducibleFileOrder = true -} - -task javaSourcesJar(type: Jar) { - archiveClassifier.set('sources') - if (plugins.hasPlugin('android-library')) { - from android.sourceSets.main.java.srcDirs - } - else { - from sourceSets.main.allSource - } - preserveFileTimestamps = false - reproducibleFileOrder = true -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - if (plugins.hasPlugin('android-library')) { - from components.release - } - else if (plugins.hasPlugin('java')) { - from components.java - jar.preserveFileTimestamps = false - jar.reproducibleFileOrder = true - } - - artifact androidJavadocJar - artifact javaSourcesJar - - groupId 'com.android.identity' - version 'YYYYMMDD' - pom { - name = artifactId - licenses { - license { - name = 'Apache 2.0' - url = 'https://opensource.org/licenses/Apache-2.0' - } - } - } - } - } - } -} \ No newline at end of file