src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java
branchJDK-8200758-branch
changeset 57080 bd4ce7f9ea2c
parent 57067 9c17d779808e
child 57091 06bc4bd64599
equal deleted inserted replaced
57079:c53a2eca0f57 57080:bd4ce7f9ea2c
   325                 + " mime-type=\"image/png\""
   325                 + " mime-type=\"image/png\""
   326                 + " alignment=\"bottomleft\" "
   326                 + " alignment=\"bottomleft\" "
   327                 + " scaling=\"none\""
   327                 + " scaling=\"none\""
   328                 + "/>");
   328                 + "/>");
   329 
   329 
   330         if (!LICENSE_FILE.fetchFrom(params).isEmpty()) {
   330         String licFileStr = LICENSE_FILE.fetchFrom(params);
   331             File licFile = null;
   331         if (licFileStr != null) {
   332 
   332             File licFile = new File(licFileStr);
   333             List<String> licFiles = LICENSE_FILE.fetchFrom(params);
   333             out.println("<license"
   334             if (licFiles.isEmpty()) {
   334                     + " file=\"" + licFile.getAbsolutePath() + "\""
   335                 return;
   335                     + " mime-type=\"text/rtf\""
   336             }
   336                     + "/>");
   337             String licFileStr = licFiles.get(0);
       
   338 
       
   339             for (RelativeFileSet rfs : APP_RESOURCES_LIST.fetchFrom(params)) {
       
   340                 if (rfs.contains(licFileStr)) {
       
   341                     licFile = new File(rfs.getBaseDirectory(), licFileStr);
       
   342                     break;
       
   343                 }
       
   344             }
       
   345 
       
   346             // this is NPE protection, validate should have caught it's absence
       
   347             // so we don't complain or throw an error
       
   348             if (licFile != null) {
       
   349                 out.println("<license"
       
   350                         + " file=\"" + licFile.getAbsolutePath() + "\""
       
   351                         + " mime-type=\"text/rtf\""
       
   352                         + "/>");
       
   353             }
       
   354         }
   337         }
   355 
   338 
   356         /*
   339         /*
   357          * Note that the content of the distribution file
   340          * Note that the content of the distribution file
   358          * below is generated by productbuild --synthesize
   341          * below is generated by productbuild --synthesize
   359          */
   342          */
   360 
   343 
   361         String appId = getAppIdentifier(params);
   344         String appId = getAppIdentifier(params);
   362         String daemonId = getDaemonIdentifier(params);
       
   363 
   345 
   364         out.println("<pkg-ref id=\"" + appId + "\"/>");
   346         out.println("<pkg-ref id=\"" + appId + "\"/>");
   365 
   347 
   366         out.println("<options customize=\"never\" require-scripts=\"false\"/>");
   348         out.println("<options customize=\"never\" require-scripts=\"false\"/>");
   367         out.println("<choices-outline>");
   349         out.println("<choices-outline>");
   536 
   518 
   537             // run basic validation to ensure requirements are met
   519             // run basic validation to ensure requirements are met
   538             // we are not interested in return code, only possible exception
   520             // we are not interested in return code, only possible exception
   539             validateAppImageAndBundeler(params);
   521             validateAppImageAndBundeler(params);
   540 
   522 
   541             // validate license file, if used, exists in the proper place
       
   542             if (params.containsKey(LICENSE_FILE.getID())) {
       
   543                 List<RelativeFileSet> appResourcesList =
       
   544                         APP_RESOURCES_LIST.fetchFrom(params);
       
   545                 for (String license : LICENSE_FILE.fetchFrom(params)) {
       
   546                     boolean found = false;
       
   547                     for (RelativeFileSet appResources : appResourcesList) {
       
   548                         found = found || appResources.contains(license);
       
   549                     }
       
   550                     if (!found) {
       
   551                         throw new ConfigException(
       
   552                                 I18N.getString("error.license-missing"),
       
   553                                 MessageFormat.format(
       
   554                                 I18N.getString("error.license-missing.advice"),
       
   555                                 license));
       
   556                     }
       
   557                 }
       
   558             }
       
   559 
       
   560             // reject explicitly set sign to true and no valid signature key
   523             // reject explicitly set sign to true and no valid signature key
   561             if (Optional.ofNullable(MacAppImageBuilder.
   524             if (Optional.ofNullable(MacAppImageBuilder.
   562                     SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.FALSE)) {
   525                     SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.FALSE)) {
   563                 String signingIdentity =
   526                 String signingIdentity =
   564                         DEVELOPER_ID_INSTALLER_SIGNING_KEY.fetchFrom(params);
   527                         DEVELOPER_ID_INSTALLER_SIGNING_KEY.fetchFrom(params);