8217895: jpackage --identifer purpose JDK-8200758-branch
authorherrick
Fri, 12 Apr 2019 10:54:10 -0400
branchJDK-8200758-branch
changeset 57323 66c1dbc008c5
parent 57320 5a5e00cc9932
child 57324 c1d3935fbb79
8217895: jpackage --identifer purpose Reviewed-by: almatvee
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java
src/jdk.jpackage/linux/native/libapplauncher/LinuxPlatform.cpp
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.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/macosx/native/libapplauncher/MacPlatform.mm
src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties
src/jdk.jpackage/share/native/libapplauncher/Helpers.cpp
src/jdk.jpackage/share/native/libapplauncher/Helpers.h
src/jdk.jpackage/share/native/libapplauncher/JavaVirtualMachine.cpp
src/jdk.jpackage/share/native/libapplauncher/Package.cpp
src/jdk.jpackage/share/native/libapplauncher/Package.h
src/jdk.jpackage/share/native/libapplauncher/Platform.cpp
src/jdk.jpackage/share/native/libapplauncher/Platform.h
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java
src/jdk.jpackage/windows/native/libapplauncher/WindowsPlatform.cpp
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java	Fri Apr 12 10:54:10 2019 -0400
@@ -187,7 +187,6 @@
                 JAVA_OPTIONS,
                 MAIN_CLASS,
                 MAIN_JAR,
-                PREFERENCES_ID,
                 VERSION,
                 VERBOSE
         );
--- a/src/jdk.jpackage/linux/native/libapplauncher/LinuxPlatform.cpp	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/linux/native/libapplauncher/LinuxPlatform.cpp	Fri Apr 12 10:54:10 2019 -0400
@@ -151,11 +151,7 @@
         return NULL;
     }
 
-    if (result->LoadFromFile(FileName) == false) {
-        // New property file format was not found,
-        // attempt to load old property file format.
-        Helpers::LoadOldConfigFile(FileName, result);
-    }
+    result->LoadFromFile(FileName);
 
     return result;
 }
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java	Fri Apr 12 10:54:10 2019 -0400
@@ -361,7 +361,6 @@
                 MAC_CF_BUNDLE_VERSION,
                 MAIN_CLASS,
                 MAIN_JAR,
-                PREFERENCES_ID,
                 SIGNING_KEYCHAIN,
                 VERSION,
                 VERBOSE
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java	Fri Apr 12 10:54:10 2019 -0400
@@ -524,9 +524,6 @@
                     StandardBundlerParam.MODULE.fetchFrom(params));
         }
 
-        data.put("DEPLOY_PREFERENCES_ID",
-                PREFERENCES_ID.fetchFrom(params).toLowerCase());
-
         StringBuilder sb = new StringBuilder();
         List<String> jvmOptions = JAVA_OPTIONS.fetchFrom(params);
 
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/Info.plist.template	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/Info.plist.template	Fri Apr 12 10:54:10 2019 -0400
@@ -40,8 +40,6 @@
   <string>DEPLOY_APP_CLASSPATH</string>
   <key>JavaMainJarName</key>
   <string>DEPLOY_MAIN_JAR_NAME</string>
-  <key>JavaPreferencesID</key>
-  <string>DEPLOY_PREFERENCES_ID</string>
   <key>JavaOptions</key>
   <array>
 DEPLOY_JAVA_OPTIONS
--- a/src/jdk.jpackage/macosx/native/libapplauncher/MacPlatform.mm	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/macosx/native/libapplauncher/MacPlatform.mm	Fri Apr 12 10:54:10 2019 -0400
@@ -394,11 +394,7 @@
     }
 
     if (UsePListForConfigFile() == false) {
-        if (result->LoadFromFile(FileName) == false) {
-            // New property file format was not found,
-            // attempt to load old property file format.
-            Helpers::LoadOldConfigFile(FileName, result);
-        }
+        result->LoadFromFile(FileName);
     } else {
         NSBundle *mainBundle = [NSBundle mainBundle];
         NSDictionary *infoDictionary = [mainBundle infoDictionary];
@@ -480,8 +476,6 @@
                 CONFIG_CLASSPATH_KEY, _T("JavaAppClasspath")));
         keys.insert(std::map<TString, TString>::value_type(APP_NAME_KEY,
                 _T("CFBundleName")));
