Bazel: Generate Eclipse classpath
To guess what build system is used, we create now .primary_build_tool file in the root of the project during the eclipse classpath generation. Change the working directory for GWT SDM session to be .gwt_work_dir. The reason for that Bazel doesn't allow to write to bazel-out. Change-Id: I984068350244ee9d66807e4bc8c6779b34a26bab
This commit is contained in:
@@ -625,12 +625,32 @@ public final class GerritLauncher {
|
||||
}
|
||||
|
||||
static String SOURCE_ROOT_RESOURCE = "/gerrit-launcher/workspace-root.txt";
|
||||
static String PRIMARY_BUILD_TOOL = ".primary_build_tool";
|
||||
|
||||
/** returns whether we're running out of a bazel build. */
|
||||
public static boolean isBazel() {
|
||||
Class<GerritLauncher> self = GerritLauncher.class;
|
||||
URL rootURL = self.getResource(SOURCE_ROOT_RESOURCE);
|
||||
return rootURL != null;
|
||||
if (rootURL != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Path p = null;
|
||||
try {
|
||||
p = resolveInSourceRoot("eclipse-out");
|
||||
Path path = p.getParent().resolve(PRIMARY_BUILD_TOOL);
|
||||
if (Files.exists(path)) {
|
||||
String content = new String(Files.readAllBytes(path));
|
||||
if (content.toLowerCase().contains("bazel")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
// Not Bazel then
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -685,7 +705,8 @@ public final class GerritLauncher {
|
||||
|
||||
// Pop up to the top-level source folder by looking for .buckconfig.
|
||||
Path dir = Paths.get(u.getPath());
|
||||
while (!Files.isRegularFile(dir.resolve(".buckconfig"))) {
|
||||
while (!Files.isRegularFile(dir.resolve(".buckconfig"))
|
||||
&& !Files.isRegularFile(dir.resolve("WORKSPACE"))) {
|
||||
Path parent = dir.getParent();
|
||||
if (parent == null) {
|
||||
throw new FileNotFoundException("Cannot find source root from " + u);
|
||||
|
Reference in New Issue
Block a user