Skip to content

Commit

Permalink
Modify gradle files for publication of identity and identity-android
Browse files Browse the repository at this point in the history
Added publish-helper.gradle for use by identity/build.gradle and
identity-android/build.gradle so that publishing will generate the
appropriate files for only those two modules.

Tested manually.
  • Loading branch information
suzannajiwani committed Oct 4, 2023
1 parent f8b3596 commit a09a7a2
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 27 deletions.
26 changes: 5 additions & 21 deletions identity-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id("com.android.library")
id("maven-publish")
alias libs.plugins.kotlin.android
alias libs.plugins.dokka
}
Expand Down Expand Up @@ -29,13 +28,6 @@ android {
lint {
lintConfig file('lint.xml')
}

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

dependencies {
Expand All @@ -46,6 +38,7 @@ dependencies {
implementation "org.bouncycastle:bcprov-jdk15on:1.67"
implementation("org.bouncycastle:bcpkix-jdk15on:1.67")
implementation "com.android.volley:volley:1.2.1"
implementation("org.jetbrains.dokka:versioning-plugin:1.9.0")

testImplementation "androidx.test.espresso:espresso-core:3.4.0"
testImplementation "androidx.test.ext:junit:1.1.3"
Expand All @@ -62,23 +55,14 @@ tasks.withType(Test) {
}
}

apply from: '../publish-helper.gradle'
afterEvaluate {

publishing {
publications {
release(MavenPublication) {
from components.release
groupId 'com.android.identity'
artifactId 'identity-credential'

pom {
licenses {
license {
name = 'Apache 2.0'
url = 'https://opensource.org/licenses/Apache-2.0'
}
}
}
// Specify custom artifactId if needed,
// otherwise it will use module's name by default.
artifactId = "identity-credential-android"
}
}
}
Expand Down
20 changes: 14 additions & 6 deletions identity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@ plugins {
}

java {
apply plugin: 'org.jetbrains.dokka'

withSourcesJar()
withJavadocJar()

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

}

dependencies {
implementation("androidx.annotation:annotation:1.5.0")
implementation "co.nstant.in:cbor:0.9"
implementation "org.bouncycastle:bcprov-jdk15on:1.69"
implementation("org.bouncycastle:bcpkix-jdk15on:1.69")
implementation("org.jetbrains.dokka:versioning-plugin:1.9.0")

testImplementation "junit:junit:4.13.2"
testImplementation "org.bouncycastle:bcprov-jdk15on:1.69"
}

apply from: '../publish-helper.gradle'
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
// Specify custom artifactId if needed,
// otherwise it will use module's name by default.
artifactId = "identity-credential"
}
}
}
}
44 changes: 44 additions & 0 deletions publish-helper.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apply plugin: 'maven-publish'

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 javaSourcesJar

groupId 'com.android.identity'
version 'YYYYMMDD'
pom {
name = artifactId
licenses {
license {
name = 'Apache 2.0'
url = 'https://opensource.org/licenses/Apache-2.0'
}
}
}
}
}
}
}

0 comments on commit a09a7a2

Please sign in to comment.