-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompile_war.bat
executable file
·75 lines (59 loc) · 2.54 KB
/
compile_war.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@echo off
SET ARTIFACT=boot-2.3.1
SET MAINCLASS=com.demo.DemoApplication
SET VERSION=0.0.1-SNAPSHOT
RMDIR /Q/S build
mkdir build\native-image
mkdir build\graal-agent\META-INF\native-image
SET rootPath=%CD%\%1
echo "root" %rootPath%
SET GRAAL_AGENT_PATH=%rootPath%build\graal-agent
echo "GRAAL_AGENT_PATH" %GRAAL_AGENT_PATH%
echo "Packaging %ARTIFACT% with Gradle"
call gradlew build
echo "***************************** Setting WAR ************************************************"
SET WAR="%ARTIFACT%-%VERSION%.war"
RMDIR /Q/S %ARTIFACT%
echo "Unpacking %WAR%"
cd build/native-image
jar -xvf ../libs/%WAR%
echo "***************************** Copy jars & classes *****************************************"
xcopy "META-INF" "WEB-INF/classes" /s /e
SET rootPath=%CD%\%1
SET CP=WEB-INF\classes;WEB-INF\lib\*;WEB-INF\lib-provided\*
echo "***************************** CLASSPATH ***********************************************"
echo %CP%
echo "**************************************************************************************"
echo "============== RUNNING THE APPLICATION WITH THE AGENT TO POPULATE CONFIGURATION FILES ========="
echo "(for debug see agent-output.txt)"
echo "Running for 50000 seconds"
echo "Once tomcat starts successfully in new window hit ctrl+c to terminate tomcat gracefully. This is very important step!!!!!"
start "java-agent" java -cp %CP% ^
-agentlib:native-image-agent=config-merge-dir=%GRAAL_AGENT_PATH%\META-INF\native-image ^
%MAINCLASS% > agent-output.txt
call gradlew test
TIMEOUT /T 50000
echo "Killing..."
taskkill /FI "WindowTitle eq java-agent*" /T
echo "*****************************GRAALVM_VERSION ******************************************"
echo native-image --version
echo "**************************************************************************************"
echo "***************************** CLASSPATH ***********************************************"
set CP=%CP%;%GRAAL_AGENT_PATH%;
echo %CP%
echo "**************************************************************************************"
echo "MAINCLASS" %MAINCLASS%
call native-image ^
--no-server ^
--no-fallback ^
--enable-all-security-services ^
--initialize-at-build-time=com.sun.jmx.remote ^
-H:Name=%ARTIFACT%-agent ^
-H:+TraceClassInitialization ^
-H:+RemoveSaturatedTypeFlows ^
-Dspring.native.remove-yaml-support=true ^
-Dspring.xml.ignore=true ^
-Dspring.spel.ignore=true ^
-Dspring.native.remove-jmx-support=true ^
-Dspring.native.verify=true ^
-cp %CP% %MAINCLASS%