diff options
author | Colin Cross <ccross@android.com> | 2015-10-23 14:33:51 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2015-10-23 19:00:43 -0700 |
commit | 112753ca552465a202557918aea372cd5880c388 (patch) | |
tree | a6e729927f3428d940ceeead8cfe7f21020dc07b | |
parent | 373a1e36a99c7af15a00723c7561db3906281ab5 (diff) | |
download | build-112753ca552465a202557918aea372cd5880c388.tar.gz |
Error out early on nonstandard JDK directory layouts
On Darwin, javac may be located in a nonstandard directory layout such as:
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac
The sed command to replace bin/javac with lib/tools.jar would fail to
match, resulting in the HOST_JDK_TOOLS_JAR being set to the javac path.
Since javac exists, the checks for missing tools.jar would all pass, and
javac would be added to the classpath instead of tools.jar, and causing
hard to debug errors about missing com.sun.javadoc when building doclava.
Change the sed command to replace /javac$, which should always be found,
with /../lib/tools.jar.
Change-Id: I5072f04636a5c14b3aeaa3a5cc3b366feae89c37
-rw-r--r-- | core/config.mk | 2 | ||||
-rwxr-xr-x | core/find-jdk-tools-jar.sh | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/core/config.mk b/core/config.mk index 8863064ad1..423cb9fa79 100644 --- a/core/config.mk +++ b/core/config.mk @@ -533,7 +533,7 @@ HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh) ifneq ($(HOST_JDK_TOOLS_JAR),) ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),) -$(error Error: could not find jdk tools.jar, please check if your JDK was installed correctly) +$(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR), please check if your JDK was installed correctly) endif endif diff --git a/core/find-jdk-tools-jar.sh b/core/find-jdk-tools-jar.sh index 02248295f9..ac0b3b6b59 100755 --- a/core/find-jdk-tools-jar.sh +++ b/core/find-jdk-tools-jar.sh @@ -16,5 +16,5 @@ else LSLINE=$(ls -l "$JAVAC") JAVAC=$(echo -n "$LSLINE" | sed -e "s/.* -> //") done - echo $JAVAC | sed -e "s:\(.*\)/bin/javac.*:\\1/lib/tools.jar:" + echo $JAVAC | sed -e 's:\(.*\)/javac$:\1/../lib/tools.jar:' fi |