Search in sources :

Example 36 with Fingerprint

use of com.google.devtools.build.lib.util.Fingerprint in project bazel by bazelbuild.

the class NativeDepsHelper method getSharedNativeDepsPath.

/**
   * Returns the path of the shared native library. The name must be
   * generated based on the rule-specific inputs to the link actions. At this
   * point this includes order-sensitive list of linker inputs and options
   * collected from the transitive closure and linkstamp-related artifacts that
   * are compiled during linking. All those inputs can be affected by modifying
   * target attributes (srcs/deps/stamp/etc). However, target build
   * configuration can be ignored since it will either change output directory
   * (in case of different configuration instances) or will not affect anything
   * (if two targets use same configuration). Final goal is for all native
   * libraries that use identical linker command to use same output name.
   *
   * <p>TODO(bazel-team): (2010) Currently process of identifying parameters that can
   * affect native library name is manual and should be kept in sync with the
   * code in the CppLinkAction.Builder/CppLinkAction/Link classes which are
   * responsible for generating linker command line. Ideally we should reuse
   * generated command line for both purposes - selecting a name of the
   * native library and using it as link action payload. For now, correctness
   * of the method below is only ensured by validations in the
   * CppLinkAction.Builder.build() method.
   */
private static PathFragment getSharedNativeDepsPath(Iterable<Artifact> linkerInputs, Collection<String> linkopts, Iterable<Artifact> linkstamps, Iterable<Artifact> buildInfoArtifacts, Collection<String> features) {
    Fingerprint fp = new Fingerprint();
    for (Artifact input : linkerInputs) {
        fp.addString(input.getExecPathString());
    }
    fp.addStrings(linkopts);
    for (Artifact input : linkstamps) {
        fp.addString(input.getExecPathString());
    }
    for (Artifact input : buildInfoArtifacts) {
        fp.addString(input.getExecPathString());
    }
    for (String feature : features) {
        fp.addString(feature);
    }
    return new PathFragment("_nativedeps/" + fp.hexDigestAndReset());
}
Also used : Fingerprint(com.google.devtools.build.lib.util.Fingerprint) PathFragment(com.google.devtools.build.lib.vfs.PathFragment) Artifact(com.google.devtools.build.lib.actions.Artifact)

Example 37 with Fingerprint

use of com.google.devtools.build.lib.util.Fingerprint in project bazel by bazelbuild.

the class JavaCompileAction method computeKey.

@Override
protected String computeKey() {
    Fingerprint f = new Fingerprint();
    f.addString(GUID);
    f.addStrings(commandLine.arguments());
    return f.hexDigestAndReset();
}
Also used : Fingerprint(com.google.devtools.build.lib.util.Fingerprint)

Example 38 with Fingerprint

use of com.google.devtools.build.lib.util.Fingerprint in project bazel by bazelbuild.

the class InstrumentedFileManifestAction method computeKey.

@Override
protected String computeKey() {
    Fingerprint f = new Fingerprint();
    f.addString(GUID);
    // Not sorting here is probably cheaper, though it might lead to unnecessary re-execution.
    f.addStrings(Iterables.transform(files, TO_EXEC_PATH));
    return f.hexDigestAndReset();
}
Also used : Fingerprint(com.google.devtools.build.lib.util.Fingerprint)

Aggregations

Fingerprint (com.google.devtools.build.lib.util.Fingerprint)38 Artifact (com.google.devtools.build.lib.actions.Artifact)9 IOException (java.io.IOException)6 Map (java.util.Map)6 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)5 RepositoryFunctionException (com.google.devtools.build.lib.rules.repository.RepositoryFunction.RepositoryFunctionException)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 Rule (com.google.devtools.build.lib.packages.Rule)2 InputStream (java.io.InputStream)2 TreeMap (java.util.TreeMap)2 Nullable (javax.annotation.Nullable)2 Test (org.junit.Test)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)1 TreeFileArtifact (com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact)1 BlazeDirectories (com.google.devtools.build.lib.analysis.BlazeDirectories)1 RunUnder (com.google.devtools.build.lib.analysis.config.RunUnder)1 MavenServerRule (com.google.devtools.build.lib.bazel.rules.workspace.MavenServerRule)1 AspectDescriptor (com.google.devtools.build.lib.packages.AspectDescriptor)1 NoSuchThingException (com.google.devtools.build.lib.packages.NoSuchThingException)1