Skip to content

Commit

Permalink
fix: Fix bazel mod deps execution
Browse files Browse the repository at this point in the history
  • Loading branch information
tpasternak committed Oct 3, 2024
1 parent e0c51ff commit 8b86bf8
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public class BlazeModRunnerImpl extends BlazeModRunner {
private static final String DEPS = "deps";
private static final String ROOT_WORKSPACE = "";


/**
* For some reason, dump_repo_mapping reqiures "", while deps requires "<root>".
* Probably a bazel bug
*/
private static final String ROOT_WORKSPACE_EXPLICIT = "<root>";

/**
* {@code bazel mod dump_repo_mapping} takes a canonical repository name and will dump a map from
* repoName -> canonicalName of all the external repositories available to that repository The
Expand Down Expand Up @@ -91,12 +98,9 @@ public ListenableFuture<String> getDeps(
BuildSystemName buildSystemName,
List<String> flags) {

// TODO: when 8.0.0 is released add this only if it's disabled explicitly for the repo
flags.add("--noenable_workspace");

return Futures.transform(
runBlazeModGetBytes(
project, invoker, context, ImmutableList.of(DEPS, ROOT_WORKSPACE, "--output=json"), flags),
project, invoker, context, ImmutableList.of(DEPS, ROOT_WORKSPACE_EXPLICIT, "--output=json"), flags),
bytes -> new String(bytes, StandardCharsets.UTF_8),
BlazeExecutor.getInstance().getExecutor()
);
Expand Down

0 comments on commit 8b86bf8

Please sign in to comment.