[android-platform-tools-base] 01/04: Refactor the build scripts: * Rename "classpaths" to "classpath" * Put gneeratePom and generateClasspath into independent Gradle modules

Kai-Chung Yan seamlik-guest at moszumanska.debian.org
Wed Aug 3 03:07:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

seamlik-guest pushed a commit to branch master
in repository android-platform-tools-base.

commit e20228aff1fa39af648e2c6bf1ad9f24db49ab09
Author: Kai-Chung Yan <seamlikok at gmail.com>
Date:   Mon Aug 1 14:30:05 2016 +0800

    Refactor the build scripts:
      * Rename "classpaths" to "classpath"
      * Put gneeratePom and generateClasspath into independent Gradle modules
---
 debian/android-platform-tools-base.install         |  4 +-
 debian/generateClasspath.gradle                    | 21 +++++++
 debian/generatePom.gradle                          | 34 ++++++++++
 debian/patches/build.gradle.patch                  | 15 ++++-
 debian/patches/series                              |  2 +-
 .../{set_classpaths.patch => set_classpath.patch}  |  4 +-
 debian/project.gradle                              | 72 ----------------------
 debian/{root.gradle => version.gradle}             |  0
 8 files changed, 72 insertions(+), 80 deletions(-)

diff --git a/debian/android-platform-tools-base.install b/debian/android-platform-tools-base.install
index 3a454a0..a0549cb 100644
--- a/debian/android-platform-tools-base.install
+++ b/debian/android-platform-tools-base.install
@@ -1,5 +1,5 @@
 draw9patch/etc/draw9patch                     usr/lib/android-sdk/tools
-lint/cli/build/lint.classpaths                usr/share/android-platform-tools-base
+lint/cli/build/lint.classpath                 usr/share/android-platform-tools-base
 lint/cli/etc/lint                             usr/lib/android-sdk/tools
-misc/screenshot2/build/screenshot2.classpaths usr/share/android-platform-tools-base
+misc/screenshot2/build/screenshot2.classpath  usr/share/android-platform-tools-base
 misc/screenshot2/etc/screenshot2              usr/lib/android-sdk/tools
\ No newline at end of file
diff --git a/debian/generateClasspath.gradle b/debian/generateClasspath.gradle
new file mode 100644
index 0000000..2cbff19
--- /dev/null
+++ b/debian/generateClasspath.gradle
@@ -0,0 +1,21 @@
+task generateClasspath(overwrite: true) {
+  def classpathFilePath = "${buildDir}/${project.name}.classpath"
+  outputs.files classpathFilePath
+  assemble.dependsOn generateClasspath
+  doFirst {
+    mkdir buildDir
+    def classpathFile = file(classpathFilePath)
+    classpathFile.createNewFile()
+    classpathFile.write(
+      configurations.runtime.collect {
+        if (it.path.startsWith('/usr/share/')) {
+          it.path
+        } else {
+          "/usr/share/java/${it.name}"
+        }
+      }.toSorted().join(':')
+    )
+  }
+  clean.doLast { delete classpathFilePath }
+}
+
diff --git a/debian/generatePom.gradle b/debian/generatePom.gradle
new file mode 100644
index 0000000..135b682
--- /dev/null
+++ b/debian/generatePom.gradle
@@ -0,0 +1,34 @@
+apply plugin: 'maven'
+
+task generatePom(overwrite: true) {
+  def pomFilePath = "${buildDir}/${project.name}.pom"
+  outputs.files pomFilePath
+  assemble.dependsOn generatePom
+  doFirst {
+    pom {
+      project {
+        if (hasProperty('pomName')) name pomName
+        if (hasProperty('pomDesc')) description pomDesc
+        url 'http://tools.android.com'
+        inceptionYear '2007'
+        licenses {
+          license {
+            name 'The Apache Software License, Version 2.0'
+            url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+          }
+        }
+        scm {
+          url 'https://android.googlesource.com/platform/tools/base'
+          connection 'git://android.googlesource.com/platform/tools/base.git'
+        }
+        developers {
+          developer {
+            name 'The Android Open Source Project'
+          }
+        }
+      }
+    }.writeTo(pomFilePath)
+  }
+  clean.doLast { delete pomFilePath }
+}
+
diff --git a/debian/patches/build.gradle.patch b/debian/patches/build.gradle.patch
index 63e5317..e078e86 100644
--- a/debian/patches/build.gradle.patch
+++ b/debian/patches/build.gradle.patch
@@ -556,17 +556,26 @@ Description: Patch upstream's build system for Debian.
 --- a/build.gradle
 +++ b/build.gradle
 @@ -1,3 +1,5 @@
