Search in sources :

Example 11 with RecordingDifferencer

use of com.google.devtools.build.skyframe.RecordingDifferencer in project bazel by bazelbuild.

the class FileFunctionTest method makeDriver.

private SequentialBuildDriver makeDriver(ExternalFileAction externalFileAction) {
    AtomicReference<PathPackageLocator> pkgLocatorRef = new AtomicReference<>(pkgLocator);
    BlazeDirectories directories = new BlazeDirectories(pkgRoot, outputBase, pkgRoot, TestConstants.PRODUCT_NAME);
    ExternalFilesHelper externalFilesHelper = new ExternalFilesHelper(pkgLocatorRef, externalFileAction, directories);
    differencer = new RecordingDifferencer();
    MemoizingEvaluator evaluator = new InMemoryMemoizingEvaluator(ImmutableMap.<SkyFunctionName, SkyFunction>builder().put(SkyFunctions.FILE_STATE, new FileStateFunction(new AtomicReference<TimestampGranularityMonitor>(), externalFilesHelper)).put(SkyFunctions.FILE_SYMLINK_CYCLE_UNIQUENESS, new FileSymlinkCycleUniquenessFunction()).put(SkyFunctions.FILE_SYMLINK_INFINITE_EXPANSION_UNIQUENESS, new FileSymlinkInfiniteExpansionUniquenessFunction()).put(SkyFunctions.FILE, new FileFunction(pkgLocatorRef)).put(SkyFunctions.PACKAGE, new PackageFunction(null, null, null, null, null, null, null)).put(SkyFunctions.PACKAGE_LOOKUP, new PackageLookupFunction(new AtomicReference<>(ImmutableSet.<PackageIdentifier>of()), CrossRepositoryLabelViolationStrategy.ERROR, ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))).put(SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(TestRuleClassProvider.getRuleClassProvider())).put(SkyFunctions.WORKSPACE_FILE, new WorkspaceFileFunction(TestRuleClassProvider.getRuleClassProvider(), TestConstants.PACKAGE_FACTORY_FACTORY_FOR_TESTING.create(TestRuleClassProvider.getRuleClassProvider(), fs), directories)).put(SkyFunctions.EXTERNAL_PACKAGE, new ExternalPackageFunction()).put(SkyFunctions.LOCAL_REPOSITORY_LOOKUP, new LocalRepositoryLookupFunction()).build(), differencer);
    PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
    PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator);
    return new SequentialBuildDriver(evaluator);
}
Also used : RecordingDifferencer(com.google.devtools.build.skyframe.RecordingDifferencer) InMemoryMemoizingEvaluator(com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator) SkyFunction(com.google.devtools.build.skyframe.SkyFunction) InMemoryMemoizingEvaluator(com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator) MemoizingEvaluator(com.google.devtools.build.skyframe.MemoizingEvaluator) AtomicReference(java.util.concurrent.atomic.AtomicReference) PathPackageLocator(com.google.devtools.build.lib.pkgcache.PathPackageLocator) SequentialBuildDriver(com.google.devtools.build.skyframe.SequentialBuildDriver) BlazeDirectories(com.google.devtools.build.lib.analysis.BlazeDirectories) SkyFunctionName(com.google.devtools.build.skyframe.SkyFunctionName) TimestampGranularityMonitor(com.google.devtools.build.lib.util.io.TimestampGranularityMonitor)

Example 12 with RecordingDifferencer

use of com.google.devtools.build.skyframe.RecordingDifferencer in project bazel by bazelbuild.

the class ContainingPackageLookupFunctionTest method setUp.

