JDK-8224788: jpackage fails on OS X when using --runtime-image
Reviewed-by: asemenyuk
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java Tue Jul 30 09:58:18 2019 +0300
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java Thu Aug 08 17:21:32 2019 -0400
@@ -355,6 +355,12 @@
sign();
}
+ @Override
+ File getRuntimeImageDir(File runtimeImageTop) {
+ File home = new File(runtimeImageTop, "Contents/Home");
+ return (home.exists() ? home : runtimeImageTop);
+ }
+
private void copyRuntimeFiles() throws IOException {
// Generate Info.plist
writeInfoPlist(contentsDir.resolve("Info.plist").toFile());
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Tue Jul 30 09:58:18 2019 +0300
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Thu Aug 08 17:21:32 2019 -0400
@@ -241,6 +241,10 @@
}
}
+ File getRuntimeImageDir(File runtimeImageTop) {
+ return runtimeImageTop;
+ }
+
String getCfgAppDir() {
return "$APPDIR" + File.separator
+ getAppDir().getFileName() + File.separator;
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Tue Jul 30 09:58:18 2019 +0300
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Thu Aug 08 17:21:32 2019 -0400
@@ -503,17 +503,18 @@
Map<String, ? super Object> params,
AbstractAppImageBuilder appBuilder)
throws IOException , ConfigException {
- File image = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params);
- if (!image.exists()) {
+ File topImage = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params);
+ if (!topImage.exists()) {
throw new ConfigException(
MessageFormat.format(I18N.getString(
"message.runtime-image-dir-does-not-exist"),
PREDEFINED_RUNTIME_IMAGE.getID(),
- image.toString()),
+ topImage.toString()),
MessageFormat.format(I18N.getString(
"message.runtime-image-dir-does-not-exist.advice"),
PREDEFINED_RUNTIME_IMAGE.getID()));
}
+ File image = appBuilder.getRuntimeImageDir(topImage);
// copy whole runtime, need to skip jmods and src.zip
final List<String> excludes = Arrays.asList("jmods", "src.zip");
IOUtils.copyRecursive(image.toPath(), appBuilder.getRoot(), excludes);