diff --git a/AdobeBranchExtension/build.gradle b/AdobeBranchExtension/build.gradle index 7b128a3..8d9c085 100644 --- a/AdobeBranchExtension/build.gradle +++ b/AdobeBranchExtension/build.gradle @@ -43,6 +43,21 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + + task androidSourcesJar(type: Jar) { + archiveClassifier.set("sources") + from android.sourceSets.main.java.srcDirs + } + + task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + } + + task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { + archiveClassifier.set("javadoc") + from androidJavadocs.destinationDir + } } dependencies { @@ -73,84 +88,72 @@ dependencies { androidTestImplementation project(path: ':AdobeBranchExtension') } -def isReleaseBuild() { - return !VERSION_NAME.contains("SNAPSHOT") -} +def applyCommonConfig = { MavenPublication publication -> + publication.groupId = GROUP + publication.artifactId = POM_ARTIFACT_ID + publication.version = VERSION_NAME -def getReleaseRepositoryUrl() { - return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL - : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} + publication.artifact bundleReleaseAar + publication.artifact androidSourcesJar + publication.artifact androidJavadocsJar -def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL - : "https://oss.sonatype.org/content/repositories/snapshots/" -} + publication.pom { + name.set(POM_NAME) + description.set(POM_DESCRIPTION) + url.set(POM_URL) -def getRepositoryUsername() { - return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" -} + developers { + developer { + id.set(POM_DEVELOPER_ID) + name.set(POM_DEVELOPER_NAME) + } + } -def getRepositoryPassword() { - return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" -} + licenses { + license { + name.set(POM_LICENCE_NAME) + url.set(POM_LICENCE_URL) + distribution.set(POM_LICENCE_DIST) + } + } -publishing { - publications { - mavenJava(MavenPublication) { - from components.findByName('release') - groupId = GROUP - artifactId = POM_ARTIFACT_ID - version = VERSION_NAME - -// // Attach sources and Javadocs -// artifact androidSourcesJar -// artifact androidJavadocsJar - - // Configure POM - pom { - name.set(POM_NAME) - description.set(POM_DESCRIPTION) - url.set(POM_URL) - packaging = POM_PACKAGING - - scm { - url.set(POM_SCM_URL) - connection.set(POM_SCM_CONNECTION) - developerConnection.set(POM_SCM_DEV_CONNECTION) - } + scm { + url.set(POM_SCM_URL) + connection.set(POM_SCM_CONNECTION) + developerConnection.set(POM_SCM_DEV_CONNECTION) + } - licenses { - license { - name.set(POM_LICENCE_NAME) - url.set(POM_LICENCE_URL) - distribution.set(POM_LICENCE_DIST) - } + withXml { + asNode().dependencies.dependency.findAll { + it.artifactId.text() == 'okhttp' || it.artifactId.text() == 'firebase-appindexing' + }.each { dependency -> + def optionalNode = dependency.optional + if (optionalNode) { + optionalNode[0].value = 'true' + } else { + dependency.appendNode('optional', 'true') } + } + } + } +} - developers { - developer { - id.set(POM_DEVELOPER_ID) - name.set(POM_DEVELOPER_NAME) - } - } +project.afterEvaluate { + publishing { + publications { - // Optional dependencies - withXml { - asNode().dependencies.dependency.findAll { - it.artifactId.text() == 'okhttp' || it.artifactId.text() == 'firebase-appindexing' - }.each { - if (it.optional) - it.optional.value = 'true' - else - it.appendNode('optional', 'true') - } - } + debug(MavenPublication) { + applyCommonConfig(delegate as MavenPublication) + from components.findByName("debug") + } + + release(MavenPublication) { + applyCommonConfig(delegate as MavenPublication) + from components.findByName("release") } } - } - repositories { + repositories { maven { url = isReleaseBuild() ? getReleaseRepositoryUrl() : getSnapshotRepositoryUrl() credentials { @@ -159,24 +162,39 @@ publishing { } } } + } + + signing { + sign publishing.publications.release + } } -signing { - useGpgCmd() - sign publishing.publications.mavenJava +tasks.withType(PublishToMavenRepository).configureEach { + if (name.contains("Debug")) { + dependsOn assembleDebug + } else if (name.contains("Release")) { + dependsOn assembleRelease + } } -task androidSourcesJar(type: Jar) { - archiveClassifier.set("sources") - from android.sourceSets.main.java.srcDirs +def isReleaseBuild() { + return !VERSION_NAME.contains("SNAPSHOT") } -task androidJavadocs(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +def getReleaseRepositoryUrl() { + return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL + : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +} + +def getSnapshotRepositoryUrl() { + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://oss.sonatype.org/content/repositories/snapshots/" } -task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - archiveClassifier.set("javadoc") - from androidJavadocs.destinationDir +def getRepositoryUsername() { + return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" +} + +def getRepositoryPassword() { + return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" } \ No newline at end of file diff --git a/ChangeLog.md b/ChangeLog.md index 2c4cd0e..31d687f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # Adobe Branch SDK Extension change log +- 3.0.1 + * Nov 19, 2024 + * Fix for missing .aar in 3.0.0 + - 3.0.0 * Nov 18, 2024 * Update Branch Android SDK to 5.14.0 diff --git a/gradle.properties b/gradle.properties index bc44eb8..df29286 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,8 +11,8 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=3.0.0 -VERSION_CODE=300000 +VERSION_NAME=3.0.1 +VERSION_CODE=300001 GROUP=io.branch.sdk.android POM_NAME=Branch Adobe Android SDK