32 import com.oracle.tools.packager.IOUtils;
33 import com.oracle.tools.packager.Platform;
34 import com.oracle.tools.packager.UnsupportedPlatformException;
35 import jdk.packager.builders.mac.MacAppImageBuilder;
36
37 import java.io.File;
38 import java.io.FileNotFoundException;
39 import java.io.IOException;
40 import java.text.MessageFormat;
41 import java.util.ArrayList;
42 import java.util.Arrays;
43 import java.util.Collection;
44 import java.util.LinkedHashSet;
45 import java.util.List;
46 import java.util.Map;
47 import java.util.Optional;
48 import java.util.ResourceBundle;
49
50 import static com.oracle.tools.packager.StandardBundlerParam.*;
51 import static com.oracle.tools.packager.mac.MacAppBundler.*;
52
53 public class MacAppStoreBundler extends MacBaseInstallerBundler {
54
55 private static final ResourceBundle I18N =
56 ResourceBundle.getBundle(MacAppStoreBundler.class.getName());
57
58 private static final String TEMPLATE_BUNDLE_ICON_HIDPI = "GenericAppHiDPI.icns";
59 private final static String DEFAULT_ENTITLEMENTS = "MacAppStore.entitlements";
60 private final static String DEFAULT_INHERIT_ENTITLEMENTS = "MacAppStore_Inherit.entitlements";
61
62 public static final BundlerParamInfo<String> MAC_APP_STORE_APP_SIGNING_KEY = new StandardBundlerParam<>(
63 I18N.getString("param.signing-key-app.name"),
64 I18N.getString("param.signing-key-app.description"),
65 "mac.signing-key-app",
66 String.class,
67 params -> MacBaseInstallerBundler.findKey("3rd Party Mac Developer Application: " + SIGNING_KEY_USER.fetchFrom(params), SIGNING_KEYCHAIN.fetchFrom(params), VERBOSE.fetchFrom(params)),
68 (s, p) -> s);
69
70 public static final BundlerParamInfo<String> MAC_APP_STORE_PKG_SIGNING_KEY = new StandardBundlerParam<>(
71 I18N.getString("param.signing-key-pkg.name"),
72 I18N.getString("param.signing-key-pkg.description"),
73 "mac.signing-key-pkg",
74 String.class,
75 params -> MacBaseInstallerBundler.findKey("3rd Party Mac Developer Installer: " + SIGNING_KEY_USER.fetchFrom(params), SIGNING_KEYCHAIN.fetchFrom(params), VERBOSE.fetchFrom(params)),
76 (s, p) -> s);
77
78 public static final StandardBundlerParam<File> MAC_APP_STORE_ENTITLEMENTS = new StandardBundlerParam<>(
79 I18N.getString("param.mac-app-store-entitlements.name"),
80 I18N.getString("param.mac-app-store-entitlements.description"),
81 "mac.app-store-entitlements",
82 File.class,
83 params -> null,
84 (s, p) -> new File(s));
85
86 public static final BundlerParamInfo<String> INSTALLER_SUFFIX = new StandardBundlerParam<> (
87 I18N.getString("param.installer-suffix.name"),
|
32 import com.oracle.tools.packager.IOUtils;
33 import com.oracle.tools.packager.Platform;
34 import com.oracle.tools.packager.UnsupportedPlatformException;
35 import jdk.packager.builders.mac.MacAppImageBuilder;
36
37 import java.io.File;
38 import java.io.FileNotFoundException;
39 import java.io.IOException;
40 import java.text.MessageFormat;
41 import java.util.ArrayList;
42 import java.util.Arrays;
43 import java.util.Collection;
44 import java.util.LinkedHashSet;
45 import java.util.List;
46 import java.util.Map;
47 import java.util.Optional;
48 import java.util.ResourceBundle;
49
50 import static com.oracle.tools.packager.StandardBundlerParam.*;
51 import static com.oracle.tools.packager.mac.MacAppBundler.*;
52 import java.io.BufferedOutputStream;
53 import java.io.BufferedReader;
54 import java.io.ByteArrayInputStream;
55 import java.io.ByteArrayOutputStream;
56 import java.io.FileOutputStream;
57 import java.io.InputStreamReader;
58 import java.io.PrintStream;
59 import java.text.DateFormat;
60 import java.text.ParseException;
61 import java.text.SimpleDateFormat;
62 import java.util.Calendar;
63 import java.util.Date;
64 import java.util.Locale;
65 import java.util.logging.Level;
66 import java.util.logging.Logger;
67 import jdk.packager.internal.mac.MacCertificate;
68
69 public class MacAppStoreBundler extends MacBaseInstallerBundler {
70
71 private static final ResourceBundle I18N =
72 ResourceBundle.getBundle(MacAppStoreBundler.class.getName());
73
74 private static final String TEMPLATE_BUNDLE_ICON_HIDPI = "GenericAppHiDPI.icns";
75 private final static String DEFAULT_ENTITLEMENTS = "MacAppStore.entitlements";
76 private final static String DEFAULT_INHERIT_ENTITLEMENTS = "MacAppStore_Inherit.entitlements";
77
78 public static final BundlerParamInfo<String> MAC_APP_STORE_APP_SIGNING_KEY = new StandardBundlerParam<>(
79 I18N.getString("param.signing-key-app.name"),
80 I18N.getString("param.signing-key-app.description"),
81 "mac.signing-key-app",
82 String.class,
83 params -> {
84 String result = MacBaseInstallerBundler.findKey("3rd Party Mac Developer Application: " + SIGNING_KEY_USER.fetchFrom(params),
85 SIGNING_KEYCHAIN.fetchFrom(params),
86 VERBOSE.fetchFrom(params));
87 if (result != null) {
88 MacCertificate certificate = new MacCertificate(result, VERBOSE.fetchFrom(params));
89
90 if (!certificate.isValid()) {
91 Log.info(MessageFormat.format(I18N.getString("error.certificate.expired"), result));
92 }
93 }
94
95 return result;
96 },
97 (s, p) -> s);
98
99 public static final BundlerParamInfo<String> MAC_APP_STORE_PKG_SIGNING_KEY = new StandardBundlerParam<>(
100 I18N.getString("param.signing-key-pkg.name"),
101 I18N.getString("param.signing-key-pkg.description"),
102 "mac.signing-key-pkg",
103 String.class,
104 params -> MacBaseInstallerBundler.findKey("3rd Party Mac Developer Installer: " + SIGNING_KEY_USER.fetchFrom(params), SIGNING_KEYCHAIN.fetchFrom(params), VERBOSE.fetchFrom(params)),
105 (s, p) -> s);
106
107 public static final StandardBundlerParam<File> MAC_APP_STORE_ENTITLEMENTS = new StandardBundlerParam<>(
108 I18N.getString("param.mac-app-store-entitlements.name"),
109 I18N.getString("param.mac-app-store-entitlements.description"),
110 "mac.app-store-entitlements",
111 File.class,
112 params -> null,
113 (s, p) -> new File(s));
114
115 public static final BundlerParamInfo<String> INSTALLER_SUFFIX = new StandardBundlerParam<> (
116 I18N.getString("param.installer-suffix.name"),
|