Skip to content
Permalink
Browse files
8237966: Creating runtime pkg requires --mac-package-identifier
Reviewed-by: kizune, asemenyuk, almatvee
  • Loading branch information
Andy Herrick committed Mar 3, 2020
1 parent aa54795 commit ef4053ee41ed31c127db38b9da38d2865f584ebc
Showing with 23 additions and 6 deletions.
  1. +23 −6 src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacPkgBundler.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -362,6 +362,7 @@ private String getRoot(Map<String, ? super Object> params,
String root = appLocation.getParent() == null ?
"." : appLocation.getParent();
File rootDir = new File(root);

File[] list = rootDir.listFiles();
if (list != null) { // Should not happend
// We should only have app image and/or .DS_Store
@@ -378,11 +379,25 @@ private String getRoot(Map<String, ? super Object> params,

// Copy to new root
Path newRoot = Files.createTempDirectory(
TEMP_ROOT.fetchFrom(params).toPath(),
"root-");

IOUtils.copyRecursive(appLocation.toPath(),
newRoot.resolve(appLocation.getName()));
TEMP_ROOT.fetchFrom(params).toPath(), "root-");

Path source, dest;

if (StandardBundlerParam.isRuntimeInstaller(params)) {
// firs, is this already a runtime with
// <runtime>/Contents/Home - if so we need the Home dir
Path original = appLocation.toPath();
Path home = original.resolve("Contents/Home");
source = (Files.exists(home)) ? home : original;

// Then we need to put back the <NAME>/Content/Home
dest = newRoot.resolve(
MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params) + "/Contents/Home");
} else {
source = appLocation.toPath();
dest = newRoot.resolve(appLocation.getName());
}
IOUtils.copyRecursive(source, dest);

return newRoot.toString();
}
@@ -422,6 +437,8 @@ private File createPKG(Map<String, ? super Object> params,
cpl.getAbsolutePath(),
"--scripts",
SCRIPTS_DIR.fetchFrom(params).getAbsolutePath(),
"--identifier",
MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params),
appPKG.getAbsolutePath());
IOUtils.exec(pb);

0 comments on commit ef4053e

Please sign in to comment.