mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8304914: Use OperatingSystem, Architecture, and Version in jpackage
Reviewed-by: asemenyuk
This commit is contained in:
parent
eae1f59da9
commit
c3cd481a9a
23 changed files with 104 additions and 195 deletions
|
@ -283,6 +283,7 @@ module java.base {
|
||||||
java.smartcardio,
|
java.smartcardio,
|
||||||
jdk.charsets,
|
jdk.charsets,
|
||||||
jdk.jlink,
|
jdk.jlink,
|
||||||
|
jdk.jpackage,
|
||||||
jdk.net;
|
jdk.net;
|
||||||
exports sun.net to
|
exports sun.net to
|
||||||
java.net.http,
|
java.net.http,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -46,6 +46,7 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
import static jdk.jpackage.internal.OverridableResource.createResource;
|
import static jdk.jpackage.internal.OverridableResource.createResource;
|
||||||
import static jdk.jpackage.internal.StandardBundlerParam.ABOUT_URL;
|
import static jdk.jpackage.internal.StandardBundlerParam.ABOUT_URL;
|
||||||
import static jdk.jpackage.internal.StandardBundlerParam.INSTALLER_NAME;
|
import static jdk.jpackage.internal.StandardBundlerParam.INSTALLER_NAME;
|
||||||
|
@ -508,7 +509,7 @@ public class LinuxDebBundler extends LinuxPackageBundler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supported(boolean runtimeInstaller) {
|
public boolean supported(boolean runtimeInstaller) {
|
||||||
return Platform.isLinux() && (new ToolValidator(TOOL_DPKG_DEB).validate() == null);
|
return OperatingSystem.isLinux() && (new ToolValidator(TOOL_DPKG_DEB).validate() == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -37,6 +37,7 @@ import java.util.Optional;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import static jdk.jpackage.internal.StandardBundlerParam.APP_NAME;
|
import static jdk.jpackage.internal.StandardBundlerParam.APP_NAME;
|
||||||
import static jdk.jpackage.internal.StandardBundlerParam.INSTALLER_NAME;
|
import static jdk.jpackage.internal.StandardBundlerParam.INSTALLER_NAME;
|
||||||
|
@ -331,7 +332,7 @@ public class LinuxRpmBundler extends LinuxPackageBundler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supported(boolean runtimeInstaller) {
|
public boolean supported(boolean runtimeInstaller) {
|
||||||
return Platform.isLinux() && (createRpmbuildToolValidator().validate() == null);
|
return OperatingSystem.isLinux() && (createRpmbuildToolValidator().validate() == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -49,6 +49,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.xpath.XPath;
|
import javax.xml.xpath.XPath;
|
||||||
import javax.xml.xpath.XPathConstants;
|
import javax.xml.xpath.XPathConstants;
|
||||||
import javax.xml.xpath.XPathFactory;
|
import javax.xml.xpath.XPathFactory;
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
import jdk.internal.util.OSVersion;
|
||||||
import static jdk.jpackage.internal.MacAppBundler.BUNDLE_ID_SIGNING_PREFIX;
|
import static jdk.jpackage.internal.MacAppBundler.BUNDLE_ID_SIGNING_PREFIX;
|
||||||
import static jdk.jpackage.internal.MacAppBundler.DEVELOPER_ID_APP_SIGNING_KEY;
|
import static jdk.jpackage.internal.MacAppBundler.DEVELOPER_ID_APP_SIGNING_KEY;
|
||||||
import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEYCHAIN;
|
import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEYCHAIN;
|
||||||
|
@ -401,7 +403,7 @@ public class MacAppImageBuilder extends AbstractAppImageBuilder {
|
||||||
ENTITLEMENTS.fetchFrom(params));
|
ENTITLEMENTS.fetchFrom(params));
|
||||||
}
|
}
|
||||||
restoreKeychainList(params);
|
restoreKeychainList(params);
|
||||||
} else if (Platform.isMac()) {
|
} else if (OperatingSystem.isMacOS()) {
|
||||||
signAppBundle(params, root, "-", null, null);
|
signAppBundle(params, root, "-", null, null);
|
||||||
} else {
|
} else {
|
||||||
// Calling signAppBundle() without signingIdentity will result in
|
// Calling signAppBundle() without signingIdentity will result in
|
||||||
|
@ -608,9 +610,7 @@ public class MacAppImageBuilder extends AbstractAppImageBuilder {
|
||||||
|
|
||||||
public static void addNewKeychain(Map<String, ? super Object> params)
|
public static void addNewKeychain(Map<String, ? super Object> params)
|
||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
if (Platform.getMajorVersion() < 10 ||
|
if (OSVersion.current().compareTo(new OSVersion(10, 12)) < 0) {
|
||||||
(Platform.getMajorVersion() == 10 &&
|
|
||||||
Platform.getMinorVersion() < 12)) {
|
|
||||||
// we need this for OS X 10.12+
|
// we need this for OS X 10.12+
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -662,9 +662,7 @@ public class MacAppImageBuilder extends AbstractAppImageBuilder {
|
||||||
|
|
||||||
public static void restoreKeychainList(Map<String, ? super Object> params)
|
public static void restoreKeychainList(Map<String, ? super Object> params)
|
||||||
throws IOException{
|
throws IOException{
|
||||||
if (Platform.getMajorVersion() < 10 ||
|
if (OSVersion.current().compareTo(new OSVersion(10, 12)) < 0) {
|
||||||
(Platform.getMajorVersion() == 10 &&
|
|
||||||
Platform.getMinorVersion() < 12)) {
|
|
||||||
// we need this for OS X 10.12+
|
// we need this for OS X 10.12+
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,9 @@
|
||||||
|
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.Architecture;
|
||||||
|
import jdk.internal.util.OSVersion;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -318,7 +321,7 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
|
||||||
xml.writeAttribute("customize", "never");
|
xml.writeAttribute("customize", "never");
|
||||||
xml.writeAttribute("require-scripts", "false");
|
xml.writeAttribute("require-scripts", "false");
|
||||||
xml.writeAttribute("hostArchitectures",
|
xml.writeAttribute("hostArchitectures",
|
||||||
Platform.isArmMac() ? "arm64" : "x86_64");
|
Architecture.isAARCH64() ? "arm64" : "x86_64");
|
||||||
xml.writeEndElement(); // </options>
|
xml.writeEndElement(); // </options>
|
||||||
xml.writeStartElement("choices-outline");
|
xml.writeStartElement("choices-outline");
|
||||||
xml.writeStartElement("line");
|
xml.writeStartElement("line");
|
||||||
|
@ -597,9 +600,7 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
|
||||||
// maybe sign
|
// maybe sign
|
||||||
if (Optional.ofNullable(
|
if (Optional.ofNullable(
|
||||||
SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.TRUE)) {
|
SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.TRUE)) {
|
||||||
if (Platform.getMajorVersion() > 10 ||
|
if (OSVersion.current().compareTo(new OSVersion(10, 12)) >= 0) {
|
||||||
(Platform.getMajorVersion() == 10 &&
|
|
||||||
Platform.getMinorVersion() >= 12)) {
|
|
||||||
// we need this for OS X 10.12+
|
// we need this for OS X 10.12+
|
||||||
Log.verbose(I18N.getString("message.signing.pkg"));
|
Log.verbose(I18N.getString("message.signing.pkg"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -30,6 +30,9 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import jdk.jpackage.internal.Arguments.CLIOptions;
|
import jdk.jpackage.internal.Arguments.CLIOptions;
|
||||||
import static jdk.jpackage.internal.StandardBundlerParam.LAUNCHER_DATA;
|
import static jdk.jpackage.internal.StandardBundlerParam.LAUNCHER_DATA;
|
||||||
import static jdk.jpackage.internal.StandardBundlerParam.APP_NAME;
|
import static jdk.jpackage.internal.StandardBundlerParam.APP_NAME;
|
||||||
|
@ -128,7 +131,7 @@ class AddLauncherArguments {
|
||||||
CLIOptions.LAUNCHER_AS_SERVICE.getId(), getOptionValue(
|
CLIOptions.LAUNCHER_AS_SERVICE.getId(), getOptionValue(
|
||||||
CLIOptions.LAUNCHER_AS_SERVICE));
|
CLIOptions.LAUNCHER_AS_SERVICE));
|
||||||
|
|
||||||
if (Platform.isWindows()) {
|
if (OperatingSystem.isWindows()) {
|
||||||
Arguments.putUnlessNull(bundleParams,
|
Arguments.putUnlessNull(bundleParams,
|
||||||
CLIOptions.WIN_CONSOLE_HINT.getId(),
|
CLIOptions.WIN_CONSOLE_HINT.getId(),
|
||||||
getOptionValue(CLIOptions.WIN_CONSOLE_HINT));
|
getOptionValue(CLIOptions.WIN_CONSOLE_HINT));
|
||||||
|
@ -138,7 +141,7 @@ class AddLauncherArguments {
|
||||||
getOptionValue(CLIOptions.WIN_MENU_HINT));
|
getOptionValue(CLIOptions.WIN_MENU_HINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.isLinux()) {
|
if (OperatingSystem.isLinux()) {
|
||||||
Arguments.putUnlessNull(bundleParams, CLIOptions.LINUX_CATEGORY.getId(),
|
Arguments.putUnlessNull(bundleParams, CLIOptions.LINUX_CATEGORY.getId(),
|
||||||
getOptionValue(CLIOptions.LINUX_CATEGORY));
|
getOptionValue(CLIOptions.LINUX_CATEGORY));
|
||||||
Arguments.putUnlessNull(bundleParams, SHORTCUT_HINT.getID(),
|
Arguments.putUnlessNull(bundleParams, SHORTCUT_HINT.getID(),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
@ -138,7 +140,7 @@ class AppImageBundler extends AbstractBundler {
|
||||||
IOUtils.writableOutputDir(outputDirectory);
|
IOUtils.writableOutputDir(outputDirectory);
|
||||||
|
|
||||||
String imageName = APP_NAME.fetchFrom(params);
|
String imageName = APP_NAME.fetchFrom(params);
|
||||||
if (Platform.isMac()) {
|
if (OperatingSystem.isMacOS()) {
|
||||||
imageName = imageName + ".app";
|
imageName = imageName + ".app";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -42,6 +42,8 @@ import javax.xml.xpath.XPath;
|
||||||
import javax.xml.xpath.XPathConstants;
|
import javax.xml.xpath.XPathConstants;
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
import javax.xml.xpath.XPathExpressionException;
|
||||||
import javax.xml.xpath.XPathFactory;
|
import javax.xml.xpath.XPathFactory;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
@ -72,9 +74,10 @@ public final class AppImageFile {
|
||||||
|
|
||||||
private static final String FILENAME = ".jpackage.xml";
|
private static final String FILENAME = ".jpackage.xml";
|
||||||
|
|
||||||
private static final Map<Platform, String> PLATFORM_LABELS = Map.of(
|
private static final Map<OperatingSystem, String> PLATFORM_LABELS = Map.of(
|
||||||
Platform.LINUX, "linux", Platform.WINDOWS, "windows", Platform.MAC,
|
OperatingSystem.LINUX, "linux",
|
||||||
"macOS");
|
OperatingSystem.WINDOWS, "windows",
|
||||||
|
OperatingSystem.MACOS, "macOS");
|
||||||
|
|
||||||
private AppImageFile(Path appImageDir, String appVersion, String launcherName,
|
private AppImageFile(Path appImageDir, String appVersion, String launcherName,
|
||||||
String mainClass, List<LauncherInfo> launcherInfos,
|
String mainClass, List<LauncherInfo> launcherInfos,
|
||||||
|
@ -434,7 +437,7 @@ public final class AppImageFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPlatform() {
|
public static String getPlatform() {
|
||||||
return PLATFORM_LABELS.get(Platform.getPlatform());
|
return PLATFORM_LABELS.get(OperatingSystem.current());
|
||||||
}
|
}
|
||||||
|
|
||||||
static class LauncherInfo {
|
static class LauncherInfo {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -24,6 +24,8 @@
|
||||||
*/
|
*/
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -179,19 +181,19 @@ public final class ApplicationLayout implements PathGroup.Facade<ApplicationLayo
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ApplicationLayout platformAppImage() {
|
public static ApplicationLayout platformAppImage() {
|
||||||
if (Platform.isWindows()) {
|
if (OperatingSystem.isWindows()) {
|
||||||
return windowsAppImage();
|
return windowsAppImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.isLinux()) {
|
if (OperatingSystem.isLinux()) {
|
||||||
return linuxAppImage();
|
return linuxAppImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.isMac()) {
|
if (OperatingSystem.isMacOS()) {
|
||||||
return macAppImage();
|
return macAppImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw Platform.throwUnknownPlatformError();
|
throw new IllegalArgumentException("Unknown platform: " + OperatingSystem.current());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ApplicationLayout javaRuntime() {
|
public static ApplicationLayout javaRuntime() {
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
*/
|
*/
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
@ -578,7 +580,7 @@ public class Arguments {
|
||||||
boolean hasRuntime = allOptions.contains(
|
boolean hasRuntime = allOptions.contains(
|
||||||
CLIOptions.PREDEFINED_RUNTIME_IMAGE);
|
CLIOptions.PREDEFINED_RUNTIME_IMAGE);
|
||||||
boolean installerOnly = !imageOnly && hasAppImage;
|
boolean installerOnly = !imageOnly && hasAppImage;
|
||||||
boolean isMac = Platform.isMac();
|
boolean isMac = OperatingSystem.isMacOS();
|
||||||
runtimeInstaller = !imageOnly && hasRuntime && !hasAppImage &&
|
runtimeInstaller = !imageOnly && hasRuntime && !hasAppImage &&
|
||||||
!hasMainModule && !hasMainJar;
|
!hasMainModule && !hasMainJar;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
@ -46,8 +48,7 @@ public class CLIHelp {
|
||||||
if (noArgs) {
|
if (noArgs) {
|
||||||
Log.info(I18N.getString("MSG_Help_no_args"));
|
Log.info(I18N.getString("MSG_Help_no_args"));
|
||||||
} else {
|
} else {
|
||||||
Platform platform = (Log.isVerbose()) ?
|
OperatingSystem platform = OperatingSystem.current();
|
||||||
Platform.UNKNOWN : Platform.getPlatform();
|
|
||||||
String types;
|
String types;
|
||||||
String pLaunchOptions;
|
String pLaunchOptions;
|
||||||
String pInstallOptions;
|
String pInstallOptions;
|
||||||
|
@ -55,7 +56,7 @@ public class CLIHelp {
|
||||||
String pAppImageDescription;
|
String pAppImageDescription;
|
||||||
String pSignSampleUsage;
|
String pSignSampleUsage;
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case MAC:
|
case MACOS:
|
||||||
types = "{\"app-image\", \"dmg\", \"pkg\"}";
|
types = "{\"app-image\", \"dmg\", \"pkg\"}";
|
||||||
pLaunchOptions = I18N.getString("MSG_Help_mac_launcher");
|
pLaunchOptions = I18N.getString("MSG_Help_mac_launcher");
|
||||||
pInstallOptions = I18N.getString("MSG_Help_mac_install");
|
pInstallOptions = I18N.getString("MSG_Help_mac_install");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -24,6 +24,8 @@
|
||||||
*/
|
*/
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
class I18N {
|
class I18N {
|
||||||
|
@ -41,13 +43,13 @@ class I18N {
|
||||||
private static final ResourceBundle PLATFORM;
|
private static final ResourceBundle PLATFORM;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (Platform.isLinux()) {
|
if (OperatingSystem.isLinux()) {
|
||||||
PLATFORM = ResourceBundle.getBundle(
|
PLATFORM = ResourceBundle.getBundle(
|
||||||
"jdk.jpackage.internal.resources.LinuxResources");
|
"jdk.jpackage.internal.resources.LinuxResources");
|
||||||
} else if (Platform.isWindows()) {
|
} else if (OperatingSystem.isWindows()) {
|
||||||
PLATFORM = ResourceBundle.getBundle(
|
PLATFORM = ResourceBundle.getBundle(
|
||||||
"jdk.jpackage.internal.resources.WinResources");
|
"jdk.jpackage.internal.resources.WinResources");
|
||||||
} else if (Platform.isMac()) {
|
} else if (OperatingSystem.isMacOS()) {
|
||||||
PLATFORM = ResourceBundle.getBundle(
|
PLATFORM = ResourceBundle.getBundle(
|
||||||
"jdk.jpackage.internal.resources.MacResources");
|
"jdk.jpackage.internal.resources.MacResources");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -77,7 +79,7 @@ public class IOUtils {
|
||||||
@Override
|
@Override
|
||||||
public FileVisitResult visitFile(Path file,
|
public FileVisitResult visitFile(Path file,
|
||||||
BasicFileAttributes attr) throws IOException {
|
BasicFileAttributes attr) throws IOException {
|
||||||
if (Platform.getPlatform() == Platform.WINDOWS) {
|
if (OperatingSystem.isWindows()) {
|
||||||
Files.setAttribute(file, "dos:readonly", false);
|
Files.setAttribute(file, "dos:readonly", false);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -91,7 +93,7 @@ public class IOUtils {
|
||||||
@Override
|
@Override
|
||||||
public FileVisitResult preVisitDirectory(Path dir,
|
public FileVisitResult preVisitDirectory(Path dir,
|
||||||
BasicFileAttributes attr) throws IOException {
|
BasicFileAttributes attr) throws IOException {
|
||||||
if (Platform.getPlatform() == Platform.WINDOWS) {
|
if (OperatingSystem.isWindows()) {
|
||||||
Files.setAttribute(dir, "dos:readonly", false);
|
Files.setAttribute(dir, "dos:readonly", false);
|
||||||
}
|
}
|
||||||
return FileVisitResult.CONTINUE;
|
return FileVisitResult.CONTINUE;
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
*/
|
*/
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
@ -358,7 +360,7 @@ final class LauncherData {
|
||||||
// of `release` file.
|
// of `release` file.
|
||||||
|
|
||||||
final Path releaseFile;
|
final Path releaseFile;
|
||||||
if (!Platform.isMac()) {
|
if (!OperatingSystem.isMacOS()) {
|
||||||
releaseFile = cookedRuntime.resolve("release");
|
releaseFile = cookedRuntime.resolve("release");
|
||||||
} else {
|
} else {
|
||||||
// On Mac `cookedRuntime` can be runtime root or runtime home.
|
// On Mac `cookedRuntime` can be runtime root or runtime home.
|
||||||
|
|
|
@ -1,125 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2016, 2022, 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
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package jdk.jpackage.internal;
|
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Platform
|
|
||||||
*
|
|
||||||
* Use <code>Platform</code> to detect the operating system
|
|
||||||
* that is currently running.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
*
|
|
||||||
* Platform platform = Platform.getPlatform();
|
|
||||||
*
|
|
||||||
* switch(platform) {
|
|
||||||
* case Platform.MAC: {
|
|
||||||
* // Do something
|
|
||||||
* break;
|
|
||||||
* }
|
|
||||||
* case Platform.WINDOWS:
|
|
||||||
* case Platform.LINUX: {
|
|
||||||
* // Do something else
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
enum Platform {UNKNOWN, WINDOWS, LINUX, MAC;
|
|
||||||
private static final Platform platform;
|
|
||||||
private static final int majorVersion;
|
|
||||||
private static final int minorVersion;
|
|
||||||
|
|
||||||
static {
|
|
||||||
String os = System.getProperty("os.name").toLowerCase();
|
|
||||||
|
|
||||||
if (os.indexOf("win") >= 0) {
|
|
||||||
platform = Platform.WINDOWS;
|
|
||||||
}
|
|
||||||
else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) {
|
|
||||||
platform = Platform.LINUX;
|
|
||||||
}
|
|
||||||
else if (os.indexOf("mac") >= 0) {
|
|
||||||
platform = Platform.MAC;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
platform = Platform.UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
String version = System.getProperty("os.version");
|
|
||||||
String[] parts = version.split(Pattern.quote("."));
|
|
||||||
|
|
||||||
if (parts.length > 0) {
|
|
||||||
majorVersion = Integer.parseInt(parts[0]);
|
|
||||||
|
|
||||||
if (parts.length > 1) {
|
|
||||||
minorVersion = Integer.parseInt(parts[1]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
minorVersion = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
majorVersion = -1;
|
|
||||||
minorVersion = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Platform() {}
|
|
||||||
|
|
||||||
static Platform getPlatform() {
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int getMajorVersion() {
|
|
||||||
return majorVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int getMinorVersion() {
|
|
||||||
return minorVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean isWindows() {
|
|
||||||
return getPlatform() == WINDOWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean isMac() {
|
|
||||||
return getPlatform() == MAC;
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean isArmMac() {
|
|
||||||
return (isMac() && "aarch64".equals(System.getProperty("os.arch")));
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean isLinux() {
|
|
||||||
return getPlatform() == LINUX;
|
|
||||||
}
|
|
||||||
|
|
||||||
static RuntimeException throwUnknownPlatformError() {
|
|
||||||
throw new IllegalArgumentException("Unknown platform");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
@ -99,14 +101,14 @@ class ScriptRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String shell() {
|
private static String shell() {
|
||||||
if (Platform.isWindows()) {
|
if (OperatingSystem.isWindows()) {
|
||||||
return "cscript";
|
return "cscript";
|
||||||
}
|
}
|
||||||
return Optional.ofNullable(System.getenv("SHELL")).orElseGet(() -> "sh");
|
return Optional.ofNullable(System.getenv("SHELL")).orElseGet(() -> "sh");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String scriptSuffix() {
|
private static String scriptSuffix() {
|
||||||
if (Platform.isWindows()) {
|
if (OperatingSystem.isWindows()) {
|
||||||
return ".wsf";
|
return ".wsf";
|
||||||
}
|
}
|
||||||
return ".sh";
|
return ".sh";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
@ -582,7 +584,7 @@ class StandardBundlerParam<T> extends BundlerParamInfo<T> {
|
||||||
PREDEFINED_RUNTIME_IMAGE.getID()));
|
PREDEFINED_RUNTIME_IMAGE.getID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.isMac()) {
|
if (OperatingSystem.isMacOS()) {
|
||||||
// On Mac topImage can be runtime root or runtime home.
|
// On Mac topImage can be runtime root or runtime home.
|
||||||
Path runtimeHome = topImage.resolve("Contents/Home");
|
Path runtimeHome = topImage.resolve("Contents/Home");
|
||||||
if (Files.isDirectory(runtimeHome)) {
|
if (Files.isDirectory(runtimeHome)) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -24,6 +24,8 @@
|
||||||
*/
|
*/
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
@ -45,7 +47,7 @@ public final class ToolValidator {
|
||||||
this.toolPath = toolPath;
|
this.toolPath = toolPath;
|
||||||
args = new ArrayList<>();
|
args = new ArrayList<>();
|
||||||
|
|
||||||
if (Platform.getPlatform() == Platform.LINUX) {
|
if (OperatingSystem.isLinux()) {
|
||||||
setCommandLine("--version");
|
setCommandLine("--version");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -27,6 +27,7 @@ package jdk.jpackage.internal;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
import jdk.jpackage.internal.Arguments.CLIOptions;
|
import jdk.jpackage.internal.Arguments.CLIOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,7 +95,7 @@ class ValidOptions {
|
||||||
put(CLIOptions.LICENSE_FILE.getId(), USE.INSTALL);
|
put(CLIOptions.LICENSE_FILE.getId(), USE.INSTALL);
|
||||||
put(CLIOptions.INSTALL_DIR.getId(), USE.INSTALL);
|
put(CLIOptions.INSTALL_DIR.getId(), USE.INSTALL);
|
||||||
put(CLIOptions.PREDEFINED_APP_IMAGE.getId(),
|
put(CLIOptions.PREDEFINED_APP_IMAGE.getId(),
|
||||||
(Platform.getPlatform() == Platform.MAC) ?
|
(OperatingSystem.isMacOS()) ?
|
||||||
EnumSet.of(USE.INSTALL, USE.SIGN) :
|
EnumSet.of(USE.INSTALL, USE.SIGN) :
|
||||||
EnumSet.of(USE.INSTALL));
|
EnumSet.of(USE.INSTALL));
|
||||||
put(CLIOptions.LAUNCHER_AS_SERVICE.getId(), USE.INSTALL);
|
put(CLIOptions.LAUNCHER_AS_SERVICE.getId(), USE.INSTALL);
|
||||||
|
@ -102,9 +103,9 @@ class ValidOptions {
|
||||||
put(CLIOptions.ABOUT_URL.getId(), USE.INSTALL);
|
put(CLIOptions.ABOUT_URL.getId(), USE.INSTALL);
|
||||||
|
|
||||||
put(CLIOptions.FILE_ASSOCIATIONS.getId(),
|
put(CLIOptions.FILE_ASSOCIATIONS.getId(),
|
||||||
(Platform.getPlatform() == Platform.MAC) ? USE.ALL : USE.INSTALL);
|
(OperatingSystem.isMacOS()) ? USE.ALL : USE.INSTALL);
|
||||||
|
|
||||||
if (Platform.getPlatform() == Platform.WINDOWS) {
|
if (OperatingSystem.isWindows()) {
|
||||||
put(CLIOptions.WIN_CONSOLE_HINT.getId(), USE.LAUNCHER);
|
put(CLIOptions.WIN_CONSOLE_HINT.getId(), USE.LAUNCHER);
|
||||||
|
|
||||||
put(CLIOptions.WIN_HELP_URL.getId(), USE.INSTALL);
|
put(CLIOptions.WIN_HELP_URL.getId(), USE.INSTALL);
|
||||||
|
@ -120,7 +121,7 @@ class ValidOptions {
|
||||||
USE.INSTALL);
|
USE.INSTALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.getPlatform() == Platform.MAC) {
|
if (OperatingSystem.isMacOS()) {
|
||||||
put(CLIOptions.MAC_SIGN.getId(),
|
put(CLIOptions.MAC_SIGN.getId(),
|
||||||
EnumSet.of(USE.ALL, USE.SIGN));
|
EnumSet.of(USE.ALL, USE.SIGN));
|
||||||
put(CLIOptions.MAC_BUNDLE_NAME.getId(), USE.ALL);
|
put(CLIOptions.MAC_BUNDLE_NAME.getId(), USE.ALL);
|
||||||
|
@ -138,7 +139,7 @@ class ValidOptions {
|
||||||
put(CLIOptions.DMG_CONTENT.getId(), USE.INSTALL);
|
put(CLIOptions.DMG_CONTENT.getId(), USE.INSTALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.getPlatform() == Platform.LINUX) {
|
if (OperatingSystem.isLinux()) {
|
||||||
put(CLIOptions.LINUX_BUNDLE_NAME.getId(), USE.INSTALL);
|
put(CLIOptions.LINUX_BUNDLE_NAME.getId(), USE.INSTALL);
|
||||||
put(CLIOptions.LINUX_DEB_MAINTAINER.getId(), USE.INSTALL);
|
put(CLIOptions.LINUX_DEB_MAINTAINER.getId(), USE.INSTALL);
|
||||||
put(CLIOptions.LINUX_CATEGORY.getId(), USE.INSTALL);
|
put(CLIOptions.LINUX_CATEGORY.getId(), USE.INSTALL);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,6 +26,8 @@
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
|
import jdk.internal.util.OSVersion;
|
||||||
|
|
||||||
final class WindowsDefender {
|
final class WindowsDefender {
|
||||||
|
|
||||||
|
@ -34,8 +36,8 @@ final class WindowsDefender {
|
||||||
static final boolean isThereAPotentialWindowsDefenderIssue(String dir) {
|
static final boolean isThereAPotentialWindowsDefenderIssue(String dir) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
if (Platform.getPlatform() == Platform.WINDOWS &&
|
if (OperatingSystem.isWindows() &&
|
||||||
Platform.getMajorVersion() == 10) {
|
OSVersion.current().major() == 10) {
|
||||||
|
|
||||||
// If DisableRealtimeMonitoring is not enabled then there
|
// If DisableRealtimeMonitoring is not enabled then there
|
||||||
// may be a problem.
|
// may be a problem.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -42,6 +42,7 @@ import jdk.jpackage.internal.IOUtils.XmlConsumer;
|
||||||
import jdk.jpackage.internal.OverridableResource.Source;
|
import jdk.jpackage.internal.OverridableResource.Source;
|
||||||
import static jdk.jpackage.internal.OverridableResource.createResource;
|
import static jdk.jpackage.internal.OverridableResource.createResource;
|
||||||
import static jdk.jpackage.internal.StandardBundlerParam.CONFIG_ROOT;
|
import static jdk.jpackage.internal.StandardBundlerParam.CONFIG_ROOT;
|
||||||
|
import jdk.internal.util.Architecture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates WiX fragment.
|
* Creates WiX fragment.
|
||||||
|
@ -102,7 +103,7 @@ abstract class WixFragmentBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean is64Bit() {
|
static boolean is64Bit() {
|
||||||
return !("x86".equals(System.getProperty("os.arch")));
|
return Architecture.is64bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Path getConfigRoot() {
|
protected Path getConfigRoot() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,6 +32,8 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
import jdk.jpackage.internal.resources.ResourceLocator;
|
import jdk.jpackage.internal.resources.ResourceLocator;
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
import static org.hamcrest.CoreMatchers.not;
|
import static org.hamcrest.CoreMatchers.not;
|
||||||
|
@ -198,17 +200,17 @@ public class OverridableResourceTest {
|
||||||
private final static String DEFAULT_NAME;
|
private final static String DEFAULT_NAME;
|
||||||
private final static Map<String, String> SUBSTITUTION_DATA;
|
private final static Map<String, String> SUBSTITUTION_DATA;
|
||||||
static {
|
static {
|
||||||
if (Platform.isWindows()) {
|
if (OperatingSystem.isWindows()) {
|
||||||
DEFAULT_NAME = "WinLauncher.template";
|
DEFAULT_NAME = "WinLauncher.template";
|
||||||
SUBSTITUTION_DATA = Map.of("COMPANY_NAME", "Foo9090345");
|
SUBSTITUTION_DATA = Map.of("COMPANY_NAME", "Foo9090345");
|
||||||
} else if (Platform.isLinux()) {
|
} else if (OperatingSystem.isLinux()) {
|
||||||
DEFAULT_NAME = "template.control";
|
DEFAULT_NAME = "template.control";
|
||||||
SUBSTITUTION_DATA = Map.of("APPLICATION_PACKAGE", "Package1967");
|
SUBSTITUTION_DATA = Map.of("APPLICATION_PACKAGE", "Package1967");
|
||||||
} else if (Platform.isMac()) {
|
} else if (OperatingSystem.isMacOS()) {
|
||||||
DEFAULT_NAME = "Info-lite.plist.template";
|
DEFAULT_NAME = "Info-lite.plist.template";
|
||||||
SUBSTITUTION_DATA = Map.of("DEPLOY_BUNDLE_IDENTIFIER", "12345");
|
SUBSTITUTION_DATA = Map.of("DEPLOY_BUNDLE_IDENTIFIER", "12345");
|
||||||
} else {
|
} else {
|
||||||
throw Platform.throwUnknownPlatformError();
|
throw new IllegalArgumentException("Unknown platform: " + OperatingSystem.current());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
package jdk.jpackage.internal;
|
package jdk.jpackage.internal;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
import static org.hamcrest.CoreMatchers.not;
|
import static org.hamcrest.CoreMatchers.not;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
|
@ -93,7 +94,7 @@ public class ToolValidatorTest {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
String fname = "java";
|
String fname = "java";
|
||||||
if (Platform.isWindows()) {
|
if (OperatingSystem.isWindows()) {
|
||||||
fname = fname + ".exe";
|
fname = fname + ".exe";
|
||||||
}
|
}
|
||||||
TOOL_JAVA = Path.of(System.getProperty("java.home"), "bin", fname).toString();
|
TOOL_JAVA = Path.of(System.getProperty("java.home"), "bin", fname).toString();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue