author | herrick |
Wed, 23 Oct 2019 10:37:54 -0400 | |
branch | JDK-8200758-branch |
changeset 58762 | 0fe62353385b |
child 58994 | b09ba68c6a19 |
permissions | -rw-r--r-- |
58762
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
1 |
/* |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
4 |
* |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
8 |
* |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
13 |
* accompanied this code). |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
14 |
* |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
18 |
* |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
21 |
* questions. |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
22 |
*/ |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
23 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
24 |
import java.io.IOException; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
25 |
import java.nio.file.Path; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
26 |
import java.util.List; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
27 |
import java.util.ArrayList; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
28 |
import jdk.jpackage.internal.IOUtils; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
29 |
import jdk.jpackage.test.TKit; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
30 |
import jdk.jpackage.test.PackageTest; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
31 |
import jdk.jpackage.test.PackageType; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
32 |
import jdk.jpackage.test.Annotations.Test; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
33 |
import jdk.jpackage.test.Annotations.Parameter; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
34 |
import jdk.jpackage.test.Annotations.Parameters; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
35 |
import jdk.jpackage.test.JPackageCommand; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
36 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
37 |
/* |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
38 |
* @test usage of scripts from resource dir |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
39 |
* @summary jpackage with |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
40 |
* @library ../helpers |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
41 |
* @build jdk.jpackage.test.* |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
42 |
* @requires (os.family == "windows") |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
43 |
* @modules jdk.jpackage/jdk.jpackage.internal |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
44 |
* @compile WinScriptTest.java |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
45 |
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
46 |
* --jpt-run=WinScriptTest |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
47 |
*/ |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
48 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
49 |
public class WinScriptTest { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
50 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
51 |
public WinScriptTest(PackageType type) { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
52 |
this.packageType = type; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
53 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
54 |
test = new PackageTest() |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
55 |
.forTypes(type) |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
56 |
.configureHelloApp() |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
57 |
.addInitializer(cmd -> { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
58 |
cmd.setFakeRuntime().saveConsoleOutput(true); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
59 |
}); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
60 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
61 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
62 |
@Parameters |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
63 |
public static List<Object[]> data() { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
64 |
return List.of(new Object[][]{ |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
65 |
{PackageType.WIN_MSI}, |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
66 |
{PackageType.WIN_EXE} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
67 |
}); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
68 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
69 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
70 |
@Test |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
71 |
@Parameter("0") |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
72 |
@Parameter("10") |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
73 |
public void test(int wsfExitCode) { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
74 |
final ScriptData appImageScriptData; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
75 |
if (wsfExitCode != 0 && packageType == PackageType.WIN_EXE) { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
76 |
appImageScriptData = new ScriptData(PackageType.WIN_MSI, 0); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
77 |
} else { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
78 |
appImageScriptData = new ScriptData(PackageType.WIN_MSI, wsfExitCode); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
79 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
80 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
81 |
final ScriptData msiScriptData = new ScriptData(PackageType.WIN_EXE, wsfExitCode); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
82 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
83 |
test.setExpectedExitCode(wsfExitCode == 0 ? 0 : 1); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
84 |
TKit.withTempDirectory("resources", tempDir -> { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
85 |
test.addInitializer(cmd -> { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
86 |
cmd.addArguments("--resource-dir", tempDir); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
87 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
88 |
appImageScriptData.createScript(cmd); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
89 |
msiScriptData.createScript(cmd); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
90 |
}); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
91 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
92 |
if (packageType == PackageType.WIN_MSI) { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
93 |
test.addBundleVerifier((cmd, result) -> { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
94 |
appImageScriptData.assertJPackageOutput(result.getOutput()); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
95 |
}); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
96 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
97 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
98 |
if (packageType == PackageType.WIN_EXE) { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
99 |
test.addBundleVerifier((cmd, result) -> { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
100 |
appImageScriptData.assertJPackageOutput(result.getOutput()); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
101 |
msiScriptData.assertJPackageOutput(result.getOutput()); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
102 |
}); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
103 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
104 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
105 |
test.run(); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
106 |
}); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
107 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
108 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
109 |
private static class ScriptData { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
110 |
ScriptData(PackageType scriptType, int wsfExitCode) { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
111 |
if (scriptType == PackageType.WIN_MSI) { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
112 |
echoText = "post app image wsf"; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
113 |
envVarName = "JpAppImageDir"; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
114 |
scriptSuffixName = "post-image"; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
115 |
} else { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
116 |
echoText = "post msi wsf"; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
117 |
envVarName = "JpMsiFile"; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
118 |
scriptSuffixName = "post-msi"; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
119 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
120 |
this.wsfExitCode = wsfExitCode; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
121 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
122 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
123 |
void assertJPackageOutput(List<String> output) { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
124 |
TKit.assertTextStream(String.format("jp: %s", echoText)) |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
125 |
.predicate(String::equals) |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
126 |
.apply(output.stream()); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
127 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
128 |
String cwdPattern = String.format("jp: CWD(%s)=", envVarName); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
129 |
TKit.assertTextStream(cwdPattern) |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
130 |
.predicate(String::startsWith) |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
131 |
.apply(output.stream()); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
132 |
String cwd = output.stream().filter(line -> line.startsWith( |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
133 |
cwdPattern)).findFirst().get().substring(cwdPattern.length()); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
134 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
135 |
String envVarPattern = String.format("jp: %s=", envVarName); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
136 |
TKit.assertTextStream(envVarPattern) |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
137 |
.predicate(String::startsWith) |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
138 |
.apply(output.stream()); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
139 |
String envVar = output.stream().filter(line -> line.startsWith( |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
140 |
envVarPattern)).findFirst().get().substring(envVarPattern.length()); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
141 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
142 |
TKit.assertTrue(envVar.startsWith(cwd), String.format( |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
143 |
"Check value of %s environment variable [%s] starts with the current directory [%s] set for %s script", |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
144 |
envVarName, envVar, cwd, echoText)); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
145 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
146 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
147 |
void createScript(JPackageCommand cmd) throws IOException { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
148 |
IOUtils.createXml(Path.of(cmd.getArgumentValue("--resource-dir"), |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
149 |
String.format("%s-%s.wsf", cmd.name(), scriptSuffixName)), xml -> { |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
150 |
xml.writeStartElement("job"); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
151 |
xml.writeAttribute("id", "main"); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
152 |
xml.writeStartElement("script"); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
153 |
xml.writeAttribute("language", "JScript"); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
154 |
xml.writeCData(String.join("\n", List.of( |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
155 |
"var shell = new ActiveXObject('WScript.Shell')", |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
156 |
"WScript.Echo('jp: " + envVarName + "=' + shell.ExpandEnvironmentStrings('%" + envVarName + "%'))", |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
157 |
"WScript.Echo('jp: CWD(" + envVarName + ")=' + shell.CurrentDirectory)", |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
158 |
String.format("WScript.Echo('jp: %s')", echoText), |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
159 |
String.format("WScript.Quit(%d)", wsfExitCode) |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
160 |
))); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
161 |
xml.writeEndElement(); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
162 |
xml.writeEndElement(); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
163 |
}); |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
164 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
165 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
166 |
private final int wsfExitCode; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
167 |
private final String scriptSuffixName; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
168 |
private final String echoText; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
169 |
private final String envVarName; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
170 |
} |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
171 |
|
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
172 |
private final PackageType packageType; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
173 |
private PackageTest test; |
0fe62353385b
8232281: jpackage is not always reporting an error when no main class specified
herrick
parents:
diff
changeset
|
174 |
} |