mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8054465: Add --permit-artifact=bar to sjavac
Add --permit-artifact=bar to white-list files that have been written to the destination directory and that sjavac should not delete. Reviewed-by: jjg, alundblad
This commit is contained in:
parent
c8256e4d27
commit
c110d6437f
7 changed files with 85 additions and 16 deletions
|
@ -25,7 +25,7 @@
|
|||
/*
|
||||
* @test
|
||||
* @summary Test all aspects of sjavac.
|
||||
* @bug 8004658 8042441 8042699 8054461 8054474
|
||||
* @bug 8004658 8042441 8042699 8054461 8054474 8054465
|
||||
*
|
||||
* @build Wrapper
|
||||
* @run main Wrapper SJavac
|
||||
|
@ -101,6 +101,7 @@ public class SJavac {
|
|||
incrementalCompileTestFullyQualifiedRef();
|
||||
compileWithAtFile();
|
||||
testStateDir();
|
||||
testPermittedArtifact();
|
||||
|
||||
delete(gensrc);
|
||||
delete(gensrc2);
|
||||
|
@ -527,6 +528,36 @@ public class SJavac {
|
|||
"bar/javac_state");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test white listing of external artifacts inside the destination dir.
|
||||
* @throws Exception If test fails
|
||||
*/
|
||||
void testPermittedArtifact() throws Exception {
|
||||
System.out.println("\nVerify that --permit-artifact=bar works.");
|
||||
System.out.println("-------------------------------------------");
|
||||
|
||||
delete(gensrc);
|
||||
delete(bin);
|
||||
|
||||
previous_bin_state = collectState(bin);
|
||||
|
||||
populate(gensrc,
|
||||
"alfa/omega/A.java",
|
||||
"package alfa.omega; public class A { }");
|
||||
|
||||
populate(bin,
|
||||
"alfa/omega/AA.class",
|
||||
"Ugh, a messy build system (tobefixed) wrote this class file, sjavac must not delete it.");
|
||||
|
||||
compile("--log=debug", "--permit-artifact=bin/alfa/omega/AA.class", "-src", "gensrc", "-d", "bin", serverArg);
|
||||
|
||||
Map<String,Long> new_bin_state = collectState(bin);
|
||||
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
|
||||
"bin/alfa/omega/A.class",
|
||||
"bin/alfa/omega/AA.class",
|
||||
"bin/javac_state");
|
||||
}
|
||||
|
||||
void removeFrom(Path dir, String... args) throws IOException {
|
||||
for (String filename : args) {
|
||||
Path p = dir.resolve(filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue