1 #
2 # Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
25
26 include MakeFileStart.gmk
27
28 ################################################################################
29 # Builds one JAR used by jtreg to test value classes (JEP 401):
30 #
31 # valueClassPlugin.jar -- Contains ValueClassPlugin (a javac Plugin that
32 # rewrites @AsValueClass classes to value classes at parse time) together
33 # with @AsValueClass and the META-INF service descriptor, compiled WITH
34 # --enable-preview and the required internal-API exports.
35 #
36 # Usage in test runs (via RunTests.gmk):
37 # make test TEST=... JTREG=VALUE_CLASS_PLUGIN=true
38 #
39 # The plugin is also enabled automatically when --enable-preview is passed via
40 # VM_OPTIONS or JAVA_OPTIONS and the plugin JARs are present in the test image:
41 # make test TEST=... JTREG=VM_OPTIONS=--enable-preview
42 #
43 ################################################################################
44
45 include CopyFiles.gmk
46 include JavaCompilation.gmk
47
48 VCP_BASEDIR := $(TOPDIR)/test/jtreg_value_class_plugin
49 VCP_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/jtreg_value_class_plugin
50
51 # Compile ValueClassPlugin WITH --enable-preview
52 $(eval $(call SetupJavaCompilation, BUILD_VCP_PLUGIN, \
53 TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
54 SRC := $(VCP_BASEDIR)/plugin, \
55 BIN := $(VCP_SUPPORT)/plugin_classes, \
56 JAR := $(VCP_SUPPORT)/valueClassPlugin.jar, \
57 JAVAC_FLAGS := \
58 --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
59 --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
60 --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
61 --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
62 --enable-preview, \
63 DISABLED_WARNINGS := preview, \
64 ))
65
66 TARGETS += $(BUILD_VCP_PLUGIN)
67
68 ################################################################################
69 # Targets for building test-image.
70 ################################################################################
71
72 $(eval $(call SetupCopyFiles, COPY_VCP, \
73 SRC := $(VCP_SUPPORT), \
74 DEST := $(TEST_IMAGE_DIR)/jtreg_value_class_plugin, \
75 FILES := \
76 $(VCP_SUPPORT)/valueClassPlugin.jar, \
77 ))
78
79 IMAGES_TARGETS += $(COPY_VCP)
80
81 build: $(TARGETS)
82 images: $(IMAGES_TARGETS)
83
84 .PHONY: images
85
86 ################################################################################
87
88 include MakeFileEnd.gmk