src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java
branchJDK-8200758-branch
changeset 57414 6eda749d3117
parent 57396 3944e4c2f779
child 57438 4a31db8d42bd
equal deleted inserted replaced
57413:45c74e654794 57414:6eda749d3117
    50  */
    50  */
    51 public class DeployParams {
    51 public class DeployParams {
    52 
    52 
    53     final List<RelativeFileSet> resources = new ArrayList<>();
    53     final List<RelativeFileSet> resources = new ArrayList<>();
    54 
    54 
    55     BundlerType bundleType = BundlerType.NONE;
    55     String targetFormat = null; // means app-image
    56     String targetFormat = null; //means any
       
    57     String licenseType;
    56     String licenseType;
    58     String copyright;
    57     String copyright;
    59     String version;
    58     String version;
    60     String applicationClass;
    59     String applicationClass;
    61 
    60 
   248                 Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId()) != null);
   247                 Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId()) != null);
   249         boolean hasInput = (bundlerArguments.get(
   248         boolean hasInput = (bundlerArguments.get(
   250                 Arguments.CLIOptions.INPUT.getId()) != null);
   249                 Arguments.CLIOptions.INPUT.getId()) != null);
   251         boolean hasModulePath = (bundlerArguments.get(
   250         boolean hasModulePath = (bundlerArguments.get(
   252                 Arguments.CLIOptions.MODULE_PATH.getId()) != null);
   251                 Arguments.CLIOptions.MODULE_PATH.getId()) != null);
   253         boolean runtimeInstaller = (BundlerType.INSTALLER == getBundleType()) &&
   252         boolean runtimeInstaller = targetFormat != null &&
   254                 !hasAppImage && !hasModule && !hasMain && hasRuntimeImage;
   253                 !hasAppImage && !hasModule && !hasMain && hasRuntimeImage;
   255 
   254 
   256         if (getBundleType() == BundlerType.IMAGE) {
   255         if (targetFormat == null) {
   257             // Module application requires --runtime-image or --module-path
   256             // Module application requires --runtime-image or --module-path
   258             if (hasModule) {
   257             if (hasModule) {
   259                 if (!hasModulePath && !hasRuntimeImage) {
   258                 if (!hasModulePath && !hasRuntimeImage) {
   260                     throw new PackagerException("ERR_MissingArgument",
   259                     throw new PackagerException("ERR_MissingArgument",
   261                             "--runtime-image or --module-path");
   260                             "--runtime-image or --module-path");
   264                 if (!hasInput) {
   263                 if (!hasInput) {
   265                     throw new PackagerException(
   264                     throw new PackagerException(
   266                            "ERR_MissingArgument", "--input");
   265                            "ERR_MissingArgument", "--input");
   267                 }
   266                 }
   268             }
   267             }
   269         } else if (getBundleType() == BundlerType.INSTALLER) {
   268         } else {
   270             if (!runtimeInstaller) {
   269             if (!runtimeInstaller) {
   271                 if (hasModule) {
   270                 if (hasModule) {
   272                     if (!hasModulePath && !hasRuntimeImage && !hasAppImage) {
   271                     if (!hasModulePath && !hasRuntimeImage && !hasAppImage) {
   273                         throw new PackagerException("ERR_MissingArgument",
   272                         throw new PackagerException("ERR_MissingArgument",
   274                             "--runtime-image, --module-path or --app-image");
   273                             "--runtime-image, --module-path or --app-image");
   338             (module != null && !module.isEmpty()))) {
   337             (module != null && !module.isEmpty()))) {
   339             result = true;
   338             result = true;
   340         }
   339         }
   341 
   340 
   342         return result;
   341         return result;
   343     }
       
   344 
       
   345     void setBundleType(BundlerType type) {
       
   346         bundleType = type;
       
   347     }
       
   348 
       
   349     BundlerType getBundleType() {
       
   350         return bundleType;
       
   351     }
   342     }
   352 
   343 
   353     void setTargetFormat(String t) {
   344     void setTargetFormat(String t) {
   354         targetFormat = t;
   345         targetFormat = t;
   355     }
   346     }
   401         // construct app resources relative to output folder!
   392         // construct app resources relative to output folder!
   402         bundleParams.setAppResourcesList(resources);
   393         bundleParams.setAppResourcesList(resources);
   403 
   394 
   404         bundleParams.setApplicationClass(applicationClass);
   395         bundleParams.setApplicationClass(applicationClass);
   405         bundleParams.setAppVersion(version);
   396         bundleParams.setAppVersion(version);
   406         bundleParams.setType(bundleType);
       
   407         bundleParams.setBundleFormat(targetFormat);
       
   408         bundleParams.setCopyright(copyright);
   397         bundleParams.setCopyright(copyright);
   409 
   398 
   410         bundleParams.setJvmargs(jvmargs);
   399         bundleParams.setJvmargs(jvmargs);
   411 
   400 
   412         if (addModules != null && !addModules.isEmpty()) {
   401         if (addModules != null && !addModules.isEmpty()) {