1 #
 2 # Copyright (c) 2015, 2023, 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 ################################################################################
27 # This file builds the Java components of testlib.
28 # It also covers the test-image part, where the built files are copied to the
29 # test image.
30 ################################################################################
31 
32 default: all
33 
34 include $(SPEC)
35 include MakeBase.gmk
36 include JavaCompilation.gmk
37 
38 ################################################################################
39 # Targets for building the test lib jars
40 ################################################################################
41 
42 TARGETS :=
43 
44 TEST_LIB_SOURCE_DIR := $(TOPDIR)/test/lib
45 TEST_LIB_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/lib
46 
47 $(eval $(call SetupJavaCompilation, BUILD_WB_JAR, \
48     TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
49     SRC := $(TEST_LIB_SOURCE_DIR)/jdk/test/whitebox/, \
50     BIN := $(TEST_LIB_SUPPORT)/wb_classes, \
51     JAR := $(TEST_LIB_SUPPORT)/wb.jar, \
52     DISABLED_WARNINGS := deprecation removal preview, \
53     JAVAC_FLAGS := --enable-preview, \
54 ))
55 
56 TARGETS += $(BUILD_WB_JAR)
57 
58 $(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \
59     TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
60     SRC := $(TEST_LIB_SOURCE_DIR), \
61     EXCLUDES := jdk/test/lib/containers jdk/test/lib/security org, \
62     BIN := $(TEST_LIB_SUPPORT)/test-lib_classes, \
63     HEADERS := $(TEST_LIB_SUPPORT)/test-lib_headers, \
64     JAR := $(TEST_LIB_SUPPORT)/test-lib.jar, \
65     DISABLED_WARNINGS := try deprecation rawtypes unchecked serial cast removal preview varargs, \
66     JAVAC_FLAGS := --add-exports java.base/sun.security.util=ALL-UNNAMED \
67         --add-exports java.base/jdk.internal.classfile=ALL-UNNAMED \
68         --add-exports java.base/jdk.internal.classfile.attribute=ALL-UNNAMED \
69         --add-exports java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED \
70         --add-exports java.base/jdk.internal.module=ALL-UNNAMED \
71         --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
72         --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
73         --add-exports jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
74         --add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
75         --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
76         --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
77         --enable-preview, \
78 ))
79 
80 TARGETS += $(BUILD_TEST_LIB_JAR)
81 
82 build-test-lib: $(TARGETS)
83 
84 ################################################################################
85 # Targets for building test-image.
86 ################################################################################
87 
88 # Copy the jars to the test image.
89 $(eval $(call SetupCopyFiles, COPY_LIBTEST_JARS, \
90     DEST := $(TEST_IMAGE_DIR)/lib-test, \
91     FILES := $(BUILD_WB_JAR_JAR) $(BUILD_TEST_LIB_JAR_JAR), \
92 ))
93 #
94 
95 test-image-lib: $(COPY_LIBTEST_JARS)
96 
97 all: build-test-lib
98 
99 .PHONY: default all build-test-lib test-image-lib