aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp
diff options
context:
space:
mode:
authorGravatar Irina Iancu <elenairina@google.com>2017-01-10 16:03:29 +0000
committerGravatar Marcel Hlopko <hlopko@google.com>2017-01-10 19:41:59 +0000
commit2f23599dda8f580234fc5a97675561cc86127444 (patch)
treea84a1bf15e7dd3ae1980522f5d6f8b71dfd39b51 /src/main/java/com/google/devtools/build/lib/rules/cpp
parent284bbda34a3405779da67dc4fa15ef0fea76a88e (diff)
Add new flag to specify if output_licenses attribute should be checked for licenses.
Also flipped :jvm attribute from HOST to TARGET and set the new flag on it. -- PiperOrigin-RevId: 144084000 MOS_MIGRATED_REVID=144084000
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
index 5ff24aa753..494e74ecf1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
@@ -237,7 +237,10 @@ public class CcToolchain implements RuleConfiguredTargetFactory {
// but it is sort-of-kind-of a tool, but various parts of it are linked into the output...
// ...so we trust the judgment of the author of the cc_toolchain rule to figure out what
// licenses should be propagated to C++ targets.
- License outputLicense = ruleContext.getRule().getToolOutputLicense(ruleContext.attributes());
+ // TODO(elenairina): Remove this and use Attribute.Builder.useOutputLicenses() on the
+ // :cc_toolchain attribute instead.
+ final License outputLicense =
+ ruleContext.getRule().getToolOutputLicense(ruleContext.attributes());
if (outputLicense != null && outputLicense != License.NO_LICENSE) {
final NestedSet<TargetLicense> license = NestedSetBuilder.create(Order.STABLE_ORDER,
new TargetLicense(ruleContext.getLabel(), outputLicense));
@@ -246,6 +249,17 @@ public class CcToolchain implements RuleConfiguredTargetFactory {
public NestedSet<TargetLicense> getTransitiveLicenses() {
return license;
}
+
+ @Override
+ public TargetLicense getOutputLicenses() {
+ return new TargetLicense(label, outputLicense);
+ }
+
+ @Override
+ public boolean hasOutputLicenses() {
+ return true;
+ }
+
};
builder.add(LicensesProvider.class, licensesProvider);