src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java
branchJDK-8200758-branch
changeset 58762 0fe62353385b
parent 58696 61c44899b4eb
child 58763 bc43733cd5cf
equal deleted inserted replaced
58761:88e2753a2334 58762:0fe62353385b
   333 
   333 
   334         Path imageDir = MSI_IMAGE_DIR.fetchFrom(params).toPath();
   334         Path imageDir = MSI_IMAGE_DIR.fetchFrom(params).toPath();
   335         try {
   335         try {
   336             Files.createDirectories(imageDir);
   336             Files.createDirectories(imageDir);
   337 
   337 
   338             Path postImageScript = imageDir.resolve(APP_NAME.fetchFrom(params) + "-post-image.wsf");
       
   339             createResource(null, params)
       
   340                     .setCategory(I18N.getString("resource.post-install-script"))
       
   341                     .saveToFile(postImageScript);
       
   342 
       
   343             prepareProto(params);
   338             prepareProto(params);
   344 
   339 
   345             wixSourcesBuilder
   340             wixSourcesBuilder
   346             .initFromParams(WIN_APP_IMAGE.fetchFrom(params).toPath(), params)
   341             .initFromParams(WIN_APP_IMAGE.fetchFrom(params).toPath(), params)
   347             .createMainFragment(CONFIG_ROOT.fetchFrom(params).toPath().resolve(
   342             .createMainFragment(CONFIG_ROOT.fetchFrom(params).toPath().resolve(
   348                     "bundle.wxf"));
   343                     "bundle.wxf"));
   349 
   344 
   350             Map<String, String> wixVars = prepareMainProjectFile(params);
   345             Map<String, String> wixVars = prepareMainProjectFile(params);
   351 
   346 
   352             if (Files.exists(postImageScript)) {
   347             new ScriptRunner()
   353                 Log.verbose(MessageFormat.format(I18N.getString(
   348             .setDirectory(imageDir)
   354                         "message.running-wsh-script"),
   349             .setResourceCategoryId("resource.post-app-image-script")
   355                         postImageScript.toAbsolutePath()));
   350             .setScriptNameSuffix("post-image")
   356                 Executor.of("wscript", postImageScript.toString()).executeExpectSuccess();
   351             .setEnvironmentVariable("JpAppImageDir", imageDir.toAbsolutePath().toString())
   357             }
   352             .run(params);
       
   353 
   358             return buildMSI(params, wixVars, outdir);
   354             return buildMSI(params, wixVars, outdir);
   359         } catch (IOException ex) {
   355         } catch (IOException ex) {
   360             Log.verbose(ex);
   356             Log.verbose(ex);
   361             throw new PackagerException(ex);
   357             throw new PackagerException(ex);
   362         }
   358         }