Fix default values in docs for attributes that are defined in ancestor classes.
For example, cc_binary and cc_test both inherit from the same rule class but
have different default values for the attribute stamp.
RELNOTES: None
PiperOrigin-RevId: 221399178
diff --git a/src/main/java/com/google/devtools/build/docgen/RuleDocumentationAttribute.java b/src/main/java/com/google/devtools/build/docgen/RuleDocumentationAttribute.java
index cac1303..2fde0f1 100644
--- a/src/main/java/com/google/devtools/build/docgen/RuleDocumentationAttribute.java
+++ b/src/main/java/com/google/devtools/build/docgen/RuleDocumentationAttribute.java
@@ -29,13 +29,14 @@
import java.util.Set;
/**
- * A class storing a rule attribute documentation along with some meta information.
- * The class provides functionality to compute the ancestry level of this attribute's
- * generator rule definition class compared to other rule definition classes.
+ * A class storing a rule attribute documentation along with some meta information. The class
+ * provides functionality to compute the ancestry level of this attribute's generator rule
+ * definition class compared to other rule definition classes.
*
* <p>Warning, two RuleDocumentationAttribute objects are equal based on only the attributeName.
*/
-public class RuleDocumentationAttribute implements Comparable<RuleDocumentationAttribute> {
+public class RuleDocumentationAttribute
+ implements Comparable<RuleDocumentationAttribute>, Cloneable {
private static final ImmutableMap<Type<?>, String> TYPE_DESC =
ImmutableMap.<Type<?>, String>builder()
@@ -70,6 +71,7 @@
private Set<String> flags;
private Attribute attribute;
+
/**
* Creates common RuleDocumentationAttribute such as deps or data.
* These attribute docs have no definitionClass or htmlDocumentation (it's in the BE header).
@@ -102,6 +104,12 @@
this.startLineCnt = startLineCnt;
this.flags = flags;
this.commonType = commonType;
+ this.fileName = fileName;
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ return super.clone();
}
/**
@@ -118,6 +126,11 @@
return attributeName;
}
+ /** Returns the file name where the rule attribute is defined. */
+ public String getFileName() {
+ return fileName;
+ }
+
/**
* Returns whether this attribute is marked as deprecated.
*/