Skip to content

Commit

Permalink
inline a function
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorcloudy committed Aug 19, 2024
1 parent 5219842 commit ab7b985
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,6 @@ public static AnalysisMock get() {
}
}

public static AnalysisMock getAnalysisMockWithMinimalBuiltinModules() {
return new AnalysisMock.Delegate(AnalysisMock.get()) {
@Override
public ImmutableMap<String, NonRegistryOverride> getBuiltinModules(
BlazeDirectories directories) {
return ImmutableMap.of("bazel_tools", LocalPathOverride.create(
directories
.getWorkingDirectory()
.getRelative("embedded_tools")
.getPathString()),
"platforms", LocalPathOverride.create(
directories
.getWorkingDirectory()
.getRelative("platforms_workspace")
.getPathString()));
}
};
}

public static AnalysisMock getAnalysisMockWithoutBuiltinModules() {
return new AnalysisMock.Delegate(AnalysisMock.get()) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@

import com.google.common.collect.ImmutableMap;
import com.google.common.testing.EqualsTester;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.util.AnalysisMock;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
import com.google.devtools.build.lib.bazel.bzlmod.LocalPathOverride;
import com.google.devtools.build.lib.bazel.bzlmod.NonRegistryOverride;
import com.google.devtools.build.lib.bazel.bzlmod.Version;
import com.google.devtools.build.lib.cmdline.RepositoryMapping;
import com.google.devtools.build.lib.cmdline.RepositoryName;
Expand Down Expand Up @@ -58,8 +61,23 @@ private EvaluationResult<RepositoryMappingValue> eval(SkyKey key)

@Override
protected AnalysisMock getAnalysisMock() {
// Make sure we don't have built-in modules affecting the dependency graph.
return AnalysisMock.getAnalysisMockWithMinimalBuiltinModules();
// Make sure we have minimal built-in modules affecting the dependency graph.
return new AnalysisMock.Delegate(AnalysisMock.get()) {
@Override
public ImmutableMap<String, NonRegistryOverride> getBuiltinModules(
BlazeDirectories directories) {
return ImmutableMap.of("bazel_tools", LocalPathOverride.create(
directories
.getWorkingDirectory()
.getRelative("embedded_tools")
.getPathString()),
"platforms", LocalPathOverride.create(
directories
.getWorkingDirectory()
.getRelative("platforms_workspace")
.getPathString()));
}
};
}

private static RepositoryMappingValue valueForWorkspace(
Expand Down

0 comments on commit ab7b985

Please sign in to comment.