From 27b3133658628c367f9ebcf301ebd4aa3b448916 Mon Sep 17 00:00:00 2001 From: Daniel Brauner <44034965+LeFrosch@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:14:30 +0100 Subject: [PATCH] Added MODULE.bazel to valid workspace root files (#6127) --- .../idea/blaze/base/bazel/BazelWorkspaceRootProvider.java | 5 +++-- .../blaze/base/wizard2/UseExistingBazelWorkspaceOption.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/base/src/com/google/idea/blaze/base/bazel/BazelWorkspaceRootProvider.java b/base/src/com/google/idea/blaze/base/bazel/BazelWorkspaceRootProvider.java index 39a29136e27..1e758556a11 100644 --- a/base/src/com/google/idea/blaze/base/bazel/BazelWorkspaceRootProvider.java +++ b/base/src/com/google/idea/blaze/base/bazel/BazelWorkspaceRootProvider.java @@ -27,11 +27,12 @@ public class BazelWorkspaceRootProvider implements WorkspaceRootProvider { private BazelWorkspaceRootProvider() {} - /** Checks for the existence of a WORKSPACE file in the given directory. */ + /** Checks for the existence of a WORKSPACE or MODULE.bazel file in the given directory. */ @Override public boolean isWorkspaceRoot(File file) { return FileOperationProvider.getInstance().isFile(new File(file, "WORKSPACE")) - || FileOperationProvider.getInstance().isFile(new File(file, "WORKSPACE.bazel")); + || FileOperationProvider.getInstance().isFile(new File(file, "WORKSPACE.bazel")) + || FileOperationProvider.getInstance().isFile(new File(file, "MODULE.bazel")); } @Nullable diff --git a/base/src/com/google/idea/blaze/base/wizard2/UseExistingBazelWorkspaceOption.java b/base/src/com/google/idea/blaze/base/wizard2/UseExistingBazelWorkspaceOption.java index 85abdafc44c..52a692c25fd 100644 --- a/base/src/com/google/idea/blaze/base/wizard2/UseExistingBazelWorkspaceOption.java +++ b/base/src/com/google/idea/blaze/base/wizard2/UseExistingBazelWorkspaceOption.java @@ -121,7 +121,7 @@ public WorkspaceTypeData getWorkspaceData() throws ConfigurationException { if (!isWorkspaceRoot(workspaceRootFile)) { throw new ConfigurationException( "Invalid workspace root: choose a bazel workspace directory " - + "(containing a WORKSPACE file)"); + + "(containing a WORKSPACE or MODULE.bazel file)"); } WorkspaceRoot root = new WorkspaceRoot(workspaceRootFile); return WorkspaceTypeData.builder()