2525
2626package jdk .jpackage .internal ;
2727
28- import jdk .jpackage .internal .model .ConfigException ;
29- import java .io .IOException ;
28+ import static jdk .jpackage .internal .StandardBundlerParam .APP_NAME ;
29+ import static jdk .jpackage .internal .StandardBundlerParam .PREDEFINED_APP_IMAGE ;
30+ import static jdk .jpackage .internal .StandardBundlerParam .PREDEFINED_APP_IMAGE_FILE ;
31+ import static jdk .jpackage .internal .StandardBundlerParam .SIGN_BUNDLE ;
32+
3033import java .nio .file .Files ;
3134import java .nio .file .Path ;
3235import java .text .MessageFormat ;
3336import java .util .Map ;
3437import java .util .Optional ;
35- import static jdk .jpackage .internal .StandardBundlerParam .APP_NAME ;
36- import static jdk .jpackage .internal .StandardBundlerParam .INSTALLER_NAME ;
37- import static jdk .jpackage .internal .StandardBundlerParam .INSTALL_DIR ;
38- import static jdk .jpackage .internal .StandardBundlerParam .OUTPUT_DIR ;
39- import static jdk .jpackage .internal .StandardBundlerParam .PREDEFINED_APP_IMAGE ;
40- import static jdk .jpackage .internal .StandardBundlerParam .PREDEFINED_APP_IMAGE_FILE ;
41- import static jdk .jpackage .internal .StandardBundlerParam .VERSION ;
42- import static jdk .jpackage .internal .StandardBundlerParam .SIGN_BUNDLE ;
43- import jdk .jpackage .internal .util .FileUtils ;
38+ import jdk .jpackage .internal .model .ConfigException ;
4439
4540public abstract class MacBaseInstallerBundler extends AbstractBundler {
4641
47- static final BundlerParamInfo <Path > IMAGES_ROOT =
48- new BundlerParamInfo <>(
49- "imagesRoot" ,
50- Path .class ,
51- params -> {
52- final var env = BuildEnvFromParams .BUILD_ENV .fetchFrom (params );
53- return env .buildRoot ().resolve ("images" );
54- },
55- (s , p ) -> null );
56-
57- private final BundlerParamInfo <Path > APP_IMAGE_TEMP_ROOT =
58- new BundlerParamInfo <>(
59- "mac.app.imageRoot" ,
60- Path .class ,
61- params -> {
62- Path imageDir = IMAGES_ROOT .fetchFrom (params );
63- try {
64- if (!IOUtils .exists (imageDir )) {
65- Files .createDirectories (imageDir );
66- }
67- return Files .createTempDirectory (
68- imageDir , "image-" );
69- } catch (IOException e ) {
70- return imageDir .resolve (getID ()+ ".image" );
71- }
72- },
73- (s , p ) -> Path .of (s ));
74-
7542 public static final BundlerParamInfo <String > SIGNING_KEY_USER =
7643 new BundlerParamInfo <>(
7744 Arguments .CLIOptions .MAC_SIGNING_KEY_NAME .getId (),
@@ -86,48 +53,6 @@ public abstract class MacBaseInstallerBundler extends AbstractBundler {
8653 params -> "" ,
8754 null );
8855
89- public static final BundlerParamInfo <String > INSTALLER_SIGN_IDENTITY =
90- new BundlerParamInfo <>(
91- Arguments .CLIOptions .MAC_INSTALLER_SIGN_IDENTITY .getId (),
92- String .class ,
93- params -> "" ,
94- null );
95-
96- public static final BundlerParamInfo <String > MAC_INSTALLER_NAME =
97- new BundlerParamInfo <> (
98- "mac.installerName" ,
99- String .class ,
100- params -> {
101- String nm = INSTALLER_NAME .fetchFrom (params );
102- if (nm == null ) return null ;
103-
104- String version = VERSION .fetchFrom (params );
105- if (version == null ) {
106- return nm ;
107- } else {
108- return nm + "-" + version ;
109- }
110- },
111- (s , p ) -> s );
112-
113- // Returns full path to installation directory
114- static String getInstallDir (
115- Map <String , ? super Object > params , boolean defaultOnly ) {
116- String returnValue = INSTALL_DIR .fetchFrom (params );
117- if (defaultOnly && returnValue != null ) {
118- Log .info (I18N .getString ("message.install-dir-ignored" ));
119- returnValue = null ;
120- }
121- if (returnValue == null ) {
122- if (StandardBundlerParam .isRuntimeInstaller (params )) {
123- returnValue = "/Library/Java/JavaVirtualMachines" ;
124- } else {
125- returnValue = "/Applications" ;
126- }
127- }
128- return returnValue ;
129- }
130-
13156 public MacBaseInstallerBundler () {
13257 appImageBundler = new MacAppBundler ();
13358 }
0 commit comments