@Before
public final void setUp() throws Exception {
    AtomicReference<PathPackageLocator> pkgLocator = new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)));
    deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of());
    ExternalFilesHelper externalFilesHelper = new ExternalFilesHelper(pkgLocator, ExternalFileAction.DEPEND_ON_EXTERNAL_PKG_FOR_EXTERNAL_REPO_PATHS, new BlazeDirectories(rootDirectory, rootDirectory, rootDirectory, TestConstants.PRODUCT_NAME));
    Map<SkyFunctionName, SkyFunction> skyFunctions = new HashMap<>();
    skyFunctions.put(SkyFunctions.PACKAGE_LOOKUP, new PackageLookupFunction(deletedPackages, CrossRepositoryLabelViolationStrategy.ERROR, ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD)));
    skyFunctions.put(SkyFunctions.CONTAINING_PACKAGE_LOOKUP, new ContainingPackageLookupFunction());
    skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, new BlacklistedPackagePrefixesFunction());
    skyFunctions.put(SkyFunctions.FILE_STATE, new FileStateFunction(new AtomicReference<TimestampGranularityMonitor>(), externalFilesHelper));
    skyFunctions.put(SkyFunctions.FILE, new FileFunction(pkgLocator));
    skyFunctions.put(SkyFunctions.DIRECTORY_LISTING, new DirectoryListingFunction());
    skyFunctions.put(SkyFunctions.DIRECTORY_LISTING_STATE, new DirectoryListingStateFunction(externalFilesHelper));
    skyFunctions.put(SkyFunctions.LOCAL_REPOSITORY_LOOKUP, new LocalRepositoryLookupFunction());
    RecordingDifferencer differencer = new RecordingDifferencer();
    evaluator = new InMemoryMemoizingEvaluator(skyFunctions, differencer);
    driver = new SequentialBuildDriver(evaluator);
    PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
    PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
    PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(differencer, PathFragment.EMPTY_FRAGMENT);
}
Also used : RecordingDifferencer(com.google.devtools.build.skyframe.RecordingDifferencer) SkyFunction(com.google.devtools.build.skyframe.SkyFunction) InMemoryMemoizingEvaluator(com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator) HashMap(java.util.HashMap) AtomicReference(java.util.concurrent.atomic.AtomicReference) PathPackageLocator(com.google.devtools.build.lib.pkgcache.PathPackageLocator) SequentialBuildDriver(com.google.devtools.build.skyframe.SequentialBuildDriver) BlazeDirectories(com.google.devtools.build.lib.analysis.BlazeDirectories) SkyFunctionName(com.google.devtools.build.skyframe.SkyFunctionName) PackageIdentifier(com.google.devtools.build.lib.cmdline.PackageIdentifier) Before(org.junit.Before)

Example 13 with RecordingDifferencer

use of com.google.devtools.build.skyframe.RecordingDifferencer in project bazel by bazelbuild.

the class ActionTemplateExpansionFunctionTest method setUp.

@Before
public void setUp() throws Exception {
    artifactValueMap = new LinkedHashMap<>();
    AtomicReference<PathPackageLocator> pkgLocator = new AtomicReference<>(new PathPackageLocator(rootDirectory.getFileSystem().getPath("/outputbase"), ImmutableList.of(rootDirectory)));
    RecordingDifferencer differencer = new RecordingDifferencer();
    MemoizingEvaluator evaluator = new InMemoryMemoizingEvaluator(ImmutableMap.<SkyFunctionName, SkyFunction>builder().put(SkyFunctions.ARTIFACT, new DummyArtifactFunction(artifactValueMap)).put(SkyFunctions.ACTION_TEMPLATE_EXPANSION, new ActionTemplateExpansionFunction()).build(), differencer);
    driver = new SequentialBuildDriver(evaluator);
    PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
    PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
}
Also used : PathPackageLocator(com.google.devtools.build.lib.pkgcache.PathPackageLocator) RecordingDifferencer(com.google.devtools.build.skyframe.RecordingDifferencer) SequentialBuildDriver(com.google.devtools.build.skyframe.SequentialBuildDriver) SkyFunctionName(com.google.devtools.build.skyframe.SkyFunctionName) InMemoryMemoizingEvaluator(com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator) SkyFunction(com.google.devtools.build.skyframe.SkyFunction) InMemoryMemoizingEvaluator(com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator) MemoizingEvaluator(com.google.devtools.build.skyframe.MemoizingEvaluator) AtomicReference(java.util.concurrent.atomic.AtomicReference) Before(org.junit.Before)

Example 14 with RecordingDifferencer

use of com.google.devtools.build.skyframe.RecordingDifferencer in project bazel by bazelbuild.

the class ArtifactFunctionTestCase method baseSetUp.

