250 throw new ConfigException(re); |
250 throw new ConfigException(re); |
251 } |
251 } |
252 } |
252 } |
253 } |
253 } |
254 |
254 |
255 private boolean doValidate(Map<String, ? super Object> p) |
255 private boolean doValidate(Map<String, ? super Object> params) |
256 throws UnsupportedPlatformException, ConfigException { |
256 throws UnsupportedPlatformException, ConfigException { |
257 if (Platform.getPlatform() != Platform.MAC) { |
257 if (Platform.getPlatform() != Platform.MAC) { |
258 throw new UnsupportedPlatformException(); |
258 throw new UnsupportedPlatformException(); |
259 } |
259 } |
260 |
260 |
261 imageBundleValidation(p); |
261 imageBundleValidation(params); |
262 |
262 |
263 if (StandardBundlerParam.getPredefinedAppImage(p) != null) { |
263 if (StandardBundlerParam.getPredefinedAppImage(params) != null) { |
264 return true; |
264 return true; |
265 } |
265 } |
266 |
266 |
267 // validate short version |
267 // validate short version |
268 if (!validCFBundleVersion(MAC_CF_BUNDLE_VERSION.fetchFrom(p))) { |
268 if (!validCFBundleVersion(MAC_CF_BUNDLE_VERSION.fetchFrom(params))) { |
269 throw new ConfigException( |
269 throw new ConfigException( |
270 I18N.getString("error.invalid-cfbundle-version"), |
270 I18N.getString("error.invalid-cfbundle-version"), |
271 I18N.getString("error.invalid-cfbundle-version.advice")); |
271 I18N.getString("error.invalid-cfbundle-version.advice")); |
272 } |
272 } |
273 |
273 |
274 // reject explicitly set sign to true and no valid signature key |
274 // reject explicitly set sign to true and no valid signature key |
275 if (Optional.ofNullable(MacAppImageBuilder. |
275 if (Optional.ofNullable(MacAppImageBuilder. |
276 SIGN_BUNDLE.fetchFrom(p)).orElse(Boolean.FALSE)) { |
276 SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.FALSE)) { |
277 String signingIdentity = DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(p); |
277 String signingIdentity = |
|
278 DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(params); |
278 if (signingIdentity == null) { |
279 if (signingIdentity == null) { |
279 throw new ConfigException( |
280 throw new ConfigException( |
280 I18N.getString("error.explicit-sign-no-cert"), |
281 I18N.getString("error.explicit-sign-no-cert"), |
281 I18N.getString("error.explicit-sign-no-cert.advice")); |
282 I18N.getString("error.explicit-sign-no-cert.advice")); |
282 } |
283 } |
283 } |
284 } |
284 |
285 |
285 return true; |
286 return true; |
286 } |
287 } |
287 |
288 |
288 File doBundle(Map<String, ? super Object> p, File outputDirectory, |
289 File doBundle(Map<String, ? super Object> params, File outputDirectory, |
289 boolean dependentTask) throws PackagerException { |
290 boolean dependentTask) throws PackagerException { |
290 if (StandardBundlerParam.isRuntimeInstaller(p)) { |
291 if (StandardBundlerParam.isRuntimeInstaller(params)) { |
291 return PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); |
292 return PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); |
292 } else { |
293 } else { |
293 return doAppBundle(p, outputDirectory, dependentTask); |
294 return doAppBundle(params, outputDirectory, dependentTask); |
294 } |
295 } |
295 } |
296 } |
296 |
297 |
297 File doAppBundle(Map<String, ? super Object> p, File outputDirectory, |
298 File doAppBundle(Map<String, ? super Object> params, File outputDirectory, |
298 boolean dependentTask) throws PackagerException { |
299 boolean dependentTask) throws PackagerException { |
299 try { |
300 try { |
300 File rootDirectory = createRoot(p, outputDirectory, dependentTask, |
301 File rootDirectory = createRoot(params, outputDirectory, |
301 APP_NAME.fetchFrom(p) + ".app"); |
302 dependentTask, APP_NAME.fetchFrom(params) + ".app"); |
302 AbstractAppImageBuilder appBuilder = |
303 AbstractAppImageBuilder appBuilder = |
303 new MacAppImageBuilder(p, outputDirectory.toPath()); |
304 new MacAppImageBuilder(params, outputDirectory.toPath()); |
304 if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) { |
305 if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(params) == null ) { |
305 JLinkBundlerHelper.execute(p, appBuilder); |
306 JLinkBundlerHelper.execute(params, appBuilder); |
306 } else { |
307 } else { |
307 StandardBundlerParam.copyPredefinedRuntimeImage(p, appBuilder); |
308 StandardBundlerParam.copyPredefinedRuntimeImage( |
|
309 params, appBuilder); |
308 } |
310 } |
309 return rootDirectory; |
311 return rootDirectory; |
310 } catch (PackagerException pe) { |
312 } catch (PackagerException pe) { |
311 throw pe; |
313 throw pe; |
312 } catch (Exception ex) { |
314 } catch (Exception ex) { |