use of com.google.devtools.build.lib.actions.MiddlemanFactory in project bazel by bazelbuild.
the class CompilationHelper method getMiddlemanInternal.
/**
* Internal implementation for getAggregatingMiddleman / getAggregatingMiddlemanWithSolibSymlinks.
*/
private static List<Artifact> getMiddlemanInternal(AnalysisEnvironment env, RuleContext ruleContext, ActionOwner actionOwner, String purpose, TransitiveInfoCollection dep) {
if (dep == null) {
return ImmutableList.of();
}
MiddlemanFactory factory = env.getMiddlemanFactory();
Iterable<Artifact> artifacts = dep.getProvider(FileProvider.class).getFilesToBuild();
return ImmutableList.of(factory.createMiddlemanAllowMultiple(env, actionOwner, ruleContext.getPackageDirectory(), purpose, artifacts, ruleContext.getConfiguration().getMiddlemanDirectory(ruleContext.getRule().getRepository())));
}
use of com.google.devtools.build.lib.actions.MiddlemanFactory in project bazel by bazelbuild.
the class MiddlemanActionTest method initializeMiddleman.
@Before
public final void initializeMiddleman() throws Exception {
scratch.file("a/BUILD", "testing_dummy_rule(name='a', outs=['a.out'])");
scratch.file("b/BUILD", "testing_dummy_rule(name='b', outs=['b.out'])");
a = getFilesToBuild(getConfiguredTarget("//a")).iterator().next();
b = getFilesToBuild(getConfiguredTarget("//b")).iterator().next();
analysisEnvironment = new AnalysisTestUtil.CollectingAnalysisEnvironment(AnalysisTestUtil.STUB_ANALYSIS_ENVIRONMENT);
middlemanFactory = new MiddlemanFactory(view.getArtifactFactory(), analysisEnvironment);
middle = middlemanFactory.createAggregatingMiddleman(NULL_ACTION_OWNER, "middleman_test", Arrays.asList(a, b), targetConfig.getMiddlemanDirectory(RepositoryName.MAIN));
analysisEnvironment.registerWith(getMutableActionGraph());
}
use of com.google.devtools.build.lib.actions.MiddlemanFactory in project bazel by bazelbuild.
the class CppHelper method getMiddlemanInternal.
/**
* Internal implementation for getAggregatingMiddlemanForCppRuntimes.
*/
private static List<Artifact> getMiddlemanInternal(RuleContext ruleContext, ActionOwner actionOwner, String purpose, Iterable<Artifact> artifacts, boolean useSolibSymlinks, boolean isCppRuntime, String solibDirOverride, BuildConfiguration configuration) {
MiddlemanFactory factory = ruleContext.getAnalysisEnvironment().getMiddlemanFactory();
if (useSolibSymlinks) {
List<Artifact> symlinkedArtifacts = new ArrayList<>();
for (Artifact artifact : artifacts) {
Preconditions.checkState(Link.SHARED_LIBRARY_FILETYPES.matches(artifact.getFilename()));
symlinkedArtifacts.add(isCppRuntime ? SolibSymlinkAction.getCppRuntimeSymlink(ruleContext, artifact, solibDirOverride, configuration) : SolibSymlinkAction.getDynamicLibrarySymlink(ruleContext, artifact, false, true, configuration));
}
artifacts = symlinkedArtifacts;
purpose += "_with_solib";
}
return ImmutableList.of(factory.createMiddlemanAllowMultiple(ruleContext.getAnalysisEnvironment(), actionOwner, ruleContext.getPackageDirectory(), purpose, artifacts, configuration.getMiddlemanDirectory(ruleContext.getRule().getRepository())));
}
Aggregations