diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
26 files changed, 303 insertions, 133 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java index 16c991b8ac..f5d545354a 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java @@ -141,7 +141,11 @@ public abstract class AnalysisTestCase extends FoundationTestCase { @Before public final void createMocks() throws Exception { analysisMock = getAnalysisMock(); - pkgLocator = new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)); + pkgLocator = + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); directories = new BlazeDirectories( new ServerDirectories(outputBase, outputBase), @@ -297,8 +301,14 @@ public abstract class AnalysisTestCase extends FoundationTestCase { viewOptions.loadingPhaseThreads = LOADING_PHASE_THREADS; PackageCacheOptions packageCacheOptions = optionsParser.getOptions(PackageCacheOptions.class); - PathPackageLocator pathPackageLocator = PathPackageLocator.create( - outputBase, packageCacheOptions.packagePath, reporter, rootDirectory, rootDirectory); + PathPackageLocator pathPackageLocator = + PathPackageLocator.create( + outputBase, + packageCacheOptions.packagePath, + reporter, + rootDirectory, + rootDirectory, + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = 7; diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java index 1a5b3dcf11..ee29b07993 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java @@ -250,7 +250,10 @@ public abstract class BuildViewTestCase extends FoundationTestCase { packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = 7; skyframeExecutor.preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)), + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, skylarkSemanticsOptions, "", @@ -353,8 +356,14 @@ public abstract class BuildViewTestCase extends FoundationTestCase { } private void setUpSkyframe() { - PathPackageLocator pkgLocator = PathPackageLocator.create( - outputBase, packageCacheOptions.packagePath, reporter, rootDirectory, rootDirectory); + PathPackageLocator pkgLocator = + PathPackageLocator.create( + outputBase, + packageCacheOptions.packagePath, + reporter, + rootDirectory, + rootDirectory, + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = 7; skyframeExecutor.preparePackageLoading( @@ -991,9 +1000,8 @@ public abstract class BuildViewTestCase extends FoundationTestCase { /** * Gets a derived Artifact for testing in the {@link BuildConfiguration#getBinDirectory}. This * method should only be used for tests that do no analysis, and so there is no ConfiguredTarget - * to own this artifact. If the test runs the analysis phase, {@link - * #getBinArtifact(String, ArtifactOwner)} or its convenience methods should be - * used instead. + * to own this artifact. If the test runs the analysis phase, {@link #getBinArtifact(String, + * ConfiguredTarget)} or its convenience methods should be used instead. */ protected Artifact getBinArtifactWithNoOwner(String rootRelativePath) { return getDerivedArtifact(PathFragment.create(rootRelativePath), @@ -1071,7 +1079,8 @@ public abstract class BuildViewTestCase extends FoundationTestCase { * Gets a derived Artifact for testing in the {@link BuildConfiguration#getGenfilesDirectory}. * This method should only be used for tests that do no analysis, and so there is no * ConfiguredTarget to own this artifact. If the test runs the analysis phase, {@link - * #getGenfilesArtifact(String, ArtifactOwner)} or its convenience methods should be used instead. + * #getGenfilesArtifact(String, ConfiguredTarget)} or its convenience methods should be used + * instead. */ protected Artifact getGenfilesArtifactWithNoOwner(String rootRelativePath) { return getDerivedArtifact(PathFragment.create(rootRelativePath), diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java index 57db7b0237..b5a4df0c69 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java @@ -97,7 +97,10 @@ public abstract class ConfigurationTestCase extends FoundationTestCase { analysisMock = getAnalysisMock(); ConfiguredRuleClassProvider ruleClassProvider = analysisMock.createRuleClassProvider(); PathPackageLocator pkgLocator = - new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)); + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); final PackageFactory pkgFactory; BlazeDirectories directories = new BlazeDirectories( diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java b/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java index 5a9d3f6ddd..e8077a7434 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java @@ -138,7 +138,10 @@ public abstract class PackageLoadingTestCase extends FoundationTestCase { packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = GLOBBING_THREADS; skyframeExecutor.preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)), + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, Options.getDefaults(SkylarkSemanticsOptions.class), defaultsPackageContents, @@ -149,8 +152,14 @@ public abstract class PackageLoadingTestCase extends FoundationTestCase { } private void setUpSkyframe() { - PathPackageLocator pkgLocator = PathPackageLocator.create( - outputBase, packageCacheOptions.packagePath, reporter, rootDirectory, rootDirectory); + PathPackageLocator pkgLocator = + PathPackageLocator.create( + outputBase, + packageCacheOptions.packagePath, + reporter, + rootDirectory, + rootDirectory, + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = GLOBBING_THREADS; skyframeExecutor.preparePackageLoading( diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java index fbdf45e2ac..bd9c91372c 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java @@ -106,8 +106,14 @@ public class BuildFileModificationTest extends FoundationTestCase { private void setUpSkyframe( PackageCacheOptions packageCacheOptions, SkylarkSemanticsOptions skylarkSemanticsOptions) { - PathPackageLocator pkgLocator = PathPackageLocator.create( - null, packageCacheOptions.packagePath, reporter, rootDirectory, rootDirectory); + PathPackageLocator pkgLocator = + PathPackageLocator.create( + null, + packageCacheOptions.packagePath, + reporter, + rootDirectory, + rootDirectory, + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = 7; skyframeExecutor.preparePackageLoading( diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java index 2c4b00f2d7..5aa200d2bd 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java @@ -491,7 +491,10 @@ public class IncrementalLoadingTest { packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = 7; skyframeExecutor.preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.of(workspace)), + new PathPackageLocator( + outputBase, + ImmutableList.of(workspace), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, Options.getDefaults(SkylarkSemanticsOptions.class), "", @@ -579,7 +582,10 @@ public class IncrementalLoadingTest { packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = 7; skyframeExecutor.preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.of(workspace)), + new PathPackageLocator( + outputBase, + ImmutableList.of(workspace), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, Options.getDefaults(SkylarkSemanticsOptions.class), "", diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java index 53687a7305..f52a5deb23 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java @@ -634,8 +634,14 @@ public class LoadingPhaseRunnerTest { BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY, BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE); TestConstants.processSkyframeExecutorForTesting(skyframeExecutor); - PathPackageLocator pkgLocator = PathPackageLocator.create( - null, options.packagePath, storedErrors, workspace, workspace); + PathPackageLocator pkgLocator = + PathPackageLocator.create( + null, + options.packagePath, + storedErrors, + workspace, + workspace, + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); PackageCacheOptions packageCacheOptions = Options.getDefaults(PackageCacheOptions.class); packageCacheOptions.defaultVisibility = ConstantRuleVisibility.PRIVATE; packageCacheOptions.showLoadingProgress = true; diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java index 1d26d0107f..1ff6b5f175 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java @@ -110,8 +110,14 @@ public class PackageCacheTest extends FoundationTestCase { private void setUpSkyframe( PackageCacheOptions packageCacheOptions, SkylarkSemanticsOptions skylarkSemanticsOptions) { - PathPackageLocator pkgLocator = PathPackageLocator.create( - null, packageCacheOptions.packagePath, reporter, rootDirectory, rootDirectory); + PathPackageLocator pkgLocator = + PathPackageLocator.create( + null, + packageCacheOptions.packagePath, + reporter, + rootDirectory, + rootDirectory, + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); packageCacheOptions.showLoadingProgress = true; packageCacheOptions.globbingThreads = 7; skyframeExecutor.preparePackageLoading( diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/PathPackageLocatorTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/PathPackageLocatorTest.java index 3ef04b5ad0..13faa5fd77 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/PathPackageLocatorTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/PathPackageLocatorTest.java @@ -14,11 +14,13 @@ package com.google.devtools.build.lib.pkgcache; import static com.google.common.truth.Truth.assertThat; +import static com.google.devtools.build.lib.testutil.MoreAsserts.expectThrows; import static org.junit.Assert.fail; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.cmdline.PackageIdentifier; import com.google.devtools.build.lib.packages.NoSuchPackageException; +import com.google.devtools.build.lib.skyframe.BazelSkyframeExecutorConstants; import com.google.devtools.build.lib.testutil.FoundationTestCase; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.Path; @@ -38,15 +40,15 @@ import org.junit.runners.JUnit4; */ @RunWith(JUnit4.class) public class PathPackageLocatorTest extends FoundationTestCase { - private Path buildFile_1A; - private Path buildFile_1B; - private Path buildFile_2C; - private Path buildFile_2CD; - private Path buildFile_2F; - private Path buildFile_2FGH; - private Path buildFile_3A; - private Path buildFile_3B; - private Path buildFile_3CI; + private Path buildBazelFile1A; + private Path buildFile1B; + private Path buildFile2C; + private Path buildFile2CD; + private Path buildFile2F; + private Path buildFile2FGH; + private Path buildBazelFile3A; + private Path buildFile3B; + private Path buildFile3CI; private Path rootDir1; private Path rootDir1WorkspaceFile; private Path rootDir2; @@ -58,14 +60,16 @@ public class PathPackageLocatorTest extends FoundationTestCase { private PathPackageLocator locator; private PathPackageLocator locatorWithSymlinks; - protected PathPackageLocator getLocator() { return locator; } - + protected PathPackageLocator getLocator() { + return locator; + } @Before public final void createFiles() throws Exception { // Root 1: // WORKSPACE - // /A/BUILD + // /A/BUILD.bazel // This is the actual buildfile for this package. + // /A/BUILD // This is a dummy buildfile and isn't used. // /B/BUILD // /C/I/BUILD // /C/D @@ -108,8 +112,8 @@ public class PathPackageLocatorTest extends FoundationTestCase { rootDir5 = scratch.resolve("/foo/bar"); rootDir1WorkspaceFile = scratch.file(rootDir1 + "/WORKSPACE"); - buildFile_1A = createBuildFile(rootDir1, "A"); - buildFile_1B = createBuildFile(rootDir1, "B"); + buildBazelFile1A = createBuildFile(rootDir1, "A", true); + buildFile1B = createBuildFile(rootDir1, "B"); createBuildFile(rootDir1, "C/I"); scratch.file(rootDir1.getPathString() + "/F/G"); @@ -120,18 +124,18 @@ public class PathPackageLocatorTest extends FoundationTestCase { // Workspace file in rootDir2. scratch.file(rootDir2 + "/WORKSPACE"); createBuildFile(rootDir2, "B"); - buildFile_2C = createBuildFile(rootDir2, "C"); - buildFile_2CD = createBuildFile(rootDir2, "C/D"); - buildFile_2F = createBuildFile(rootDir2, "F"); - buildFile_2FGH = createBuildFile(rootDir2, "F/G/H"); + buildFile2C = createBuildFile(rootDir2, "C"); + buildFile2CD = createBuildFile(rootDir2, "C/D"); + buildFile2F = createBuildFile(rootDir2, "F"); + buildFile2FGH = createBuildFile(rootDir2, "F/G/H"); scratch.file(rootDir2.getPathString() + "/C/I"); // Root3 just needs a symlink to 4 FileSystemUtils.ensureSymbolicLink( rootDir3ParentParent.getRelative("READONLY"), rootDir4Parent); - buildFile_3A = rootDir3.getRelative("A/BUILD"); - buildFile_3B = rootDir3.getRelative("B/BUILD"); - buildFile_3CI = rootDir3.getRelative("C/I/BUILD"); + buildBazelFile3A = rootDir3.getRelative("A/BUILD.bazel"); + buildFile3B = rootDir3.getRelative("B/BUILD"); + buildFile3CI = rootDir3.getRelative("C/I/BUILD"); // Root4 FileSystemUtils.ensureSymbolicLink( @@ -152,12 +156,26 @@ public class PathPackageLocatorTest extends FoundationTestCase { // Root5 createBuildFile(rootDir5, "H/I"); - locator = new PathPackageLocator(outputBase, ImmutableList.of(rootDir1, rootDir2)); - locatorWithSymlinks = new PathPackageLocator(outputBase, ImmutableList.of(rootDir3)); + locator = + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDir1, rootDir2), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); + locatorWithSymlinks = + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDir3), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); } private Path createBuildFile(Path workspace, String packageName) throws IOException { - return scratch.file(workspace + "/" + packageName + "/BUILD"); + return createBuildFile(workspace, packageName, false); + } + + private Path createBuildFile(Path workspace, String packageName, boolean dotBazel) + throws IOException { + String buildFileName = dotBazel ? "BUILD.bazel" : "BUILD"; + return scratch.file(workspace + "/" + packageName + "/" + buildFileName); } private void checkFails(String packageName, String expectedError) { @@ -180,50 +198,50 @@ public class PathPackageLocatorTest extends FoundationTestCase { public void testGetPackageBuildFile() throws Exception { AtomicReference<? extends UnixGlob.FilesystemCalls> cache = UnixGlob.DEFAULT_SYSCALLS_REF; assertThat(locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("A"))) - .isEqualTo(buildFile_1A); + .isEqualTo(buildBazelFile1A); assertThat(locator.getPackageBuildFileNullable(PackageIdentifier.createInMainRepo("A"), cache)) - .isEqualTo(buildFile_1A); + .isEqualTo(buildBazelFile1A); assertThat(locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("B"))) - .isEqualTo(buildFile_1B); + .isEqualTo(buildFile1B); assertThat(locator.getPackageBuildFileNullable(PackageIdentifier.createInMainRepo("B"), cache)) - .isEqualTo(buildFile_1B); + .isEqualTo(buildFile1B); assertThat(locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("C"))) - .isEqualTo(buildFile_2C); + .isEqualTo(buildFile2C); assertThat(locator.getPackageBuildFileNullable(PackageIdentifier.createInMainRepo("C"), cache)) - .isEqualTo(buildFile_2C); + .isEqualTo(buildFile2C); assertThat(locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("C/D"))) - .isEqualTo(buildFile_2CD); + .isEqualTo(buildFile2CD); assertThat( locator.getPackageBuildFileNullable(PackageIdentifier.createInMainRepo("C/D"), cache)) - .isEqualTo(buildFile_2CD); + .isEqualTo(buildFile2CD); checkFails("C/E", "no such package 'C/E': BUILD file not found on package path"); assertThat( locator.getPackageBuildFileNullable(PackageIdentifier.createInMainRepo("C/E"), cache)) .isNull(); assertThat(locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("F"))) - .isEqualTo(buildFile_2F); + .isEqualTo(buildFile2F); checkFails("F/G", "no such package 'F/G': BUILD file not found on package path"); assertThat( locator.getPackageBuildFileNullable(PackageIdentifier.createInMainRepo("F/G"), cache)) .isNull(); assertThat(locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("F/G/H"))) - .isEqualTo(buildFile_2FGH); + .isEqualTo(buildFile2FGH); assertThat( locator.getPackageBuildFileNullable(PackageIdentifier.createInMainRepo("F/G/H"), cache)) - .isEqualTo(buildFile_2FGH); + .isEqualTo(buildFile2FGH); checkFails("I", "no such package 'I': BUILD file not found on package path"); } @Test public void testGetPackageBuildFileWithSymlinks() throws Exception { assertThat(locatorWithSymlinks.getPackageBuildFile(PackageIdentifier.createInMainRepo("A"))) - .isEqualTo(buildFile_3A); + .isEqualTo(buildBazelFile3A); assertThat(locatorWithSymlinks.getPackageBuildFile(PackageIdentifier.createInMainRepo("B"))) - .isEqualTo(buildFile_3B); + .isEqualTo(buildFile3B); assertThat(locatorWithSymlinks.getPackageBuildFile(PackageIdentifier.createInMainRepo("C/I"))) - .isEqualTo(buildFile_3CI); + .isEqualTo(buildFile3CI); checkFails( locatorWithSymlinks, "C/D", "no such package 'C/D': BUILD file not found on package path"); } @@ -242,7 +260,8 @@ public class PathPackageLocatorTest extends FoundationTestCase { reporter, /*workspace=*/ FileSystemUtils.getWorkingDirectory(scratch.getFileSystem()), /* clientWorkingDirectory= */ FileSystemUtils.getWorkingDirectory( - scratch.getFileSystem())); + scratch.getFileSystem()), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); return nonExistentRoot; } @@ -253,11 +272,10 @@ public class PathPackageLocatorTest extends FoundationTestCase { createBuildFile(nonExistentRoot1, "X"); // The package isn't found // The package is found, because we didn't drop the root: - try { - locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("X")); - fail("Exception expected"); - } catch (NoSuchPackageException e) { - } + expectThrows( + NoSuchPackageException.class, + () -> locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("X"))); + Path nonExistentRoot2 = setLocator("/non/existent/2/workspace"); // Now let's create the root: createBuildFile(nonExistentRoot2, "X"); @@ -280,10 +298,21 @@ public class PathPackageLocatorTest extends FoundationTestCase { "%workspace%/somewhere", // Workspace-relative // Absolute clientPath.getRelative("below").getPathString()); - assertThat(PathPackageLocator - .create(null, pathElements, reporter, workspace, clientPath).getPathEntries()) - .containsExactly(belowClient, clientPath, workspace.getRelative("somewhere"), - clientPath.getRelative("below")).inOrder(); + assertThat( + PathPackageLocator.create( + null, + pathElements, + reporter, + workspace, + clientPath, + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY) + .getPathEntries()) + .containsExactly( + belowClient, + clientPath, + workspace.getRelative("somewhere"), + clientPath.getRelative("below")) + .inOrder(); } @Test @@ -291,11 +320,22 @@ public class PathPackageLocatorTest extends FoundationTestCase { Path workspace = scratch.dir("/some/path/to/workspace"); // No warning if workspace == cwd. - PathPackageLocator.create(null, ImmutableList.of("./foo"), reporter, workspace, workspace); + PathPackageLocator.create( + null, + ImmutableList.of("./foo"), + reporter, + workspace, + workspace, + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); assertThat(eventCollector.count()).isSameAs(0); PathPackageLocator.create( - null, ImmutableList.of("./foo"), reporter, workspace, workspace.getRelative("foo")); + null, + ImmutableList.of("./foo"), + reporter, + workspace, + workspace.getRelative("foo"), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); assertThat(eventCollector.count()).isSameAs(1); assertContainsEvent("The package path element './foo' will be taken relative"); } @@ -305,7 +345,12 @@ public class PathPackageLocatorTest extends FoundationTestCase { public void testDollarSigns() throws Exception { Path workspace = scratch.dir("/some/path/to/workspace$1"); - PathPackageLocator.create(null, ImmutableList.of("%workspace%/blabla"), reporter, workspace, - workspace.getRelative("foo")); + PathPackageLocator.create( + null, + ImmutableList.of("%workspace%/blabla"), + reporter, + workspace, + workspace.getRelative("foo"), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); } } diff --git a/src/test/java/com/google/devtools/build/lib/repository/ExternalPackageUtilTest.java b/src/test/java/com/google/devtools/build/lib/repository/ExternalPackageUtilTest.java index aa537287a9..6976f7942f 100644 --- a/src/test/java/com/google/devtools/build/lib/repository/ExternalPackageUtilTest.java +++ b/src/test/java/com/google/devtools/build/lib/repository/ExternalPackageUtilTest.java @@ -32,6 +32,7 @@ import com.google.devtools.build.lib.packages.PackageFactory.EnvironmentExtensio import com.google.devtools.build.lib.packages.Rule; import com.google.devtools.build.lib.packages.RuleClassProvider; import com.google.devtools.build.lib.pkgcache.PathPackageLocator; +import com.google.devtools.build.lib.skyframe.BazelSkyframeExecutorConstants; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.ExternalPackageFunction; @@ -41,7 +42,6 @@ import com.google.devtools.build.lib.skyframe.LocalRepositoryLookupFunction; import com.google.devtools.build.lib.skyframe.PackageFunction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.skyframe.PrecomputedValue; import com.google.devtools.build.lib.skyframe.RegisteredToolchainsFunction; import com.google.devtools.build.lib.skyframe.SkyFunctions; @@ -81,7 +81,9 @@ public class ExternalPackageUtilTest extends BuildViewTestCase { public void createEnvironment() { AnalysisMock analysisMock = AnalysisMock.get(); AtomicReference<PathPackageLocator> pkgLocator = - new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory))); + new AtomicReference<>( + new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); AtomicReference<ImmutableSet<PackageIdentifier>> deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()); BlazeDirectories directories = @@ -101,7 +103,7 @@ public class ExternalPackageUtilTest extends BuildViewTestCase { new PackageLookupFunction( deletedPackages, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); skyFunctions.put( SkyFunctions.FILE_STATE, new FileStateFunction( 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 6bf0519cb8..49d292a66b 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 @@ -23,6 +23,7 @@ import com.google.devtools.build.lib.analysis.ServerDirectories; import com.google.devtools.build.lib.cmdline.RepositoryName; import com.google.devtools.build.lib.events.StoredEventHandler; import com.google.devtools.build.lib.pkgcache.PathPackageLocator; +import com.google.devtools.build.lib.skyframe.BazelSkyframeExecutorConstants; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.ExternalPackageFunction; @@ -32,7 +33,6 @@ import com.google.devtools.build.lib.skyframe.LocalRepositoryLookupFunction; import com.google.devtools.build.lib.skyframe.PackageFunction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.skyframe.PrecomputedValue; import com.google.devtools.build.lib.skyframe.SkyFunctions; import com.google.devtools.build.lib.skyframe.WorkspaceASTFunction; @@ -79,7 +79,11 @@ public class RepositoryDelegatorTest extends FoundationTestCase { new RepositoryDelegatorFunction( ImmutableMap.of(), null, new AtomicBoolean(true), ImmutableMap::of, directories); AtomicReference<PathPackageLocator> pkgLocator = - new AtomicReference<>(new PathPackageLocator(root, ImmutableList.of(root))); + new AtomicReference<>( + new PathPackageLocator( + root, + ImmutableList.of(root), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); ExternalFilesHelper externalFilesHelper = new ExternalFilesHelper( pkgLocator, ExternalFileAction.DEPEND_ON_EXTERNAL_PKG_FOR_EXTERNAL_REPO_PATHS, @@ -102,7 +106,7 @@ public class RepositoryDelegatorTest extends FoundationTestCase { new PackageLookupFunction( null, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))) + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)) .put( SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(TestRuleClassProvider.getRuleClassProvider())) @@ -110,8 +114,10 @@ public class RepositoryDelegatorTest extends FoundationTestCase { SkyFunctions.WORKSPACE_FILE, new WorkspaceFileFunction( TestRuleClassProvider.getRuleClassProvider(), - TestConstants.PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING.builder().build( - TestRuleClassProvider.getRuleClassProvider(), root.getFileSystem()), + TestConstants.PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING + .builder() + .build( + TestRuleClassProvider.getRuleClassProvider(), root.getFileSystem()), directories)) .put(SkyFunctions.LOCAL_REPOSITORY_LOOKUP, new LocalRepositoryLookupFunction()) .put(SkyFunctions.EXTERNAL_PACKAGE, new ExternalPackageFunction()) diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunctionTest.java index 63d39ff878..fecdccae31 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunctionTest.java @@ -70,8 +70,12 @@ public final class ActionTemplateExpansionFunctionTest extends FoundationTestCas @Before public void setUp() throws Exception { artifactValueMap = new LinkedHashMap<>(); - AtomicReference<PathPackageLocator> pkgLocator = new AtomicReference<>(new PathPackageLocator( - rootDirectory.getFileSystem().getPath("/outputbase"), ImmutableList.of(rootDirectory))); + AtomicReference<PathPackageLocator> pkgLocator = + new AtomicReference<>( + new PathPackageLocator( + rootDirectory.getFileSystem().getPath("/outputbase"), + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); RecordingDifferencer differencer = new SequencedRecordingDifferencer(); MemoizingEvaluator evaluator = new InMemoryMemoizingEvaluator( diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTestCase.java b/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTestCase.java index 9408db89c8..046b0d7739 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTestCase.java @@ -25,7 +25,6 @@ import com.google.devtools.build.lib.analysis.ServerDirectories; import com.google.devtools.build.lib.pkgcache.PathPackageLocator; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.testutil.TestConstants; import com.google.devtools.build.lib.testutil.TestRuleClassProvider; import com.google.devtools.build.lib.testutil.TestUtils; @@ -75,8 +74,12 @@ abstract class ArtifactFunctionTestCase { @Before public void baseSetUp() throws Exception { setupRoot(new CustomInMemoryFs()); - AtomicReference<PathPackageLocator> pkgLocator = new AtomicReference<>(new PathPackageLocator( - root.getFileSystem().getPath("/outputbase"), ImmutableList.of(root))); + AtomicReference<PathPackageLocator> pkgLocator = + new AtomicReference<>( + new PathPackageLocator( + root.getFileSystem().getPath("/outputbase"), + ImmutableList.of(root), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); BlazeDirectories directories = new BlazeDirectories(new ServerDirectories(root, root), root, TestConstants.PRODUCT_NAME); ExternalFilesHelper externalFilesHelper = new ExternalFilesHelper( @@ -102,7 +105,7 @@ abstract class ArtifactFunctionTestCase { new PackageLookupFunction( null, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))) + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)) .put( SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(TestRuleClassProvider.getRuleClassProvider())) @@ -110,8 +113,10 @@ abstract class ArtifactFunctionTestCase { SkyFunctions.WORKSPACE_FILE, new WorkspaceFileFunction( TestRuleClassProvider.getRuleClassProvider(), - TestConstants.PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING.builder().build( - TestRuleClassProvider.getRuleClassProvider(), root.getFileSystem()), + TestConstants.PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING + .builder() + .build( + TestRuleClassProvider.getRuleClassProvider(), root.getFileSystem()), directories)) .put(SkyFunctions.EXTERNAL_PACKAGE, new ExternalPackageFunction()) .put( diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java index 19b0c95224..b2a28a0a2f 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java @@ -36,7 +36,6 @@ import com.google.devtools.build.lib.rules.repository.RepositoryFunction; import com.google.devtools.build.lib.rules.repository.RepositoryLoaderFunction; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.syntax.SkylarkSemantics; import com.google.devtools.build.lib.testutil.FoundationTestCase; import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor; @@ -75,7 +74,11 @@ public class ContainingPackageLookupFunctionTest extends FoundationTestCase { AnalysisMock analysisMock = AnalysisMock.get(); AtomicReference<PathPackageLocator> pkgLocator = - new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory))); + new AtomicReference<>( + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()); BlazeDirectories directories = new BlazeDirectories( @@ -96,7 +99,7 @@ public class ContainingPackageLookupFunctionTest extends FoundationTestCase { new PackageLookupFunction( deletedPackages, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); skyFunctions.put( SkyFunctions.PACKAGE, new PackageFunction(null, null, null, null, null, null, null)); skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java index e1379f2768..e28fef3774 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/FileFunctionTest.java @@ -42,7 +42,6 @@ import com.google.devtools.build.lib.pkgcache.PathPackageLocator; import com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.syntax.SkylarkSemantics; import com.google.devtools.build.lib.testutil.ManualClock; import com.google.devtools.build.lib.testutil.TestConstants; @@ -113,7 +112,11 @@ public class FileFunctionTest { this.fs = fs; pkgRoot = fs.getRootDirectory().getRelative("root"); outputBase = fs.getRootDirectory().getRelative("output_base"); - pkgLocator = new PathPackageLocator(outputBase, ImmutableList.of(pkgRoot)); + pkgLocator = + new PathPackageLocator( + outputBase, + ImmutableList.of(pkgRoot), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); FileSystemUtils.createDirectoryAndParents(pkgRoot); } @@ -151,7 +154,7 @@ public class FileFunctionTest { new PackageLookupFunction( new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()), CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))) + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)) .put( SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(TestRuleClassProvider.getRuleClassProvider())) @@ -159,8 +162,9 @@ public class FileFunctionTest { SkyFunctions.WORKSPACE_FILE, new WorkspaceFileFunction( TestRuleClassProvider.getRuleClassProvider(), - TestConstants.PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING.builder().build( - TestRuleClassProvider.getRuleClassProvider(), fs), + TestConstants.PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING + .builder() + .build(TestRuleClassProvider.getRuleClassProvider(), fs), directories)) .put(SkyFunctions.EXTERNAL_PACKAGE, new ExternalPackageFunction()) .put(SkyFunctions.LOCAL_REPOSITORY_LOOKUP, new LocalRepositoryLookupFunction()) @@ -631,7 +635,11 @@ public class FileFunctionTest { @Test public void testSymlinkAcrossPackageRoots() throws Exception { Path otherPkgRoot = fs.getRootDirectory().getRelative("other_root"); - pkgLocator = new PathPackageLocator(outputBase, ImmutableList.of(pkgRoot, otherPkgRoot)); + pkgLocator = + new PathPackageLocator( + outputBase, + ImmutableList.of(pkgRoot, otherPkgRoot), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY); symlink("a", "/other_root/b"); assertValueChangesIfContentsOfFileChanges("/other_root/b", true, "a"); } diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java index a9e0fbe762..301fa746c0 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java @@ -39,7 +39,6 @@ import com.google.devtools.build.lib.packages.FilesetEntry.SymlinkBehavior; import com.google.devtools.build.lib.pkgcache.PathPackageLocator; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.testutil.FoundationTestCase; import com.google.devtools.build.lib.testutil.TestConstants; import com.google.devtools.build.lib.util.Fingerprint; @@ -81,8 +80,12 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase { @Before public final void setUp() throws Exception { - pkgLocator = new AtomicReference<>( - new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory))); + pkgLocator = + new AtomicReference<>( + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); AtomicReference<ImmutableSet<PackageIdentifier>> deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()); ExternalFilesHelper externalFilesHelper = @@ -110,7 +113,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase { new PackageLookupFunction( deletedPackages, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, new BlacklistedPackagePrefixesFunction()); skyFunctions.put(SkyFunctions.FILESET_ENTRY, new FilesetEntryFunction()); diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java index f1b8b407bf..eb2d141b1c 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java @@ -40,7 +40,6 @@ import com.google.devtools.build.lib.pkgcache.PathPackageLocator; import com.google.devtools.build.lib.skyframe.DirtinessCheckerUtils.BasicFilesystemDirtinessChecker; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.testutil.TestConstants; import com.google.devtools.build.lib.testutil.TestRuleClassProvider; import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor; @@ -102,8 +101,12 @@ public class FilesystemValueCheckerTest { FileSystemUtils.createDirectoryAndParents(pkgRoot); FileSystemUtils.createEmptyFile(pkgRoot.getRelative("WORKSPACE")); - AtomicReference<PathPackageLocator> pkgLocator = new AtomicReference<>(new PathPackageLocator( - fs.getPath("/output_base"), ImmutableList.of(pkgRoot))); + AtomicReference<PathPackageLocator> pkgLocator = + new AtomicReference<>( + new PathPackageLocator( + fs.getPath("/output_base"), + ImmutableList.of(pkgRoot), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); BlazeDirectories directories = new BlazeDirectories( new ServerDirectories(pkgRoot, pkgRoot), pkgRoot, TestConstants.PRODUCT_NAME); @@ -124,7 +127,7 @@ public class FilesystemValueCheckerTest { new PackageLookupFunction( new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()), CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); skyFunctions.put(SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(TestRuleClassProvider.getRuleClassProvider())); skyFunctions.put(SkyFunctions.WORKSPACE_FILE, diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java index 7724160cec..660d89595f 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java @@ -36,7 +36,6 @@ import com.google.devtools.build.lib.pkgcache.PathPackageLocator; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.GlobValue.InvalidGlobPatternException; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.syntax.SkylarkSemantics; import com.google.devtools.build.lib.testutil.ManualClock; import com.google.devtools.build.lib.testutil.TestConstants; @@ -113,7 +112,10 @@ public abstract class GlobFunctionTest { pkgLocator = new AtomicReference<>( - new PathPackageLocator(outputBase, ImmutableList.of(writableRoot, root))); + new PathPackageLocator( + outputBase, + ImmutableList.of(writableRoot, root), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); differencer = new SequencedRecordingDifferencer(); evaluator = new InMemoryMemoizingEvaluator(createFunctionMap(), differencer); @@ -149,7 +151,7 @@ public abstract class GlobFunctionTest { new PackageLookupFunction( deletedPackages, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, new BlacklistedPackagePrefixesFunction()); skyFunctions.put( diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupFunctionTest.java index 7c4e309d61..a854d2ef34 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupFunctionTest.java @@ -30,7 +30,6 @@ import com.google.devtools.build.lib.packages.RuleClassProvider; import com.google.devtools.build.lib.pkgcache.PathPackageLocator; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.syntax.SkylarkSemantics; import com.google.devtools.build.lib.testutil.FoundationTestCase; import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor; @@ -67,7 +66,11 @@ public class LocalRepositoryLookupFunctionTest extends FoundationTestCase { public final void setUp() throws Exception { AnalysisMock analysisMock = AnalysisMock.get(); AtomicReference<PathPackageLocator> pkgLocator = - new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory))); + new AtomicReference<>( + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()); BlazeDirectories directories = new BlazeDirectories( @@ -83,7 +86,7 @@ public class LocalRepositoryLookupFunctionTest extends FoundationTestCase { new PackageLookupFunction( deletedPackages, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); skyFunctions.put( SkyFunctions.FILE_STATE, new FileStateFunction( diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java index d08f3d3881..a8c2316f30 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java @@ -79,7 +79,10 @@ public class PackageFunctionTest extends BuildViewTestCase { packageCacheOptions.globbingThreads = 7; getSkyframeExecutor() .preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.copyOf(roots)), + new PathPackageLocator( + outputBase, + ImmutableList.copyOf(roots), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, Options.getDefaults(SkylarkSemanticsOptions.class), "", @@ -309,7 +312,10 @@ public class PackageFunctionTest extends BuildViewTestCase { packageCacheOptions.globbingThreads = 7; getSkyframeExecutor() .preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.<Path>of(rootDirectory)), + new PathPackageLocator( + outputBase, + ImmutableList.<Path>of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, Options.getDefaults(SkylarkSemanticsOptions.class), "", diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java index 27eef90146..a90119ce5a 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java @@ -27,6 +27,7 @@ import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.cmdline.PackageIdentifier; import com.google.devtools.build.lib.cmdline.RepositoryName; import com.google.devtools.build.lib.events.NullEventHandler; +import com.google.devtools.build.lib.packages.BuildFileName; import com.google.devtools.build.lib.packages.BuildFileNotFoundException; import com.google.devtools.build.lib.packages.PackageFactory; import com.google.devtools.build.lib.packages.PackageFactory.EnvironmentExtension; @@ -39,7 +40,6 @@ import com.google.devtools.build.lib.rules.repository.RepositoryFunction; import com.google.devtools.build.lib.rules.repository.RepositoryLoaderFunction; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.skyframe.PackageLookupValue.ErrorReason; import com.google.devtools.build.lib.skyframe.PackageLookupValue.IncorrectRepositoryReferencePackageLookupValue; import com.google.devtools.build.lib.syntax.SkylarkSemantics; @@ -88,8 +88,12 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase { scratch.file("parentpackage/BUILD"); AnalysisMock analysisMock = AnalysisMock.get(); - AtomicReference<PathPackageLocator> pkgLocator = new AtomicReference<>( - new PathPackageLocator(outputBase, ImmutableList.of(emptyPackagePath, rootDirectory))); + AtomicReference<PathPackageLocator> pkgLocator = + new AtomicReference<>( + new PathPackageLocator( + outputBase, + ImmutableList.of(emptyPackagePath, rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()); BlazeDirectories directories = new BlazeDirectories( @@ -105,7 +109,7 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase { new PackageLookupFunction( deletedPackages, crossRepositoryLabelViolationStrategy(), - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); skyFunctions.put( SkyFunctions.PACKAGE, new PackageFunction(null, null, null, null, null, null, null)); diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java index e0d3bdfab7..c6b946f4a3 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java @@ -39,7 +39,6 @@ import com.google.devtools.build.lib.events.NullEventHandler; import com.google.devtools.build.lib.pkgcache.PathPackageLocator; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalFunction.FileOperationException; import com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalValue.ResolvedFile; import com.google.devtools.build.lib.skyframe.RecursiveFilesystemTraversalValue.TraversalRequest; @@ -86,8 +85,12 @@ public final class RecursiveFilesystemTraversalFunctionTest extends FoundationTe @Before public final void setUp() throws Exception { AnalysisMock analysisMock = AnalysisMock.get(); - pkgLocator = new AtomicReference<>( - new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory))); + pkgLocator = + new AtomicReference<>( + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); AtomicReference<ImmutableSet<PackageIdentifier>> deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()); BlazeDirectories directories = @@ -114,7 +117,7 @@ public final class RecursiveFilesystemTraversalFunctionTest extends FoundationTe new PackageLookupFunction( deletedPackages, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, new BlacklistedPackagePrefixesFunction()); skyFunctions.put(SkyFunctions.PACKAGE, @@ -695,8 +698,11 @@ public final class RecursiveFilesystemTraversalFunctionTest extends FoundationTe // to the definition of //a/b/ under pp1, not under pp2. // Set the package paths. - pkgLocator.set(new PathPackageLocator(outputBase, - ImmutableList.of(rootDirectory.getRelative("pp1"), rootDirectory.getRelative("pp2")))); + pkgLocator.set( + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory.getRelative("pp1"), rootDirectory.getRelative("pp2")), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get()); Artifact aBuildArtifact = sourceArtifactUnderPackagePath("a/BUILD", "pp1"); diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/SkyframeLabelVisitorTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/SkyframeLabelVisitorTest.java index 07a991404f..63e900f344 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/SkyframeLabelVisitorTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/SkyframeLabelVisitorTest.java @@ -405,7 +405,10 @@ public class SkyframeLabelVisitorTest extends SkyframeLabelVisitorTestCase { packageCacheOptions.globbingThreads = 7; getSkyframeExecutor() .preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)), + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, Options.getDefaults(SkylarkSemanticsOptions.class), loadingMock.getDefaultsPackageContent(), diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkFileContentHashTests.java b/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkFileContentHashTests.java index 719b9f0828..ee996e0b89 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkFileContentHashTests.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkFileContentHashTests.java @@ -163,7 +163,10 @@ public class SkylarkFileContentHashTests extends BuildViewTestCase { packageCacheOptions.globbingThreads = 7; getSkyframeExecutor() .preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)), + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, Options.getDefaults(SkylarkSemanticsOptions.class), "", diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java index c799c96944..d71a7f333b 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupFunctionTest.java @@ -53,7 +53,10 @@ public class SkylarkImportLookupFunctionTest extends BuildViewTestCase { packageCacheOptions.globbingThreads = 7; getSkyframeExecutor() .preparePackageLoading( - new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory, alternativeRoot)), + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory, alternativeRoot), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), packageCacheOptions, Options.getDefaults(SkylarkSemanticsOptions.class), "", diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTestCase.java b/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTestCase.java index 664ea53011..3758bdc0ac 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTestCase.java @@ -63,7 +63,6 @@ import com.google.devtools.build.lib.exec.SingleBuildFileCache; import com.google.devtools.build.lib.pkgcache.PathPackageLocator; import com.google.devtools.build.lib.skyframe.ExternalFilesHelper.ExternalFileAction; import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy; -import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName; import com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.ActionCompletedReceiver; import com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.ProgressSupplier; import com.google.devtools.build.lib.testutil.FoundationTestCase; @@ -161,7 +160,11 @@ public abstract class TimestampBuilderTestCase extends FoundationTestCase { final boolean keepGoing, @Nullable EvaluationProgressReceiver evaluationProgressReceiver) throws Exception { AtomicReference<PathPackageLocator> pkgLocator = - new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory))); + new AtomicReference<>( + new PathPackageLocator( + outputBase, + ImmutableList.of(rootDirectory), + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)); AtomicReference<TimestampGranularityMonitor> tsgmRef = new AtomicReference<>(tsgm); BlazeDirectories directories = new BlazeDirectories( @@ -206,7 +209,7 @@ public abstract class TimestampBuilderTestCase extends FoundationTestCase { new PackageLookupFunction( null, CrossRepositoryLabelViolationStrategy.ERROR, - ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))) + BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY)) .put( SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(TestRuleClassProvider.getRuleClassProvider())) @@ -214,8 +217,11 @@ public abstract class TimestampBuilderTestCase extends FoundationTestCase { SkyFunctions.WORKSPACE_FILE, new WorkspaceFileFunction( TestRuleClassProvider.getRuleClassProvider(), - TestConstants.PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING.builder().build( - TestRuleClassProvider.getRuleClassProvider(), scratch.getFileSystem()), + TestConstants.PACKAGE_FACTORY_BUILDER_FACTORY_FOR_TESTING + .builder() + .build( + TestRuleClassProvider.getRuleClassProvider(), + scratch.getFileSystem()), directories)) .put(SkyFunctions.EXTERNAL_PACKAGE, new ExternalPackageFunction()) .put( |