25
25
26
26
package jdk .jpackage .internal ;
27
27
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
+
30
33
import java .nio .file .Files ;
31
34
import java .nio .file .Path ;
32
35
import java .text .MessageFormat ;
33
36
import java .util .Map ;
34
37
import 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 ;
44
39
45
40
public abstract class MacBaseInstallerBundler extends AbstractBundler {
46
41
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
-
75
42
public static final BundlerParamInfo <String > SIGNING_KEY_USER =
76
43
new BundlerParamInfo <>(
77
44
Arguments .CLIOptions .MAC_SIGNING_KEY_NAME .getId (),
@@ -86,48 +53,6 @@ public abstract class MacBaseInstallerBundler extends AbstractBundler {
86
53
params -> "" ,
87
54
null );
88
55
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
-
131
56
public MacBaseInstallerBundler () {
132
57
appImageBundler = new MacAppBundler ();
133
58
}
0 commit comments