use of com.google.devtools.build.lib.packages.Package.Builder in project bazel by bazelbuild.
the class PackageFactoryApparatus method evalAndReturnGlobCache.
/**
* Evaluates the {@code buildFileAST} into a {@link Package}.
*/
public Pair<Package, GlobCache> evalAndReturnGlobCache(String packageName, Path buildFile, BuildFileAST buildFileAST) throws InterruptedException {
PackageIdentifier packageId = PackageIdentifier.createInMainRepo(packageName);
GlobCache globCache = new GlobCache(buildFile.getParentDirectory(), packageId, getPackageLocator(), null, TestUtils.getPool(), -1);
LegacyGlobber globber = PackageFactory.createLegacyGlobber(globCache);
Package externalPkg = factory.newExternalPackageBuilder(buildFile.getParentDirectory().getRelative("WORKSPACE"), "TESTING").build();
Builder resultBuilder = factory.evaluateBuildFile(externalPkg.getWorkspaceName(), packageId, buildFileAST, buildFile, globber, ImmutableList.<Event>of(), ConstantRuleVisibility.PUBLIC, false, new MakeEnvironment.Builder(), ImmutableMap.<String, Extension>of(), ImmutableList.<Label>of());
Package result = resultBuilder.build();
Event.replayEventsOn(eventHandler, result.getEvents());
return Pair.of(result, globCache);
}
Aggregations