test/jdk/tools/jlink/basic/BasicTest.java
author sundar
Wed, 21 Aug 2019 17:38:19 +0530
changeset 57821 182f94955cfb
parent 51977 a8862960c19f
permissions -rw-r--r--
8220700: jlink generated launcher script needs quoting to avoid parameter expansion Reviewed-by: mchung, alanb, sgehwolf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/**
51675
b487c1e914d0 8210112: remove jdk.testlibrary.ProcessTools
iignatyev
parents: 47216
diff changeset
     2
 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * accompanied this code).
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * questions.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    23
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    24
/*
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    25
 * @test
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    26
 * @summary Basic test of jlink to create jmods and images
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    27
 * @author Andrei Eremeev
51977
a8862960c19f 8211171: move JarUtils to top-level testlibrary
iignatyev
parents: 51675
diff changeset
    28
 * @library /test/lib
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    29
 * @modules java.base/jdk.internal.module
41484
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    30
 *          jdk.jlink
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    31
 *          jdk.compiler
51675
b487c1e914d0 8210112: remove jdk.testlibrary.ProcessTools
iignatyev
parents: 47216
diff changeset
    32
 * @build jdk.test.lib.process.ProcessTools
b487c1e914d0 8210112: remove jdk.testlibrary.ProcessTools
iignatyev
parents: 47216
diff changeset
    33
 *        jdk.test.lib.process.OutputAnalyzer
51977
a8862960c19f 8211171: move JarUtils to top-level testlibrary
iignatyev
parents: 51675
diff changeset
    34
 *        jdk.test.lib.compiler.CompilerUtils
a8862960c19f 8211171: move JarUtils to top-level testlibrary
iignatyev
parents: 51675
diff changeset
    35
 *        jdk.test.lib.util.JarUtils
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    36
 * @run main BasicTest
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    37
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    38
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    39
import java.io.File;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    40
import java.io.PrintWriter;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    41
import java.nio.file.Files;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    42
import java.nio.file.Path;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    43
import java.nio.file.Paths;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    44
import java.util.ArrayList;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    45
import java.util.Collections;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    46
import java.util.List;
41484
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    47
import java.util.spi.ToolProvider;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    48
45393
de4e1efc8eec 8181335: remove packageless CompilerUtils
iignatyev
parents: 42762
diff changeset
    49
import jdk.test.lib.compiler.CompilerUtils;
51675
b487c1e914d0 8210112: remove jdk.testlibrary.ProcessTools
iignatyev
parents: 47216
diff changeset
    50
import jdk.test.lib.process.OutputAnalyzer;
b487c1e914d0 8210112: remove jdk.testlibrary.ProcessTools
iignatyev
parents: 47216
diff changeset
    51
import jdk.test.lib.process.ProcessTools;
51977
a8862960c19f 8211171: move JarUtils to top-level testlibrary
iignatyev
parents: 51675
diff changeset
    52
import jdk.test.lib.util.JarUtils;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    53
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    54
public class BasicTest {
41484
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    55
    static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    56
        .orElseThrow(() ->
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    57
            new RuntimeException("jmod tool not found")
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    58
        );
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    59
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    60
    static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    61
        .orElseThrow(() ->
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    62
            new RuntimeException("jlink tool not found")
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
    63
        );
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    64
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41484
diff changeset
    65
    private final String TEST_MODULE = "test";
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    66
    private final Path jdkHome = Paths.get(System.getProperty("test.jdk"));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    67
    private final Path jdkMods = jdkHome.resolve("jmods");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    68
    private final Path testSrc = Paths.get(System.getProperty("test.src"));
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41484
diff changeset
    69
    private final Path src = testSrc.resolve("src").resolve(TEST_MODULE);
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    70
    private final Path classes = Paths.get("classes");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    71
    private final Path jmods = Paths.get("jmods");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    72
    private final Path jars = Paths.get("jars");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    73
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    74
    public static void main(String[] args) throws Throwable {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    75
        new BasicTest().run();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    76
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    77
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    78
    public void run() throws Throwable {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    79
        if (Files.notExists(jdkMods)) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    80
            return;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    81
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    82
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    83
        if (!CompilerUtils.compile(src, classes)) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    84
            throw new AssertionError("Compilation failure. See log.");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    85
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    86
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    87
        Files.createDirectories(jmods);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    88
        Files.createDirectories(jars);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    89
        Path jarfile = jars.resolve("test.jar");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    90
        JarUtils.createJarFile(jarfile, classes);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    91
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    92
        Path image = Paths.get("mysmallimage");
42762
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
    93
        runJmod(jarfile.toString(), TEST_MODULE, true);
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
    94
        runJlink(image, TEST_MODULE, "--compress", "2", "--launcher", "foo=" + TEST_MODULE);
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
    95
        execute(image, "foo");
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    96
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41484
diff changeset
    97
        Files.delete(jmods.resolve(TEST_MODULE + ".jmod"));
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    98
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    99
        image = Paths.get("myimage");
42762
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   100
        runJmod(classes.toString(), TEST_MODULE, true);
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   101
        runJlink(image, TEST_MODULE, "--launcher", "bar=" + TEST_MODULE);
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   102
        execute(image, "bar");
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   103
        Files.delete(jmods.resolve(TEST_MODULE + ".jmod"));
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   104
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   105
        image = Paths.get("myimage2");
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   106
        runJmod(classes.toString(), TEST_MODULE, false /* no ModuleMainClass! */);
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   107
        // specify main class in --launcher command line
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   108
        runJlink(image, TEST_MODULE, "--launcher", "bar2=" + TEST_MODULE + "/jdk.test.Test");
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   109
        execute(image, "bar2");
