Allow FPStrategy to opt out of fingerprinting

Review Request #1602 — Created Jan. 12, 2015 and submitted — Latest diff uploaded

benjyw, jsirois, stuhood, zundel

Allow FingerprintStrategy to opt out of fingerprinting.

NOTE! This change bumps the universal GLOBAL_CACHE_KEY_GEN_VERSION. It therefore invalidates every artifact and target!

In some cases (in particular Ivy), a FingerprintStrategy might want to say that a target it is fingerprinting contributes nothing to the fingerprint. Currently this is impossible since even the presence of an "empty" fingerprint (a hasher that's been intialized, not updated, and then had its hexdigest dumped) still contributes to the transitive fingerprint of other targets. This change modifies the interface of FingerprintStrategy so that None is a valid return value.

Callers of FingerprintStrategy.fingerprint_target are modified accordingly to handle the possibility of None. In particular, a transitive hash as computed in Target.transitive_invalidation_hash considers that if its transitive dependencies all opted out (or are empty) and its own non-transitive hash is an opt-out, then the transitive hash is also an opt-out.

The motivation of this change was to reduce the number of calls to ivy. Generally, unless a target is a JarLibrary or it contains configurations/excludes in its payload, it doesn't contribute to invalidating an ivy resolve. Previously, a structural change to the build graph (adding a dependency that brought in no 3rd party libs) would still trigger an ivy resolve, even though it was unnecessary. Now, only changes that could possibly affect ivy resolution cause the transitive fingerprint to change.

CI is baking: