8231910: Expose the APPDIR variable to applications that use jpackage JDK-8200758-branch
authorherrick
Wed, 09 Oct 2019 10:58:20 -0400
branchJDK-8200758-branch
changeset 58538 12c965587689
parent 58466 47f0d21c7e8d
child 58539 327232be010c
8231910: Expose the APPDIR variable to applications that use jpackage Reviewed-by: asemenyuk, almatvee
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/Info.plist.template
src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java
src/jdk.jpackage/share/native/libapplauncher/Macros.cpp
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java	Fri Oct 04 18:13:05 2019 -0400
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java	Wed Oct 09 10:58:20 2019 -0400
@@ -101,14 +101,15 @@
 
     @Override
     protected String getCfgAppDir() {
-        return Path.of("$APPDIR").resolve(
-                ApplicationLayout.linuxAppImage().appDirectory()).toString() + File.separator;
+        return Path.of("$ROOTDIR").resolve(
+                ApplicationLayout.linuxAppImage().appDirectory()).toString()
+                + File.separator;
     }
 
     @Override
     protected String getCfgRuntimeDir() {
-        return Path.of("$APPDIR").resolve(
-                ApplicationLayout.linuxAppImage().runtimeDirectory()).toString();
+        return Path.of("$ROOTDIR").resolve(
+              ApplicationLayout.linuxAppImage().runtimeDirectory()).toString();
     }
 
     @Override
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java	Fri Oct 04 18:13:05 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java	Wed Oct 09 10:58:20 2019 -0400
@@ -484,7 +484,6 @@
                 COPYRIGHT.fetchFrom(params) != null ?
                 COPYRIGHT.fetchFrom(params) : "Unknown");
         data.put("DEPLOY_LAUNCHER_NAME", getLauncherName(params));
-        data.put("DEPLOY_JAVA_RUNTIME_NAME", getCfgRuntimeDir());
         data.put("DEPLOY_BUNDLE_SHORT_VERSION",
                 VERSION.fetchFrom(params) != null ?
                 VERSION.fetchFrom(params) : "1.0.0");
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/Info.plist.template	Fri Oct 04 18:13:05 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
-  <key>LSMinimumSystemVersion</key>
-  <string>10.7.4</string>
-  <key>CFBundleDevelopmentRegion</key>
-  <string>English</string>
-  <key>CFBundleAllowMixedLocalizations</key>
-  <true/>
-  <key>CFBundleExecutable</key>
-  <string>DEPLOY_LAUNCHER_NAME</string>
-  <key>CFBundleIconFile</key>
-  <string>DEPLOY_ICON_FILE</string>
-  <key>CFBundleIdentifier</key>
-  <string>DEPLOY_BUNDLE_IDENTIFIER</string>
-  <key>CFBundleInfoDictionaryVersion</key>
-  <string>6.0</string>
-  <key>CFBundleName</key>
-  <string>DEPLOY_BUNDLE_NAME</string>
-  <key>CFBundlePackageType</key>
-  <string>APPL</string>
-  <key>CFBundleShortVersionString</key>
-  <string>DEPLOY_BUNDLE_SHORT_VERSION</string>
-  <key>CFBundleSignature</key>
-  <string>????</string>
-  <!-- See http://developer.apple.com/library/mac/#releasenotes/General/SubmittingToMacAppStore/_index.html
-       for list of AppStore categories -->
-  <key>LSApplicationCategoryType</key>
-  <string>DEPLOY_BUNDLE_CATEGORY</string>
-  <key>CFBundleVersion</key>
-  <string>DEPLOY_BUNDLE_CFBUNDLE_VERSION</string>
-  <key>NSHumanReadableCopyright</key>
-  <string>DEPLOY_BUNDLE_COPYRIGHT</string>
-  <key>JavaRuntime</key>
-  <string>DEPLOY_JAVA_RUNTIME_NAME</string>
-  <key>JavaMainClassName</key>
-  <string>DEPLOY_LAUNCHER_CLASS</string>
-  <key>JavaAppClasspath</key>
-  <string>DEPLOY_APP_CLASSPATH</string>
-  <key>JavaMainJarName</key>
-  <string>DEPLOY_MAIN_JAR_NAME</string>
-  <key>JavaOptions</key>
-  <array>
-DEPLOY_JAVA_OPTIONS
-  </array>
-  <key>ArgOptions</key>
-  <array>
-DEPLOY_ARGUMENTS
-  </array>DEPLOY_FILE_ASSOCIATIONS
-  <key>NSHighResolutionCapable</key>
-  <string>true</string>
- </dict>
-</plist>
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java	Fri Oct 04 18:13:05 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java	Wed Oct 09 10:58:20 2019 -0400
@@ -249,12 +249,12 @@
     }
 
     protected String getCfgAppDir() {
-        return "$APPDIR" + File.separator
+        return "$ROOTDIR" + File.separator
                 + getAppDir().getFileName() + File.separator;
     }
 
     protected String getCfgRuntimeDir() {
-        return "$APPDIR" + File.separator + "runtime";
+        return "$ROOTDIR" + File.separator + "runtime";
     }
 
     String getCfgClassPath(String classpath) {
--- a/src/jdk.jpackage/share/native/libapplauncher/Macros.cpp	Fri Oct 04 18:13:05 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/Macros.cpp	Wed Oct 09 10:58:20 2019 -0400
@@ -39,21 +39,9 @@
     Macros& macros = Macros::GetInstance();
 
     // Public macros.
-    macros.AddMacro(_T("$APPDIR"), package.GetPackageRootDirectory());
-    macros.AddMacro(_T("$PACKAGEDIR"), package.GetPackageAppDirectory());
-    macros.AddMacro(_T("$LAUNCHERDIR"), package.GetPackageLauncherDirectory());
-    macros.AddMacro(_T("$APPDATADIR"), package.GetAppDataDirectory());
-
-    TString javaHome =
-            FilePath::ExtractFilePath(package.GetJavaLibraryFileName());
-    macros.AddMacro(_T("$JREHOME"), javaHome);
-
-    // App CDS Macros
-    macros.AddMacro(_T("$CACHEDIR"), package.GetAppCDSCacheDirectory());
-
-    // Private macros.
-    TString javaVMLibraryName = FilePath::ExtractFileName(javaHome);
-    macros.AddMacro(_T("$JAVAVMLIBRARYNAME"), javaVMLibraryName);
+    macros.AddMacro(_T("$ROOTDIR"), package.GetPackageRootDirectory());
+    macros.AddMacro(_T("$APPDIR"), package.GetPackageAppDirectory());
+    macros.AddMacro(_T("$BINDIR"), package.GetPackageLauncherDirectory());
 }
 
 Macros& Macros::GetInstance() {
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java	Fri Oct 04 18:13:05 2019 -0400
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java	Wed Oct 09 10:58:20 2019 -0400
@@ -316,8 +316,6 @@
                     I18N.getString("error.parameters-null.advice"));
 
             // run basic validation to ensure requirements are met
-            // we are not interested in return code, only possible exception
-            validateWixTools();
 
             String lightVersion = findToolVersion(getLightPath());
             if (!VersionExtractor.isLessThan(lightVersion, "3.6")) {