Update error handling for absolute symlink violations when loading a `.bzl` file. PiperOrigin-RevId: 688152231 Change-Id: I6d74ee2da3694268067d4a2dcfe46f11eaedf4e0
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BazelSkyframeExecutorConstants.java b/src/main/java/com/google/devtools/build/lib/skyframe/BazelSkyframeExecutorConstants.java index 86c80c3..77ae054 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/BazelSkyframeExecutorConstants.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/BazelSkyframeExecutorConstants.java
@@ -17,6 +17,7 @@ import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.packages.BuildFileName; import com.google.devtools.build.lib.repository.ExternalPackageHelper; +import com.google.devtools.build.lib.skyframe.PackageFunction.ActionOnFilesystemErrorCodeLoadingBzlFile; import com.google.devtools.build.lib.skyframe.PackageFunction.ActionOnIOExceptionReadingBuildFile; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; import com.google.devtools.build.lib.vfs.PathFragment; @@ -58,12 +59,18 @@ ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE = ActionOnIOExceptionReadingBuildFile.UseOriginalIOException.INSTANCE; + public static final ActionOnFilesystemErrorCodeLoadingBzlFile + ACTION_ON_FILESYSTEM_ERROR_CODE_LOADING_BZL_FILE = + ActionOnFilesystemErrorCodeLoadingBzlFile.ALWAYS_USE_PACKAGE_LOADING_CODE; + public static final boolean USE_REPO_DOT_BAZEL = true; public static SequencedSkyframeExecutor.Builder newBazelSkyframeExecutorBuilder() { return SequencedSkyframeExecutor.builder() .setIgnoredPackagePrefixesFunction(IGNORED_PACKAGE_PREFIXES_FUNCTION) .setActionOnIOExceptionReadingBuildFile(ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE) + .setActionOnFilesystemErrorCodeLoadingBzlFile( + ACTION_ON_FILESYSTEM_ERROR_CODE_LOADING_BZL_FILE) .setShouldUseRepoDotBazel(USE_REPO_DOT_BAZEL) .setCrossRepositoryLabelViolationStrategy(CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY) .setBuildFilesByPriority(BUILD_FILES_BY_PRIORITY)
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 1952e32..944de513 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
@@ -53,6 +53,7 @@ import com.google.devtools.build.lib.util.DetailedExitCode; import com.google.devtools.build.lib.util.Fingerprint; import com.google.devtools.build.lib.util.Pair; +import com.google.devtools.build.lib.vfs.DetailedIOException; import com.google.devtools.build.lib.vfs.PathFragment; import com.google.devtools.build.lib.vfs.Root; import com.google.devtools.build.skyframe.RecordingSkyFunctionEnvironment; @@ -1631,14 +1632,23 @@ errorMessage, detailedExitCode, cause, Transience.PERSISTENT); } - static BzlLoadFailedException errorReadingBzl( - PathFragment file, BzlCompileFunction.FailedIOException cause) { - String errorMessage = - String.format( - "Encountered error while reading extension file '%s': %s", file, cause.getMessage()); - return new BzlLoadFailedException(errorMessage, Code.IO_ERROR, cause, cause.getTransience()); + static BzlLoadFailedException errorReadingBzl( + PathFragment file, BzlCompileFunction.FailedIOException cause) { + String errorMessage = + String.format( + "Encountered error while reading extension file '%s': %s", file, cause.getMessage()); + + if (cause.getCause() instanceof DetailedIOException detailedException) { + return new BzlLoadFailedException( + errorMessage, + detailedException.getDetailedExitCode(), + detailedException, + detailedException.getTransience()); } + return new BzlLoadFailedException(errorMessage, Code.IO_ERROR, cause, cause.getTransience()); + } + static BzlLoadFailedException noBuildFile(Label file, @Nullable String reason) { if (reason != null) { return new BzlLoadFailedException(
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BzlmodRepoRuleFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/BzlmodRepoRuleFunction.java index 749fd34..11dcd0d 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/BzlmodRepoRuleFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/BzlmodRepoRuleFunction.java
@@ -253,7 +253,8 @@ keys, starlarkSemantics, null, - /* checkVisibility= */ false); + /* checkVisibility= */ false, + BazelSkyframeExecutorConstants.ACTION_ON_FILESYSTEM_ERROR_CODE_LOADING_BZL_FILE); } catch (NoSuchPackageException e) { throw new BzlmodRepoRuleFunctionException(e, Transience.PERSISTENT); }
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 7cc6968..2e6fc75 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
@@ -54,6 +54,7 @@ import com.google.devtools.build.lib.profiler.ProfilerTask; import com.google.devtools.build.lib.profiler.SilentCloseable; import com.google.devtools.build.lib.server.FailureDetails.FailureDetail; +import com.google.devtools.build.lib.server.FailureDetails.Filesystem; import com.google.devtools.build.lib.server.FailureDetails.PackageLoading; import com.google.devtools.build.lib.server.FailureDetails.PackageLoading.Code; import com.google.devtools.build.lib.skyframe.PackageFunctionWithMultipleGlobDeps.SkyframeGlobbingIOException; @@ -114,6 +115,8 @@ private final ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile; + private final ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile; + private final boolean shouldUseRepoDotBazel; protected final Function<SkyKey, ThreadStateReceiver> threadStateReceiverFactoryForMetrics; @@ -179,6 +182,7 @@ @Nullable BzlLoadFunction bzlLoadFunctionForInlining, @Nullable PackageProgressReceiver packageProgress, ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile, + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile, boolean shouldUseRepoDotBazel, Function<SkyKey, ThreadStateReceiver> threadStateReceiverFactoryForMetrics, AtomicReference<Semaphore> cpuBoundSemaphore) { @@ -189,6 +193,7 @@ this.numPackagesSuccessfullyLoaded = numPackagesSuccessfullyLoaded; this.packageProgress = packageProgress; this.actionOnIOExceptionReadingBuildFile = actionOnIOExceptionReadingBuildFile; + this.actionOnFilesystemErrorCodeLoadingBzlFile = actionOnFilesystemErrorCodeLoadingBzlFile; this.shouldUseRepoDotBazel = shouldUseRepoDotBazel; this.threadStateReceiverFactoryForMetrics = threadStateReceiverFactoryForMetrics; this.cpuBoundSemaphore = cpuBoundSemaphore; @@ -238,6 +243,20 @@ } } + /** + * What to do when encountering a {@link Filesystem} error code while trying to load a bzl file. + * + * <p>This class should decide whether the Filesystem error code takes precedence over the + * PackageLoading error code. + */ + public interface ActionOnFilesystemErrorCodeLoadingBzlFile { + boolean shouldTakePrecedenceOverPackageLoadingCode(Filesystem.Code filesystemCode); + + /** By default, always use the PackageLoading error code. */ + public static ActionOnFilesystemErrorCodeLoadingBzlFile ALWAYS_USE_PACKAGE_LOADING_CODE = + filesystemCode -> false; + } + /** Ways that {@link PackageFunction} can perform globbing. */ public enum GlobbingStrategy { /** @@ -662,7 +681,8 @@ List<BzlLoadValue.Key> keys, StarlarkSemantics semantics, @Nullable BzlLoadFunction bzlLoadFunctionForInlining, - boolean checkVisibility) + boolean checkVisibility, + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile) throws NoSuchPackageException, InterruptedException { List<BzlLoadValue> bzlLoads; try { @@ -688,13 +708,23 @@ } } catch (BzlLoadFailedException e) { Throwable rootCause = Throwables.getRootCause(e); - throw PackageFunctionException.builder() - .setType(PackageFunctionException.Type.BUILD_FILE_CONTAINS_ERRORS) - .setPackageIdentifier(packageId) - .setException(rootCause instanceof IOException ? (IOException) rootCause : null) - .setMessage(e.getMessage()) - .setPackageLoadingCode(PackageLoading.Code.IMPORT_STARLARK_FILE_ERROR) - .buildCause(); + PackageFunctionException.Builder exceptionBuilder = + PackageFunctionException.builder() + .setType(PackageFunctionException.Type.BUILD_FILE_CONTAINS_ERRORS) + .setPackageIdentifier(packageId) + .setException(rootCause instanceof IOException ? (IOException) rootCause : null) + .setMessage(e.getMessage()); + + Filesystem.Code filesystemCode = + e.getDetailedExitCode().getFailureDetail().getFilesystem().getCode(); + if (actionOnFilesystemErrorCodeLoadingBzlFile.shouldTakePrecedenceOverPackageLoadingCode( + filesystemCode)) { + exceptionBuilder.setFilesystemCode(filesystemCode); + } else { + exceptionBuilder.setPackageLoadingCode(PackageLoading.Code.IMPORT_STARLARK_FILE_ERROR); + } + exceptionBuilder.setTransience(e.getTransience()); + throw exceptionBuilder.buildCause(); } // Build map of loaded modules. @@ -1085,7 +1115,8 @@ keys.build(), starlarkBuiltinsValue.starlarkSemantics, bzlLoadFunctionForInlining, - /* checkVisibility= */ true); + /* checkVisibility= */ true, + actionOnFilesystemErrorCodeLoadingBzlFile); } catch (NoSuchPackageException e) { throw new PackageFunctionException(e, Transience.PERSISTENT); } @@ -1301,6 +1332,8 @@ @Nullable private PackageProgressReceiver packageProgress; private ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile = PackageFunction.ActionOnIOExceptionReadingBuildFile.UseOriginalIOException.INSTANCE; + private ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile = + PackageFunction.ActionOnFilesystemErrorCodeLoadingBzlFile.ALWAYS_USE_PACKAGE_LOADING_CODE; private boolean shouldUseRepoDotBazel = true; private GlobbingStrategy globbingStrategy = GlobbingStrategy.SINGLE_GLOBS_HYBRID; private Function<SkyKey, ThreadStateReceiver> threadStateReceiverFactoryForMetrics = @@ -1351,6 +1384,13 @@ } @CanIgnoreReturnValue + public Builder setActionOnFilesystemErrorCodeLoadingBzlFile( + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile) { + this.actionOnFilesystemErrorCodeLoadingBzlFile = actionOnFilesystemErrorCodeLoadingBzlFile; + return this; + } + + @CanIgnoreReturnValue public Builder setShouldUseRepoDotBazel(boolean shouldUseRepoDotBazel) { this.shouldUseRepoDotBazel = shouldUseRepoDotBazel; return this; @@ -1386,6 +1426,7 @@ bzlLoadFunctionForInlining, packageProgress, actionOnIOExceptionReadingBuildFile, + actionOnFilesystemErrorCodeLoadingBzlFile, shouldUseRepoDotBazel, threadStateReceiverFactoryForMetrics, cpuBoundSemaphore); @@ -1399,6 +1440,7 @@ bzlLoadFunctionForInlining, packageProgress, actionOnIOExceptionReadingBuildFile, + actionOnFilesystemErrorCodeLoadingBzlFile, shouldUseRepoDotBazel, threadStateReceiverFactoryForMetrics, cpuBoundSemaphore); @@ -1412,6 +1454,7 @@ bzlLoadFunctionForInlining, packageProgress, actionOnIOExceptionReadingBuildFile, + actionOnFilesystemErrorCodeLoadingBzlFile, shouldUseRepoDotBazel, threadStateReceiverFactoryForMetrics, cpuBoundSemaphore); @@ -1534,6 +1577,7 @@ private Exception exception; private String message; private PackageLoading.Code packageLoadingCode; + private Filesystem.Code filesystemCode; @CanIgnoreReturnValue Builder setType(Type exceptionType) { @@ -1571,6 +1615,12 @@ return this; } + @CanIgnoreReturnValue + Builder setFilesystemCode(Filesystem.Code filesystemCode) { + this.filesystemCode = filesystemCode; + return this; + } + @Override public int hashCode() { return Objects.hash( @@ -1595,8 +1645,18 @@ NoSuchPackageException buildCause() { checkNotNull(exceptionType, "The NoSuchPackageException type must be set."); - checkNotNull(packageLoadingCode, "The PackageLoading code must be set."); - DetailedExitCode detailedExitCode = createDetailedExitCode(message, packageLoadingCode); + + DetailedExitCode detailedExitCode; + if (filesystemCode != null) { + detailedExitCode = createDetailedExitCodeWithFilesystemCode(message, filesystemCode); + } else { + checkNotNull( + packageLoadingCode, + "Either the Filesystem code or the PackageLoading code must be set."); + detailedExitCode = + createDetailedExitCodeWithPackageLoadingCode(message, packageLoadingCode); + } + return exceptionType.create(packageIdentifier, message, detailedExitCode, exception); } @@ -1605,7 +1665,7 @@ buildCause(), checkNotNull(transience, "Transience must be set")); } - private static DetailedExitCode createDetailedExitCode( + private static DetailedExitCode createDetailedExitCodeWithPackageLoadingCode( String message, PackageLoading.Code packageLoadingCode) { return DetailedExitCode.of( FailureDetail.newBuilder() @@ -1613,6 +1673,15 @@ .setPackageLoading(PackageLoading.newBuilder().setCode(packageLoadingCode).build()) .build()); } + + private static DetailedExitCode createDetailedExitCodeWithFilesystemCode( + String message, Filesystem.Code filesystemCode) { + return DetailedExitCode.of( + FailureDetail.newBuilder() + .setMessage(message) + .setFilesystem(Filesystem.newBuilder().setCode(filesystemCode)) + .build()); + } } } }
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithMultipleGlobDeps.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithMultipleGlobDeps.java index b18243d..fca4fbe 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithMultipleGlobDeps.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithMultipleGlobDeps.java
@@ -76,6 +76,7 @@ @Nullable BzlLoadFunction bzlLoadFunctionForInlining, @Nullable PackageProgressReceiver packageProgress, ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile, + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile, boolean shouldUseRepoDotBazel, Function<SkyKey, ThreadStateReceiver> threadStateReceiverFactoryForMetrics, AtomicReference<Semaphore> cpuBoundSemaphore) { @@ -87,6 +88,7 @@ bzlLoadFunctionForInlining, packageProgress, actionOnIOExceptionReadingBuildFile, + actionOnFilesystemErrorCodeLoadingBzlFile, shouldUseRepoDotBazel, threadStateReceiverFactoryForMetrics, cpuBoundSemaphore);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithSingleGlobsDep.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithSingleGlobsDep.java index f3d8023..264b0ab 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithSingleGlobsDep.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithSingleGlobsDep.java
@@ -58,6 +58,7 @@ @Nullable BzlLoadFunction bzlLoadFunctionForInlining, @Nullable PackageProgressReceiver packageProgress, ActionOnIOExceptionReadingBuildFile actionOnIoExceptionReadingBuildFile, + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile, boolean shouldUseRepoDotBazel, Function<SkyKey, ThreadStateReceiver> threadStateReceiverFactoryForMetrics, AtomicReference<Semaphore> cpuBoundSemaphore) { @@ -69,6 +70,7 @@ bzlLoadFunctionForInlining, packageProgress, actionOnIoExceptionReadingBuildFile, + actionOnFilesystemErrorCodeLoadingBzlFile, shouldUseRepoDotBazel, threadStateReceiverFactoryForMetrics, cpuBoundSemaphore);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithoutGlobDeps.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithoutGlobDeps.java index e679522..a51b4be 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithoutGlobDeps.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunctionWithoutGlobDeps.java
@@ -46,6 +46,7 @@ @Nullable BzlLoadFunction bzlLoadFunctionForInlining, @Nullable PackageProgressReceiver packageProgress, ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile, + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile, boolean shouldUseRepoDotBazel, Function<SkyKey, ThreadStateReceiver> threadStateReceiverFactoryForMetrics, AtomicReference<Semaphore> cpuBoundSemaphore) { @@ -57,6 +58,7 @@ bzlLoadFunctionForInlining, packageProgress, actionOnIOExceptionReadingBuildFile, + actionOnFilesystemErrorCodeLoadingBzlFile, shouldUseRepoDotBazel, threadStateReceiverFactoryForMetrics, cpuBoundSemaphore);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SequencedSkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SequencedSkyframeExecutor.java index 43820a3..a4b2b98 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SequencedSkyframeExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SequencedSkyframeExecutor.java
@@ -66,6 +66,7 @@ import com.google.devtools.build.lib.repository.ExternalPackageHelper; import com.google.devtools.build.lib.skyframe.AspectKeyCreator.AspectKey; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; +import com.google.devtools.build.lib.skyframe.PackageFunction.ActionOnFilesystemErrorCodeLoadingBzlFile; import com.google.devtools.build.lib.skyframe.PackageFunction.ActionOnIOExceptionReadingBuildFile; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; import com.google.devtools.build.lib.skyframe.actiongraph.v2.ActionGraphDump; @@ -165,6 +166,7 @@ ExternalPackageHelper externalPackageHelper, @Nullable SkyframeExecutorRepositoryHelpersHolder repositoryHelpersHolder, ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile, + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile, boolean shouldUseRepoDotBazel, SkyKeyStateReceiver skyKeyStateReceiver, BugReporter bugReporter, @@ -184,6 +186,7 @@ buildFilesByPriority, externalPackageHelper, actionOnIOExceptionReadingBuildFile, + actionOnFilesystemErrorCodeLoadingBzlFile, shouldUseRepoDotBazel, /* shouldUnblockCpuWorkWhenFetchingDeps= */ false, new PackageProgressReceiver(), @@ -790,6 +793,7 @@ private ImmutableList<BuildFileName> buildFilesByPriority; private ExternalPackageHelper externalPackageHelper; private ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile; + private ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile; private boolean shouldUseRepoDotBazel = true; // Fields with default values. @@ -818,6 +822,7 @@ Preconditions.checkNotNull(buildFilesByPriority); Preconditions.checkNotNull(externalPackageHelper); Preconditions.checkNotNull(actionOnIOExceptionReadingBuildFile); + Preconditions.checkNotNull(actionOnFilesystemErrorCodeLoadingBzlFile); Preconditions.checkNotNull(ignoredPackagePrefixesFunction); SequencedSkyframeExecutor skyframeExecutor = @@ -838,6 +843,7 @@ externalPackageHelper, repositoryHelpersHolder, actionOnIOExceptionReadingBuildFile, + actionOnFilesystemErrorCodeLoadingBzlFile, shouldUseRepoDotBazel, skyKeyStateReceiver, bugReporter, @@ -943,6 +949,13 @@ } @CanIgnoreReturnValue + public Builder setActionOnFilesystemErrorCodeLoadingBzlFile( + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile) { + this.actionOnFilesystemErrorCodeLoadingBzlFile = actionOnFilesystemErrorCodeLoadingBzlFile; + return this; + } + + @CanIgnoreReturnValue public Builder setShouldUseRepoDotBazel(boolean shouldUseRepoDotBazel) { this.shouldUseRepoDotBazel = shouldUseRepoDotBazel; return this;
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 b721125..685204f 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
@@ -201,6 +201,7 @@ import com.google.devtools.build.lib.skyframe.FilesystemValueChecker.ImmutableBatchDirtyResult; import com.google.devtools.build.lib.skyframe.FilesystemValueChecker.XattrProviderOverrider; import com.google.devtools.build.lib.skyframe.MetadataConsumerForMetrics.FilesMetricConsumer; +import com.google.devtools.build.lib.skyframe.PackageFunction.ActionOnFilesystemErrorCodeLoadingBzlFile; import com.google.devtools.build.lib.skyframe.PackageFunction.ActionOnIOExceptionReadingBuildFile; import com.google.devtools.build.lib.skyframe.PackageFunction.GlobbingStrategy; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; @@ -436,6 +437,8 @@ private final ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile; + private final ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile; + private final boolean shouldUseRepoDotBazel; private final boolean shouldUnblockCpuWorkWhenFetchingDeps; @@ -556,6 +559,7 @@ ImmutableList<BuildFileName> buildFilesByPriority, ExternalPackageHelper externalPackageHelper, ActionOnIOExceptionReadingBuildFile actionOnIOExceptionReadingBuildFile, + ActionOnFilesystemErrorCodeLoadingBzlFile actionOnFilesystemErrorCodeLoadingBzlFile, boolean shouldUseRepoDotBazel, boolean shouldUnblockCpuWorkWhenFetchingDeps, @Nullable PackageProgressReceiver packageProgress, @@ -614,6 +618,7 @@ this.buildFilesByPriority = buildFilesByPriority; this.externalPackageHelper = externalPackageHelper; this.actionOnIOExceptionReadingBuildFile = actionOnIOExceptionReadingBuildFile; + this.actionOnFilesystemErrorCodeLoadingBzlFile = actionOnFilesystemErrorCodeLoadingBzlFile; this.shouldUseRepoDotBazel = shouldUseRepoDotBazel; this.packageProgress = packageProgress; this.configuredTargetProgress = configuredTargetProgress; @@ -694,6 +699,7 @@ .setBzlLoadFunctionForInlining(bzlLoadFunctionForInliningPackageAndWorkspaceNodes) .setPackageProgress(packageProgress) .setActionOnIOExceptionReadingBuildFile(actionOnIOExceptionReadingBuildFile) + .setActionOnFilesystemErrorCodeLoadingBzlFile(actionOnFilesystemErrorCodeLoadingBzlFile) .setShouldUseRepoDotBazel(shouldUseRepoDotBazel) .setGlobbingStrategy(getGlobbingStrategy()) .setThreadStateReceiverFactoryForMetrics(skyKeyStateReceiver::makeThreadStateReceiver)
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceFileFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceFileFunction.java index c8ba1d5..b53825f 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceFileFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceFileFunction.java
@@ -360,7 +360,8 @@ keys.build(), starlarkSemantics, bzlLoadFunctionForInlining, - /* checkVisibility= */ true); + /* checkVisibility= */ true, + BazelSkyframeExecutorConstants.ACTION_ON_FILESYSTEM_ERROR_CODE_LOADING_BZL_FILE); } catch (NoSuchPackageException e) { throw new WorkspaceFileFunctionException(e, Transience.PERSISTENT); }