8145603: Enable build.bat to use vcproj to build
Reviewed-by: mgronlun, mikael, gtriantafill
--- a/hotspot/make/windows/build.bat Thu Dec 17 11:18:22 2015 -0500
+++ b/hotspot/make/windows/build.bat Thu Dec 17 08:41:30 2015 -0800
@@ -1,6 +1,6 @@
@echo off
REM
-REM Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+REM Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
REM
REM This code is free software; you can redistribute it and/or modify it
@@ -23,96 +23,62 @@
REM
REM
+REM Set HotSpotWorkSpace to the directory two steps above this script
+for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi)
REM
REM Since we don't have uname and we could be cross-compiling,
REM Use the compiler to determine which ARCH we are building
REM
-REM Note: Running this batch file from the Windows command shell requires
-REM that "grep" be accessible on the PATH. An MKS install does this.
-REM
-cl 2>&1 | grep "IA-64" >NUL
-if %errorlevel% == 0 goto isia64
-cl 2>&1 | grep "AMD64" >NUL
+cl 2>&1 1>&3 | findstr x64>NUL
if %errorlevel% == 0 goto amd64
-cl 2>&1 | grep "x64" >NUL
-if %errorlevel% == 0 goto amd64
-set ARCH=x86
-set BUILDARCH=i486
-set Platform_arch=x86
-set Platform_arch_model=x86_32
-goto end
+set VCPROJ=%HotSpotWorkSpace%\build\vs-i486\jvm.vcxproj
+set PLATFORM=x86
+goto testmkshome
:amd64
-set LP64=1
-set ARCH=x86
-set BUILDARCH=amd64
-set Platform_arch=x86
-set Platform_arch_model=x86_64
+set VCPROJ=%HotSpotWorkSpace%\build\vs-amd64\jvm.vcxproj
+set PLATFORM=x64
+goto testmkshome
+
+:testmkshome
+if not "%HOTSPOTMKSHOME%" == "" goto testjavahome
+if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin
+if not "%HOTSPOTMKSHOME%" == "" goto testjavahome
+if exist c:\cygwin64\bin set HOTSPOTMKSHOME=c:\cygwin64\bin
+if not "%HOTSPOTMKSHOME%" == "" goto testjavahome
+echo Error: please set variable HOTSPOTMKSHOME to place where
+echo your MKS/Cygwin installation is
+echo.
goto end
-:isia64
-set LP64=1
-set ARCH=ia64
-set Platform_arch=ia64
-set Platform_arch_model=ia64
-:end
-if "%4" == "" goto usage
-if not "%7" == "" goto usage
+:testjavahome
+if not "%JAVA_HOME%" == "" goto testbuildversion
+echo Error: please set variable JAVA_HOME to a bootstrap JDK
+echo.
+goto end
-if "%1" == "product" goto test1
-if "%1" == "debug" goto test1
-if "%1" == "fastdebug" goto test1
-if "%1" == "tree" goto test1
+:testbuildversion
+if "%1" == "compiler1" goto testdebuglevel
+if "%1" == "tiered" goto testdebuglevel
goto usage
-:test1
-if "%2" == "core" goto test2
-if "%2" == "compiler1" goto test2
-if "%2" == "compiler2" goto test2
-if "%2" == "tiered" goto test2
-if "%2" == "adlc" goto build_adlc
-
-goto usage
-
-:test2
-if "%1" == "tree" goto build_tree
-REM check_j2se_version
-REM jvmti.make requires J2SE 1.4.x or newer.
-REM If not found then fail fast.
-%4\bin\javap javax.xml.transform.TransformerFactory >NUL
-if %errorlevel% == 0 goto build
-echo.
-echo J2SE version found at %4\bin\java:
-%4\bin\java -version
-echo.
-echo An XSLT processor (J2SE 1.4.x or newer) is required to
-echo bootstrap this build
-echo.
-
+:testdebuglevel
+if "%2" == "product" goto build
+if "%2" == "debug" goto build
+if "%2" == "fastdebug" goto build
goto usage
:build
-nmake -f %3/make/windows/build.make Variant=%2 WorkSpace=%3 BootStrapDir=%4 BuildUser="%USERNAME%" HOTSPOT_BUILD_VERSION="%5" %1
-goto end
-
-:build_adlc
-nmake -f %3/make/windows/build.make Variant=compiler2 WorkSpace=%3 BootStrapDir=%4 BuildUser="%USERNAME%" HOTSPOT_BUILD_VERSION=%5 ADLC_ONLY=1 %1
-goto end
-
-:build_tree
-nmake -f %3/make/windows/build.make Variant=%2 WorkSpace=%3 BootStrapDir=%4 BuildUser="%USERNAME%" HOTSPOT_BUILD_VERSION="%5" %1
+if NOT EXIST %VCPROJ% call %~dp0\create.bat %JAVA_HOME%
+msbuild /Property:Platform=%PLATFORM% /Property:Configuration=%1_%2 /v:m %VCPROJ%
goto end
:usage
-echo Usage: build flavor version workspace bootstrap_dir [build_id] [windbg_home]
+echo Usage: build version debuglevel
echo.
echo where:
-echo flavor is "product", "debug" or "fastdebug",
-echo version is "core", "compiler1", "compiler2", or "tiered",
-echo workspace is source directory without trailing slash,
-echo bootstrap_dir is a full path to a JDK in which bin/java
-echo and bin/javac are present and working, and build_id is an
-echo optional build identifier displayed by java -version
+echo version is "compiler1" or "tiered",
+echo debuglevel is "product", "debug" or "fastdebug"
exit /b 1
:end