Skylark IDE info aspect: sources and dependencies.
1. Refactored IntelliJSkylarkAspectTest. Eventually that test will be
merged with AndroidStudioInfoAspect test to validate implementation
equivalence.
2. Exposed ``root`` and ``is_source`` on Artifacts to Skylark.
3. Skylark aspect implementation outputs sources and dependencies
information.
--
MOS_MIGRATED_REVID=112473407
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
index 5a98552..d4de3db 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
@@ -271,6 +271,9 @@
* package-path entries (for source Artifacts), or one of the bin, genfiles or includes dirs
* (for derived Artifacts). It will always be an ancestor of getPath().
*/
+ @SkylarkCallable(name = "root", structField = true,
+ doc = "The root beneath which this file resides."
+ )
public final Root getRoot() {
return root;
}
@@ -289,6 +292,8 @@
* root relationships. Note that this will report all Artifacts in the output
* tree, including in the include symlink tree, as non-source.
*/
+ @SkylarkCallable(name = "is_source", structField = true,
+ doc = "Returns true if this is a source file, i.e. it is not generated")
public final boolean isSourceArtifact() {
return execPath == rootRelativePath;
}