Bug 1099501 - Export and use ANDROID_TOOLS where appropriate. r=snorp,bnicholson

In certain configurations, in particular when installing the Android SDK
using HomeBrew, one sees a configuration with symlinks like:

    [brian@brian-macbook git]$ ls -l /usr/local/Cellar/android-sdk/23.0.2/
    total 72
    ...
    lrwxr-xr-x   1 brian  admin    38 Nov 14 16:39 platforms -> ../../../var/lib/android-sdk/platforms
    ...
    drwxr-xr-x  26 brian  admin   884 Nov 14 17:43 tools

In this case, we have
ANDROID_SDK=/usr/local/Cellar/android-sdk/23.0.2/platforms/android-21.

It is an anti-pattern to use ANDORID_SDK/.. to find other paths in the
tree.  This pattern is used in at least two places:

1) When we try to find
/usr/local/Cellar/android-sdk/23.0.2/platforms/android-21/../../tools,
we end up in the /usr/local/var/lib subtree.  This patch works around
that by exporting and using ANDROID_TOOLS; ANDROID_TOOLS itself is
extracted using path matching, rather than following .. through the
filesystem.

2) We also need to use ANDROID_SDK_ROOT rather than
ANDROID_SDK/../.. through-out.

--HG--
extra : rebase_source : 5e0323a94f2b80550f17a624e16f338cdeec406d
This commit is contained in:
Nick Alexander 2014-11-17 11:12:00 -08:00
parent df420b6488
commit f16d77b0a2
7 changed files with 23 additions and 18 deletions

View File

@ -4,7 +4,7 @@
include $(topsrcdir)/config/rules.mk
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar:$(ANDROID_SDK)/../../tools/lib/lint.jar:$(ANDROID_SDK)/../../tools/lib/lint-checks.jar
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar:$(ANDROID_TOOLS)/lib/lint.jar:$(ANDROID_TOOLS)/lib/lint-checks.jar
# Include Android specific java flags, instead of what's in rules.mk.
include $(topsrcdir)/config/android-common.mk

View File

@ -58,10 +58,6 @@ public class SDKProcessor {
String generatedFilePrefix = args[3];
sMaxSdkVersion = Integer.parseInt(args[4]);
Properties props = System.getProperties();
props.setProperty("com.android.tools.lint.bindir",
new File(new File(sdkJar).getParentFile(), "../../tools").toString());
LintCliClient lintClient = new LintCliClient();
sApiLookup = ApiLookup.get(lintClient);
@ -252,4 +248,4 @@ public class SDKProcessor {
}
}
}
}
}

View File

@ -376,6 +376,9 @@ case "$target" in
ANDROID_BUILD_TOOLS="${android_build_tools}"
AC_SUBST(ANDROID_SDK_ROOT)
AC_SUBST(ANDROID_SDK)
AC_SUBST(ANDROID_TOOLS)
AC_SUBST(ANDROID_PLATFORM_TOOLS)
AC_SUBST(ANDROID_BUILD_TOOLS)
ANDROID_COMPAT_LIB=$ANDROID_COMPAT_DIR_BASE/v4/android-support-v4.jar
AC_MSG_CHECKING([for v4 compat library])

View File

@ -25,7 +25,7 @@ GARBAGE_DIRS = \
binaries \
$(NULL)
ANDROID=$(ANDROID_SDK)/../../tools/android
ANDROID=$(ANDROID_TOOLS)/android
TARGET="android-$(ANDROID_TARGET_SDK)"

View File

@ -10,13 +10,13 @@ GECKOVIEW_LIBRARY_FILES := \
build.xml \
$(NULL)
PP_TARGETS = properties manifest project
properties = local.properties.in
project = project.properties.in
manifest = AndroidManifest.xml.in
GARBAGE = $(GECKOVIEW_LIBRARY_FILES) local.properties project.properties AndroidManifest.xml
PP_TARGETS += gen
gen := \
local.properties.in \
project.properties.in \
AndroidManifest.xml.in \
$(NULL)
gen_FLAGS += -DANDROID_SDK_ROOT=$(ANDROID_SDK_ROOT)
GARBAGE_DIRS = \
bin \

View File

@ -8,4 +8,4 @@
# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=@ANDROID_SDK@/../../
sdk.dir=@ANDROID_SDK_ROOT@

View File

@ -2,15 +2,21 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
annotation_processor_jar_files := $(DEPTH)/build/annotationProcessors/annotationProcessors.jar:$(ANDROID_SDK)/../../tools/lib/lint.jar:$(ANDROID_SDK)/../../tools/lib/lint-checks.jar
annotation_processor_jar_files := $(DEPTH)/build/annotationProcessors/annotationProcessors.jar:$(ANDROID_TOOLS)/lib/lint.jar:$(ANDROID_TOOLS)/lib/lint-checks.jar
sdk_processor := \
$(JAVA) \
-Dcom.android.tools.lint.bindir='$(ANDROID_TOOLS)' \
-classpath $(annotation_processor_jar_files) \
org.mozilla.gecko.annotationProcessors.SDKProcessor
MediaCodec.cpp: $(ANDROID_SDK)/android.jar mediacodec-classes.txt
$(JAVA) -classpath $(annotation_processor_jar_files) org.mozilla.gecko.annotationProcessors.SDKProcessor $(ANDROID_SDK)/android.jar $(srcdir)/mediacodec-classes.txt $(CURDIR) MediaCodec 16
$(sdk_processor) $(ANDROID_SDK)/android.jar $(srcdir)/mediacodec-classes.txt $(CURDIR) MediaCodec 16
MediaCodec.h: MediaCodec.cpp
SurfaceTexture.cpp: $(ANDROID_SDK)/android.jar surfacetexture-classes.txt
$(JAVA) -classpath $(annotation_processor_jar_files) org.mozilla.gecko.annotationProcessors.SDKProcessor $(ANDROID_SDK)/android.jar $(srcdir)/surfacetexture-classes.txt $(CURDIR) SurfaceTexture 16
$(sdk_processor) $(ANDROID_SDK)/android.jar $(srcdir)/surfacetexture-classes.txt $(CURDIR) SurfaceTexture 16
SurfaceTexture.h: SurfaceTexture.cpp