aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r--src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java11
-rw-r--r--src/test/java/com/google/devtools/build/android/ideinfo/PackageParserTest.java96
-rw-r--r--src/test/java/com/google/devtools/build/lib/ideinfo/AndroidStudioInfoAspectTest.java150
3 files changed, 68 insertions, 189 deletions
diff --git a/src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java b/src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java
index baa30494e2..f2628d2457 100644
--- a/src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java
+++ b/src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java
@@ -44,12 +44,11 @@ public class ArtifactLocationConverterTest {
@Test
public void testConverterSourceArtifact() throws Exception {
ArtifactLocation parsed = converter.convert(
- Joiner.on(",").join("", "test.java", "/usr/local/code")
+ Joiner.on(',').join("", "test.java")
);
assertThat(parsed)
.isEqualTo(
ArtifactLocation.newBuilder()
- .setRootPath(Paths.get("/usr/local/code").toString())
.setRelativePath(Paths.get("test.java").toString())
.setIsSource(true)
.build());
@@ -58,12 +57,11 @@ public class ArtifactLocationConverterTest {
@Test
public void testConverterDerivedArtifact() throws Exception {
ArtifactLocation parsed = converter.convert(
- Joiner.on(",").join("bin", "java/com/test.java", "/usr/local/_tmp/code/bin")
+ Joiner.on(',').join("bin", "java/com/test.java")
);
assertThat(parsed)
.isEqualTo(
ArtifactLocation.newBuilder()
- .setRootPath(Paths.get("/usr/local/_tmp/code/bin").toString())
.setRootExecutionPathFragment(Paths.get("bin").toString())
.setRelativePath(Paths.get("java/com/test.java").toString())
.setIsSource(false)
@@ -77,8 +75,9 @@ public class ArtifactLocationConverterTest {
}
@Test
- public void testFutureFormat() throws Exception {
- ArtifactLocation parsed = converter.convert("bin/out,java/com/test.java");
+ public void testOldFormat() throws Exception {
+ ArtifactLocation parsed = converter
+ .convert("bin/out,java/com/test.java,/usr/local/_tmp/code/bin/out");
assertThat(parsed)
.isEqualTo(
ArtifactLocation.newBuilder()
diff --git a/src/test/java/com/google/devtools/build/android/ideinfo/PackageParserTest.java b/src/test/java/com/google/devtools/build/android/ideinfo/PackageParserTest.java
index b302641788..cfb8096ee0 100644
--- a/src/test/java/com/google/devtools/build/android/ideinfo/PackageParserTest.java
+++ b/src/test/java/com/google/devtools/build/android/ideinfo/PackageParserTest.java
@@ -25,7 +25,6 @@ import com.google.devtools.build.lib.ideinfo.androidstudio.PackageManifestOuterC
import com.google.protobuf.MessageLite;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -91,14 +90,12 @@ public class PackageParserTest {
private static final ArtifactLocation DUMMY_SOURCE_ARTIFACT =
ArtifactLocation.newBuilder()
- .setRootPath("/usr/local/google/code")
.setRelativePath("java/com/google/Foo.java")
.setIsSource(true)
.build();
private static final ArtifactLocation DUMMY_DERIVED_ARTIFACT =
ArtifactLocation.newBuilder()
- .setRootPath("/usr/local/_tmp/code/bin")
.setRootExecutionPathFragment("bin")
.setRelativePath("java/com/google/Bla.java")
.setIsSource(false)
@@ -124,10 +121,10 @@ public class PackageParserTest {
"--output_manifest",
"/tmp/out.manifest",
"--sources",
- Joiner.on(":").join(
- ",java/com/google/Foo.java,/usr/local/google/code",
- "bin,java/com/google/Bla.java,/usr/local/_tmp/code/bin"
- )};
+ Joiner.on(':').join(
+ ",java/com/google/Foo.java",
+ "bin/out,java/com/google/Bla.java")
+ };
PackageParser.PackageParserOptions options = PackageParser.parseArgs(args);
assertThat(options.outputManifest.toString())
.isEqualTo(Paths.get("/tmp/out.manifest").toString());
@@ -135,15 +132,13 @@ public class PackageParserTest {
assertThat(options.sources.get(0))
.isEqualTo(
ArtifactLocation.newBuilder()
- .setRootPath(Paths.get("/usr/local/google/code").toString())
.setRelativePath(Paths.get("java/com/google/Foo.java").toString())
.setIsSource(true)
.build());
assertThat(options.sources.get(1))
.isEqualTo(
ArtifactLocation.newBuilder()
- .setRootPath(Paths.get("/usr/local/_tmp/code/bin").toString())
- .setRootExecutionPathFragment(Paths.get("bin").toString())
+ .setRootExecutionPathFragment(Paths.get("bin/out").toString())
.setRelativePath(Paths.get("java/com/google/Bla.java").toString())
.setIsSource(false)
.build());
@@ -220,8 +215,7 @@ public class PackageParserTest {
public void testWriteEmptyMap() throws Exception {
parser.writeManifest(
Maps.<ArtifactLocation, String> newHashMap(),
- Paths.get("/java/com/google/test.manifest"),
- false);
+ Paths.get("/java/com/google/test.manifest"));
assertThat(mockIoProvider.writer.toString()).isEmpty();
}
@@ -233,21 +227,15 @@ public class PackageParserTest {
DUMMY_DERIVED_ARTIFACT,
"com.other"
);
- parser.writeManifest(map, Paths.get("/java/com/google/test.manifest"), false);
+ parser.writeManifest(map, Paths.get("/java/com/google/test.manifest"));
String writtenString = mockIoProvider.writer.toString();
assertThat(writtenString).contains(String.format(
- "root_path: \"%s\"",
- DUMMY_SOURCE_ARTIFACT.getRootPath()));
- assertThat(writtenString).contains(String.format(
"relative_path: \"%s\"",
DUMMY_SOURCE_ARTIFACT.getRelativePath()));
assertThat(writtenString).contains("package_string: \"com.google\"");
assertThat(writtenString).contains(String.format(
- "root_path: \"%s\"",
- DUMMY_DERIVED_ARTIFACT.getRootPath()));
- assertThat(writtenString).contains(String.format(
"root_execution_path_fragment: \"%s\"",
DUMMY_DERIVED_ARTIFACT.getRootExecutionPathFragment()));
assertThat(writtenString).contains(String.format(
@@ -258,74 +246,14 @@ public class PackageParserTest {
@Test
public void testHandlesOldFormat() throws Exception {
- String[] args =
- new String[] {
- "--output_manifest",
- "/tmp/out.manifest",
- "--sources_absolute_paths",
- "/usr/local/code/java/com/google/Foo.java"
- + File.pathSeparator
- + "/usr/local/code/java/com/google/Bla.java",
- "--sources_execution_paths",
- "java/com/google/Foo.java" + File.pathSeparator + "java/com/google/Bla.java"
- };
- PackageParser.PackageParserOptions options = PackageParser.parseArgs(args);
- assertThat(options.outputManifest.toString())
- .isEqualTo(Paths.get("/tmp/out.manifest").toString());
- assertThat(options.sourcesAbsolutePaths.get(0).toString())
- .isEqualTo(Paths.get("/usr/local/code/java/com/google/Foo.java").toString());
- assertThat(options.sourcesAbsolutePaths.get(1).toString())
- .isEqualTo(Paths.get("/usr/local/code/java/com/google/Bla.java").toString());
-
- PackageParser.convertFromOldFormat(options);
- assertThat(options.sources).hasSize(2);
- assertThat(options.sources.get(0))
- .isEqualTo(
- ArtifactLocation.newBuilder()
- .setRootPath(Paths.get("/usr/local/code/").toString() + File.separator)
- .setRelativePath(Paths.get("java/com/google/Foo.java").toString())
- .build());
-
- mockIoProvider
- .addSource(options.sources.get(0),
- "package com.test;\n public class Bla {}\"")
- .addSource(options.sources.get(1),
- "package com.other;\n public class Foo {}\"");
-
- Map<ArtifactLocation, String> map = parser.parsePackageStrings(options.sources);
- assertThat(map).hasSize(2);
- assertThat(map).containsEntry(options.sources.get(0), "com.test");
- assertThat(map).containsEntry(options.sources.get(1), "com.other");
-
- parser.writeManifest(map, options.outputManifest, true);
-
- String writtenString = mockIoProvider.writer.toString();
- assertThat(writtenString).doesNotContain("location");
- assertThat(writtenString)
- .contains(
- "absolute_path: \""
- + Paths.get("/usr/local/code/java/com/google/Foo.java")
- .toString()
- .replace("\\", "\\\\")
- + "\"");
- assertThat(writtenString)
- .contains(
- "absolute_path: \""
- + Paths.get("/usr/local/code/java/com/google/Bla.java")
- .toString()
- .replace("\\", "\\\\")
- + "\"");
- }
-
- @Test
- public void testHandlesFutureFormat() throws Exception {
String[] args = new String[] {
"--output_manifest",
"/tmp/out.manifest",
"--sources",
- ",java/com/google/Foo.java:"
- + "bin/out,java/com/google/Bla.java",
- };
+ Joiner.on(':').join(
+ ",java/com/google/Foo.java,/usr/local/google/code",
+ "bin,java/com/google/Bla.java,/usr/local/_tmp/code/bin"
+ )};
PackageParser.PackageParserOptions options = PackageParser.parseArgs(args);
assertThat(options.outputManifest.toString())
.isEqualTo(Paths.get("/tmp/out.manifest").toString());
@@ -339,7 +267,7 @@ public class PackageParserTest {
assertThat(options.sources.get(1))
.isEqualTo(
ArtifactLocation.newBuilder()
- .setRootExecutionPathFragment(Paths.get("bin/out").toString())
+ .setRootExecutionPathFragment(Paths.get("bin").toString())
.setRelativePath(Paths.get("java/com/google/Bla.java").toString())
.setIsSource(false)
.build());
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 0a375a2666..34c380aa17 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
@@ -26,7 +26,6 @@ import com.google.devtools.build.lib.ideinfo.androidstudio.AndroidStudioIdeInfo.
import com.google.devtools.build.lib.ideinfo.androidstudio.AndroidStudioIdeInfo.JavaRuleIdeInfo;
import com.google.devtools.build.lib.ideinfo.androidstudio.AndroidStudioIdeInfo.RuleIdeInfo;
import com.google.devtools.build.lib.ideinfo.androidstudio.AndroidStudioIdeInfo.RuleIdeInfo.Kind;
-import com.google.devtools.build.lib.vfs.Path;
import com.google.protobuf.ByteString;
import com.google.protobuf.ProtocolStringList;
import java.nio.file.Paths;
@@ -45,13 +44,12 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
@Test
public void testSimpleJavaLibrary() throws Exception {
- Path buildFilePath =
- scratch.file(
- "com/google/example/BUILD",
- "java_library(",
- " name = 'simple',",
- " srcs = ['simple/Simple.java']",
- ")");
+ scratch.file(
+ "com/google/example/BUILD",
+ "java_library(",
+ " name = 'simple',",
+ " srcs = ['simple/Simple.java']",
+ ")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple", ruleIdeInfos);
@@ -59,12 +57,6 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
assertThat(Paths.get(location.getRelativePath()).toString())
.isEqualTo(Paths.get("com/google/example/BUILD").toString());
assertThat(location.getIsSource()).isTrue();
- if (testLegacyAswbPluginVersionCompatibility()) {
- assertThat(ruleIdeInfo.getBuildFile()).isEqualTo(buildFilePath.toString());
- assertThat(Paths.get(location.getRootPath(), location.getRelativePath()).toString())
- .isEqualTo(Paths.get(buildFilePath.toString()).toString());
- assertThat(ruleIdeInfo.getKind()).isEqualTo(Kind.JAVA_LIBRARY);
- }
assertThat(ruleIdeInfo.getKindString()).isEqualTo("java_library");
assertThat(relativePathsForJavaSourcesOf(ruleIdeInfo))
.containsExactly("com/google/example/simple/Simple.java");
@@ -982,19 +974,12 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
// todo(dslomov): Skylark aspect implementation does not yet return a correct root path.
assertThat(ruleIdeInfo.getJavaRuleIdeInfo().getSourcesList()).containsExactly(
ArtifactLocation.newBuilder()
- .setRootPath(
- testLegacyAswbPluginVersionCompatibility()
- ? targetConfig.getGenfilesDirectory(RepositoryName.MAIN).getPath()
- .getPathString()
- : "")
.setRootExecutionPathFragment(
targetConfig.getGenfilesDirectory(RepositoryName.MAIN).getExecPathString())
.setRelativePath("com/google/example/gen.java")
.setIsSource(false)
.build(),
ArtifactLocation.newBuilder()
- .setRootPath(testLegacyAswbPluginVersionCompatibility()
- ? directories.getWorkspace().getPathString() : "")
.setRelativePath("com/google/example/Test.java")
.setIsSource(true)
.build());
@@ -1114,16 +1099,15 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
@Test
public void testSimpleCCLibraryForCCToolchainExistence() throws Exception {
- Path buildFilePath =
- scratch.file(
- "com/google/example/BUILD",
- "cc_library(",
- " name = 'simple',",
- " srcs = ['simple/simple.cc'],",
- " hdrs = ['simple/simple.h'],",
- ")");
+ scratch.file(
+ "com/google/example/BUILD",
+ "cc_library(",
+ " name = 'simple',",
+ " srcs = ['simple/simple.cc'],",
+ " hdrs = ['simple/simple.h'],",
+ ")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(2);
+ assertThat(ruleIdeInfos).hasSize(2);
RuleIdeInfo ruleInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple",
ruleIdeInfos
@@ -1134,11 +1118,6 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
ArtifactLocation location = ruleInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString())
.isEqualTo(Paths.get("com/google/example/BUILD").toString());
- if (testLegacyAswbPluginVersionCompatibility()) {
- assertThat(ruleInfo.getBuildFile()).isEqualTo(buildFilePath.toString());
- assertThat(Paths.get(location.getRootPath(), location.getRelativePath()).toString())
- .isEqualTo(Paths.get(buildFilePath.toString()).toString());
- }
assertThat(ruleInfo.hasCRuleIdeInfo()).isTrue();
assertThat(ruleInfo.getDependenciesList()).hasSize(1);
@@ -1147,27 +1126,20 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
@Test
public void testSimpleCCLibrary() throws Exception {
- Path buildFilePath =
- scratch.file(
- "com/google/example/BUILD",
- "cc_library(",
- " name = 'simple',",
- " srcs = ['simple/simple.cc'],",
- " hdrs = ['simple/simple.h'],",
- ")");
+ scratch.file(
+ "com/google/example/BUILD",
+ "cc_library(",
+ " name = 'simple',",
+ " srcs = ['simple/simple.cc'],",
+ " hdrs = ['simple/simple.h'],",
+ ")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(2);
+ assertThat(ruleIdeInfos).hasSize(2);
RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple", ruleIdeInfos);
ArtifactLocation location = ruleIdeInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString())
.isEqualTo(Paths.get("com/google/example/BUILD").toString());
- if (testLegacyAswbPluginVersionCompatibility()) {
- assertThat(ruleIdeInfo.getBuildFile()).isEqualTo(buildFilePath.toString());
- assertThat(Paths.get(location.getRootPath(), location.getRelativePath()).toString())
- .isEqualTo(Paths.get(buildFilePath.toString()).toString());
- assertThat(ruleIdeInfo.getKind()).isEqualTo(Kind.CC_LIBRARY);
- }
assertThat(ruleIdeInfo.getKindString()).isEqualTo("cc_library");
assertThat(ruleIdeInfo.getDependenciesCount()).isEqualTo(1);
@@ -1204,7 +1176,7 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
" includes = ['foo/bar'],",
")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(2);
+ assertThat(ruleIdeInfos).hasSize(2);
RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple", ruleIdeInfos);
@@ -1250,7 +1222,7 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
" copts = ['-DGOPT', '-Ifoo/baz/'],",
")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(2);
+ assertThat(ruleIdeInfos).hasSize(2);
RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple", ruleIdeInfos);
@@ -1289,7 +1261,7 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
" defines = ['VERSION2'],",
")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(2);
+ assertThat(ruleIdeInfos).hasSize(2);
RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple", ruleIdeInfos);
@@ -1305,26 +1277,19 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
@Test
public void testSimpleCCBinary() throws Exception {
- Path buildFilePath =
- scratch.file(
- "com/google/example/BUILD",
- "cc_binary(",
- " name = 'simple',",
- " srcs = ['simple/simple.cc'],",
- ")");
+ scratch.file(
+ "com/google/example/BUILD",
+ "cc_binary(",
+ " name = 'simple',",
+ " srcs = ['simple/simple.cc'],",
+ ")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(2);
+ assertThat(ruleIdeInfos).hasSize(2);
RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple", ruleIdeInfos);
ArtifactLocation location = ruleIdeInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString())
.isEqualTo(Paths.get("com/google/example/BUILD").toString());
- if (testLegacyAswbPluginVersionCompatibility()) {
- assertThat(ruleIdeInfo.getBuildFile()).isEqualTo(buildFilePath.toString());
- assertThat(Paths.get(location.getRootPath(), location.getRelativePath()).toString())
- .isEqualTo(Paths.get(buildFilePath.toString()).toString());
- assertThat(ruleIdeInfo.getKind()).isEqualTo(Kind.CC_BINARY);
- }
assertThat(ruleIdeInfo.getKindString()).isEqualTo("cc_binary");
assertThat(ruleIdeInfo.getDependenciesCount()).isEqualTo(1);
@@ -1347,26 +1312,19 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
@Test
public void testSimpleCCTest() throws Exception {
- Path buildFilePath =
- scratch.file(
- "com/google/example/BUILD",
- "cc_test(",
- " name = 'simple',",
- " srcs = ['simple/simple.cc'],",
- ")");
+ scratch.file(
+ "com/google/example/BUILD",
+ "cc_test(",
+ " name = 'simple',",
+ " srcs = ['simple/simple.cc'],",
+ ")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(2);
+ assertThat(ruleIdeInfos).hasSize(2);
RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple", ruleIdeInfos);
ArtifactLocation location = ruleIdeInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString())
.isEqualTo(Paths.get("com/google/example/BUILD").toString());
- if (testLegacyAswbPluginVersionCompatibility()) {
- assertThat(ruleIdeInfo.getBuildFile()).isEqualTo(buildFilePath.toString());
- assertThat(Paths.get(location.getRootPath(), location.getRelativePath()).toString())
- .isEqualTo(Paths.get(buildFilePath.toString()).toString());
- assertThat(ruleIdeInfo.getKind()).isEqualTo(Kind.CC_TEST);
- }
assertThat(ruleIdeInfo.getKindString()).isEqualTo("cc_test");
assertThat(ruleIdeInfo.getDependenciesCount()).isEqualTo(1);
@@ -1403,7 +1361,7 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
" deps = [':lib'],",
")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(3);
+ assertThat(ruleIdeInfos).hasSize(3);
RuleIdeInfo ruleIdeInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple", ruleIdeInfos);
@@ -1454,7 +1412,7 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
" deps = [':lib2'],",
")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:lib1");
- assertThat(ruleIdeInfos.size()).isEqualTo(3);
+ assertThat(ruleIdeInfos).hasSize(3);
RuleIdeInfo lib1 = getRuleInfoAndVerifyLabel(
"//com/google/example:lib1", ruleIdeInfos);
@@ -1515,7 +1473,7 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
" deps = [':lib2'],",
")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:lib1");
- assertThat(ruleIdeInfos.size()).isEqualTo(3);
+ assertThat(ruleIdeInfos).hasSize(3);
RuleIdeInfo lib1 = getRuleInfoAndVerifyLabel(
"//com/google/example:lib1", ruleIdeInfos);
@@ -1567,7 +1525,7 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
" deps = [':lib2'],",
")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:lib1");
- assertThat(ruleIdeInfos.size()).isEqualTo(3);
+ assertThat(ruleIdeInfos).hasSize(3);
RuleIdeInfo lib1 = getRuleInfoAndVerifyLabel(
"//com/google/example:lib1", ruleIdeInfos);
@@ -1624,16 +1582,15 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
@Test
public void testCcToolchainInfoIsOnlyPresentForToolchainRules() throws Exception {
- Path buildFilePath =
- scratch.file(
- "com/google/example/BUILD",
- "cc_library(",
- " name = 'simple',",
- " srcs = ['simple/simple.cc'],",
- " hdrs = ['simple/simple.h'],",
- ")");
+ scratch.file(
+ "com/google/example/BUILD",
+ "cc_library(",
+ " name = 'simple',",
+ " srcs = ['simple/simple.cc'],",
+ " hdrs = ['simple/simple.h'],",
+ ")");
Map<String, RuleIdeInfo> ruleIdeInfos = buildRuleIdeInfo("//com/google/example:simple");
- assertThat(ruleIdeInfos.size()).isEqualTo(2);
+ assertThat(ruleIdeInfos).hasSize(2);
RuleIdeInfo ruleInfo = getRuleInfoAndVerifyLabel(
"//com/google/example:simple",
ruleIdeInfos
@@ -1644,11 +1601,6 @@ public class AndroidStudioInfoAspectTest extends AndroidStudioInfoAspectTestBase
ArtifactLocation location = ruleInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString())
.isEqualTo(Paths.get("com/google/example/BUILD").toString());
- if (testLegacyAswbPluginVersionCompatibility()) {
- assertThat(ruleInfo.getBuildFile()).isEqualTo(buildFilePath.toString());
- assertThat(Paths.get(location.getRootPath(), location.getRelativePath()).toString())
- .isEqualTo(Paths.get(buildFilePath.toString()).toString());
- }
assertThat(ruleInfo.hasCToolchainIdeInfo()).isFalse();
assertThat(toolchainInfo.hasCToolchainIdeInfo()).isTrue();