summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Baker-Malone <jbakermalone@google.com>2021-01-20 07:35:27 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-01-20 07:35:27 +0000
commit100eea62311c8dd6bf44b4b30fbec22d52542a5e (patch)
treefbe5c6b24b53ba8eb39d865f0704e5d8b7262a8f
parent11efef7a00287fb011f11348ff9fee33c7e1af3c (diff)
parentda7b74d9ccbb96eae161ab1e09b41673a6f14112 (diff)
downloaddalvik-100eea62311c8dd6bf44b4b30fbec22d52542a5e.tar.gz
Update bat files to not use find_java.bat am: da7b74d9cc
Original change: https://googleplex-android-review.googlesource.com/c/platform/dalvik/+/13366650 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I424c1ef11547d061d97da79ffab6445e78bbf8a0
-rwxr-xr-xdx/etc/dx.bat34
-rwxr-xr-xdx/etc/mainDexClasses.bat32
2 files changed, 55 insertions, 11 deletions
diff --git a/dx/etc/dx.bat b/dx/etc/dx.bat
index 654588617..f2e3857df 100755
--- a/dx/etc/dx.bat
+++ b/dx/etc/dx.bat
@@ -22,12 +22,34 @@ REM Set up prog to be the path of this script, including following symlinks,
REM and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0
-rem Check we have a valid Java.exe in the path.
-set java_exe=
-if exist "%~dp0..\tools\lib\find_java.bat" call "%~dp0..\tools\lib\find_java.bat"
-if exist "%~dp0..\..\tools\lib\find_java.bat" call "%~dp0..\..\tools\lib\find_java.bat"
-if not defined java_exe goto :EOF
-
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+exit /b 1
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+exit /b 1
+
+:init
set jarfile=dx.jar
set "frameworkdir=%~dp0"
rem frameworkdir must not end with a dir sep.
diff --git a/dx/etc/mainDexClasses.bat b/dx/etc/mainDexClasses.bat
index dc5f2c355..232635ca0 100755
--- a/dx/etc/mainDexClasses.bat
+++ b/dx/etc/mainDexClasses.bat
@@ -16,12 +16,34 @@ REM limitations under the License.
REM don't modify the caller's environment
setlocal
-rem Check we have a valid Java.exe in the path.
-set java_exe=
-if exist "%~dp0..\tools\lib\find_java.bat" call "%~dp0..\tools\lib\find_java.bat"
-if exist "%~dp0..\..\tools\lib\find_java.bat" call "%~dp0..\..\tools\lib\find_java.bat"
-if not defined java_exe goto :EOF
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+exit /b 1
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+exit /b 1
+:init
set baserules="%~dp0\mainDexClasses.rules"
set extrarules="%~dp0\mainDexClassesNoAapt.rules"