Search in sources :

Example 1 with Linkstamp

use of com.google.devtools.build.lib.rules.cpp.CcLinkParams.Linkstamp in project bazel by bazelbuild.

the class CppHelper method resolveLinkstamps.

/**
   * Resolves the linkstamp collection from the {@code CcLinkParams} into a map.
   *
   * <p>Emits a warning on the rule if there are identical linkstamp artifacts with different
   * compilation contexts.
   */
public static Map<Artifact, NestedSet<Artifact>> resolveLinkstamps(RuleErrorConsumer listener, CcLinkParams linkParams) {
    Map<Artifact, NestedSet<Artifact>> result = new LinkedHashMap<>();
    for (Linkstamp pair : linkParams.getLinkstamps()) {
        Artifact artifact = pair.getArtifact();
        if (result.containsKey(artifact)) {
            listener.ruleWarning("rule inherits the '" + artifact.toDetailString() + "' linkstamp file from more than one cc_library rule");
        }
        result.put(artifact, pair.getDeclaredIncludeSrcs());
    }
    return result;
}
Also used : Linkstamp(com.google.devtools.build.lib.rules.cpp.CcLinkParams.Linkstamp) NestedSet(com.google.devtools.build.lib.collect.nestedset.NestedSet) Artifact(com.google.devtools.build.lib.actions.Artifact) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

Artifact (com.google.devtools.build.lib.actions.Artifact)1 NestedSet (com.google.devtools.build.lib.collect.nestedset.NestedSet)1 Linkstamp (com.google.devtools.build.lib.rules.cpp.CcLinkParams.Linkstamp)1 LinkedHashMap (java.util.LinkedHashMap)1