1 # Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
 2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 3 #
 4 # This code is free software; you can redistribute it and/or modify it
 5 # under the terms of the GNU General Public License version 2 only, as
 6 # published by the Free Software Foundation.
 7 #
 8 # This code is distributed in the hope that it will be useful, but WITHOUT
 9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11 # version 2 for more details (a copy is included in the LICENSE file that
12 # accompanied this code).
13 #
14 # You should have received a copy of the GNU General Public License version
15 # 2 along with this work; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 #
18 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 # or visit www.oracle.com if you need additional information or have any
20 # questions.
21 
22 #===============================================================================
23 # Leyden-premain + Sprint-boot getting-started demo
24 #  - https://spring.io/guides/gs/spring-boot
25 #  - https://docs.spring.io/spring-boot/maven-plugin/aot.html
26 #  - https://bell-sw.com/blog/how-to-use-cds-with-spring-boot-applications/
27 #
28 # See ../lib/DemoSupport.gmk for the "make" targets that build the demo, run the
29 # demo, and gather benchmarking data.
30 #===============================================================================
31 
32 # The following needs to be defined before including ../lib/DemoSupport.gmk
33 DEMO_NAME       = spring-boot-getting-started
34 DEMO_SRC        = gs-spring-boot/complete/src/main/java/com/example/springboot/Application.java
35 DEMO_JAR        = gs-spring-boot/complete/spring-boot-complete-0.0.1-SNAPSHOT/spring-boot-complete-0.0.1-SNAPSHOT.jar
36 DEMO_CMDLINE    = -Dserver.port=0 -Dspring.aot.enabled=true -Dspring.output.ansi.enabled=NEVER -Dspring.context.exit=onRefresh -jar ${DEMO_JAR}
37 # This is for uploading into Artifactory, usually to a path like
38 #    https://xxxx.com/artifactory/yyyy/io/spring/spring-boot-getting-started/3.3.0/spring-boot-getting-started-3.3.0.zip
39 DEMO_ARTIFACT   = spring-boot-getting-started-3.3.0.zip
40 
41 include ../lib/DemoSupport.gmk
42 
43 # Create the project using instructions from https://spring.io/guides/gs/spring-boot and
44 # patch the ${DEMO_SRC} to show start-up measurement used by ../lib/DemoSupport.gmk
45 # Note: we use GIT version 99085f078b01fed27667c0b8fbbb957758911f4a
46 # Note: pom.xml is patched to add <goal>process-aot</goal>; see https://docs.spring.io/spring-boot/maven-plugin/aot.html
47 ${DEMO_SRC}: Application.java pom.xml
48 	rm -rf gs-spring-boot ${DEMO_SRC}
49 	git clone https://github.com/spring-guides/gs-spring-boot.git
50 	cd gs-spring-boot; git reset --hard 99085f078b01fed27667c0b8fbbb957758911f4a
51 	cp -v Application.java ${DEMO_SRC}
52 	cp -v pom.xml gs-spring-boot/complete
53 
54 # Package the app in CDS friendly way
55 # See https://bell-sw.com/blog/how-to-use-cds-with-spring-boot-applications/
56 ${DEMO_JAR}: ${DEMO_SRC}
57 	cd gs-spring-boot/complete && JAVA_HOME=${BLDJDK_HOME} ${MVN} -Dmaven.test.skip=true package
58 	cd gs-spring-boot/complete && ${BLDJDK_JAVA} -Djarmode=tools -jar target/spring-boot-complete-0.0.1-SNAPSHOT.jar extract
59 
60 ${DEMO_ARTIFACT}: ${DEMO_JAR}
61 	${JAR} cvfM ${DEMO_ARTIFACT} \
62 		-C gs-spring-boot/complete/spring-boot-complete-0.0.1-SNAPSHOT .
63 
64 clean: clean0
65 	rm -rf gs-spring-boot ${DEMO_ARTIFACT} mainline_vs_premain.* compare_premain_builds.*
66 
67 clean0:
68 	rm -f *.cds *.cds.code *.classlist *.jsa *~ *.log *.log.* hs_err_* tmp.txt
69 
70 # Show the patch we made to gs-spring-boot
71 diff:
72 	cd gs-spring-boot; git diff -w
73