use of com.facebook.buck.rules.DependencyAggregation in project buck by facebook.
the class AbstractCxxSourceRuleFactory method requireAggregatedPreprocessDepsRule.
/**
* Returns the no-op rule that aggregates the preprocessor dependencies.
*
* Individual compile rules can depend on it, instead of having to depend on every preprocessor
* dep themselves. This turns O(n*m) dependencies into O(n+m) dependencies, where n is number of
* files in a target, and m is the number of targets.
*/
private BuildRule requireAggregatedPreprocessDepsRule() {
BuildTarget target = createAggregatedPreprocessDepsBuildTarget();
Optional<DependencyAggregation> existingRule = getResolver().getRuleOptionalWithType(target, DependencyAggregation.class);
if (existingRule.isPresent()) {
return existingRule.get();
} else {
BuildRuleParams params = getParams().withBuildTarget(target).copyReplacingDeclaredAndExtraDeps(Suppliers.ofInstance(getPreprocessDeps()), Suppliers.ofInstance(ImmutableSortedSet.of()));
DependencyAggregation rule = new DependencyAggregation(params);
getResolver().addToIndex(rule);
return rule;
}
}
use of com.facebook.buck.rules.DependencyAggregation in project buck by facebook.
the class CxxPrecompiledHeaderTemplate method requireAggregatedDepsRule.
public DependencyAggregation requireAggregatedDepsRule(CxxPlatform cxxPlatform) {
BuildTarget depAggTarget = createAggregatedDepsTarget(cxxPlatform);
Optional<DependencyAggregation> existingRule = ruleResolver.getRuleOptionalWithType(depAggTarget, DependencyAggregation.class);
if (existingRule.isPresent()) {
return existingRule.get();
}
BuildRuleParams depAggParams = params.withBuildTarget(depAggTarget).copyReplacingDeclaredAndExtraDeps(Suppliers.ofInstance(getPreprocessDeps(cxxPlatform)), Suppliers.ofInstance(ImmutableSortedSet.of()));
DependencyAggregation depAgg = new DependencyAggregation(depAggParams);
ruleResolver.addToIndex(depAgg);
return depAgg;
}
Aggregations