diff options
author | 2016-05-23 16:18:50 +0000 | |
---|---|---|
committer | 2016-05-24 11:40:42 +0000 | |
commit | da88fa18e7f6880faffaddb88085f8813accd7b8 (patch) | |
tree | 816c73189806a21c66268fc0c86f94c3b9fc0c45 /src | |
parent | 02287b692acfb23ae5014e875f61d01835fbc8d8 (diff) |
Do not include generated sources in the IDE package manifests.
The IDE doesn't add generated sources. Including these causes
execution of actions that generate sources, including building
whatever tools they need. This is not necessary for the IDE
stage.
--
MOS_MIGRATED_REVID=123004127
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspect.java | 2 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java | 26 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspect.java b/src/main/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspect.java index 27a97bce36..619150a553 100644 --- a/src/main/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspect.java +++ b/src/main/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspect.java @@ -744,7 +744,7 @@ public class AndroidStudioInfoAspect extends NativeAspectClass implements Config Collection<Artifact> srcs = getSources(ruleContext); List<Artifact> javaSrcs = Lists.newArrayList(); for (Artifact src : srcs) { - if (src.getRootRelativePathString().endsWith(".java")) { + if (src.isSourceArtifact() && src.getRootRelativePathString().endsWith(".java")) { javaSrcs.add(src); } } diff --git a/src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java b/src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java index f9a1b49e83..a8bdeb1af4 100644 --- a/src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java +++ b/src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java @@ -103,7 +103,31 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase assertNotNull(packageManifest); assertEquals(packageManifest.getRelativePath(), "com/google/example/simple.manifest"); } - + + @Test + public void testPackageManifestNotCreatedForOnlyGeneratedSources() throws Exception { + if (!isNativeTest()) { + return; + } + + scratch.file( + "com/google/example/BUILD", + "genrule(", + " name = 'gen_sources',", + " outs = ['Gen.java'],", + " cmd = '',", + ")", + "java_library(", + " name = 'simple',", + " srcs = [':gen_sources']", + ")"); + Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple"); + assertThat(ruleIdeInfos.size()).isEqualTo(1); + RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel( + "//com/google/example:simple", ruleIdeInfos); + assertThat(ruleIdeInfo.getJavaRuleIdeInfo().hasPackageManifest()).isFalse(); + } + @Test public void testJavaLibraryWithDependencies() throws Exception { scratch.file( |