src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java
author herrick
Tue, 24 Sep 2019 13:57:28 -0400
branchJDK-8200758-branch
changeset 58304 7a61351edad2
parent 57909 c7de06ed4b54
child 58346 d5a3cd78e560
permissions -rw-r--r--
8231282 : Revisit --linux-deb-copyright option Submitted-by: asemenyuk Reviewed-by: herrick, almatvee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
     1
/*
57106
ea870b9ce89a 8216492: Update copyright of all new jpackage fils to 2019
kcr
parents: 57099
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
     4
 *
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    10
 *
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    15
 * accompanied this code).
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    16
 *
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    20
 *
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    23
 * questions.
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    24
 */
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    25
57039
98d3963b0b7b 8214051: rename jpackager tool to jpackage
herrick
parents: 57017
diff changeset
    26
package jdk.jpackage.internal;
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    27
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    28
import java.util.Collection;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    29
import java.util.HashMap;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    30
import java.util.Map;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    31
import java.io.File;
57039
98d3963b0b7b 8214051: rename jpackager tool to jpackage
herrick
parents: 57017
diff changeset
    32
import jdk.jpackage.internal.Arguments.CLIOptions;
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    33
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    34
/*
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    35
 * AddLauncherArguments
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    36
 *
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    37
 * Processes a add-launcher properties file to create the Map of
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    38
 * bundle params applicable to the add-launcher:
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    39
 *
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    40
 * BundlerParams p = (new AddLauncherArguments(file)).getLauncherMap();
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    41
 *
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    42
 * A add-launcher is another executable program generated by either the
57307
4948a1944cf9 8221777: CLI changes from jpackage EA5 feedback
herrick
parents: 57291
diff changeset
    43
 * create-app-image mode or the create-installer mode.
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    44
 * The add-launcher may be the same program with different configuration,
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    45
 * or a completely different program created from the same files.
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    46
 *
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    47
 * There may be multiple add-launchers, each created by using the
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    48
 * command line arg "--add-launcher <file path>
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    49
 *
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    50
 * The add-launcher properties file may have any of:
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    51
 *
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    52
 * appVersion
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    53
 * module
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    54
 * main-jar
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    55
 * main-class
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    56
 * icon
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    57
 * arguments
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57259
diff changeset
    58
 * java-options
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    59
 * win-console
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    60
 *
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    61
 */
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    62
class AddLauncherArguments {
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    63
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
    64
    private final String name;
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    65
    private final String filename;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    66
    private Map<String, String> allArgs;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    67
    private Map<String, ? super Object> bundleParams;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    68
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
    69
    AddLauncherArguments(String name, String filename) {
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
    70
        this.name = name;
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    71
        this.filename = filename;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    72
    }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    73
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    74
    private void initLauncherMap() {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    75
        if (bundleParams != null) {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    76
            return;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    77
        }
56957
2f01969ed7cb 8211299: Output of System.out is not printed to CMD on Windows
herrick
parents: 56933
diff changeset
    78
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    79
        allArgs = Arguments.getPropertiesFromFile(filename);
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
    80
        allArgs.put(CLIOptions.NAME.getId(), name);
56957
2f01969ed7cb 8211299: Output of System.out is not printed to CMD on Windows
herrick
parents: 56933
diff changeset
    81
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    82
        bundleParams = new HashMap<>();
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    83
        String mainJar = getOptionValue(CLIOptions.MAIN_JAR);
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    84
        String mainClass = getOptionValue(CLIOptions.APPCLASS);
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    85
        String module = getOptionValue(CLIOptions.MODULE);
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    86
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    87
        if (module != null && mainClass != null) {
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
    88
            putUnlessNull(bundleParams, CLIOptions.MODULE.getId(),
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    89
                    module + "/" + mainClass);
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    90
        } else if (module != null) {
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
    91
            putUnlessNull(bundleParams, CLIOptions.MODULE.getId(),
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    92
                    module);
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    93
        } else {
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
    94
            putUnlessNull(bundleParams, CLIOptions.MAIN_JAR.getId(),
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
    95
                    mainJar);
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
    96
            putUnlessNull(bundleParams, CLIOptions.APPCLASS.getId(),
56957
2f01969ed7cb 8211299: Output of System.out is not printed to CMD on Windows
herrick
parents: 56933
diff changeset
    97
                    mainClass);
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    98
        }
56957
2f01969ed7cb 8211299: Output of System.out is not printed to CMD on Windows
herrick
parents: 56933
diff changeset
    99
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
   100
        putUnlessNull(bundleParams, CLIOptions.NAME.getId(),
56869
41e17fe9fbeb 8208522: removed unreferenced class and minor formatting of java source
herrick
parents: 56849
diff changeset
   101
                getOptionValue(CLIOptions.NAME));
57256
d7c27451f759 8219678: CLI changes in jpackage
herrick
parents: 57106
diff changeset
   102
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
   103
        putUnlessNull(bundleParams, CLIOptions.VERSION.getId(),
56869
41e17fe9fbeb 8208522: removed unreferenced class and minor formatting of java source
herrick
parents: 56849
diff changeset
   104
                getOptionValue(CLIOptions.VERSION));
56957
2f01969ed7cb 8211299: Output of System.out is not printed to CMD on Windows
herrick
parents: 56933
diff changeset
   105
57741
38856ef4a19c 8229138: Add --linux-app-release option for DEB and RPM packages
herrick
parents: 57438
diff changeset
   106
        putUnlessNull(bundleParams, CLIOptions.RELEASE.getId(),
38856ef4a19c 8229138: Add --linux-app-release option for DEB and RPM packages
herrick
parents: 57438
diff changeset
   107
                getOptionValue(CLIOptions.RELEASE));
38856ef4a19c 8229138: Add --linux-app-release option for DEB and RPM packages
herrick
parents: 57438
diff changeset
   108
57790
1ea531646100 8213941: Debian linux problems in JavaPackager
herrick
parents: 57741
diff changeset
   109
        putUnlessNull(bundleParams, CLIOptions.LINUX_CATEGORY.getId(),
1ea531646100 8213941: Debian linux problems in JavaPackager
herrick
parents: 57741
diff changeset
   110
                getOptionValue(CLIOptions.LINUX_CATEGORY));
57909
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57807
diff changeset
   111
56869
41e17fe9fbeb 8208522: removed unreferenced class and minor formatting of java source
herrick
parents: 56849
diff changeset
   112
        putUnlessNull(bundleParams,
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
   113
                CLIOptions.WIN_CONSOLE_HINT.getId(),
56957
2f01969ed7cb 8211299: Output of System.out is not printed to CMD on Windows
herrick
parents: 56933
diff changeset
   114
                getOptionValue(CLIOptions.WIN_CONSOLE_HINT));
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
   115
56849
16c34c7b4147 8208579: [jpackager] --secondary-launcher arg fails when properties file has no icon
herrick
parents: 56821
diff changeset
   116
        String value = getOptionValue(CLIOptions.ICON);
57330
a30edd277572 8222733: Modify jpackage option --add-launcher synta
herrick
parents: 57307
diff changeset
   117
        putUnlessNull(bundleParams, CLIOptions.ICON.getId(),
56869
41e17fe9fbeb 8208522: removed unreferenced class and minor formatting of java source
herrick
parents: 56849
diff changeset
   118
                (value == null) ? null : new File(value));
56957
2f01969ed7cb 8211299: Output of System.out is not printed to CMD on Windows
herrick
parents: 56933
diff changeset
   119
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   120
        String argumentStr = getOptionValue(CLIOptions.ARGUMENTS);
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   121
        putUnlessNullOrEmpty(bundleParams,
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   122
                CLIOptions.ARGUMENTS.getId(),
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   123
                Arguments.getArgumentList(argumentStr));
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   124
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57259
diff changeset
   125
        String jvmargsStr = getOptionValue(CLIOptions.JAVA_OPTIONS);
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   126
        putUnlessNullOrEmpty(bundleParams,
57291
f2d429260ad4 8221582: Rename jvm-args option to java-options
herrick
parents: 57259
diff changeset
   127
                CLIOptions.JAVA_OPTIONS.getId(),
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   128
                Arguments.getArgumentList(jvmargsStr));
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   129
    }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   130
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   131
    private String getOptionValue(CLIOptions option) {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   132
        if (option == null || allArgs == null) {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   133
            return null;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   134
        }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   135
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   136
        String id = option.getId();
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   137
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   138
        if (allArgs.containsKey(id)) {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   139
            return allArgs.get(id);
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   140
        }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   141
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   142
        return null;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   143
    }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   144
57067
9c17d779808e 8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents: 57039
diff changeset
   145
    Map<String, ? super Object> getLauncherMap() {
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   146
        initLauncherMap();
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   147
        return bundleParams;
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   148
    }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   149
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   150
    private void putUnlessNull(Map<String, ? super Object> params,
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   151
            String param, Object value) {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   152
        if (value != null) {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   153
            params.put(param, value);
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   154
        }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   155
    }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   156
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   157
    private void putUnlessNullOrEmpty(Map<String, ? super Object> params,
57015
5d2008115309 JDK-8213244: Fix all warnings in jpackager java code
herrick
parents: 56994
diff changeset
   158
            String param, Collection<?> value) {
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   159
        if (value != null && !value.isEmpty()) {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   160
            params.put(param, value);
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   161
        }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   162
    }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   163
57259
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   164
    static Map<String, ? super Object> merge(
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   165
            Map<String, ? super Object> original,
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   166
            Map<String, ? super Object> additional) {
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   167
        Map<String, ? super Object> tmp = new HashMap<>(original);
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   168
        if (additional.containsKey("module")) {
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   169
            tmp.remove("main-jar");
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   170
            tmp.remove("main-class");
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   171
        } else if (additional.containsKey("main-jar")) {
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   172
            tmp.remove("module");
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   173
        }
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   174
        tmp.putAll(additional);
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   175
        return tmp;
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   176
    }
a84c657c713d 8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents: 57256
diff changeset
   177
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
   178
}