@Before
public void baseSetUp() throws Exception {
    setupRoot(new CustomInMemoryFs());
    AtomicReference<PathPackageLocator> pkgLocator = new AtomicReference<>(new PathPackageLocator(root.getFileSystem().getPath("/outputbase"), ImmutableList.of(root)));
    BlazeDirectories directories = new BlazeDirectories(root, root, root, TestConstants.PRODUCT_NAME);
    ExternalFilesHelper externalFilesHelper = new ExternalFilesHelper(pkgLocator, ExternalFileAction.DEPEND_ON_EXTERNAL_PKG_FOR_EXTERNAL_REPO_PATHS, directories);
    differencer = new RecordingDifferencer();
    evaluator = new InMemoryMemoizingEvaluator(ImmutableMap.<SkyFunctionName, SkyFunction>builder().put(SkyFunctions.FILE_STATE, new FileStateFunction(new AtomicReference<TimestampGranularityMonitor>(), externalFilesHelper)).put(SkyFunctions.FILE, new FileFunction(pkgLocator)).put(SkyFunctions.ARTIFACT, new ArtifactFunction(allowedMissingInputsPredicate)).put(SkyFunctions.ACTION_EXECUTION, new SimpleActionExecutionFunction()).put(SkyFunctions.PACKAGE, new PackageFunction(null, null, null, null, null, null, null)).put(SkyFunctions.PACKAGE_LOOKUP, new PackageLookupFunction(null, CrossRepositoryLabelViolationStrategy.ERROR, ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))).put(SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(TestRuleClassProvider.getRuleClassProvider())).put(SkyFunctions.WORKSPACE_FILE, new WorkspaceFileFunction(TestRuleClassProvider.getRuleClassProvider(), TestConstants.PACKAGE_FACTORY_FACTORY_FOR_TESTING.create(TestRuleClassProvider.getRuleClassProvider(), root.getFileSystem()), directories)).put(SkyFunctions.EXTERNAL_PACKAGE, new ExternalPackageFunction()).put(SkyFunctions.ACTION_TEMPLATE_EXPANSION, new ActionTemplateExpansionFunction()).build(), differencer);
    driver = new SequentialBuildDriver(evaluator);
    PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
    PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
    actions = new HashSet<>();
}
Also used : RecordingDifferencer(com.google.devtools.build.skyframe.RecordingDifferencer) InMemoryMemoizingEvaluator(com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator) AtomicReference(java.util.concurrent.atomic.AtomicReference) PathPackageLocator(com.google.devtools.build.lib.pkgcache.PathPackageLocator) SequentialBuildDriver(com.google.devtools.build.skyframe.SequentialBuildDriver) BlazeDirectories(com.google.devtools.build.lib.analysis.BlazeDirectories) Before(org.junit.Before)

Aggregations

RecordingDifferencer (com.google.devtools.build.skyframe.RecordingDifferencer)14 PathPackageLocator (com.google.devtools.build.lib.pkgcache.PathPackageLocator)11 InMemoryMemoizingEvaluator (com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator)11 SequentialBuildDriver (com.google.devtools.build.skyframe.SequentialBuildDriver)11 AtomicReference (java.util.concurrent.atomic.AtomicReference)10 BlazeDirectories (com.google.devtools.build.lib.analysis.BlazeDirectories)9 SkyFunction (com.google.devtools.build.skyframe.SkyFunction)9 SkyFunctionName (com.google.devtools.build.skyframe.SkyFunctionName)9 Before (org.junit.Before)9 HashMap (java.util.HashMap)6 ImmutableSet (com.google.common.collect.ImmutableSet)3 AnalysisMock (com.google.devtools.build.lib.analysis.util.AnalysisMock)3 PackageIdentifier (com.google.devtools.build.lib.cmdline.PackageIdentifier)3 Path (com.google.devtools.build.lib.vfs.Path)3 ErrorInfo (com.google.devtools.build.skyframe.ErrorInfo)3 SkyKey (com.google.devtools.build.skyframe.SkyKey)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 PackageFactory (com.google.devtools.build.lib.packages.PackageFactory)2 RuleClassProvider (com.google.devtools.build.lib.packages.RuleClassProvider)2 TimestampGranularityMonitor (com.google.devtools.build.lib.util.io.TimestampGranularityMonitor)2