Skip to content

Commit

Permalink
Updated build graddle configurations for publishing releases
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrudu committed Jul 9, 2021
1 parent dc64ee5 commit 64297d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 48 deletions.
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 4 additions & 48 deletions DeviceIdentifiersWrapper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,48 +37,15 @@ dependencies {
compileOnly 'com.symbol:emdk:+'
}

def jarName = 'deviceidentifierswrapper.jar'

task clearJarRelease(type: Delete) {
delete "${project.buildDir}/outputs/jar/release/" + jarName
}

task clearJarDebug(type: Delete) {
delete "${project.buildDir}/outputs/jar/debug/" + jarName
}

task makeJarRelease(type: Copy) {
from("${project.buildDir}/intermediates/intermediate-jars/release/")
into("${project.buildDir}/outputs/jar/release")
include('classes.jar')
rename('classes.jar', jarName)
}

task makeJarDebug(type: Copy) {
from("${project.buildDir}/intermediates/intermediate-jars/debug/")
into("${project.buildDir}/outputs/jar/debug")
include('classes.jar')
rename('classes.jar', jarName)
}

task makeAllJar(type: Copy) {}

makeJarRelease.dependsOn(clearJarRelease, build)
makeJarDebug.dependsOn(clearJarDebug, build)

makeAllJar.dependsOn(makeJarDebug,makeJarRelease)

/*
Publish tasks
Generate release files for publication and Zip them
https://medium.com/@daniellevass/how-to-publish-your-android-studio-library-to-jcenter-5384172c4739
https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle
*/

// ./gradlew clean build generateRelease
apply plugin: 'maven'

def groupId = project.PUBLISH_GROUP_ID
def artifactId = project.PUBLISH_ARTIFACT_ID
def version = project.PUBLISH_VERSION

def localReleaseDest = "${buildDir}/release/${version}"
Expand All @@ -91,29 +58,19 @@ task androidJavadocs(type: Javadoc) {
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
archiveClassifier = 'javadoc'
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

uploadArchives {
repositories.mavenDeployer {
pom.groupId = groupId
pom.artifactId = artifactId
pom.version = version
// Add other pom properties here if you want (developer details / licenses)
repository(url: "file://${localReleaseDest}")
}
}

task zipRelease(type: Zip) {
from localReleaseDest
destinationDir buildDir
archiveName "release-${version}.zip"
archiveBaseName = "release-${version}"
}

task generateRelease {
Expand All @@ -123,7 +80,6 @@ task generateRelease {
}
}

generateRelease.dependsOn(uploadArchives)
generateRelease.dependsOn(zipRelease)


Expand Down

0 comments on commit 64297d9

Please sign in to comment.