author | jjg |
Thu, 31 Mar 2016 15:20:50 -0700 | |
changeset 36778 | e04318f39f92 |
parent 36526 | 3b41f1c69604 |
child 37758 | 3ecf9b414e05 |
permissions | -rw-r--r-- |
36526 | 1 |
/* |
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @summary tests for -modulepath |
|
27 |
* @library /tools/lib |
|
28 |
* @modules |
|
29 |
* jdk.compiler/com.sun.tools.javac.api |
|
30 |
* jdk.compiler/com.sun.tools.javac.main |
|
31 |
* jdk.jdeps/com.sun.tools.javap |
|
32 |
* jdk.jlink/jdk.tools.jmod |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
33 |
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase |
36526 | 34 |
* @run main ModulePathTest |
35 |
*/ |
|
36 |
||
37 |
import java.io.File; |
|
38 |
import java.io.IOException; |
|
39 |
import java.nio.file.Files; |
|
40 |
import java.nio.file.Path; |
|
41 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
42 |
import toolbox.JarTask; |
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
43 |
import toolbox.JavacTask; |
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
44 |
import toolbox.Task; |
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
45 |
import toolbox.ToolBox; |
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
46 |
|
36526 | 47 |
public class ModulePathTest extends ModuleTestBase { |
48 |
||
49 |
public static final String PATH_SEP = File.pathSeparator; |
|
50 |
||
51 |
public static void main(String... args) throws Exception { |
|
52 |
ModulePathTest t = new ModulePathTest(); |
|
53 |
t.runTests(); |
|
54 |
} |
|
55 |
||
56 |
@Test |
|
57 |
void testNotExistsOnPath(Path base) throws Exception { |
|
58 |
Path src = base.resolve("src"); |
|
59 |
tb.writeJavaFiles(src, "class C { }"); |
|
60 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
61 |
String log = new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 62 |
.options("-XDrawDiagnostics", |
63 |
"-modulepath", "doesNotExist") |
|
64 |
.files(findJavaFiles(src)) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
65 |
.run(Task.Expect.FAIL) |
36526 | 66 |
.writeAll() |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
67 |
.getOutput(Task.OutputKind.DIRECT); |
36526 | 68 |
|
69 |
if (!log.contains("- compiler.err.illegal.argument.for.option: -modulepath, doesNotExist")) |
|
70 |
throw new Exception("expected output not found"); |
|
71 |
} |
|
72 |
||
73 |
@Test |
|
74 |
void testNotADirOnPath_1(Path base) throws Exception { |
|
75 |
Path src = base.resolve("src"); |
|
76 |
tb.writeJavaFiles(src, "class C { }"); |
|
77 |
tb.writeFile("dummy.txt", ""); |
|
78 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
79 |
String log = new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 80 |
.options("-XDrawDiagnostics", |
81 |
"-modulepath", "dummy.txt") |
|
82 |
.files(findJavaFiles(src)) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
83 |
.run(Task.Expect.FAIL) |
36526 | 84 |
.writeAll() |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
85 |
.getOutput(Task.OutputKind.DIRECT); |
36526 | 86 |
|
87 |
if (!log.contains("- compiler.err.illegal.argument.for.option: -modulepath, dummy.txt")) |
|
88 |
throw new Exception("expected output not found"); |
|
89 |
} |
|
90 |
||
91 |
@Test |
|
92 |
void testNotADirOnPath_2(Path base) throws Exception { |
|
93 |
Path src = base.resolve("src"); |
|
94 |
tb.writeJavaFiles(src, "class C { }"); |
|
95 |
tb.writeFile("dummy.jimage", ""); |
|
96 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
97 |
String log = new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 98 |
.options("-XDrawDiagnostics", |
99 |
"-modulepath", "dummy.jimage") |
|
100 |
.files(findJavaFiles(src)) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
101 |
.run(Task.Expect.FAIL) |
36526 | 102 |
.writeAll() |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
103 |
.getOutput(Task.OutputKind.DIRECT); |
36526 | 104 |
|
105 |
if (!log.contains("- compiler.err.illegal.argument.for.option: -modulepath, dummy.jimage")) |
|
106 |
throw new Exception("expected output not found"); |
|
107 |
} |
|
108 |
||
109 |
@Test |
|
110 |
void testExplodedModuleOnPath(Path base) throws Exception { |
|
111 |
Path modSrc = base.resolve("modSrc"); |
|
112 |
tb.writeJavaFiles(modSrc, |
|
113 |
"module m1 { exports p; }", |
|
114 |
"package p; public class CC { }"); |
|
115 |
Path modClasses = base.resolve("modClasses"); |
|
116 |
Files.createDirectories(modClasses); |
|
117 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
118 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 119 |
.outdir(modClasses) |
120 |
.files(findJavaFiles(modSrc)) |
|
121 |
.run() |
|
122 |
.writeAll(); |
|
123 |
||
124 |
Path src = base.resolve("src"); |
|
125 |
tb.writeJavaFiles(src, |
|
126 |
"module m { requires m1 ; }", |
|
127 |
"class C { }"); |
|
128 |
Path classes = base.resolve("classes"); |
|
129 |
Files.createDirectories(classes); |
|
130 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
131 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 132 |
.outdir(classes) |
133 |
.options("-modulepath", modClasses.toString()) |
|
134 |
.files(findJavaFiles(src)) |
|
135 |
.run() |
|
136 |
.writeAll(); |
|
137 |
} |
|
138 |
||
139 |
@Test |
|
140 |
void testBadExplodedModuleOnPath(Path base) throws Exception { |
|
141 |
Path modClasses = base.resolve("modClasses"); |
|
142 |
tb.writeFile(modClasses.resolve("module-info.class"), "module m1 { }"); |
|
143 |
||
144 |
Path src = base.resolve("src"); |
|
145 |
tb.writeJavaFiles(src, |
|
146 |
"module m { requires m1 ; }", |
|
147 |
"class C { }"); |
|
148 |
Path classes = base.resolve("classes"); |
|
149 |
Files.createDirectories(classes); |
|
150 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
151 |
String log = new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 152 |
.outdir(classes) |
153 |
.options("-XDrawDiagnostics", |
|
154 |
"-modulepath", modClasses.toString()) |
|
155 |
.files(findJavaFiles(src)) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
156 |
.run(Task.Expect.FAIL) |
36526 | 157 |
.writeAll() |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
158 |
.getOutput(Task.OutputKind.DIRECT); |
36526 | 159 |
|
160 |
if (!log.contains("- compiler.err.locn.bad.module-info: " + modClasses.toString())) |
|
161 |
throw new Exception("expected output not found"); |
|
162 |
} |
|
163 |
||
164 |
@Test |
|
165 |
void testAutoJarOnPath(Path base) throws Exception { |
|
166 |
Path jarSrc = base.resolve("jarSrc"); |
|
167 |
tb.writeJavaFiles(jarSrc, |
|
168 |
"package p; public class CC { }"); |
|
169 |
Path jarClasses = base.resolve("jarClasses"); |
|
170 |
Files.createDirectories(jarClasses); |
|
171 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
172 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 173 |
.outdir(jarClasses) |
174 |
.files(findJavaFiles(jarSrc)) |
|
175 |
.run() |
|
176 |
.writeAll(); |
|
177 |
||
178 |
Path moduleJar = base.resolve("m1.jar"); |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
179 |
new JarTask(tb, moduleJar) |
36526 | 180 |
.baseDir(jarClasses) |
181 |
.files("p/CC.class") |
|
182 |
.run(); |
|
183 |
||
184 |
Path src = base.resolve("src"); |
|
185 |
tb.writeJavaFiles(src, "class C { p.CC cc; }"); |
|
186 |
Path classes = base.resolve("classes"); |
|
187 |
Files.createDirectories(classes); |
|
188 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
189 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 190 |
.outdir(classes) |
191 |
.options("-modulepath", moduleJar.toString(), "-addmods", "m1") |
|
192 |
.files(findJavaFiles(src)) |
|
193 |
.run() |
|
194 |
.writeAll(); |
|
195 |
} |
|
196 |
||
197 |
@Test |
|
198 |
void testModJarOnPath(Path base) throws Exception { |
|
199 |
Path jarSrc = base.resolve("jarSrc"); |
|
200 |
tb.writeJavaFiles(jarSrc, |
|
201 |
"module m1 { exports p; }", |
|
202 |
"package p; public class CC { }"); |
|
203 |
Path jarClasses = base.resolve("jarClasses"); |
|
204 |
Files.createDirectories(jarClasses); |
|
205 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
206 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 207 |
.outdir(jarClasses) |
208 |
.files(findJavaFiles(jarSrc)) |
|
209 |
.run() |
|
210 |
.writeAll(); |
|
211 |
||
212 |
Path moduleJar = base.resolve("myModule.jar"); // deliberately not m1 |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
213 |
new JarTask(tb, moduleJar) |
36526 | 214 |
.baseDir(jarClasses) |
215 |
.files("module-info.class", "p/CC.class") |
|
216 |
.run(); |
|
217 |
||
218 |
Path src = base.resolve("src"); |
|
219 |
tb.writeJavaFiles(src, |
|
220 |
"module m { requires m1 ; }", |
|
221 |
"class C { }"); |
|
222 |
Path classes = base.resolve("classes"); |
|
223 |
Files.createDirectories(classes); |
|
224 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
225 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 226 |
.outdir(classes) |
227 |
.options("-modulepath", moduleJar.toString()) |
|
228 |
.files(findJavaFiles(src)) |
|
229 |
.run() |
|
230 |
.writeAll(); |
|
231 |
} |
|
232 |
||
233 |
@Test |
|
234 |
void testBadJarOnPath(Path base) throws Exception { |
|
235 |
Path src = base.resolve("src"); |
|
236 |
tb.writeJavaFiles(src, "class C { }"); |
|
237 |
tb.writeFile("dummy.jar", ""); |
|
238 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
239 |
String log = new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 240 |
.options("-XDrawDiagnostics", |
241 |
"-modulepath", "dummy.jar") |
|
242 |
.files(findJavaFiles(src)) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
243 |
.run(Task.Expect.FAIL) |
36526 | 244 |
.writeAll() |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
245 |
.getOutput(Task.OutputKind.DIRECT); |
36526 | 246 |
|
247 |
if (!log.contains("- compiler.err.locn.cant.read.file: dummy.jar")) |
|
248 |
throw new Exception("expected output not found"); |
|
249 |
} |
|
250 |
||
251 |
@Test |
|
252 |
void testJModOnPath(Path base) throws Exception { |
|
253 |
Path jmodSrc = base.resolve("jmodSrc"); |
|
254 |
tb.writeJavaFiles(jmodSrc, |
|
255 |
"module m1 { exports p; }", |
|
256 |
"package p; public class CC { }"); |
|
257 |
Path jmodClasses = base.resolve("jmodClasses"); |
|
258 |
Files.createDirectories(jmodClasses); |
|
259 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
260 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 261 |
.outdir(jmodClasses) |
262 |
.files(findJavaFiles(jmodSrc)) |
|
263 |
.run() |
|
264 |
.writeAll(); |
|
265 |
||
266 |
Path jmod = base.resolve("myModule.jmod"); // deliberately not m1 |
|
267 |
jmod(jmodClasses, jmod); |
|
268 |
||
269 |
Path src = base.resolve("src"); |
|
270 |
tb.writeJavaFiles(src, |
|
271 |
"module m { requires m1 ; }", |
|
272 |
"class C { }"); |
|
273 |
Path classes = base.resolve("classes"); |
|
274 |
Files.createDirectories(classes); |
|
275 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
276 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 277 |
.outdir(classes) |
278 |
.options("-modulepath", jmod.toString()) |
|
279 |
.files(findJavaFiles(src)) |
|
280 |
.run() |
|
281 |
.writeAll(); |
|
282 |
} |
|
283 |
||
284 |
@Test |
|
285 |
void testBadJModOnPath(Path base) throws Exception { |
|
286 |
Path src = base.resolve("src"); |
|
287 |
tb.writeJavaFiles(src, "class C { }"); |
|
288 |
tb.writeFile("dummy.jmod", ""); |
|
289 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
290 |
String log = new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 291 |
.options("-XDrawDiagnostics", |
292 |
"-modulepath", "dummy.jmod") |
|
293 |
.files(findJavaFiles(src)) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
294 |
.run(Task.Expect.FAIL) |
36526 | 295 |
.writeAll() |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
296 |
.getOutput(Task.OutputKind.DIRECT); |
36526 | 297 |
|
298 |
if (!log.contains("- compiler.err.locn.cant.read.file: dummy.jmod")) |
|
299 |
throw new Exception("expected output not found"); |
|
300 |
} |
|
301 |
||
302 |
@Test |
|
303 |
void relativePath(Path base) throws Exception { |
|
304 |
final Path modules = base.resolve("modules"); |
|
305 |
new ModuleBuilder("m1").build(modules); |
|
306 |
||
307 |
Path src = base.resolve("src"); |
|
308 |
tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
|
309 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
310 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 311 |
.options("-XDrawDiagnostics", |
312 |
"-modulepath", modules + "/./../modules") |
|
313 |
.files(findJavaFiles(src)) |
|
314 |
.run() |
|
315 |
.writeAll(); |
|
316 |
} |
|
317 |
||
318 |
@Test |
|
319 |
void duplicatePaths_1(Path base) throws Exception { |
|
320 |
final Path modules = base.resolve("modules"); |
|
321 |
new ModuleBuilder("m1").build(modules); |
|
322 |
||
323 |
Path src = base.resolve("src"); |
|
324 |
tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
|
325 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
326 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 327 |
.options("-XDrawDiagnostics", |
328 |
"-modulepath", modules + "/./../modules" + PATH_SEP + modules) |
|
329 |
.files(findJavaFiles(src)) |
|
330 |
.run() |
|
331 |
.writeAll(); |
|
332 |
} |
|
333 |
||
334 |
@Test |
|
335 |
void duplicatePaths_2(Path base) throws Exception { |
|
336 |
final Path modules = base.resolve("modules"); |
|
337 |
new ModuleBuilder("m1").build(modules); |
|
338 |
||
339 |
Path src = base.resolve("src"); |
|
340 |
tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }"); |
|
341 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
342 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 343 |
.options("-XDrawDiagnostics", |
344 |
"-modulepath", modules.toString(), |
|
345 |
"-modulepath", modules.toString()) |
|
346 |
.files(findJavaFiles(src)) |
|
347 |
.run() |
|
348 |
.writeAll(); |
|
349 |
} |
|
350 |
||
351 |
@Test |
|
352 |
void oneModuleHidesAnother(Path base) throws Exception { |
|
353 |
final Path module = base.resolve("modules"); |
|
354 |
new ModuleBuilder("m1") |
|
355 |
.exports("pkg1") |
|
356 |
.classes("package pkg1; public class E { }") |
|
357 |
.build(module); |
|
358 |
||
359 |
final Path deepModuleDir = module.resolve("deepModuleDir"); |
|
360 |
new ModuleBuilder("m1") |
|
361 |
.exports("pkg2") |
|
362 |
.classes("package pkg2; public class E { }") |
|
363 |
.build(deepModuleDir); |
|
364 |
||
365 |
Path src = base.resolve("src"); |
|
366 |
tb.writeJavaFiles(src, "module m2 { requires m1; }", " package p; class A { void main() { pkg2.E.class.getName(); } }"); |
|
367 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
368 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 369 |
.options("-XDrawDiagnostics", |
370 |
"-modulepath", deepModuleDir + PATH_SEP + module) |
|
371 |
.files(findJavaFiles(src)) |
|
372 |
.run() |
|
373 |
.writeAll(); |
|
374 |
} |
|
375 |
||
376 |
@Test |
|
377 |
void modulesInDifferentContainers(Path base) throws Exception { |
|
378 |
final Path modules = base.resolve("modules"); |
|
379 |
new ModuleBuilder("m1") |
|
380 |
.exports("one") |
|
381 |
.classes("package one; public class A { }") |
|
382 |
.build(modules); |
|
383 |
||
384 |
new ModuleBuilder("m2") |
|
385 |
.requires("m1", modules) |
|
386 |
.build(base.resolve("tmp")); |
|
387 |
jar(base.resolve("tmp/m2"), modules.resolve("m2.jar")); |
|
388 |
||
389 |
new ModuleBuilder("m3") |
|
390 |
.requires("m2", modules) |
|
391 |
.build(base.resolve("tmp")); |
|
392 |
jmod(base.resolve("tmp/m3"), modules.resolve("m3.jmod")); |
|
393 |
||
394 |
Path src = base.resolve("src"); |
|
395 |
tb.writeJavaFiles(src, "module m { requires m3; requires m2; requires m1; }", |
|
396 |
"package p; class A { void main() { one.A.class.getName(); } }"); |
|
397 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
398 |
new JavacTask(tb, Task.Mode.CMDLINE) |
36526 | 399 |
.options("-XDrawDiagnostics", |
400 |
"-modulepath", modules.toString()) |
|
401 |
.files(findJavaFiles(src)) |
|
402 |
.run() |
|
403 |
.writeAll(); |
|
404 |
} |
|
405 |
||
406 |
private void jar(Path dir, Path jar) throws IOException { |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
407 |
new JarTask(tb, jar) |
36526 | 408 |
.baseDir(dir) |
409 |
.files(".") |
|
410 |
.run() |
|
411 |
.writeAll(); |
|
412 |
} |
|
413 |
||
414 |
private void jmod(Path dir, Path jmod) throws Exception { |
|
415 |
String[] args = { |
|
416 |
"create", |
|
417 |
"--class-path", dir.toString(), |
|
418 |
jmod.toString() |
|
419 |
}; |
|
420 |
jdk.tools.jmod.Main.run(args, System.out); |
|
421 |
} |
|
422 |
} |