Skip to content

Commit fc31474

Browse files
lahodajerikj79
andcommittedNov 24, 2023
8318913: The module-infos for --release data do not contain pre-set versions
Co-authored-by: Erik Joelsson <erikj@openjdk.org> Reviewed-by: vromero, ihse
1 parent df1b896 commit fc31474

File tree

14 files changed

+546
-260
lines changed

14 files changed

+546
-260
lines changed
 

‎make/Main.gmk

+17-4
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,11 @@ endif
608608
ifeq ($(CREATING_BUILDJDK), true)
609609
# This target is only called by the recursive call below.
610610
create-buildjdk-interim-image-helper: interim-image jdk.jlink-launchers \
611-
java.base-copy jdk.jdeps-launchers
611+
java.base-copy jdk.jdeps-launchers jdk.compiler-launchers
612612
endif
613613

614-
BUILDJDK_MODULES := $(sort $(foreach m, jdk.jlink $(INTERIM_IMAGE_MODULES), \
615-
$(call FindTransitiveDepsForModule, $m) $m))
614+
BUILDJDK_MODULES := $(sort $(foreach m, jdk.jlink jdk.compiler \
615+
$(INTERIM_IMAGE_MODULES), $(call FindTransitiveDepsForModule, $m) $m))
616616

617617
$(eval $(call SetupTarget, create-buildjdk-interim-image, \
618618
MAKEFILE := Main, \
@@ -971,7 +971,20 @@ else
971971
jdk.jdeps-gendata: java
972972

973973
# The ct.sym generation uses all the moduleinfos as input
974-
jdk.compiler-gendata: $(GENSRC_MODULEINFO_TARGETS)
974+
jdk.compiler-gendata: $(GENSRC_MODULEINFO_TARGETS) $(JAVA_TARGETS)
975+
# jdk.compiler-gendata needs the BUILD_JDK. If the BUILD_JDK was supplied
976+
# externally, no extra prerequisites are needed.
977+
ifeq ($(CREATE_BUILDJDK), true)
978+
ifneq ($(CREATING_BUILDJDK), true)
979+
# When cross compiling and an external BUILD_JDK wasn't supplied, it's
980+
# produced by the create-buildjdk target.
981+
jdk.compiler-gendata: create-buildjdk
982+
endif
983+
else ifeq ($(EXTERNAL_BUILDJDK), false)
984+
# When not cross compiling, the BUILD_JDK is the interim jdk image, and
985+
# the javac launcher is needed.
986+
jdk.compiler-gendata: jdk.compiler-launchers
987+
endif
975988

976989
# Declare dependencies between jmod targets.
977990
# java.base jmod needs jrt-fs.jar and access to the jmods for all non

‎make/autoconf/boot-jdk.m4

+2-2
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
520520
521521
# Don't presuppose SerialGC is present in the buildjdk. Also, we cannot test
522522
# the buildjdk, but on the other hand we know what it will support.
523-
BUILDJDK_JAVA_FLAGS_SMALL="-Xms32M -Xmx512M -XX:TieredStopAtLevel=1"
524-
AC_SUBST(BUILDJDK_JAVA_FLAGS_SMALL)
523+
BUILD_JAVA_FLAGS_SMALL="-Xms32M -Xmx512M -XX:TieredStopAtLevel=1"
524+
AC_SUBST(BUILD_JAVA_FLAGS_SMALL)
525525
526526
JAVA_TOOL_FLAGS_SMALL=""
527527
for f in $JAVA_FLAGS_SMALL; do

‎make/autoconf/spec.gmk.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ STRIPFLAGS:=@STRIPFLAGS@
663663
JAVA_FLAGS:=@JAVA_FLAGS@
664664
JAVA_FLAGS_BIG:=@JAVA_FLAGS_BIG@
665665
JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@
666-
BUILDJDK_JAVA_FLAGS_SMALL:=@BUILDJDK_JAVA_FLAGS_SMALL@
666+
BUILD_JAVA_FLAGS_SMALL:=@BUILD_JAVA_FLAGS_SMALL@
667667
JAVA_TOOL_FLAGS_SMALL:=@JAVA_TOOL_FLAGS_SMALL@
668668

669669
# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk
@@ -690,6 +690,7 @@ JTREG_JAVA = @FIXPATH@ $(JTREG_JDK)/bin/java $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
690690

691691
BUILD_JAVA_FLAGS := @BOOTCYCLE_JVM_ARGS_BIG@
692692
BUILD_JAVA=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS)
693+
BUILD_JAVA_SMALL=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS_SMALL)
693694
BUILD_JAVAC=@FIXPATH@ $(BUILD_JDK)/bin/javac
694695
BUILD_JAR=@FIXPATH@ $(BUILD_JDK)/bin/jar
695696

‎make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java

+283-54
Large diffs are not rendered by default.

‎make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java

-123
This file was deleted.

‎make/modules/jdk.compiler/Gendata.gmk

