public class DefaultRuleKeyFactory extends Object implements RuleKeyFactoryWithDiagnostics<RuleKey>
RuleKeyFactory
which adds some default settings to RuleKey
s.Modifier and Type | Class and Description |
---|---|
class |
DefaultRuleKeyFactory.Builder<RULE_KEY> |
Constructor and Description |
---|
DefaultRuleKeyFactory(RuleKeyFieldLoader ruleKeyFieldLoader,
FileHashLoader hashLoader,
SourcePathRuleFinder ruleFinder) |
DefaultRuleKeyFactory(RuleKeyFieldLoader ruleKeyFieldLoader,
FileHashLoader hashLoader,
SourcePathRuleFinder ruleFinder,
Optional<ThriftRuleKeyLogger> ruleKeyLogger) |
DefaultRuleKeyFactory(RuleKeyFieldLoader ruleKeyFieldLoader,
FileHashLoader hashLoader,
SourcePathRuleFinder ruleFinder,
RuleKeyCache<RuleKey> ruleKeyCache,
Optional<ThriftRuleKeyLogger> ruleKeyLogger) |
Modifier and Type | Method and Description |
---|---|
RuleKey |
build(BuildEngineAction action)
Creates a new
RULE_KEY for the given BuildEngineAction . |
<DIAG_KEY> RuleKeyDiagnostics.Result<RuleKey,DIAG_KEY> |
buildForDiagnostics(AddsToRuleKey appendable,
RuleKeyHasher<DIAG_KEY> hasher) |
<DIAG_KEY> RuleKeyDiagnostics.Result<RuleKey,DIAG_KEY> |
buildForDiagnostics(BuildEngineAction action,
RuleKeyHasher<DIAG_KEY> hasher)
Builds a diagnostic result for the given rule or appendable.
|
RuleKey |
getFromCache(BuildEngineAction action)
Returns a
RULE_KEY from an internal cache, if possible. |
DefaultRuleKeyFactory.Builder<com.google.common.hash.HashCode> |
newBuilderForTesting(BuildRule buildRule) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInputSizeLimit
public DefaultRuleKeyFactory(RuleKeyFieldLoader ruleKeyFieldLoader, FileHashLoader hashLoader, SourcePathRuleFinder ruleFinder, RuleKeyCache<RuleKey> ruleKeyCache, Optional<ThriftRuleKeyLogger> ruleKeyLogger)
public DefaultRuleKeyFactory(RuleKeyFieldLoader ruleKeyFieldLoader, FileHashLoader hashLoader, SourcePathRuleFinder ruleFinder)
public DefaultRuleKeyFactory(RuleKeyFieldLoader ruleKeyFieldLoader, FileHashLoader hashLoader, SourcePathRuleFinder ruleFinder, Optional<ThriftRuleKeyLogger> ruleKeyLogger)
public DefaultRuleKeyFactory.Builder<com.google.common.hash.HashCode> newBuilderForTesting(BuildRule buildRule)
@Nullable public RuleKey getFromCache(BuildEngineAction action)
RuleKeyFactory
RULE_KEY
from an internal cache, if possible. If a non-null value is
returned, it is guaranteed to be he same as if RuleKeyFactory.build(com.facebook.buck.core.build.action.BuildEngineAction)
were called instead.getFromCache
in interface RuleKeyFactory<RuleKey>
public RuleKey build(BuildEngineAction action)
RuleKeyFactory
RULE_KEY
for the given BuildEngineAction
. In most cases RULE_KEY
is going to be RuleKey
, but it can be anything really.build
in interface RuleKeyFactory<RuleKey>
action
- The build rule to create the key for.public <DIAG_KEY> RuleKeyDiagnostics.Result<RuleKey,DIAG_KEY> buildForDiagnostics(BuildEngineAction action, RuleKeyHasher<DIAG_KEY> hasher)
RuleKeyFactoryWithDiagnostics
This method is intended to be used exclusively for diagnostic purposes and not for computing rule keys used for build process in any other way.
The provided custom hasher is used for all the elements hashed under this rule or appendable.
Note however that if the factory chooses to hash nested build rules and appendables separately, and only include their final hash for the computation of this hash, this choice applies both to real rule keys and the diagnostic keys. The client may need to perform a separate call for each build rule or appendable of interest. Moreover, the hash for the nested build rules and appendables is obtained by using the default hasher and not the provided custom hasher. This is the natural choice as it allows the custom hasher to see precisely those elements that the default hasher sees. It is also more efficient because factories usually cache rule keys computed with the default hasher, whereas using the custom hasher prevents that and would require hashing all of its transitive dependencies.
buildForDiagnostics
in interface RuleKeyFactoryWithDiagnostics<RuleKey>
public <DIAG_KEY> RuleKeyDiagnostics.Result<RuleKey,DIAG_KEY> buildForDiagnostics(AddsToRuleKey appendable, RuleKeyHasher<DIAG_KEY> hasher)
buildForDiagnostics
in interface RuleKeyFactoryWithDiagnostics<RuleKey>