Replace getFileConfiguredTarget(label).getArtifact() with getArtifact(label), make it work over filegroups.
The pattern was often used to test implicit outputs from a target. Since we're replacing implicit outputs with filegroups, we need a getter that works on both.
@@ -1052,6 +1052,19 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
return (FileConfiguredTarget) getConfiguredTarget(label, targetConfig);
}
+ /**
+ * Returns the Artifact for the specified label, configured for the "build" (aka "target")
+ * configuration.
+ */
+ protected Artifact getArtifact(String label) throws LabelSyntaxException {
+ ConfiguredTarget target = getConfiguredTarget(label, targetConfig);
+ if (target instanceof FileConfiguredTarget) {
+ return ((FileConfiguredTarget) target).getArtifact();
+ } else {
+ return getFilesToBuild(target).getSingleton();
+ }
+ }
+
/**
* Returns the ConfiguredTarget for the specified label, configured for the "host" configuration.
*/
@@ -1632,7 +1645,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
}
protected Action getGeneratingActionForLabel(String label) throws Exception {
- return getGeneratingAction(getFileConfiguredTarget(label).getArtifact());
+ return getGeneratingAction(getArtifact(label));
}
protected static String fileName(Artifact artifact) {
