8237971: Package type for runtime image on macosx
Reviewed-by: asemenyuk, almatvee
This commit is contained in:
parent
6bd9391f03
commit
840c3050e9
@ -83,17 +83,6 @@ public abstract class MacBaseInstallerBundler extends AbstractBundler {
|
||||
params -> "",
|
||||
null);
|
||||
|
||||
public static final BundlerParamInfo<String> MAC_INSTALL_DIR =
|
||||
new StandardBundlerParam<>(
|
||||
"mac-install-dir",
|
||||
String.class,
|
||||
params -> {
|
||||
String dir = INSTALL_DIR.fetchFrom(params);
|
||||
return (dir != null) ? dir : "/Applications";
|
||||
},
|
||||
(s, p) -> s
|
||||
);
|
||||
|
||||
public static final BundlerParamInfo<String> INSTALLER_NAME =
|
||||
new StandardBundlerParam<> (
|
||||
"mac.installerName",
|
||||
@ -111,6 +100,19 @@ public abstract class MacBaseInstallerBundler extends AbstractBundler {
|
||||
},
|
||||
(s, p) -> s);
|
||||
|
||||
protected static String getInstallDir(
|
||||
Map<String, ? super Object> params) {
|
||||
String returnValue = INSTALL_DIR.fetchFrom(params);
|
||||
if (returnValue == null) {
|
||||
if (StandardBundlerParam.isRuntimeInstaller(params)) {
|
||||
returnValue = "/Library/Java/JavaVirtualMachines";
|
||||
} else {
|
||||
returnValue = "/Applications";
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
protected void validateAppImageAndBundeler(
|
||||
Map<String, ? super Object> params) throws ConfigException {
|
||||
if (PREDEFINED_APP_IMAGE.fetchFrom(params) != null) {
|
||||
|
@ -68,9 +68,9 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
|
||||
File appImageDir = APP_IMAGE_TEMP_ROOT.fetchFrom(params);
|
||||
try {
|
||||
appImageDir.mkdirs();
|
||||
File appLocation = prepareAppBundle(params);
|
||||
|
||||
if (prepareAppBundle(params) != null &&
|
||||
prepareConfigFiles(params)) {
|
||||
if (appLocation != null && prepareConfigFiles(params)) {
|
||||
File configScript = getConfig_Script(params);
|
||||
if (configScript.exists()) {
|
||||
Log.verbose(MessageFormat.format(
|
||||
@ -79,7 +79,7 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
|
||||
IOUtils.run("bash", configScript);
|
||||
}
|
||||
|
||||
return buildDMG(params, outdir);
|
||||
return buildDMG(params, appLocation, outdir);
|
||||
}
|
||||
return null;
|
||||
} catch (IOException ex) {
|
||||
@ -117,8 +117,7 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
|
||||
data.put("DEPLOY_VOLUME_PATH", volumePath.toString());
|
||||
data.put("DEPLOY_APPLICATION_NAME", APP_NAME.fetchFrom(params));
|
||||
|
||||
data.put("DEPLOY_INSTALL_LOCATION", MAC_INSTALL_DIR.fetchFrom(params));
|
||||
data.put("DEPLOY_INSTALL_NAME", MAC_INSTALL_DIR.fetchFrom(params));
|
||||
data.put("DEPLOY_INSTALL_LOCATION", getInstallDir(params));
|
||||
|
||||
createResource(DEFAULT_DMG_SETUP_SCRIPT, params)
|
||||
.setCategory(I18N.getString("resource.dmg-setup-script"))
|
||||
@ -253,9 +252,8 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
|
||||
return null;
|
||||
}
|
||||
|
||||
private File buildDMG(
|
||||
Map<String, ? super Object> params, File outdir)
|
||||
throws IOException {
|
||||
private File buildDMG( Map<String, ? super Object> params,
|
||||
File appLocation, File outdir) throws IOException {
|
||||
File imagesRoot = IMAGES_ROOT.fetchFrom(params);
|
||||
if (!imagesRoot.exists()) imagesRoot.mkdirs();
|
||||
|
||||
@ -269,6 +267,24 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
|
||||
StandardBundlerParam.getPredefinedAppImage(params);
|
||||
if (predefinedImage != null) {
|
||||
srcFolder = predefinedImage;
|
||||
} else if (StandardBundlerParam.isRuntimeInstaller(params)) {
|
||||
Path newRoot = Files.createTempDirectory(
|
||||
TEMP_ROOT.fetchFrom(params).toPath(), "root-");
|
||||
|
||||
// first, 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");
|
||||
Path source = (Files.exists(home)) ? home : original;
|
||||
|
||||
// Then we need to put back the <NAME>/Content/Home
|
||||
Path root = newRoot.resolve(
|
||||
MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params));
|
||||
Path dest = root.resolve("Contents/Home");
|
||||
|
||||
IOUtils.copyRecursive(source, dest);
|
||||
|
||||
srcFolder = newRoot.toFile();
|
||||
}
|
||||
|
||||
Log.verbose(MessageFormat.format(I18N.getString(
|
||||
|
@ -176,10 +176,10 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
|
||||
|
||||
Map<String, String> data = new HashMap<>();
|
||||
|
||||
Path appLocation = Path.of(MAC_INSTALL_DIR.fetchFrom(params),
|
||||
Path appLocation = Path.of(getInstallDir(params),
|
||||
APP_NAME.fetchFrom(params) + ".app", "Contents", "app");
|
||||
|
||||
data.put("INSTALL_LOCATION", MAC_INSTALL_DIR.fetchFrom(params));
|
||||
data.put("INSTALL_LOCATION", getInstallDir(params));
|
||||
data.put("APP_LOCATION", appLocation.toString());
|
||||
|
||||
createResource(TEMPLATE_PREINSTALL_SCRIPT, params)
|
||||
@ -406,7 +406,7 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
|
||||
"--root",
|
||||
root,
|
||||
"--install-location",
|
||||
MAC_INSTALL_DIR.fetchFrom(params),
|
||||
getInstallDir(params),
|
||||
"--analyze",
|
||||
cpl.getAbsolutePath());
|
||||
|
||||
@ -421,7 +421,7 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
|
||||
"--root",
|
||||
root,
|
||||
"--install-location",
|
||||
MAC_INSTALL_DIR.fetchFrom(params),
|
||||
getInstallDir(params),
|
||||
"--component-plist",
|
||||
cpl.getAbsolutePath(),
|
||||
"--scripts",
|
||||
|
@ -8,8 +8,8 @@ tell application "Finder"
|
||||
set toolbar visible of theWindow to false
|
||||
set statusbar visible of theWindow to false
|
||||
|
||||
-- size of window should match size of background
|
||||
set the bounds of theWindow to {400, 100, 917, 380}
|
||||
-- size of window should fit the size of background
|
||||
set the bounds of theWindow to {400, 100, 920, 440}
|
||||
|
||||
set theViewOptions to a reference to the icon view options of theWindow
|
||||
set arrangement of theViewOptions to not arranged
|
||||
@ -17,20 +17,17 @@ tell application "Finder"
|
||||
set background picture of theViewOptions to POSIX file "DEPLOY_BG_FILE"
|
||||
|
||||
-- Create alias for install location
|
||||
make new alias file at POSIX file "DEPLOY_VOLUME_PATH" to POSIX file "DEPLOY_INSTALL_LOCATION" with properties {name:"DEPLOY_INSTALL_NAME"}
|
||||
make new alias file at POSIX file "DEPLOY_VOLUME_PATH" to POSIX file "DEPLOY_INSTALL_LOCATION" with properties {name:"DEPLOY_INSTALL_LOCATION"}
|
||||
|
||||
set allTheFiles to the name of every item of theWindow
|
||||
repeat with theFile in allTheFiles
|
||||
set theFilePath to POSIX path of theFile
|
||||
if theFilePath is "/DEPLOY_APPLICATION_NAME.app" then
|
||||
-- Position application location
|
||||
set position of item theFile of theWindow to {120, 130}
|
||||
else if theFilePath is "DEPLOY_INSTALL_NAME" then
|
||||
if theFilePath is "DEPLOY_INSTALL_LOCATION" then
|
||||
-- Position install location
|
||||
set position of item theFile of theWindow to {390, 130}
|
||||
else
|
||||
-- Move all other files far enough to be not visible if user has "show hidden files" option set
|
||||
set position of item theFile of theWindow to {1000, 130}
|
||||
-- Position application or runtime
|
||||
set position of item theFile of theWindow to {120, 130}
|
||||
end if
|
||||
end repeat
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user