@@ -10059,17 +10059,45 @@ def _get_jdk_module_jar(module, suite, jdk):
10059
10059
jdkExplodedModule = join(jdk.home, 'modules', module)
10060
10060
jdkModules = join(jdk.home, 'lib', 'modules')
10061
10061
if not exists(jarPath) or TimeStampFile(jdkModules if exists(jdkModules) else jdkExplodedModule).isNewerThan(jarPath):
10062
+ def _classes_dir(start):
10063
+ """
10064
+ Searches for the directory containing the sources of `module` by traversing the
10065
+ ancestors of `start` and looking for ``*/src/<module>/share/classes``.
10066
+ """
10067
+ d = start
10068
+ while d != os.sep:
10069
+ for subdir in os.listdir(d):
10070
+ classes = join(d, subdir, 'src', module, 'share', 'classes')
10071
+ if exists(classes):
10072
+ return classes
10073
+ d = dirname(d)
10074
+
10075
+ # Try find the sources for `module` based on the assumption `jdk.home` is in the
10076
+ # build/ directory of a JDK9 repo.
10077
+ classes = _classes_dir(jdk.home)
10078
+ sourcesDirs = []
10079
+ if classes:
10080
+ if module == 'jdk.vm.ci':
10081
+ for subdir in os.listdir(classes):
10082
+ src = join(classes, subdir, 'src')
10083
+ if exists(src):
10084
+ sourcesDirs.append(src)
10085
+ else:
10086
+ sourcesDirs.append(classes)
10087
+
10062
10088
className = module.replace('.', '_') + '_ExtractJar'
10063
10089
javaSource = join(jdkOutputDir, className + '.java')
10064
10090
with open(javaSource, 'w') as fp:
10065
10091
print >> fp, """
10092
+ import java.io.File;
10066
10093
import java.io.FileOutputStream;
10067
10094
import java.io.IOException;
10068
10095
import java.net.URI;
10069
10096
import java.nio.file.FileSystem;
10070
10097
import java.nio.file.FileSystems;
10071
10098
import java.nio.file.Files;
10072
10099
import java.nio.file.Path;
10100
+ import java.nio.file.Paths;
10073
10101
import java.util.jar.JarEntry;
10074
10102
import java.util.jar.JarOutputStream;
10075
10103
import java.util.stream.Stream;
@@ -10098,12 +10126,31 @@ def _get_jdk_module_jar(module, suite, jdk):
10098
10126
}
10099
10127
});
10100
10128
}
10129
+ for (int i = 1; i < args.length; i++) {
10130
+ Path sourceDir = Paths.get(args[i]);
10131
+ int sourceDirLength = sourceDir.toString().length();
10132
+ try (Stream<Path> stream = Files.walk(sourceDir)) {
10133
+ stream.forEach(p -> {
10134
+ if (!p.toFile().isDirectory()) {
10135
+ String path = p.toString().substring(sourceDirLength + 1);
10136
+ JarEntry je = new JarEntry(path.replace(File.separatorChar, '/'));
10137
+ try {
10138
+ jos.putNextEntry(je);
10139
+ jos.write(Files.readAllBytes(p));
10140
+ jos.closeEntry();
10141
+ } catch (IOException e) {
10142
+ e.printStackTrace();
10143
+ }
10144
+ }
10145
+ });
10146
+ }
10147
+ }
10101
10148
}
10102
10149
}
10103
10150
}
10104
10151
""" % {"module" : module, "className" : className}
10105
10152
run([jdk.javac, '-d', jdkOutputDir, javaSource])
10106
- run([jdk.java, '-ea', '-cp', jdkOutputDir, className, jarPath])
10153
+ run([jdk.java, '-ea', '-cp', jdkOutputDir, className, jarPath] + sourcesDirs )
10107
10154
return jarPath
10108
10155
10109
10156
def _eclipseinit_project(p, files=None, libFiles=None):
@@ -13556,7 +13603,7 @@ def alarm_handler(signum, frame):
13556
13603
# no need to show the stack trace when the user presses CTRL-C
13557
13604
abort(1)
13558
13605
13559
- version = VersionSpec("5.25 .0")
13606
+ version = VersionSpec("5.26 .0")
13560
13607
13561
13608
currentUmask = None
13562
13609
0 commit comments