57821
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   110
        Files.delete(jmods.resolve(TEST_MODULE + ".jmod"));
42762
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   111
57821
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   112
        image = Paths.get("myadder");
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   113
        runJmod(classes.toString(), TEST_MODULE, false /* no ModuleMainClass! */);
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   114
        // specify main class in --launcher command line
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   115
        runJlink(image, TEST_MODULE, "--launcher", "adder=" + TEST_MODULE + "/jdk.test.Adder");
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   116
        addAndCheck(image, "adder");
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   117
    }
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   118
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   119
    private void addAndCheck(Path image, String scriptName) throws Throwable {
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   120
        String cmd = image.resolve("bin").resolve(scriptName).toString();
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   121
        OutputAnalyzer analyzer;
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   122
        if (System.getProperty("os.name").startsWith("Windows")) {
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   123
            analyzer = ProcessTools.executeProcess("sh.exe", cmd, "12", "8", "7", "--", "foo bar");
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   124
        } else {
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   125
            analyzer = ProcessTools.executeProcess(cmd, "12", "8", "7", "--", "foo bar");
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   126
        }
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   127
        if (analyzer.getExitValue() != 27) {
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   128
            throw new AssertionError("Image invocation failed: expected 27, rc=" + analyzer.getExitValue());
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   129
        }
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   130
        // last argument contains space and should be properly quoted.
182f94955cfb 8220700: jlink generated launcher script needs quoting to avoid parameter expansion
sundar
parents: 51977
diff changeset
   131
        analyzer.stdoutShouldContain("Num args: 5");
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   132
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   133
42762
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   134
    private void execute(Path image, String scriptName) throws Throwable {
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   135
        String cmd = image.resolve("bin").resolve(scriptName).toString();
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   136
        OutputAnalyzer analyzer;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   137
        if (System.getProperty("os.name").startsWith("Windows")) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   138
            analyzer = ProcessTools.executeProcess("sh.exe", cmd, "1", "2", "3");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   139
        } else {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   140
            analyzer = ProcessTools.executeProcess(cmd, "1", "2", "3");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   141
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   142
        if (analyzer.getExitValue() != 0) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   143
            throw new AssertionError("Image invocation failed: rc=" + analyzer.getExitValue());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   144
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   145
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   146
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   147
    private void runJlink(Path image, String modName, String... options) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   148
        List<String> args = new ArrayList<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   149
        Collections.addAll(args,
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 36511
diff changeset
   150
                "--module-path", jdkMods + File.pathSeparator + jmods,
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 36511
diff changeset
   151
                "--add-modules", modName,
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   152
                "--output", image.toString());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   153
        Collections.addAll(args, options);
41484
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
   154
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
   155
        PrintWriter pw = new PrintWriter(System.out);
834b7539ada3 8164689: Retrofit jar, jlink, jmod as a ToolProvider
mchung
parents: 40261
diff changeset
   156
        int rc = JLINK_TOOL.run(pw, pw, args.toArray(new String[args.size()]));
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   157
        if (rc != 0) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   158
            throw new AssertionError("Jlink failed: rc = " + rc);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   159
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   160
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   161
42762
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   162
    private void runJmod(String cp, String modName, boolean main) {
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   163
        int rc;
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   164
        if (main) {
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   165
            rc = JMOD_TOOL.run(System.out, System.out, new String[] {
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   166
                "create",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   167
                "--class-path", cp,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   168
                "--module-version", "1.0",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   169
                "--main-class", "jdk.test.Test",
42762
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   170
                jmods.resolve(modName + ".jmod").toString()
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   171
            });
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   172
        } else {
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   173
            rc = JMOD_TOOL.run(System.out, System.out, new String[] {
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   174
                "create",
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   175
                "--class-path", cp,
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   176
                "--module-version", "1.0",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   177
                jmods.resolve(modName + ".jmod").toString(),
42762
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   178
            });
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   179
        }
11a1ad340d4f 8170289: Re-examine entry point support in jlink
sundar
parents: 42338
diff changeset
   180
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   181
        if (rc != 0) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   182
            throw new AssertionError("Jmod failed: rc = " + rc);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   183
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   184
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   185
}