Search in sources :

Example 1 with ContentAgnosticRuleKeyFactory

use of com.facebook.buck.rules.keys.ContentAgnosticRuleKeyFactory in project buck by facebook.

the class ActionGraphCache method getRuleKeysFromBuildRules.

private static Map<BuildRule, RuleKey> getRuleKeysFromBuildRules(Iterable<BuildRule> buildRules, BuildRuleResolver buildRuleResolver, RuleKeyFieldLoader fieldLoader) {
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(buildRuleResolver);
    SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
    ContentAgnosticRuleKeyFactory factory = new ContentAgnosticRuleKeyFactory(fieldLoader, pathResolver, ruleFinder);
    HashMap<BuildRule, RuleKey> ruleKeysMap = new HashMap<>();
    for (BuildRule rule : buildRules) {
        ruleKeysMap.put(rule, factory.build(rule));
    }
    return ruleKeysMap;
}
Also used : HashMap(java.util.HashMap) ContentAgnosticRuleKeyFactory(com.facebook.buck.rules.keys.ContentAgnosticRuleKeyFactory)

Example 2 with ContentAgnosticRuleKeyFactory

use of com.facebook.buck.rules.keys.ContentAgnosticRuleKeyFactory in project buck by facebook.

the class ActionGraphCacheTest method getRuleKeysFromBuildRules.

private Map<BuildRule, RuleKey> getRuleKeysFromBuildRules(Iterable<BuildRule> buildRules, BuildRuleResolver buildRuleResolver) {
    RuleKeyFieldLoader ruleKeyFieldLoader = new RuleKeyFieldLoader(0);
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(buildRuleResolver);
    SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
    ContentAgnosticRuleKeyFactory factory = new ContentAgnosticRuleKeyFactory(ruleKeyFieldLoader, pathResolver, ruleFinder);
    HashMap<BuildRule, RuleKey> ruleKeysMap = new HashMap<>();
    for (BuildRule rule : buildRules) {
        ruleKeysMap.put(rule, factory.build(rule));
    }
    return ruleKeysMap;
}
Also used : RuleKeyFieldLoader(com.facebook.buck.rules.keys.RuleKeyFieldLoader) HashMap(java.util.HashMap) ContentAgnosticRuleKeyFactory(com.facebook.buck.rules.keys.ContentAgnosticRuleKeyFactory)

Aggregations

ContentAgnosticRuleKeyFactory (com.facebook.buck.rules.keys.ContentAgnosticRuleKeyFactory)2 HashMap (java.util.HashMap)2 RuleKeyFieldLoader (com.facebook.buck.rules.keys.RuleKeyFieldLoader)1