Skip to content

Commit 642f45f

Browse files
author
Andy Herrick
committed
8261839: Error creating runtime package on macos without mac-package-identifier
Reviewed-by: asemenyuk, almatvee, kizune
1 parent 682e120 commit 642f45f

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,13 @@ public class MacAppImageBuilder extends AbstractAppImageBuilder {
110110
// Get identifier from app image if user provided
111111
// app image and did not provide the identifier via CLI.
112112
String identifier = extractBundleIdentifier(params);
113-
if (identifier != null) {
114-
return identifier;
113+
if (identifier == null) {
114+
identifier = MacAppBundler.getIdentifier(params);
115115
}
116-
117-
return MacAppBundler.getIdentifier(params);
116+
if (identifier == null) {
117+
identifier = APP_NAME.fetchFrom(params);
118+
}
119+
return identifier;
118120
},
119121
(s, p) -> s);
120122

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ JPackageCommand assertAppLayout() {
723723
.filter(path -> path.getFileName().equals(appImageFileName))
724724
.map(Path::toString)
725725
.collect(Collectors.toList());
726-
if (isImagePackageType() || TKit.isOSX()) {
726+
if (isImagePackageType() || (TKit.isOSX() && !isRuntime())) {
727727
List<String> expected = List.of(
728728
AppImageFile.getPathInAppImage(rootDir).toString());
729729
TKit.assertStringListEquals(expected, appImageFiles,
@@ -750,11 +750,11 @@ JPackageCommand assertAppLayout() {
750750
if (!isRuntime()) {
751751
TKit.assertExecutableFileExists(appLauncherPath());
752752
TKit.assertFileExists(appLauncherCfgPath(null));
753-
}
754753

755-
if (TKit.isOSX()) {
756-
TKit.assertFileExists(appRuntimeDirectory().resolve(
757-
"Contents/MacOS/libjli.dylib"));
754+
if (TKit.isOSX()) {
755+
TKit.assertFileExists(appRuntimeDirectory().resolve(
756+
"Contents/MacOS/libjli.dylib"));
757+
}
758758
}
759759

760760
return this;

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public static void withExplodedDmg(JPackageCommand cmd,
6262

6363
final Path mountPoint = Path.of(plist.queryValue("mount-point"));
6464
try {
65-
Path dmgImage = mountPoint.resolve(cmd.name() + ".app");
65+
Path dmgImage = mountPoint.resolve(cmd.name() +
66+
(cmd.isRuntime() ? "" : ".app"));
6667
TKit.trace(String.format("Exploded [%s] in [%s] directory",
6768
cmd.outputBundle(), dmgImage));
6869
ThrowingConsumer.toConsumer(consumer).accept(dmgImage);
@@ -215,7 +216,7 @@ static String getBundleName(JPackageCommand cmd) {
215216
static Path getInstallationDirectory(JPackageCommand cmd) {
216217
cmd.verifyIsOfType(PackageType.MAC);
217218
return Path.of(cmd.getArgumentValue("--install-dir", () -> "/Applications"))
218-
.resolve(cmd.name() + ".app");
219+
.resolve(cmd.name() + (cmd.isRuntime() ? "" : ".app"));
219220
}
220221

221222
private static String getPackageName(JPackageCommand cmd) {

test/jdk/tools/jpackage/share/RuntimePackageTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
* @library ../helpers
5454
* @key jpackagePlatformPackage
5555
* @build jdk.jpackage.test.*
56-
* @comment Temporary disable for OSX until functionality implemented
57-
* @requires (os.family != "mac")
5856
* @requires (jpackage.test.SQETest == null)
5957
* @modules jdk.jpackage/jdk.jpackage.internal
6058
* @compile RuntimePackageTest.java
@@ -68,8 +66,6 @@
6866
* @library ../helpers
6967
* @key jpackagePlatformPackage
7068
* @build jdk.jpackage.test.*
71-
* @comment Temporary disable for OSX until functionality implemented
72-
* @requires (os.family != "mac")
7369
* @requires (jpackage.test.SQETest != null)
7470
* @modules jdk.jpackage/jdk.jpackage.internal
7571
* @compile RuntimePackageTest.java
@@ -111,7 +107,11 @@ private static PackageTest init(Set<PackageType> types) {
111107
})
112108
.addInstallVerifier(cmd -> {
113109
Set<Path> srcRuntime = listFiles(Path.of(cmd.getArgumentValue("--runtime-image")));
114-
Set<Path> dstRuntime = listFiles(cmd.appRuntimeDirectory());
110+
Path dest = cmd.appRuntimeDirectory();
111+
if (TKit.isOSX()) {
112+
dest = dest.resolve("Contents/Home");
113+
}
114+
Set<Path> dstRuntime = listFiles(dest);
115115

116116
Set<Path> intersection = new HashSet<>(srcRuntime);
117117
intersection.retainAll(dstRuntime);

0 commit comments

Comments
 (0)