src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java
branchJDK-8200758-branch
changeset 57256 d7c27451f759
parent 57218 8018ecf829bc
child 57283 0b0be19f79e4
equal deleted inserted replaced
57255:f686bda3b831 57256:d7c27451f759
    44     private static final ResourceBundle I18N = ResourceBundle.getBundle(
    44     private static final ResourceBundle I18N = ResourceBundle.getBundle(
    45             "jdk.jpackage.internal.resources.WinResources");
    45             "jdk.jpackage.internal.resources.WinResources");
    46 
    46 
    47     static final BundlerParamInfo<File> ICON_ICO =
    47     static final BundlerParamInfo<File> ICON_ICO =
    48             new StandardBundlerParam<>(
    48             new StandardBundlerParam<>(
    49             I18N.getString("param.icon-ico.name"),
       
    50             I18N.getString("param.icon-ico.description"),
       
    51             "icon.ico",
    49             "icon.ico",
    52             File.class,
    50             File.class,
    53             params -> {
    51             params -> {
    54                 File f = ICON.fetchFrom(params);
    52                 File f = ICON.fetchFrom(params);
    55                 if (f != null && !f.getName().toLowerCase().endsWith(".ico")) {
    53                 if (f != null && !f.getName().toLowerCase().endsWith(".ico")) {
   169         return doBundle(p, outputDirectory, false) != null;
   167         return doBundle(p, outputDirectory, false) != null;
   170     }
   168     }
   171 
   169 
   172     File doBundle(Map<String, ? super Object> p, File outputDirectory,
   170     File doBundle(Map<String, ? super Object> p, File outputDirectory,
   173             boolean dependentTask) throws PackagerException {
   171             boolean dependentTask) throws PackagerException {
   174         if (RUNTIME_INSTALLER.fetchFrom(p)) {
   172         if (StandardBundlerParam.isRuntimeInstaller(p)) {
   175             return doJreBundle(p, outputDirectory, dependentTask);
   173             return PREDEFINED_RUNTIME_IMAGE.fetchFrom(p);
   176         } else {
   174         } else {
   177             return doAppBundle(p, outputDirectory, dependentTask);
   175             return doAppBundle(p, outputDirectory, dependentTask);
   178         }
       
   179     }
       
   180 
       
   181     File doJreBundle(Map<String, ? super Object> p, File outputDirectory,
       
   182             boolean dependentTask) throws PackagerException {
       
   183         try {
       
   184             File rootDirectory = createRoot(p, outputDirectory, dependentTask,
       
   185                 APP_NAME.fetchFrom(p), "windowsapp-image-builder");
       
   186             AbstractAppImageBuilder appBuilder = new WindowsAppImageBuilder(
       
   187                     APP_NAME.fetchFrom(p),
       
   188                     outputDirectory.toPath());
       
   189             File predefined = PREDEFINED_RUNTIME_IMAGE.fetchFrom(p);
       
   190             if (predefined == null ) {
       
   191                 JLinkBundlerHelper.generateJre(p, appBuilder);
       
   192             } else {
       
   193                 return predefined;
       
   194             }
       
   195             return rootDirectory;
       
   196         } catch (PackagerException pe) {
       
   197             throw pe;
       
   198         } catch (Exception e) {
       
   199             Log.verbose(e);
       
   200             throw new PackagerException(e);
       
   201         }
   176         }
   202     }
   177     }
   203 
   178 
   204     File doAppBundle(Map<String, ? super Object> p, File outputDirectory,
   179     File doAppBundle(Map<String, ? super Object> p, File outputDirectory,
   205             boolean dependentTask) throws PackagerException {
   180             boolean dependentTask) throws PackagerException {
   206         try {
   181         try {
   207             File rootDirectory = createRoot(p, outputDirectory, dependentTask,
   182             File rootDirectory = createRoot(p, outputDirectory, dependentTask,
   208                     APP_NAME.fetchFrom(p), "windowsapp-image-builder");
   183                     APP_NAME.fetchFrom(p));
   209             AbstractAppImageBuilder appBuilder =
   184             AbstractAppImageBuilder appBuilder =
   210                     new WindowsAppImageBuilder(p, outputDirectory.toPath());
   185                     new WindowsAppImageBuilder(p, outputDirectory.toPath());
   211             if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) {
   186             if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) {
   212                 JLinkBundlerHelper.execute(p, appBuilder);
   187                 JLinkBundlerHelper.execute(p, appBuilder);
   213             } else {
   188             } else {