Port the build to Gradle

Closes gh-19609
Closes gh-19608
This commit is contained in:
Andy Wilkinson
2020-01-10 13:48:43 +00:00
parent abe95fa8a7
commit ce99db1902
974 changed files with 17108 additions and 26596 deletions

View File

@@ -40,7 +40,9 @@ public class BuildOutput {
public File getTestClassesLocation() {
try {
File location = new File(this.testClass.getProtectionDomain().getCodeSource().getLocation().toURI());
if (location.getPath().endsWith(path("target", "test-classes"))) {
if (location.getPath().endsWith(path("bin", "test")) || location.getPath().endsWith(path("bin", "intTest"))
|| location.getPath().endsWith(path("build", "classes", "java", "test"))
|| location.getPath().endsWith(path("build", "classes", "java", "intTest"))) {
return location;
}
throw new IllegalStateException("Unexpected test classes location '" + location + "'");
@@ -56,9 +58,16 @@ public class BuildOutput {
*/
public File getTestResourcesLocation() {
File testClassesLocation = getTestClassesLocation();
if (testClassesLocation.getPath().endsWith(path("target", "test-classes"))) {
if (testClassesLocation.getPath().endsWith(path("bin", "test"))
|| testClassesLocation.getPath().endsWith(path("bin", "intTest"))) {
return testClassesLocation;
}
if (testClassesLocation.getPath().endsWith(path("build", "classes", "java", "test"))) {
return new File(testClassesLocation.getParentFile().getParentFile().getParentFile(), "resources/test");
}
if (testClassesLocation.getPath().endsWith(path("build", "classes", "java", "intTest"))) {
return new File(testClassesLocation.getParentFile().getParentFile().getParentFile(), "resources/intTest");
}
throw new IllegalStateException(
"Cannot determine test resources location from classes location '" + testClassesLocation + "'");
}
@@ -68,7 +77,7 @@ public class BuildOutput {
* @return root location
*/
public File getRootLocation() {
return getTestClassesLocation().getParentFile();
return new File("build");
}
private String path(String... components) {