+24-29
Original file line numberDiff line numberDiff line change
@@ -35,59 +35,54 @@ $(eval $(call IncludeCustomExtension, modules/jdk.compiler/Gendata.gmk))
3535
# This is needed to properly setup DOCS_MODULES.
3636
$(eval $(call ReadImportMetaData))
3737

38-
# Modules that should be visible for 9 - the documented modules:
39-
CT_MODULES := $(DOCS_MODULES)
38+
# Modules that should be visible - the documented modules:
39+
CT_MODULES := $(filter-out $(MODULES_FILTER), $(DOCS_MODULES))
40+
CT_TRANSITIVE_MODULES := $(call FindTransitiveIndirectDepsForModules, $(CT_MODULES))
41+
CT_MODULES_API_TARGETS := \
42+
$(foreach m, $(CT_MODULES) $(CT_TRANSITIVE_MODULES), \
43+
$(call SetupJavaCompilationApiTarget, $m, $(JDK_OUTPUTDIR)/modules/$m))
4044

41-
# Get the complete module source path:
42-
CT_MODULESOURCEPATH := $(call GetModuleSrcPath)
45+
SYMBOL_FILES := $(wildcard $(MODULE_SRC)/share/data/symbols/*)
4346

4447
CT_DATA_DESCRIPTION += $(MODULE_SRC)/share/data/symbols/symbols
4548

4649
COMPILECREATESYMBOLS_ADD_EXPORTS := \
47-
--add-exports java.base/jdk.internal.javac=java.compiler.interim,jdk.compiler.interim \
48-
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.compiler.interim,jdk.javadoc.interim \
49-
--add-exports jdk.compiler.interim/com.sun.tools.javac.api=ALL-UNNAMED \
50-
--add-exports jdk.compiler.interim/com.sun.tools.javac.code=ALL-UNNAMED \
51-
--add-exports jdk.compiler.interim/com.sun.tools.javac.util=ALL-UNNAMED \
52-
--add-exports jdk.compiler.interim/com.sun.tools.javac.jvm=ALL-UNNAMED \
50+
--add-modules jdk.compiler,jdk.jdeps \
51+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
52+
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
53+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
54+
--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
55+
--add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \
5356
#
5457

58+
# TODO: Unify with jdk.javadoc-gendata. Should only compile this once and share.
5559
$(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
56-
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
57-
SRC := $(TOPDIR)/make/langtools/src/classes \
58-
$(TOPDIR)/src/jdk.jdeps/share/classes, \
60+
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK), \
61+
COMPILER := buildjdk, \
62+
SRC := $(TOPDIR)/make/langtools/src/classes, \
5963
INCLUDES := build/tools/symbolgenerator com/sun/tools/classfile, \
60-
BIN := $(BUILDTOOLS_OUTPUTDIR)/create_symbols, \
64+
BIN := $(BUILDTOOLS_OUTPUTDIR)/create_symbols_javac, \
6165
DISABLED_WARNINGS := options this-escape, \
6266
JAVAC_FLAGS := \
63-
$(INTERIM_LANGTOOLS_ARGS) \
6467
$(COMPILECREATESYMBOLS_ADD_EXPORTS), \
6568
))
6669

67-
$(SUPPORT_OUTPUTDIR)/symbols/ct.sym: \
68-
$(COMPILE_CREATE_SYMBOLS) \
69-
$(wildcard $(MODULE_SRC)/share/data/symbols/*) \
70-
$(MODULE_INFOS)
70+
$(SUPPORT_OUTPUTDIR)/symbols/ct.sym: $(COMPILE_CREATE_SYMBOLS) $(SYMBOL_FILES) \
71+
$(MODULE_INFOS) $(CT_MODULES_API_TARGETS)
7172
$(RM) -r $(@D)
7273
$(MKDIR) -p $(@D)
7374
$(ECHO) Creating ct.sym classes
74-
$(JAVA_SMALL) $(INTERIM_LANGTOOLS_ARGS) \
75+
$(BUILD_JAVA_SMALL) \
7576
$(COMPILECREATESYMBOLS_ADD_EXPORTS) \
76-
-classpath $(BUILDTOOLS_OUTPUTDIR)/create_symbols \
77-
build.tools.symbolgenerator.TransitiveDependencies \
78-
$(@D)/system-modules \
79-
$(CT_MODULESOURCEPATH) \
80-
$(CT_MODULES)
81-
$(JAVA_SMALL) $(INTERIM_LANGTOOLS_ARGS) \
82-
$(COMPILECREATESYMBOLS_ADD_EXPORTS) \
83-
-classpath $(BUILDTOOLS_OUTPUTDIR)/create_symbols \
77+
-classpath $(BUILDTOOLS_OUTPUTDIR)/create_symbols_javac \
8478
build.tools.symbolgenerator.CreateSymbols \
8579
build-ctsym \
8680
$(CT_DATA_DESCRIPTION) \
8781
$(@D)/ct.sym \
8882
$(SOURCE_DATE_EPOCH) \
8983
$(JDK_SOURCE_TARGET_VERSION) \
90-
$(@D)/system-modules
84+
"$(VERSION_PRE)" \
85+
$(JDK_OUTPUTDIR)/modules/
9186
$(TOUCH) $@
9287

9388
# Copy ct.sym to the modules libs dir

‎src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java

-37
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import java.io.IOException;
2929
import java.io.PrintWriter;
30-
import java.net.URI;
3130
import java.nio.file.DirectoryStream;
3231
import java.nio.file.FileSystem;
3332
import java.nio.file.FileSystems;
@@ -48,8 +47,6 @@
4847
import java.util.NoSuchElementException;
4948
import java.util.Set;
5049
import java.util.TreeSet;
51-
import java.util.stream.Collectors;
52-
import java.util.stream.Stream;
5350

5451
import javax.annotation.processing.Processor;
5552
import javax.tools.ForwardingJavaFileObject;
@@ -71,8 +68,6 @@
7168
import com.sun.tools.javac.util.Log;
7269
import com.sun.tools.javac.util.StringUtils;
7370

74-
import static java.nio.charset.StandardCharsets.UTF_8;
75-
7671
/** PlatformProvider for JDK N.
7772
*
7873
* <p><b>This is NOT part of any supported API.
@@ -173,17 +168,8 @@ public JavaFileObject getJavaFileForInput(Location location, String className,
173168
"",
174169
fileName + ".sig");
175170

176-
if (result == null) {
177-
//in jrt://, the classfile may have the .class extension:
178-
result = (JavaFileObject) getFileForInput(location,
179-
"",
180-
fileName + ".class");
181-
}
182-
183171
if (result != null) {
184172
return new SigJavaFileObject(result);
185-
} else {
186-
return null;
187173
}
188174
}
189175

@@ -262,7 +248,6 @@ public String inferBinaryName(Location location, JavaFileObject file) {
262248
Path root = fs.getRootDirectories().iterator().next();
263249
boolean hasModules =
264250
Feature.MODULES.allowedInSource(Source.lookup(sourceVersion));
265-
Path systemModules = root.resolve(ctSymVersion).resolve("system-modules");
266251

267252
if (!hasModules) {
268253
List<Path> paths = new ArrayList<>();
@@ -281,18 +266,6 @@ public String inferBinaryName(Location location, JavaFileObject file) {
281266
}
282267

283268
fm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, paths);
284-
} else if (Files.isRegularFile(systemModules)) {
285-
fm.handleOption("--system", Arrays.asList("none").iterator());
286-
287-
Path jrtModules =
288-
FileSystems.getFileSystem(URI.create("jrt:/"))
289-
.getPath("modules");
290-
try (Stream<String> lines =
291-
Files.lines(systemModules, UTF_8)) {
292-
lines.map(line -> jrtModules.resolve(line))
293-
.filter(mod -> Files.exists(mod))
294-
.forEach(mod -> setModule(fm, mod));
295-
}
296269
} else {
297270
Map<String, List<Path>> module2Paths = new HashMap<>();
298271

@@ -327,16 +300,6 @@ public String inferBinaryName(Location location, JavaFileObject file) {
327300
}
328301
}
329302

330-
private static void setModule(StandardJavaFileManager fm, Path mod) {
331-
try {
332-
fm.setLocationForModule(StandardLocation.SYSTEM_MODULES,
333-
mod.getFileName().toString(),
334-
Collections.singleton(mod));
335-
} catch (IOException ex) {
336-
throw new IllegalStateException(ex);
337-
}
338-
}
339-
340303
private static class SigJavaFileObject extends ForwardingJavaFileObject<JavaFileObject> {
341304

342305
public SigJavaFileObject(JavaFileObject fileObject) {

‎test/langtools/tools/javac/platform/CanHandleClassFilesTest.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ protected Class<?> findClass(String name) throws ClassNotFoundException {
109109
var createSymbolsClass = Class.forName("build.tools.symbolgenerator.CreateSymbols", false, cl);
110110
var main = createSymbolsClass.getMethod("main", String[].class);
111111
var symbols = targetDir.resolve("symbols");
112-
var systemModules = targetDir.resolve("system-modules");
112+
var modules = targetDir.resolve("modules");
113113

114114
try (Writer w = Files.newBufferedWriter(symbols)) {}
115-
try (Writer w = Files.newBufferedWriter(systemModules)) {}
115+
Files.createDirectories(modules);
116116

117117
main.invoke(null,
118118
(Object) new String[] {"build-description-incremental",
@@ -126,7 +126,8 @@ protected Class<?> findClass(String name) throws ClassNotFoundException {
126126
targetDir.resolve("ct.sym").toAbsolutePath().toString(),
127127
Long.toString(System.currentTimeMillis() / 1000),
128128
"" + SourceVersion.latest().ordinal(),
129-
systemModules.toAbsolutePath().toString()});
129+
"",
130+
modules.toAbsolutePath().toString()});
130131
}
131132
}
132133

0 commit comments

Comments
 (0)
Please sign in to comment.