Search in sources :

Example 1 with Builder

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);
}
Also used : PackageIdentifier(com.google.devtools.build.lib.cmdline.PackageIdentifier) LegacyGlobber(com.google.devtools.build.lib.packages.PackageFactory.LegacyGlobber) Builder(com.google.devtools.build.lib.packages.Package.Builder) MakeEnvironment(com.google.devtools.build.lib.packages.MakeEnvironment) Package(com.google.devtools.build.lib.packages.Package) GlobCache(com.google.devtools.build.lib.packages.GlobCache)

Aggregations

PackageIdentifier (com.google.devtools.build.lib.cmdline.PackageIdentifier)1 GlobCache (com.google.devtools.build.lib.packages.GlobCache)1 MakeEnvironment (com.google.devtools.build.lib.packages.MakeEnvironment)1 Package (com.google.devtools.build.lib.packages.Package)1 Builder (com.google.devtools.build.lib.packages.Package.Builder)1 LegacyGlobber (com.google.devtools.build.lib.packages.PackageFactory.LegacyGlobber)1