-        keys.insert(std::map<TString, TString>::value_type(CONFIG_APP_ID_KEY,
-                _T("JavaPreferencesID")));
         keys.insert(std::map<TString, TString>::value_type(JAVA_RUNTIME_KEY,
                 _T("JavaRuntime")));
         keys.insert(std::map<TString, TString>::value_type(JPACKAGE_APP_DATA_DIR,
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java	Fri Apr 12 10:54:10 2019 -0400
@@ -197,7 +197,6 @@
         out.println("[Application]");
         out.println("app.name=" + APP_NAME.fetchFrom(params));
         out.println("app.version=" + VERSION.fetchFrom(params));
-        out.println("app.preferences.id=" + PREFERENCES_ID.fetchFrom(params));
         out.println("app.runtime=" + runtimeLocation);
         out.println("app.identifier=" + IDENTIFIER.fetchFrom(params));
         out.println("app.classpath=" + String.join(File.pathSeparator,
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java	Fri Apr 12 10:54:10 2019 -0400
@@ -177,10 +177,6 @@
         return fetchParam(IDENTIFIER);
     }
 
-    public String getPreferencesID() {
-        return fetchParam(PREFERENCES_ID);
-    }
-
     public String getApplicationClass() {
         return fetchParam(MAIN_CLASS);
     }
@@ -282,14 +278,6 @@
         putUnlessNull(PARAM_COPYRIGHT, c);
     }
 
-    public String getIdentifier() {
-        return fetchParam(IDENTIFIER);
-    }
-
-    public void setIdentifier(String s) {
-        putUnlessNull(PARAM_IDENTIFIER, s);
-    }
-
     private String mainJar = null;
 
     // assuming that application was packaged according to the rules
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java	Fri Apr 12 10:54:10 2019 -0400
@@ -486,8 +486,6 @@
         // construct app resources relative to output folder!
         bundleParams.setAppResourcesList(resources);
 
-        bundleParams.setIdentifier(id);
-
         bundleParams.setApplicationClass(applicationClass);
         bundleParams.setAppVersion(version);
         bundleParams.setType(bundleType);
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java	Fri Apr 12 10:54:10 2019 -0400
@@ -315,15 +315,6 @@
                     (s, p) -> s
             );
 
-    static final StandardBundlerParam<String> PREFERENCES_ID =
-            new StandardBundlerParam<>(
-                    "preferencesID",
-                    String.class,
-                    p -> Optional.ofNullable(IDENTIFIER.fetchFrom(p)).
-                             orElse("").replace('.', '/'),
-                    (s, p) -> s
-            );
-
     static final StandardBundlerParam<Boolean> VERBOSE  =
             new StandardBundlerParam<>(
                     Arguments.CLIOptions.VERBOSE.getId(),
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties	Fri Apr 12 10:54:10 2019 -0400
@@ -164,9 +164,9 @@
 \          The keys "extension", "mime-type", "icon", and "description"\n\
 \          can be used to describe the association.\n\
 \  --identifier <id string>\n\
-\          Machine readable identifier of the application\n\
-\          The format must be a DNS name in reverse order,\n\
-\          such as com.example.myapplication.\n\
+\          An identifier that uniquely identifies the application\n\
+\          Defaults to the main class name.\n\
+\          The value should be a valid DNS name.\n\
 \  --install-dir <file path>\n\
 \          {4}\
 \  --installer-type <type> \n\
@@ -223,7 +223,7 @@
 MSG_Help_mac_launcher=\
 \  --mac-bundle-identifier <ID string>\n\
 \          An identifier that uniquely identifies the application for MacOSX\n\
-\          (and on the Mac App Store)\n\
+\          Defaults to the value of --identifier option.\n\
 \          May only use alphanumeric (A-Z,a-z,0-9), hyphen (-),\n\
 \          and period (.) characters.\n\
 \  --mac-bundle-name <name string>\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties	Fri Apr 12 10:54:10 2019 -0400
@@ -164,9 +164,9 @@
 \          The keys "extension", "mime-type", "icon", and "description"\n\
 \          can be used to describe the association.\n\
 \  --identifier <id string>\n\
-\          Machine readable identifier of the application\n\
-\          The format must be a DNS name in reverse order,\n\
-\          such as com.example.myapplication.\n\
+\          An identifier that uniquely identifies the application\n\
+\          Defaults to the main class name.\n\
+\          The value should be a valid DNS name.\n\
 \  --install-dir <file path>\n\
 \          {4}\
 \  --installer-type <type> \n\
@@ -223,7 +223,7 @@
 MSG_Help_mac_launcher=\
 \  --mac-bundle-identifier <ID string>\n\
 \          An identifier that uniquely identifies the application for MacOSX\n\
-\          (and on the Mac App Store)\n\
+\          Defaults to the value of --identifier option.\n\
 \          May only use alphanumeric (A-Z,a-z,0-9), hyphen (-),\n\
 \          and period (.) characters.\n\
 \  --mac-bundle-name <name string>\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties	Fri Apr 12 10:54:10 2019 -0400
@@ -164,9 +164,9 @@
 \          The keys "extension", "mime-type", "icon", and "description"\n\
 \          can be used to describe the association.\n\
 \  --identifier <id string>\n\
-\          Machine readable identifier of the application\n\
-\          The format must be a DNS name in reverse order,\n\
-\          such as com.example.myapplication.\n\
+\          An identifier that uniquely identifies the application\n\
+\          Defaults to the main class name.\n\
+\          The value should be a valid DNS name.\n\
 \  --install-dir <file path>\n\
 \          {4}\
 \  --installer-type <type> \n\
@@ -223,7 +223,7 @@
 MSG_Help_mac_launcher=\
 \  --mac-bundle-identifier <ID string>\n\
 \          An identifier that uniquely identifies the application for MacOSX\n\
-\          (and on the Mac App Store)\n\
+\          Defaults to the value of --identifier option.\n\
 \          May only use alphanumeric (A-Z,a-z,0-9), hyphen (-),\n\
 \          and period (.) characters.\n\
 \  --mac-bundle-name <name string>\n\
--- a/src/jdk.jpackage/share/native/libapplauncher/Helpers.cpp	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/Helpers.cpp	Fri Apr 12 10:54:10 2019 -0400
@@ -167,62 +167,6 @@
     return result;
 }
 
-void AppendToIni(PropertyFile &Source, IniFile* Destination, TString Key) {
-    TString value;
-
-    if (Source.GetValue(Key, value) == true) {
-        Platform& platform = Platform::GetInstance();
-        std::map<TString, TString> keys = platform.GetKeys();
-        Destination->Append(keys[CONFIG_SECTION_APPLICATION], Key, value);
-    }
-}
-
-void Helpers::LoadOldConfigFile(TString FileName, IniFile* Container) {
-    PropertyFile propertyFile;
-
-    if (propertyFile.LoadFromFile(FileName) == true) {
-        Platform& platform = Platform::GetInstance();
-
-        std::map<TString, TString> keys = platform.GetKeys();
-
-        // Application Section
-        AppendToIni(propertyFile, Container, keys[CONFIG_MAINJAR_KEY]);
-        AppendToIni(propertyFile, Container, keys[CONFIG_MAINMODULE_KEY]);
-        AppendToIni(propertyFile, Container, keys[CONFIG_MAINCLASSNAME_KEY]);
-        AppendToIni(propertyFile, Container, keys[CONFIG_CLASSPATH_KEY]);
-        AppendToIni(propertyFile, Container, keys[APP_NAME_KEY]);
-        AppendToIni(propertyFile, Container, keys[CONFIG_APP_ID_KEY]);
-        AppendToIni(propertyFile, Container, keys[JAVA_RUNTIME_KEY]);
-        AppendToIni(propertyFile, Container, keys[JPACKAGE_APP_DATA_DIR]);
-
-        AppendToIni(propertyFile, Container, keys[CONFIG_APP_MEMORY]);
-        AppendToIni(propertyFile, Container, keys[CONFIG_SPLASH_KEY]);
-
-        // JavaOptions Section
-        OrderedMap<TString, TString> JavaOptions =
-                Helpers::GetJavaOptionsFromConfig(&propertyFile);
-        Container->AppendSection(keys[CONFIG_SECTION_JAVAOPTIONS], JavaOptions);
-
-        // ArgOptions Section
-        std::list<TString> args = Helpers::GetArgsFromConfig(&propertyFile);
-        OrderedMap<TString, TString> convertedArgs;
-
-        for (std::list<TString>::iterator iterator = args.begin();
-                iterator != args.end(); iterator++) {
-            TString arg = *iterator;
-            TString name;
-            TString value;
-
-            if (Helpers::SplitOptionIntoNameValue(arg, name, value) == true) {
-                convertedArgs.Append(name, value);
-            }
-        }
-
-        Container->AppendSection(keys[CONFIG_SECTION_ARGOPTIONS],
-                convertedArgs);
-    }
-}
-
 std::list<TString>
         Helpers::MapToNameValueList(OrderedMap<TString, TString> Map) {
     std::list<TString> result;
--- a/src/jdk.jpackage/share/native/libapplauncher/Helpers.h	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/Helpers.h	Fri Apr 12 10:54:10 2019 -0400
@@ -55,8 +55,6 @@
             GetJavaOptionsFromConfig(IPropertyContainer* config);
     static std::list<TString> GetArgsFromConfig(IPropertyContainer* config);
 
-    static void LoadOldConfigFile(TString FileName, IniFile* Container);
-
     static std::list<TString>
             MapToNameValueList(OrderedMap<TString, TString> Map);
 
--- a/src/jdk.jpackage/share/native/libapplauncher/JavaVirtualMachine.cpp	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/JavaVirtualMachine.cpp	Fri Apr 12 10:54:10 2019 -0400
@@ -158,7 +158,6 @@
             + package.GetPackageLauncherDirectory());
     options.AppendValue(
             _T("-Djava.launcher.path"), package.GetPackageLauncherDirectory());
-    options.AppendValue(_T("-Dapp.preferences.id"), package.GetAppID());
     options.AppendValues(package.GetJavaOptions());
 
 #ifdef DEBUG
--- a/src/jdk.jpackage/share/native/libapplauncher/Package.cpp	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/Package.cpp	Fri Apr 12 10:54:10 2019 -0400
@@ -71,8 +71,6 @@
             platform.GetConfigFile(platform.GetConfigFileName());
 
     config->GetValue(keys[CONFIG_SECTION_APPLICATION],
-            keys[CONFIG_APP_ID_KEY], FBootFields->FAppID);
-    config->GetValue(keys[CONFIG_SECTION_APPLICATION],
             keys[JPACKAGE_APP_DATA_DIR], FBootFields->FPackageAppDataDirectory);
     FBootFields->FPackageAppDataDirectory =
             FilePath::FixPathForPlatform(FBootFields->FPackageAppDataDirectory);
@@ -479,11 +477,6 @@
     return FBootFields->FAppCDSCacheFileName;
 }
 
