src/jdk.jpackage/share/classes/jdk/jpackage/internal/CLIHelp.java
author herrick
Tue, 10 Sep 2019 14:57:03 -0400
branchJDK-8200758-branch
changeset 58114 42df7de58e39
parent 57776 783db59cd8d3
permissions -rw-r--r--
8230519: jpackage "--package-type" values and default Reviewed-by: asemenyuk, 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: 57071
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
 */
56982
e094d5483bd6 8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents: 56933
diff changeset
    25
57039
98d3963b0b7b 8214051: rename jpackager tool to jpackage
herrick
parents: 57025
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.ResourceBundle;
57025
bab8a5dae662 help text updates
herrick
parents: 57022
diff changeset
    29
import java.io.File;
bab8a5dae662 help text updates
herrick
parents: 57022
diff changeset
    30
import java.text.MessageFormat;
bab8a5dae662 help text updates
herrick
parents: 57022
diff changeset
    31
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    32
56994
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    33
/**
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    34
 * CLIHelp
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    35
 *
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    36
 * Generate and show the command line interface help message(s).
b4aca2dbe2b5 8212537: Create method and class description comments for main functionality
herrick
parents: 56982
diff changeset
    37
 */
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    38
public class CLIHelp {
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    39
56869
41e17fe9fbeb 8208522: removed unreferenced class and minor formatting of java source
herrick
parents: 56821
diff changeset
    40
    private static final ResourceBundle I18N = ResourceBundle.getBundle(
57059
9bb2a4dc3af7 8214143: Reduce Resource files
herrick
parents: 57039
diff changeset
    41
            "jdk.jpackage.internal.resources.HelpResources");
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    42
57039
98d3963b0b7b 8214051: rename jpackager tool to jpackage
herrick
parents: 57025
diff changeset
    43
    // generates --help for jpackage's CLI
57022
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    44
    public static void showHelp(boolean noArgs) {
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    45
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    46
        if (noArgs) {
57257
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    47
            Log.info(I18N.getString("MSG_Help_no_args"));
57022
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    48
        } else {
57776
783db59cd8d3 8224594: Simplify jpackage Logging
herrick
parents: 57348
diff changeset
    49
            Platform platform = (Log.isVerbose()) ?
57257
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    50
                    Platform.UNKNOWN : Platform.getPlatform();
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    51
            String types;
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    52
            String pLaunchOptions;
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    53
            String pInstallOptions;
57283
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    54
            String pInstallDir;
57022
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    55
            switch (platform) {
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    56
                case MAC:
58114
42df7de58e39 8230519: jpackage "--package-type" values and default
herrick
parents: 57776
diff changeset
    57
                    types = "{\"app-image\", \"dmg\", \"pkg\"}";
57348
d3a667ff5579 JDK-8223189: Fix trailing whitespace and whitespace only file modification.
herrick
parents: 57286
diff changeset
    58
                    pLaunchOptions = I18N.getString("MSG_Help_mac_launcher");
57286
2ee6dedec44f 8221256: Fix create-installer specific options on MAC
herrick
parents: 57283
diff changeset
    59
                    pInstallOptions = "";
57283
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    60
                    pInstallDir
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    61
                            = I18N.getString("MSG_Help_mac_linux_install_dir");
57022
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    62
                    break;
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    63
                case LINUX:
58114
42df7de58e39 8230519: jpackage "--package-type" values and default
herrick
parents: 57776
diff changeset
    64
                    types = "{\"app-image\", \"rpm\", \"deb\"}";
57348
d3a667ff5579 JDK-8223189: Fix trailing whitespace and whitespace only file modification.
herrick
parents: 57286
diff changeset
    65
                    pLaunchOptions = "";
57257
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    66
                    pInstallOptions = I18N.getString("MSG_Help_linux_install");
57283
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    67
                    pInstallDir
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    68
                            = I18N.getString("MSG_Help_mac_linux_install_dir");
57022
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    69
                    break;
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    70
                case WINDOWS:
58114
42df7de58e39 8230519: jpackage "--package-type" values and default
herrick
parents: 57776
diff changeset
    71
                    types = "{\"app-image\", \"exe\", \"msi\"}";
57348
d3a667ff5579 JDK-8223189: Fix trailing whitespace and whitespace only file modification.
herrick
parents: 57286
diff changeset
    72
                    pLaunchOptions = I18N.getString("MSG_Help_win_launcher");
57257
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    73
                    pInstallOptions = I18N.getString("MSG_Help_win_install");
57283
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    74
                    pInstallDir
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    75
                            = I18N.getString("MSG_Help_win_install_dir");
57257
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    76
                    break;
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    77
                default:
58114
42df7de58e39 8230519: jpackage "--package-type" values and default
herrick
parents: 57776
diff changeset
    78
                    types = "{\"app-image\", \"exe\", \"msi\", \"rpm\", \"deb\", \"pkg\", \"dmg\"}";
57348
d3a667ff5579 JDK-8223189: Fix trailing whitespace and whitespace only file modification.
herrick
parents: 57286
diff changeset
    79
                    pLaunchOptions = I18N.getString("MSG_Help_win_launcher")
d3a667ff5579 JDK-8223189: Fix trailing whitespace and whitespace only file modification.
herrick
parents: 57286
diff changeset
    80
                            + I18N.getString("MSG_Help_mac_launcher");
57257
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    81
                    pInstallOptions = I18N.getString("MSG_Help_win_install")
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    82
                            + I18N.getString("MSG_Help_linux_install");
57283
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    83
                    pInstallDir
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    84
                            = I18N.getString("MSG_Help_default_install_dir");
57022
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    85
                    break;
81021f910bc2 8213333: Fix issues found in jpackager with automated tests
herrick
parents: 57017
diff changeset
    86
            }
57257
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    87
            Log.info(MessageFormat.format(I18N.getString("MSG_Help"),
69ad9df313e4 8219679: Help text changes in jpackage
herrick
parents: 57106
diff changeset
    88
                    File.pathSeparator, types, pLaunchOptions,
57283
0b0be19f79e4 8215019: Allow --install-dir on windows
herrick
parents: 57257
diff changeset
    89
                    pInstallOptions, pInstallDir));
56821
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    90
        }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    91
    }
565d54ca1f41 8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff changeset
    92
}