|
|
@@ -119,29 +119,29 @@ public class Util {
|
|
|
return project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets();
|
|
|
}
|
|
|
|
|
|
- public static File locateElasticsearchWorkspace(Gradle gradle) {
|
|
|
- if(gradle.getRootProject().getName().startsWith("build-tools")) {
|
|
|
- File buildToolsParent = gradle.getRootProject().getRootDir().getParentFile();
|
|
|
- if(versionFileExists(buildToolsParent)) {
|
|
|
- return buildToolsParent;
|
|
|
- }
|
|
|
+ public static File locateElasticsearchWorkspace(Gradle gradle) {
|
|
|
+ if (gradle.getRootProject().getName().startsWith("build-tools")) {
|
|
|
+ File buildToolsParent = gradle.getRootProject().getRootDir().getParentFile();
|
|
|
+ if (versionFileExists(buildToolsParent)) {
|
|
|
return buildToolsParent;
|
|
|
}
|
|
|
- if (gradle.getParent() == null) {
|
|
|
- // See if any of these included builds is the Elasticsearch gradle
|
|
|
- for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
|
|
|
- if (versionFileExists(includedBuild.getProjectDir())) {
|
|
|
- return includedBuild.getProjectDir();
|
|
|
- }
|
|
|
+ return buildToolsParent;
|
|
|
+ }
|
|
|
+ if (gradle.getParent() == null) {
|
|
|
+ // See if any of these included builds is the Elasticsearch gradle
|
|
|
+ for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
|
|
|
+ if (versionFileExists(includedBuild.getProjectDir())) {
|
|
|
+ return includedBuild.getProjectDir();
|
|
|
}
|
|
|
-
|
|
|
- // Otherwise assume this gradle is the root elasticsearch workspace
|
|
|
- return gradle.getRootProject().getRootDir();
|
|
|
- } else {
|
|
|
- // We're an included build, so keep looking
|
|
|
- return locateElasticsearchWorkspace(gradle.getParent());
|
|
|
}
|
|
|
+
|
|
|
+ // Otherwise assume this gradle is the root elasticsearch workspace
|
|
|
+ return gradle.getRootProject().getRootDir();
|
|
|
+ } else {
|
|
|
+ // We're an included build, so keep looking
|
|
|
+ return locateElasticsearchWorkspace(gradle.getParent());
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
private static boolean versionFileExists(File rootDir) {
|
|
|
return new File(rootDir, "build-tools-internal/version.properties").exists();
|