Bug 1338629 - Update annotation processing classpath to reflect SDK 25.3+ r=nalexander
authorAndrzej Hunt <ahunt@mozilla.com>
Thu, 30 Mar 2017 18:55:02 -0700
changeset 350791 e701cc8a939c653e275aa289a558eb51454e1ed6
parent 350790 698b0748f7f7a779cfc371d6a073b71641ad18a5
child 350792 dfc478fe634319bd2edbadfced3fd8ce6470da6b
push id31584
push userarchaeopteryx@coole-files.de
push dateSat, 01 Apr 2017 11:07:36 +0000
treeherdermozilla-central@0d6ffde320ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1338629
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1338629 - Update annotation processing classpath to reflect SDK 25.3+ r=nalexander It looks like Google decided to split these jars out a bit, so we need to piece them all back together. We could probably just query the sdk version instead, but I'm not 100% sure know when this setup changed - moreover we don't know when (if?) the paths are likely to change again. SDK 26.0 still has lint 25.3.1, so the SDK and lint versions don't appear to be tied. It seems that only the lint* jars are needed to compile 'build/annotationProcessor', however we need all the remaining jars in the classpath when running that code in 'widget/android/bindings'. MozReview-Commit-ID: GAKwMrVXW55
build/annotationProcessors/moz.build
build/autoconf/android.m4
old-configure.in
widget/android/bindings/Makefile.in
--- a/build/annotationProcessors/moz.build
+++ b/build/annotationProcessors/moz.build
@@ -13,12 +13,9 @@ jar.sources += [
     'classloader/IterableJarLoadingURLClassLoader.java',
     'classloader/JarClassIterator.java',
     'CodeGenerator.java',
     'SDKProcessor.java',
     'utils/AlphabeticAnnotatableEntityComparator.java',
     'utils/GeneratableElementIterator.java',
     'utils/Utils.java',
 ]
-jar.extra_jars += [
-    CONFIG['ANDROID_TOOLS'] + '/lib/lint.jar',
-    CONFIG['ANDROID_TOOLS'] + '/lib/lint-checks.jar',
-]
+jar.extra_jars += CONFIG['ANDROID_LINT_CLASSPATH'].split()
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -232,16 +232,18 @@ if test -n "$MOZ_INSTALL_TRACKING"; then
     MOZ_ANDROID_AAR(play-services-basement, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
 fi
 
 ])
 
 dnl Configure an Android SDK.
 dnl Arg 1: target SDK version, like 23.
 dnl Arg 2: list of build-tools versions, like "23.0.3 23.0.1".
+dnl Arg 3: target lint version, like "25.3.1" (note: we fall back to
+dnl        unversioned lint if this version is not found).
 AC_DEFUN([MOZ_ANDROID_SDK],
 [
 
 MOZ_ARG_WITH_STRING(android-sdk,
 [  --with-android-sdk=DIR
                           location where the Android SDK can be found (like ~/.mozbuild/android-sdk-linux)],
     android_sdk_root=$withval)
 
@@ -356,16 +358,36 @@ case "$target" in
     fi
     AC_MSG_RESULT([$ANDROID_SUPPORT_ANNOTATIONS_JAR])
     AC_SUBST(ANDROID_SUPPORT_ANNOTATIONS_JAR)
     ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB=$ANDROID_SUPPORT_ANNOTATIONS_JAR
     AC_SUBST(ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB)
     ;;
 esac
 
+android_lint_target=$3
+ANDROID_LINT_CLASSPATH=""
+android_lint_versioned_jar="$ANDROID_SDK_ROOT/tools/lib/lint-$android_lint_target.jar"
+android_lint_unversioned_jar="$ANDROID_SDK_ROOT/tools/lib/lint.jar"
+if test -e "$android_lint_versioned_jar" ; then
+    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $android_lint_versioned_jar"
+    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/lint-checks-$android_lint_target.jar"
+    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/sdklib-$android_lint_target.jar"
+    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/repository-$android_lint_target.jar"
+    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/common-$android_lint_target.jar"
+    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/lint-api-$android_lint_target.jar"
+elif test -e "$android_lint_unversioned_jar" ; then
+    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $android_lint_unversioned_jar"
+    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/lint-checks.jar"
+else
+    AC_MSG_ERROR([Unable to find android sdk's lint jar. This probably means that you need to update android.m4 to find the latest version of lint-*.jar and all its dependencies. (looked for $android_lint_versioned_jar and $android_lint_unversioned_jar)])
+fi
+AC_MSG_RESULT([$ANDROID_LINT_CLASSPATH])
+AC_SUBST(ANDROID_LINT_CLASSPATH)
+
 MOZ_ARG_WITH_STRING(android-min-sdk,
 [  --with-android-min-sdk=[VER]     Impose a minimum Firefox for Android SDK version],
 [ MOZ_ANDROID_MIN_SDK_VERSION=$withval ])
 
 MOZ_ARG_WITH_STRING(android-max-sdk,
 [  --with-android-max-sdk=[VER]     Impose a maximum Firefox for Android SDK version],
 [ MOZ_ANDROID_MAX_SDK_VERSION=$withval ])
 
--- a/old-configure.in
+++ b/old-configure.in
@@ -2339,17 +2339,17 @@ AC_SUBST(MOZ_B2G_VERSION)
 dnl ========================================================
 dnl Ensure Android SDK and build-tools versions depending on
 dnl mobile target.
 dnl ========================================================
 
 if test -z "$gonkdir" ; then
     case "$MOZ_BUILD_APP" in
     mobile/android)
-        MOZ_ANDROID_SDK(23, 23.0.3 23.0.1)
+        MOZ_ANDROID_SDK(23, 23.0.3 23.0.1, 25.3.1)
         ;;
     esac
 fi
 
 dnl ========================================================
 dnl =
 dnl = Toolkit Options
 dnl =
--- a/widget/android/bindings/Makefile.in
+++ b/widget/android/bindings/Makefile.in
@@ -3,18 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Bug 1099345 - The SDK's lint code (used by the code generator) does not enjoy
 # concurrent access to a cache that it generates.
 .NOTPARALLEL:
 
 annotation_processor_jar_files := \
   $(DEPTH)/build/annotationProcessors/annotationProcessors.jar \
-  $(ANDROID_TOOLS)/lib/lint.jar \
-  $(ANDROID_TOOLS)/lib/lint-checks.jar \
+  $(ANDROID_LINT_CLASSPATH) \
   $(NULL)
 
 sdk_processor := \
   $(JAVA) \
   -Dcom.android.tools.lint.bindir='$(ANDROID_TOOLS)' \
   -classpath $(subst $(NULL) ,:,$(strip $(annotation_processor_jar_files))) \
   org.mozilla.gecko.annotationProcessors.SDKProcessor