use of com.google.devtools.build.skyframe.MemoizingEvaluator in project bazel by bazelbuild.
the class TreeArtifactMetadataTest method testEqualTreeArtifacts.
@Test
public void testEqualTreeArtifacts() throws Exception {
Artifact treeArtifact = createTreeArtifact("out");
ImmutableList<PathFragment> children = ImmutableList.of(new PathFragment("one"), new PathFragment("two"));
TreeArtifactValue valueOne = evaluateTreeArtifact(treeArtifact, children);
MemoizingEvaluator evaluator = driver.getGraphForTesting();
evaluator.delete(new Predicate<SkyKey>() {
@Override
public boolean apply(SkyKey key) {
// Delete action execution node to force our artifacts to be re-evaluated.
return actions.contains(key.argument());
}
});
TreeArtifactValue valueTwo = evaluateTreeArtifact(treeArtifact, children);
assertThat(valueOne.getDigest()).isNotSameAs(valueTwo.getDigest());
assertThat(valueOne).isEqualTo(valueTwo);
}
use of com.google.devtools.build.skyframe.MemoizingEvaluator 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);
}
use of com.google.devtools.build.skyframe.MemoizingEvaluator 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());
}
Aggregations