Skip to content

Commit

Permalink
8261839: Error creating runtime package on macos without mac-package-…
Browse files Browse the repository at this point in the history
…identifier

Reviewed-by: asemenyuk, almatvee, kizune
  • Loading branch information
Andy Herrick committed Mar 1, 2021
1 parent 682e120 commit 642f45f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ public class MacAppImageBuilder extends AbstractAppImageBuilder {
// Get identifier from app image if user provided
// app image and did not provide the identifier via CLI.
String identifier = extractBundleIdentifier(params);
if (identifier != null) {
return identifier;
if (identifier == null) {
identifier = MacAppBundler.getIdentifier(params);
}

return MacAppBundler.getIdentifier(params);
if (identifier == null) {
identifier = APP_NAME.fetchFrom(params);
}
return identifier;
},
(s, p) -> s);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ JPackageCommand assertAppLayout() {
.filter(path -> path.getFileName().equals(appImageFileName))
.map(Path::toString)
.collect(Collectors.toList());
if (isImagePackageType() || TKit.isOSX()) {
if (isImagePackageType() || (TKit.isOSX() && !isRuntime())) {
List<String> expected = List.of(
AppImageFile.getPathInAppImage(rootDir).toString());
TKit.assertStringListEquals(expected, appImageFiles,
Expand All @@ -750,11 +750,11 @@ JPackageCommand assertAppLayout() {
if (!isRuntime()) {
TKit.assertExecutableFileExists(appLauncherPath());
TKit.assertFileExists(appLauncherCfgPath(null));
}

if (TKit.isOSX()) {
TKit.assertFileExists(appRuntimeDirectory().resolve(
"Contents/MacOS/libjli.dylib"));
if (TKit.isOSX()) {
TKit.assertFileExists(appRuntimeDirectory().resolve(
"Contents/MacOS/libjli.dylib"));
}
}

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public static void withExplodedDmg(JPackageCommand cmd,

final Path mountPoint = Path.of(plist.queryValue("mount-point"));
try {
Path dmgImage = mountPoint.resolve(cmd.name() + ".app");
Path dmgImage = mountPoint.resolve(cmd.name() +
(cmd.isRuntime() ? "" : ".app"));
TKit.trace(String.format("Exploded [%s] in [%s] directory",
cmd.outputBundle(), dmgImage));
ThrowingConsumer.toConsumer(consumer).accept(dmgImage);
Expand Down Expand Up @@ -215,7 +216,7 @@ static String getBundleName(JPackageCommand cmd) {
static Path getInstallationDirectory(JPackageCommand cmd) {
cmd.verifyIsOfType(PackageType.MAC);
return Path.of(cmd.getArgumentValue("--install-dir", () -> "/Applications"))
.resolve(cmd.name() + ".app");
.resolve(cmd.name() + (cmd.isRuntime() ? "" : ".app"));
}

private static String getPackageName(JPackageCommand cmd) {
Expand Down
10 changes: 5 additions & 5 deletions test/jdk/tools/jpackage/share/RuntimePackageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
* @library ../helpers
* @key jpackagePlatformPackage
* @build jdk.jpackage.test.*
* @comment Temporary disable for OSX until functionality implemented
* @requires (os.family != "mac")
* @requires (jpackage.test.SQETest == null)
* @modules jdk.jpackage/jdk.jpackage.internal
* @compile RuntimePackageTest.java
Expand All @@ -68,8 +66,6 @@
* @library ../helpers
* @key jpackagePlatformPackage
* @build jdk.jpackage.test.*
* @comment Temporary disable for OSX until functionality implemented
* @requires (os.family != "mac")
* @requires (jpackage.test.SQETest != null)
* @modules jdk.jpackage/jdk.jpackage.internal
* @compile RuntimePackageTest.java
Expand Down Expand Up @@ -111,7 +107,11 @@ private static PackageTest init(Set<PackageType> types) {
})
.addInstallVerifier(cmd -> {
Set<Path> srcRuntime = listFiles(Path.of(cmd.getArgumentValue("--runtime-image")));
Set<Path> dstRuntime = listFiles(cmd.appRuntimeDirectory());
Path dest = cmd.appRuntimeDirectory();
if (TKit.isOSX()) {
dest = dest.resolve("Contents/Home");
}
Set<Path> dstRuntime = listFiles(dest);

Set<Path> intersection = new HashSet<>(srcRuntime);
intersection.retainAll(dstRuntime);
Expand Down

1 comment on commit 642f45f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.