diff --git a/src/main/java/com/google/devtools/build/lib/packages/AutoloadSymbols.java b/src/main/java/com/google/devtools/build/lib/packages/AutoloadSymbols.java index 6b27cfb7d08bbd..f2b25cab2fd977 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/AutoloadSymbols.java +++ b/src/main/java/com/google/devtools/build/lib/packages/AutoloadSymbols.java @@ -22,12 +22,17 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.devtools.build.lib.bazel.bzlmod.BazelDepGraphValue; +import com.google.devtools.build.lib.bazel.bzlmod.ModuleKey; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.cmdline.Label.RepoContext; import com.google.devtools.build.lib.cmdline.LabelSyntaxException; +import com.google.devtools.build.lib.cmdline.RepositoryMapping; import com.google.devtools.build.lib.cmdline.RepositoryName; +import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions; import com.google.devtools.build.lib.skyframe.BzlLoadValue; +import com.google.devtools.build.lib.skyframe.PrecomputedValue.Precomputed; import com.google.devtools.build.lib.skyframe.RepositoryMappingValue; import com.google.devtools.build.skyframe.SkyFunction; import java.util.HashSet; @@ -83,6 +88,10 @@ public class AutoloadSymbols { private final boolean bzlmodEnabled; private final boolean autoloadsEnabled; + // Configuration of --incompatible_load_externally + public static final Precomputed AUTOLOAD_SYMBOLS = + new Precomputed<>("autoload_symbols"); + public AutoloadSymbols(RuleClassProvider ruleClassProvider, StarlarkSemantics semantics) { ImmutableList symbolConfiguration = ImmutableList.copyOf(semantics.get(BuildLanguageOptions.INCOMPATIBLE_AUTOLOAD_EXTERNALLY)); @@ -378,23 +387,71 @@ private static Map convertNativeStructToMap(StarlarkInfo struct) @Nullable public ImmutableMap getLoadKeys(SkyFunction.Environment env) throws InterruptedException { - RepositoryMappingValue repositoryMappingValue = - (RepositoryMappingValue) - env.getValue(RepositoryMappingValue.key(RepositoryName.BAZEL_TOOLS)); - if (repositoryMappingValue == null) { - return null; - } + final RepoContext repoContext; + if (bzlmodEnabled) { + BazelDepGraphValue bazelDepGraphValue = + (BazelDepGraphValue) env.getValue(BazelDepGraphValue.KEY); + if (bazelDepGraphValue == null) { + return null; + } - RepoContext repoContext = - Label.RepoContext.of( - RepositoryName.BAZEL_TOOLS, repositoryMappingValue.getRepositoryMapping()); + ImmutableMap highestVersions = + bazelDepGraphValue.getCanonicalRepoNameLookup().values().stream() + .collect( + toImmutableMap( + ModuleKey::name, + moduleKey -> moduleKey, + (m1, m2) -> m1.version().compareTo(m2.version()) >= 0 ? m1 : m1)); + RepositoryMapping repositoryMapping = + RepositoryMapping.create( + highestVersions.entrySet().stream() + .collect( + toImmutableMap( + Map.Entry::getKey, + entry -> + bazelDepGraphValue + .getCanonicalRepoNameLookup() + .inverse() + .get(entry.getValue()))), + RepositoryName.MAIN); + repoContext = Label.RepoContext.of(RepositoryName.MAIN, repositoryMapping); + } else { + RepositoryMappingValue repositoryMappingValue = + (RepositoryMappingValue) env.getValue(RepositoryMappingValue.key(RepositoryName.MAIN)); + if (repositoryMappingValue == null) { + return null; + } + // Create with owner, so that we can report missing references (isVisible is false if missing) + repoContext = + Label.RepoContext.of( + RepositoryName.MAIN, + RepositoryMapping.create( + repositoryMappingValue.getRepositoryMapping().entries(), RepositoryName.MAIN)); + } // Inject loads for rules and symbols removed from Bazel ImmutableMap.Builder loadKeysBuilder = ImmutableMap.builderWithExpectedSize(autoloadedSymbols.size()); + ImmutableSet.Builder missingRepositories = ImmutableSet.builder(); for (String symbol : autoloadedSymbols) { - loadKeysBuilder.put(symbol, AUTOLOAD_CONFIG.get(symbol).getKey(repoContext)); + Label label = AUTOLOAD_CONFIG.get(symbol).getLabel(repoContext); + // Only load if the dependency is present + if (label.getRepository().isVisible()) { + loadKeysBuilder.put(symbol, BzlLoadValue.keyForBuild(label)); + } else { + missingRepositories.add(label.getRepository().getName()); + } + } + for (String missingRepository : missingRepositories.build()) { + env.getListener() + .handle( + Event.warn( + String.format( + "Couldn't auto load rules or symbols, because no dependency on" + + " module/repository '%s' found. This will result in a failure if" + + " there's a reference to those rules or symbols.", + missingRepository))); } return loadKeysBuilder.buildOrThrow(); } @@ -480,10 +537,9 @@ public abstract static class SymbolRedirect { public abstract ImmutableSet getRdeps(); - public BzlLoadValue.Key getKey(RepoContext bazelToolsRepoContext) throws InterruptedException { + Label getLabel(RepoContext repoContext) throws InterruptedException { try { - return BzlLoadValue.keyForBuild( - Label.parseWithRepoContext(getLoadLabel(), bazelToolsRepoContext)); + return Label.parseWithRepoContext(getLoadLabel(), repoContext); } catch (LabelSyntaxException e) { throw new IllegalStateException(e); } diff --git a/src/main/java/com/google/devtools/build/lib/packages/BUILD b/src/main/java/com/google/devtools/build/lib/packages/BUILD index c41443a94b618f..4f72aa5d3f766a 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/BUILD +++ b/src/main/java/com/google/devtools/build/lib/packages/BUILD @@ -54,6 +54,7 @@ java_library( "ConfiguredAttributeMapper.java", "LabelPrinter.java", "PackageSpecification.java", + "AutoloadSymbols.java", ], ), deps = [ @@ -87,7 +88,6 @@ java_library( "//src/main/java/com/google/devtools/build/lib/profiler", "//src/main/java/com/google/devtools/build/lib/skyframe:bzl_load_value", "//src/main/java/com/google/devtools/build/lib/skyframe:detailed_exceptions", - "//src/main/java/com/google/devtools/build/lib/skyframe:repository_mapping_value", "//src/main/java/com/google/devtools/build/lib/skyframe:starlark_builtins_value", "//src/main/java/com/google/devtools/build/lib/skyframe/serialization", "//src/main/java/com/google/devtools/build/lib/skyframe/serialization:abstract-exported-starlark-symbol-codec", @@ -121,6 +121,27 @@ java_library( ], ) +java_library( + name = "autoload_symbols", + srcs = ["AutoloadSymbols.java"], + deps = [ + "//src/main/java/com/google/devtools/build/lib/bazel/bzlmod:common", + "//src/main/java/com/google/devtools/build/lib/bazel/bzlmod:resolution", + "//src/main/java/com/google/devtools/build/lib/cmdline", + "//src/main/java/com/google/devtools/build/lib/events", + "//src/main/java/com/google/devtools/build/lib/packages", + "//src/main/java/com/google/devtools/build/lib/packages/semantics", + "//src/main/java/com/google/devtools/build/lib/skyframe:bzl_load_value", + "//src/main/java/com/google/devtools/build/lib/skyframe:precomputed_value", + "//src/main/java/com/google/devtools/build/lib/skyframe:repository_mapping_value", + "//src/main/java/com/google/devtools/build/skyframe:skyframe-objects", + "//src/main/java/net/starlark/java/eval", + "//third_party:auto_value", + "//third_party:guava", + "//third_party:jsr305", + ], +) + java_library( name = "bzl_visibility", srcs = ["BzlVisibility.java"], diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BUILD b/src/main/java/com/google/devtools/build/lib/skyframe/BUILD index f468abb07375cf..832e59a34a7183 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/BUILD +++ b/src/main/java/com/google/devtools/build/lib/skyframe/BUILD @@ -317,6 +317,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/io:inconsistent_filesystem_exception", "//src/main/java/com/google/devtools/build/lib/io:process_package_directory_exception", "//src/main/java/com/google/devtools/build/lib/packages", + "//src/main/java/com/google/devtools/build/lib/packages:autoload_symbols", "//src/main/java/com/google/devtools/build/lib/packages:bzl_visibility", "//src/main/java/com/google/devtools/build/lib/packages:globber", "//src/main/java/com/google/devtools/build/lib/packages:globber_utils", @@ -796,6 +797,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/cmdline", "//src/main/java/com/google/devtools/build/lib/events", "//src/main/java/com/google/devtools/build/lib/packages", + "//src/main/java/com/google/devtools/build/lib/packages:autoload_symbols", "//src/main/java/com/google/devtools/build/lib/vfs", "//src/main/java/com/google/devtools/build/skyframe:skyframe-objects", "//src/main/java/net/starlark/java/eval", diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BzlCompileFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/BzlCompileFunction.java index 38c691fce1a27e..f5bc53498b3c17 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/BzlCompileFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/BzlCompileFunction.java @@ -161,7 +161,7 @@ static BzlCompileValue computeInline( // Takes into account --incompatible_autoload_externally, similarly to the comment above, this // only defines the correct set of symbols, but does not load them yet. - AutoloadSymbols autoloadSymbols = PrecomputedValue.AUTOLOAD_SYMBOLS.get(env); + AutoloadSymbols autoloadSymbols = AutoloadSymbols.AUTOLOAD_SYMBOLS.get(env); if (autoloadSymbols == null) { return null; } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BzlLoadFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/BzlLoadFunction.java index 1e16e34f904eb9..1952e329389190 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/BzlLoadFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/BzlLoadFunction.java @@ -610,7 +610,7 @@ private StarlarkBuiltinsValue getBuiltins( } return StarlarkBuiltinsValue.createEmpty(starlarkSemantics); } - AutoloadSymbols autoloadSymbols = PrecomputedValue.AUTOLOAD_SYMBOLS.get(env); + AutoloadSymbols autoloadSymbols = AutoloadSymbols.AUTOLOAD_SYMBOLS.get(env); if (autoloadSymbols == null) { return null; } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java index fce95cd4fad919..dcbff90d0ec55b 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java @@ -462,7 +462,7 @@ public SkyValue compute(SkyKey key, Environment env) StarlarkBuiltinsValue starlarkBuiltinsValue; try { // Bazel: we do autoloads for all BUILD files if enabled - AutoloadSymbols autoloadSymbols = PrecomputedValue.AUTOLOAD_SYMBOLS.get(env); + AutoloadSymbols autoloadSymbols = AutoloadSymbols.AUTOLOAD_SYMBOLS.get(env); if (autoloadSymbols == null) { return null; } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java index 734bbd35e16f87..21082d2472b142 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java @@ -19,7 +19,6 @@ import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.devtools.build.lib.analysis.config.BuildOptions; -import com.google.devtools.build.lib.packages.AutoloadSymbols; import com.google.devtools.build.lib.packages.Package.ConfigSettingVisibilityPolicy; import com.google.devtools.build.lib.packages.RuleVisibility; import com.google.devtools.build.lib.pkgcache.PathPackageLocator; @@ -85,10 +84,6 @@ public static Injected injected(Precomputed precomputed, T value) { public static final Precomputed STARLARK_SEMANTICS = new Precomputed<>("starlark_semantics"); - // Configuration of --incompatible_load_externally - public static final Precomputed AUTOLOAD_SYMBOLS = - new Precomputed<>("autoload_symbols"); - public static final Precomputed BUILD_ID = new Precomputed<>("build_id", /* shareable= */ false); diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java index 639a812badbec5..da79fb421cd145 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java @@ -1351,7 +1351,7 @@ private void setStarlarkSemantics(StarlarkSemantics starlarkSemantics) { } private void setAutoloadsConfiguration(AutoloadSymbols autoloadSymbols) { - PrecomputedValue.AUTOLOAD_SYMBOLS.set(injectable(), autoloadSymbols); + AutoloadSymbols.AUTOLOAD_SYMBOLS.set(injectable(), autoloadSymbols); } public void setBaselineConfiguration(BuildOptions buildOptions) { diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/StarlarkBuiltinsFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/StarlarkBuiltinsFunction.java index f32df8ad4f0ef3..f7ab2bc6a07dd4 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/StarlarkBuiltinsFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/StarlarkBuiltinsFunction.java @@ -185,7 +185,7 @@ private static StarlarkBuiltinsValue computeInternal( if (starlarkSemantics.get(BuildLanguageOptions.EXPERIMENTAL_BUILTINS_BZL_PATH).isEmpty()) { return StarlarkBuiltinsValue.createEmpty(starlarkSemantics); } - AutoloadSymbols autoloadSymbols = PrecomputedValue.AUTOLOAD_SYMBOLS.get(env); + AutoloadSymbols autoloadSymbols = AutoloadSymbols.AUTOLOAD_SYMBOLS.get(env); if (autoloadSymbols == null) { return null; } @@ -251,7 +251,6 @@ private static StarlarkBuiltinsValue computeInternal( } autoBzlLoadValues = autoBzlLoadValuesBuilder.buildOrThrow(); } catch (BzlLoadFailedException ex) { - throw BuiltinsFailedException.errorEvaluatingAutoloadedBzls( ex, starlarkSemantics.getBool(BuildLanguageOptions.ENABLE_BZLMOD)); } @@ -368,7 +367,7 @@ static BuiltinsFailedException errorEvaluatingAutoloadedBzls( String additionalMessage = bzlmodEnabled ? "" - : ". Most likely you need to upgrade the version of rules repository in the" + : " Most likely you need to upgrade the version of rules repository in the" + " WORKSPACE file."; return new BuiltinsFailedException( String.format( diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/packages/AbstractPackageLoader.java b/src/main/java/com/google/devtools/build/lib/skyframe/packages/AbstractPackageLoader.java index 08a40352346975..9d6bc9bb0606d6 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/packages/AbstractPackageLoader.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/packages/AbstractPackageLoader.java @@ -351,7 +351,7 @@ public void inject(SkyKey key, Delta delta) { PrecomputedValue.CONFIG_SETTING_VISIBILITY_POLICY.set( injectable, ConfigSettingVisibilityPolicy.LEGACY_OFF); PrecomputedValue.STARLARK_SEMANTICS.set(injectable, starlarkSemantics); - PrecomputedValue.AUTOLOAD_SYMBOLS.set( + AutoloadSymbols.AUTOLOAD_SYMBOLS.set( injectable, new AutoloadSymbols(ruleClassProvider, starlarkSemantics)); return new ImmutableDiff(ImmutableList.of(), valuesToInject); } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/packages/BUILD b/src/main/java/com/google/devtools/build/lib/skyframe/packages/BUILD index 0cc232fc6e005c..bc67b392f0b7e8 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/packages/BUILD +++ b/src/main/java/com/google/devtools/build/lib/skyframe/packages/BUILD @@ -48,6 +48,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/io:file_symlink_cycle_uniqueness_function", "//src/main/java/com/google/devtools/build/lib/io:file_symlink_infinite_expansion_uniqueness_function", "//src/main/java/com/google/devtools/build/lib/packages", + "//src/main/java/com/google/devtools/build/lib/packages:autoload_symbols", "//src/main/java/com/google/devtools/build/lib/pkgcache", "//src/main/java/com/google/devtools/build/lib/repository:external_package_helper", "//src/main/java/com/google/devtools/build/lib/skyframe:bzl_compile", diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BUILD b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BUILD index 65f458328fa321..ab4d8669a6997f 100644 --- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BUILD +++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BUILD @@ -51,6 +51,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/cmdline", "//src/main/java/com/google/devtools/build/lib/events", "//src/main/java/com/google/devtools/build/lib/packages", + "//src/main/java/com/google/devtools/build/lib/packages:autoload_symbols", "//src/main/java/com/google/devtools/build/lib/packages/semantics", "//src/main/java/com/google/devtools/build/lib/pkgcache", "//src/main/java/com/google/devtools/build/lib/rules:repository/local_repository_rule", diff --git a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java index 55e12bcc1778c7..549d1043333f81 100644 --- a/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java +++ b/src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java @@ -268,7 +268,7 @@ public void setup() throws Exception { .set(BuildLanguageOptions.INCOMPATIBLE_AUTOLOAD_EXTERNALLY, ImmutableList.of()) .build(); PrecomputedValue.STARLARK_SEMANTICS.set(differencer, semantics); - PrecomputedValue.AUTOLOAD_SYMBOLS.set( + AutoloadSymbols.AUTOLOAD_SYMBOLS.set( differencer, new AutoloadSymbols(ruleClassProvider, semantics)); RepositoryDelegatorFunction.REPOSITORY_OVERRIDES.set(differencer, ImmutableMap.of()); RepositoryDelegatorFunction.FORCE_FETCH.set( diff --git a/src/test/java/com/google/devtools/build/lib/rules/repository/BUILD b/src/test/java/com/google/devtools/build/lib/rules/repository/BUILD index e3938d9b04cb06..a724d6cd5cf5b9 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/repository/BUILD +++ b/src/test/java/com/google/devtools/build/lib/rules/repository/BUILD @@ -30,6 +30,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/cmdline", "//src/main/java/com/google/devtools/build/lib/events", "//src/main/java/com/google/devtools/build/lib/packages", + "//src/main/java/com/google/devtools/build/lib/packages:autoload_symbols", "//src/main/java/com/google/devtools/build/lib/packages/semantics", "//src/main/java/com/google/devtools/build/lib/pkgcache", "//src/main/java/com/google/devtools/build/lib/repository:external_package_helper", diff --git a/src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorTest.java b/src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorTest.java index 27a59ba892c10f..785330cc2b5aa9 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorTest.java @@ -279,7 +279,7 @@ public void setupDelegator() throws Exception { StarlarkSemantics semantics = StarlarkSemantics.builder().setBool(BuildLanguageOptions.ENABLE_BZLMOD, true).build(); PrecomputedValue.STARLARK_SEMANTICS.set(differencer, semantics); - PrecomputedValue.AUTOLOAD_SYMBOLS.set( + AutoloadSymbols.AUTOLOAD_SYMBOLS.set( differencer, new AutoloadSymbols(ruleClassProvider, semantics)); RepositoryDelegatorFunction.RESOLVED_FILE_INSTEAD_OF_WORKSPACE.set( differencer, Optional.empty()); diff --git a/src/test/shell/integration/load_removed_symbols_test.sh b/src/test/shell/integration/load_removed_symbols_test.sh index 3c082c74f18406..04f0a5da4227f1 100755 --- a/src/test/shell/integration/load_removed_symbols_test.sh +++ b/src/test/shell/integration/load_removed_symbols_test.sh @@ -79,7 +79,33 @@ local_path_override( EOF } -function disabled_test_removed_rule_loaded() { +function test_missing_necessary_bzlmod_dep() { + # Intentionally not adding rules_android to MODULE.bazel + cat > BUILD << EOF +aar_import( + name = 'aar', + aar = 'aar.file', + deps = [], +) +EOF + bazel build --incompatible_autoload_externally=aar_import :aar >&$TEST_log 2>&1 && fail "build unexpectedly succeeded" + expect_log "name 'aar_import' is not defined" + expect_log "WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_android' found. This will result in a failure if there's a reference to those rules or symbols." +} + +function test_missing_unnecessary_bzmod_dep() { + # Intentionally not adding rules_android to MODULE.bazel + cat > BUILD << EOF +filegroup( + name = 'filegroup', + srcs = [], +) +EOF + bazel build --incompatible_autoload_externally=aar_import :filegroup >&$TEST_log 2>&1 || fail "build failed" + expect_log "WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_android' found. This will result in a failure if there's a reference to those rules or symbols." +} + +function test_removed_rule_loaded() { setup_module_dot_bazel mock_rules_android @@ -94,7 +120,7 @@ EOF # TODO(b/355260271): add test with workspace enabled } -function disabled_test_removed_rule_loaded_from_bzl() { +function test_removed_rule_loaded_from_bzl() { setup_module_dot_bazel mock_rules_android @@ -385,7 +411,7 @@ EOF expect_log "Duplicated symbol 'py_library' in --incompatible_autoload_externally" } -function disabled_test_missing_symbol_error() { +function test_missing_symbol_error() { setup_module_dot_bazel mock_rules_android rules_android_workspace="${TEST_TMPDIR}/rules_android_workspace" @@ -404,7 +430,7 @@ EOF expect_log "Failed to apply symbols loaded externally: The toplevel symbol 'aar_import' set by --incompatible_load_symbols_externally couldn't be loaded. 'aar_import' not found in auto loaded '@rules_android//rules:rules.bzl'." } -function disabled_test_missing_bzlfile_error() { +function test_missing_bzlfile_error() { setup_module_dot_bazel mock_rules_android rules_android_workspace="${TEST_TMPDIR}/rules_android_workspace"