Fix test for incremental build of renamed properties class
Previously, the .class file for the renamed properties class was on the class path of the compilation in two places: 1. The output directory of the test's previous compilation 2. The output directory of the compilation of src/test/java of spring-boot-configuration-processor The first of these locations is addressed by updating TestProject. The .class file is now deleted from the project's output location at the same time as the .java file is deleted from its source location. The second of these locations is addressed by configuring the class path of the compiler to include a copy of the result of compiling src/test/java of spring-boot-configuration-processor. From this copy entries can then be deleted as needed without destabilizing other tests. Closes gh-26271
This commit is contained in:
@@ -62,6 +62,8 @@ public class TestCompiler {
|
||||
Iterable<? extends File> temp = Collections.singletonList(this.outputLocation);
|
||||
this.fileManager.setLocation(StandardLocation.CLASS_OUTPUT, temp);
|
||||
this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, temp);
|
||||
Iterable<? extends File> classPath = this.fileManager.getLocation(StandardLocation.CLASS_PATH);
|
||||
this.fileManager.setLocation(StandardLocation.CLASS_PATH, prepareClassPath(classPath));
|
||||
}
|
||||
|
||||
public TestCompilationTask getTask(Collection<File> sourceFiles) {
|
||||
@@ -103,6 +105,10 @@ public class TestCompiler {
|
||||
return SOURCE_DIRECTORY;
|
||||
}
|
||||
|
||||
protected Iterable<? extends File> prepareClassPath(Iterable<? extends File> classPath) {
|
||||
return classPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* A compilation task.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user