-+apply from: 'debian/root.gradle'
++apply from: 'debian/version.gradle'
 +
  subprojects { Project project ->
      // only configure leaf projects.
      if (!project.getSubprojects().isEmpty()) return
-@@ -5,6 +7,6 @@
+@@ -5,6 +7,15 @@
      // exclude aar projects.
      if ("fdr".equals(project.name)) return
  
 -    apply from: "$rootDir/buildSrc/base/baseJava.gradle"
-+    apply from: "$rootDir/debian/project.gradle"
++    apply plugin: 'java'
++    apply from: "${rootDir}/debian/generatePom.gradle"
++    apply from: "${rootDir}/debian/generateClasspath.gradle"
++    
++    sourceCompatibility = 1.6
++    targetCompatibility = 1.6
++
++    afterEvaluate {
++        jar.baseName = "${group}.${archivesBaseName}"
++    }
  }
  
 --- a/build-system/gradle-api/build.gradle
diff --git a/debian/patches/series b/debian/patches/series
index 54214cc..ade6234 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,5 +6,5 @@ trove3.patch
 libhttpcore-java-ThreadSafe.patch
 exclude_instant-run.patch
 #disable_jacoco.patch
-set_classpaths.patch
+set_classpath.patch
 Inception-Date.patch
diff --git a/debian/patches/set_classpaths.patch b/debian/patches/set_classpath.patch
similarity index 97%
rename from debian/patches/set_classpaths.patch
rename to debian/patches/set_classpath.patch
index f763fd0..d7f325c 100644
--- a/debian/patches/set_classpaths.patch
+++ b/debian/patches/set_classpath.patch
@@ -10,7 +10,7 @@ Description: Set Class-Paths
      jarpath="$frameworkdir/$jarfile"
  fi
  
-+classpaths=`cat /usr/share/android-platform-tools-base/screenshot2.classpaths`:$jarpath
++classpaths=`cat /usr/share/android-platform-tools-base/screenshot2.classpath`:$jarpath
 +mainclass=com.android.screenshot.Screenshot
 +
  # need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
@@ -23,7 +23,7 @@ Description: Set Class-Paths
  
  jarpath="$frameworkdir/$jarfile"
  
-+classpaths=`cat /usr/share/android-platform-tools-base/lint.classpaths`:$jarpath
++classpaths=`cat /usr/share/android-platform-tools-base/lint.classpath`:$jarpath
 +
  exec "$javaCmd" \
      -Xmx1024m $os_opts $java_debug \
diff --git a/debian/project.gradle b/debian/project.gradle
deleted file mode 100644
index 8dfed6c..0000000
--- a/debian/project.gradle
+++ /dev/null
@@ -1,72 +0,0 @@
-apply plugin: 'java'
-apply plugin: 'maven'
-
-sourceCompatibility = 1.6
-targetCompatibility = 1.6
-def pomFilePath = "${buildDir}/${project.name}.pom"
-def classpathsFilePath = "${buildDir}/${project.name}.classpaths"
-
-/* ********************
- * Task generatePom   *
- **********************/
-/* No idea why adding any tasks with wahtever name would make Gradle complain
-   that this task exists. Therefore I have to set the "overwrite". */
-task generatePom(overwrite: true) {
-  outputs.files "${buildDir}/${project.name}.pom"
-  doFirst {
-    pom {
-      project {
-        if (hasProperty('pomName')) name pomName
-        if (hasProperty('pomDesc')) description pomDesc
-        url 'http://tools.android.com'
-        inceptionYear '2007'
-        licenses {
-          license {
-            name 'The Apache Software License, Version 2.0'
-            url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-          }
-        }
-        scm {
-          url 'https://android.googlesource.com/platform/tools/base'
-          connection 'git://android.googlesource.com/platform/tools/base.git'
-        }
-        developers {
-          developer {
-            name 'The Android Open Source Project'
-          }
-        }
-      }
-    }.writeTo("${buildDir}/${project.name}.pom")
-  }
-}
-clean.doLast { delete pomFilePath }
-assemble.dependsOn generatePom
-
-/***************************
- * Task generateClasspaths *
- ***************************/
-task generateClasspaths(overwrite: true) {
-  outputs.files classpathsFilePath
-  doFirst {
-    mkdir buildDir
-    def classpathsFile = file(classpathsFilePath)
-    classpathsFile.createNewFile()
-    classpathsFile.write(
-      configurations.runtime.collect {
-        if (it.path.startsWith('/usr/share/')) {
-          it.path
-        } else {
-          "/usr/share/java/${it.name}"
-        }
-      }.toSorted().join(':')
-    )
-  }
-}
-clean.doLast { delete classpathsFilePath }
-assemble.dependsOn generateClasspaths
-
-/* Not sure this file is included before or after when each project sets their
-   "archivesBaseName". For insurance, do it after the evaluation completed. */
-afterEvaluate {
-  jar.baseName = "${group}.${archivesBaseName}"
-}
\ No newline at end of file
diff --git a/debian/root.gradle b/debian/version.gradle
similarity index 100%
rename from debian/root.gradle
rename to debian/version.gradle

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/android-platform-tools-base.git



More information about the pkg-java-commits mailing list