-TString Package::GetAppID() {
-    assert(FBootFields != NULL);
-    return FBootFields->FAppID;
-}
-
 TString Package::GetPackageAppDataDirectory() {
     assert(FBootFields != NULL);
     return FBootFields->FPackageAppDataDirectory;
--- a/src/jdk.jpackage/share/native/libapplauncher/Package.h	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/Package.h	Fri Apr 12 10:54:10 2019 -0400
@@ -47,7 +47,6 @@
     TString FPackageAppDirectory;
     TString FPackageLauncherDirectory;
     TString FAppDataDirectory;
-    TString FAppID;
     TString FPackageAppDataDirectory;
     TString FClassPath;
     TString FModulePath;
@@ -108,7 +107,6 @@
     TString GetAppCDSCacheDirectory();
     TString GetAppCDSCacheFileName();
 
-    TString GetAppID();
     TString GetPackageAppDataDirectory();
     TString GetClassPath();
     TString GetModulePath();
--- a/src/jdk.jpackage/share/native/libapplauncher/Platform.cpp	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/Platform.cpp	Fri Apr 12 10:54:10 2019 -0400
@@ -140,8 +140,6 @@
             _T("app.modulepath")));
     keys.insert(std::map<TString, TString>::value_type(APP_NAME_KEY,
             _T("app.name")));
