summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYigit Boyar <yboyar@google.com>2016-03-28 23:35:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-03-28 23:35:22 +0000
commitb1f1dc2a28cf94a59c9305a3a49d3dd122ae886e (patch)
tree744b3685b2a4985bd8d2359799e1eae9dd1c3126
parentf58c3bd412f9bdc5ec589fdcfed470889abb6ea6 (diff)
parent04ea1584983e77440f8339618e77100269a29de9 (diff)
downloaddata-binding-b1f1dc2a28cf94a59c9305a3a49d3dd122ae886e.tar.gz
Merge "Re-enable jarjar for release builds." into studio-master-dev
-rw-r--r--build.gradle49
-rw-r--r--propLoader.gradle5
2 files changed, 33 insertions, 21 deletions
diff --git a/build.gradle b/build.gradle
index c33a72c2..45e1623e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -169,8 +169,7 @@ def fullJar(project) {
if (localizeTask != null) {
localizeTask.dependsOn project.tasks.findByName('buildLicenseNotice')
}
-
- if (!dataBindingConfig.runProguard || !dataBindingConfig.inReleaseBuild) {
+ if (!dataBindingConfig.inReleaseBuild) {
return
}
def jarName = project.uploadArchives.repositories.mavenDeployer.pom.artifactId
@@ -178,6 +177,7 @@ def fullJar(project) {
def fatJar = "${workingDir}/${jarName}-fat.jar"
def proguardJar = "${workingDir}/${jarName}-proguard.jar"
def jarJar = project.jar.archivePath
+ def runProguard = dataBindingConfig.runProguard
project.configurations {
jarJarArchives
@@ -208,6 +208,9 @@ def fullJar(project) {
destinationDir = new File(workingDir)
with project.jar
}
+ /**
+ * not used unless jarJarFile is changed to use proguarded version instead.
+ */
project.tasks.create(name: 'proguard', type: proguard.gradle.ProGuardTask) {
dependsOn 'fatJar'
@@ -218,9 +221,9 @@ def fullJar(project) {
}
project.tasks.create(name: 'jarJarFile') {
- dependsOn 'proguard'
+ dependsOn runProguard ? 'proguard' : 'fatJar'
dependsOn project.jar
- def inputLibrary = proguardJar
+ def inputLibrary = runProguard ? proguardJar : fatJar
def outputLibrary = jarJar
inputs.file(inputLibrary)
outputs.file(outputLibrary)
@@ -248,25 +251,33 @@ def fullJar(project) {
}
}
- project.uploadArchives {
- dependsOn 'jarJarFile'
- repositories {
- mavenDeployer {
- pom.whenConfigured { pom ->
- pom.dependencies.removeAll { dep ->
- def isBaseLibrary = dep.groupId == 'com.android.databinding' &&
- dep.artifactId == 'baseLibrary'
- def isGradle = dep.groupId == 'com.android.tools.build' &&
- dep.artifactId == 'gradle'
- def isChardet = dep.groupId == 'com.googlecode.juniversalchardet' &&
- dep.artifactId == 'juniversalchardet'
- return !isBaseLibrary && !isGradle && !isChardet
+ def setupUpload = { uploadTask ->
+ uploadTask.dependsOn 'jarJarFile'
+ uploadTask.repositories {
+ mavenDeployer {
+ pom.whenConfigured { pom ->
+ pom.dependencies.removeAll { dep ->
+ def isBaseLibrary = dep.groupId == 'com.android.databinding' &&
+ dep.artifactId == 'baseLibrary'
+ def isGradle = dep.groupId == 'com.android.tools.build' &&
+ dep.artifactId == 'gradle'
+ def isChardet = dep.groupId == 'com.googlecode.juniversalchardet' &&
+ dep.artifactId == 'juniversalchardet'
+ return !isBaseLibrary && !isGradle && !isChardet
+ }
}
}
}
- }
- outputs.upToDateWhen { false } // force it to re-run all the time.
+ uploadTask.outputs.upToDateWhen { false } // force it to re-run all the time.
}
+
+ if (project.publishLocal != null) {
+ setupUpload(project.publishLocal)
+ }
+ if (project.uploadArchives != null) {
+ setupUpload(project.uploadArchives)
+ }
+
project.bintrayUpload.dependsOn 'jarJarFile'
project.publishing.publications.mavenJava(MavenPublication) {
pom.withXml {
diff --git a/propLoader.gradle b/propLoader.gradle
index 310d313e..d3e65cd9 100644
--- a/propLoader.gradle
+++ b/propLoader.gradle
@@ -14,9 +14,10 @@ def repoBase = databindingProperties.mavenRepoAbsolutePath == "." ? root : datab
databindingProperties.androidGradlePluginRepoDir = "${root}/../../${databindingProperties.androidGradlePluginOutRepo}"
databindingProperties.mavenRepoDir = "${databindingProperties.androidGradlePluginRepoDir}"
databindingProperties.internalPrebuiltsRepoDir = "${root}/${databindingProperties.internalPrebuiltsRepoName}"
-databindingProperties.runProguard = project.hasProperty('runProguard') && project.getProperty('runProguard').equals("true")
-databindingProperties.inReleaseBuild = project.ext.hasProperty('release') && project.ext.release
+databindingProperties.inReleaseBuild = project.hasProperty('release') && project.ext.release == "true"
+
+databindingProperties.runProguard = (project.hasProperty('runProguard') && project.getProperty('runProguard').equals("true"))
// load version from gradle build file
apply from: "$root/../buildSrc/base/version.gradle"
databindingProperties.androidPluginVersion=ext.buildVersion