23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package jdk.jpackage.internal; |
26 package jdk.jpackage.internal; |
27 |
27 |
28 import java.io.BufferedWriter; |
|
29 import java.io.File; |
28 import java.io.File; |
30 import java.io.FileWriter; |
|
31 import java.io.IOException; |
29 import java.io.IOException; |
32 import java.io.PrintStream; |
30 import java.io.PrintStream; |
33 import java.io.PrintWriter; |
31 import java.io.PrintWriter; |
34 import java.io.Writer; |
32 import java.io.Writer; |
35 import java.net.URLEncoder; |
33 import java.net.URLEncoder; |
36 import java.nio.file.Files; |
34 import java.nio.file.Files; |
37 import java.nio.file.Path; |
35 import java.nio.file.Path; |
38 import java.text.MessageFormat; |
36 import java.text.MessageFormat; |
39 import java.util.ArrayList; |
37 import java.util.ArrayList; |
40 import java.util.Arrays; |
|
41 import java.util.Collection; |
|
42 import java.util.HashMap; |
38 import java.util.HashMap; |
43 import java.util.LinkedHashSet; |
|
44 import java.util.List; |
39 import java.util.List; |
45 import java.util.Map; |
40 import java.util.Map; |
46 import java.util.Optional; |
41 import java.util.Optional; |
47 import java.util.ResourceBundle; |
42 import java.util.ResourceBundle; |
48 |
43 |
49 import static jdk.jpackage.internal.StandardBundlerParam.*; |
44 import static jdk.jpackage.internal.StandardBundlerParam.*; |
50 import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEYCHAIN; |
45 import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEYCHAIN; |
51 import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEY_USER; |
46 import static jdk.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEY_USER; |
|
47 import static jdk.jpackage.internal.MacAppImageBuilder.MAC_CF_BUNDLE_IDENTIFIER; |
52 |
48 |
53 public class MacPkgBundler extends MacBaseInstallerBundler { |
49 public class MacPkgBundler extends MacBaseInstallerBundler { |
54 |
50 |
55 private static final ResourceBundle I18N = ResourceBundle.getBundle( |
51 private static final ResourceBundle I18N = ResourceBundle.getBundle( |
56 "jdk.jpackage.internal.resources.MacResources"); |
52 "jdk.jpackage.internal.resources.MacResources"); |
493 |
489 |
494 // run basic validation to ensure requirements are met |
490 // run basic validation to ensure requirements are met |
495 // we are not interested in return code, only possible exception |
491 // we are not interested in return code, only possible exception |
496 validateAppImageAndBundeler(params); |
492 validateAppImageAndBundeler(params); |
497 |
493 |
|
494 if (MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params) == null) { |
|
495 throw new ConfigException( |
|
496 I18N.getString("message.app-image-requires-identifier"), |
|
497 I18N.getString( |
|
498 "message.app-image-requires-identifier.advice")); |
|
499 } |
|
500 |
498 // reject explicitly set sign to true and no valid signature key |
501 // reject explicitly set sign to true and no valid signature key |
499 if (Optional.ofNullable(MacAppImageBuilder. |
502 if (Optional.ofNullable(MacAppImageBuilder. |
500 SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.FALSE)) { |
503 SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.FALSE)) { |
501 String signingIdentity = |
504 String signingIdentity = |
502 DEVELOPER_ID_INSTALLER_SIGNING_KEY.fetchFrom(params); |
505 DEVELOPER_ID_INSTALLER_SIGNING_KEY.fetchFrom(params); |