-    keys.insert(std::map<TString, TString>::value_type(CONFIG_APP_ID_KEY,
-            _T("app.preferences.id")));
     keys.insert(std::map<TString, TString>::value_type(JAVA_RUNTIME_KEY,
             _T("app.runtime")));
     keys.insert(std::map<TString, TString>::value_type(JPACKAGE_APP_DATA_DIR,
--- a/src/jdk.jpackage/share/native/libapplauncher/Platform.h	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/Platform.h	Fri Apr 12 10:54:10 2019 -0400
@@ -59,7 +59,6 @@
 #define CONFIG_MODULEPATH_KEY     _T("CONFIG_MODULEPATH_KEY")
 #define APP_NAME_KEY              _T("APP_NAME_KEY")
 #define CONFIG_SPLASH_KEY         _T("CONFIG_SPLASH_KEY")
-#define CONFIG_APP_ID_KEY         _T("CONFIG_APP_ID_KEY")
 #define CONFIG_APP_MEMORY         _T("CONFIG_APP_MEMORY")
 #define CONFIG_APP_DEBUG          _T("CONFIG_APP_DEBUG")
 #define CONFIG_APPLICATION_INSTANCE _T("CONFIG_APPLICATION_INSTANCE")
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java	Fri Apr 12 10:54:10 2019 -0400
@@ -234,7 +234,6 @@
                 JAVA_OPTIONS,
                 MAIN_CLASS,
                 MAIN_JAR,
-                PREFERENCES_ID,
                 VERSION,
                 VERBOSE
             );
--- a/src/jdk.jpackage/windows/native/libapplauncher/WindowsPlatform.cpp	Thu Apr 11 07:44:51 2019 -0400
+++ b/src/jdk.jpackage/windows/native/libapplauncher/WindowsPlatform.cpp	Fri Apr 12 10:54:10 2019 -0400
@@ -239,11 +239,7 @@
         return NULL;
     }
 
-    if (result->LoadFromFile(FileName) == false) {
-        // New property file format was not found,
-        // attempt to load old property file format.
-        Helpers::LoadOldConfigFile(FileName, result);
-    }
+    result->LoadFromFile(FileName);
 
     return result;
 }