use of com.google.devtools.build.lib.rules.repository.RepositoryLoaderFunction in project bazel by bazelbuild.
the class AnalysisMock method getSkyFunctions.
public ImmutableMap<SkyFunctionName, SkyFunction> getSkyFunctions() {
// Some tests require the local_repository rule so we need the appropriate SkyFunctions.
RepositoryFunction localRepositoryFunction = new LocalRepositoryFunction();
ImmutableMap<String, RepositoryFunction> repositoryHandlers = ImmutableMap.of(LocalRepositoryRule.NAME, localRepositoryFunction, AndroidSdkRepositoryRule.NAME, new AndroidSdkRepositoryFunction(), AndroidNdkRepositoryRule.NAME, new AndroidNdkRepositoryFunction());
return ImmutableMap.of(SkyFunctions.REPOSITORY_DIRECTORY, new RepositoryDelegatorFunction(repositoryHandlers, null, new AtomicBoolean(true)), SkyFunctions.REPOSITORY, new RepositoryLoaderFunction());
}
use of com.google.devtools.build.lib.rules.repository.RepositoryLoaderFunction in project bazel by bazelbuild.
the class BazelRepositoryModule method workspaceInit.
@Override
public void workspaceInit(BlazeDirectories directories, WorkspaceBuilder builder) {
builder.addCustomDirtinessChecker(REPOSITORY_VALUE_CHECKER);
// Create the repository function everything flows through.
builder.addSkyFunction(SkyFunctions.REPOSITORY, new RepositoryLoaderFunction());
builder.addSkyFunction(SkyFunctions.REPOSITORY_DIRECTORY, delegator);
builder.addSkyFunction(MavenServerFunction.NAME, new MavenServerFunction());
filesystem = directories.getFileSystem();
}
use of com.google.devtools.build.lib.rules.repository.RepositoryLoaderFunction in project bazel by bazelbuild.
the class PackageLookupFunctionTest method setUp.
@Before
public final void setUp() throws Exception {
emptyPackagePath = rootDirectory.getRelative("somewhere/else");
scratch.file("parentpackage/BUILD");
AnalysisMock analysisMock = AnalysisMock.get();
AtomicReference<PathPackageLocator> pkgLocator = new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(emptyPackagePath, rootDirectory)));
deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of());
BlazeDirectories directories = new BlazeDirectories(rootDirectory, outputBase, rootDirectory, analysisMock.getProductName());
ExternalFilesHelper externalFilesHelper = new ExternalFilesHelper(pkgLocator, ExternalFileAction.DEPEND_ON_EXTERNAL_PKG_FOR_EXTERNAL_REPO_PATHS, directories);
Map<SkyFunctionName, SkyFunction> skyFunctions = new HashMap<>();
skyFunctions.put(SkyFunctions.PACKAGE_LOOKUP, new PackageLookupFunction(deletedPackages, crossRepositoryLabelViolationStrategy(), ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD)));
skyFunctions.put(SkyFunctions.PACKAGE, new PackageFunction(null, null, null, null, null, null, null));
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.BLACKLISTED_PACKAGE_PREFIXES, new BlacklistedPackagePrefixesFunction());
RuleClassProvider ruleClassProvider = analysisMock.createRuleClassProvider();
skyFunctions.put(SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(ruleClassProvider));
skyFunctions.put(SkyFunctions.WORKSPACE_FILE, new WorkspaceFileFunction(ruleClassProvider, analysisMock.getPackageFactoryForTesting().create(ruleClassProvider, new PackageFactory.EmptyEnvironmentExtension(), scratch.getFileSystem()), directories));
skyFunctions.put(SkyFunctions.EXTERNAL_PACKAGE, new ExternalPackageFunction());
skyFunctions.put(SkyFunctions.LOCAL_REPOSITORY_LOOKUP, new LocalRepositoryLookupFunction());
skyFunctions.put(SkyFunctions.FILE_SYMLINK_CYCLE_UNIQUENESS, new FileSymlinkCycleUniquenessFunction());
ImmutableMap<String, RepositoryFunction> repositoryHandlers = ImmutableMap.of(LocalRepositoryRule.NAME, (RepositoryFunction) new LocalRepositoryFunction());
skyFunctions.put(SkyFunctions.REPOSITORY_DIRECTORY, new RepositoryDelegatorFunction(repositoryHandlers, null, new AtomicBoolean(true)));
skyFunctions.put(SkyFunctions.REPOSITORY, new RepositoryLoaderFunction());
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);
PrecomputedValue.BLAZE_DIRECTORIES.set(differencer, directories);
}
Aggregations