diff options
author | 2016-02-12 18:56:02 +0000 | |
---|---|---|
committer | 2016-02-15 09:19:10 +0000 | |
commit | 500175fcfb37953f50cf0869df164902755807f2 (patch) | |
tree | a59b2bda11681e8674d551e235dea1b4655fe578 /src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java | |
parent | b0ee77a714511daf1a168a0bf90b096409872555 (diff) |
Don't include absolute paths in blaze IDE artifacts
RELNOTES: Don't include absolute paths in blaze IDE artifacts
--
MOS_MIGRATED_REVID=114550121
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java | 40 |
1 files changed, 20 insertions, 20 deletions
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 6810d5d50d..22416fc896 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 @@ -43,6 +43,7 @@ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -69,6 +70,10 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase "//com/google/example:simple", ruleIdeInfos); if (isNativeTest()) { assertThat(ruleIdeInfo.getBuildFile()).isEqualTo(buildFilePath.toString()); + ArtifactLocation location = ruleIdeInfo.getBuildFileArtifactLocation(); + assertThat(Paths.get(location.getRootPath(), location.getRelativePath()).toString()) + .isEqualTo(buildFilePath.toString()); + assertThat(location.getRelativePath()).isEqualTo("com/google/example/BUILD"); } assertThat(ruleIdeInfo.getKind()).isEqualTo(Kind.JAVA_LIBRARY); assertThat(ruleIdeInfo.getDependenciesCount()).isEqualTo(0); @@ -907,26 +912,21 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase ")"); Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:lib"); RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel("//com/google/example:lib", ruleIdeInfos); - assertThat(ruleIdeInfo.getJavaRuleIdeInfo().getSourcesList()) - .containsExactly( - expectedArtifactLocationWithRootPath( - targetConfig.getGenfilesDirectory().getPath().getPathString()) - .setRelativePath("com/google/example/gen.java") - .setIsSource(false) - .build(), - expectedArtifactLocationWithRootPath(directories.getWorkspace().getPathString()) - .setRelativePath("com/google/example/Test.java") - .setIsSource(true) - .build()); - } - - private ArtifactLocation.Builder expectedArtifactLocationWithRootPath(String pathString) { - if (isNativeTest()) { - return ArtifactLocation.newBuilder().setRootPath(pathString); - } else { - // todo(dslomov): Skylark aspect implementation does not yet return a correct root path. - return ArtifactLocation.newBuilder(); - } + // todo(dslomov): Skylark aspect implementation does not yet return a correct root path. + assertThat(ruleIdeInfo.getJavaRuleIdeInfo().getSourcesList()).containsExactly( + ArtifactLocation.newBuilder() + .setRootPath( + isNativeTest() ? targetConfig.getGenfilesDirectory().getPath().getPathString() : "") + .setRootExecutionPathFragment( + isNativeTest() ? targetConfig.getGenfilesDirectory().getExecPathString() : "") + .setRelativePath("com/google/example/gen.java") + .setIsSource(false) + .build(), + ArtifactLocation.newBuilder() + .setRootPath(isNativeTest() ? directories.getWorkspace().getPathString() : "") + .setRelativePath("com/google/example/Test.java") + .setIsSource(true) + .build()); } @Test |