use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testAndroidLibraryWithAidlWithImportRoot.
@Test
public void testAndroidLibraryWithAidlWithImportRoot() throws Exception {
scratch.file("java/com/google/example/BUILD", "android_library(", " name = 'has_idl_import_root',", " idl_import_root = 'idl',", " idl_srcs = ['idl/com/google/example/a.aidl'],", ")");
String idlTarget = "//java/com/google/example:has_idl_import_root";
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo(idlTarget);
TargetIdeInfo idlTargetIdeInfo = getTargetIdeInfoAndVerifyLabel(idlTarget, targetIdeInfos);
assertThat(idlTargetIdeInfo.getAndroidIdeInfo().getIdlImportRoot()).isEqualTo("idl");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testSimpleAndroidBinaryThatDependsOnCCLibrary.
@Test
public void testSimpleAndroidBinaryThatDependsOnCCLibrary() throws Exception {
scratch.file("com/google/example/BUILD", "android_library(", " name = 'androidlib',", " srcs = ['Lib.java'],", " deps = ['simple'],", ")", "cc_library(", " name = 'simple',", " srcs = ['simple/simple.cc'],", " hdrs = ['simple/simple.h'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:androidlib");
TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:androidlib", targetIdeInfos);
assertThat(targetIdeInfo.getDependenciesList()).contains("//com/google/example:simple");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testJavaLibraryWithExports.
@Test
public void testJavaLibraryWithExports() throws Exception {
scratch.file("com/google/example/BUILD", "java_library(", " name = 'simple',", " srcs = ['simple/Simple.java']", ")", "java_library(", " name = 'complex',", " srcs = ['complex/Complex.java'],", " exports = [':simple'],", ")", "java_library(", " name = 'extracomplex',", " srcs = ['extracomplex/ExtraComplex.java'],", " deps = [':complex']", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:extracomplex");
getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
getTargetIdeInfoAndVerifyLabel("//com/google/example:complex", targetIdeInfos);
TargetIdeInfo complexTarget = getTargetIdeInfoAndVerifyLabel("//com/google/example:complex", targetIdeInfos);
TargetIdeInfo extraComplexTarget = getTargetIdeInfoAndVerifyLabel("//com/google/example:extracomplex", targetIdeInfos);
assertThat(complexTarget.getDependenciesList()).contains("//com/google/example:simple");
assertThat(extraComplexTarget.getDependenciesList()).containsAllOf("//com/google/example:simple", "//com/google/example:complex");
assertThat(getIdeResolveFiles()).containsExactly("com/google/example/libextracomplex.jar", "com/google/example/libextracomplex-hjar.jar", "com/google/example/libextracomplex-src.jar", "com/google/example/libcomplex.jar", "com/google/example/libcomplex-hjar.jar", "com/google/example/libcomplex-src.jar", "com/google/example/libsimple.jar", "com/google/example/libsimple-hjar.jar", "com/google/example/libsimple-src.jar");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testAndroidLibraryExportsDoNotOverReport.
@Test
public void testAndroidLibraryExportsDoNotOverReport() throws Exception {
scratch.file("com/google/example/BUILD", "android_library(", " name = 'lib',", " deps = [':middle'],", ")", "android_library(", " name = 'middle',", " srcs = ['Middle.java'],", " deps = [':exported'],", ")", "android_library(", " name = 'exported',", " srcs = ['Exported.java'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:lib");
TargetIdeInfo target = getTargetIdeInfoAndVerifyLabel("//com/google/example:lib", targetIdeInfos);
TargetIdeInfo javaToolchain = Iterables.getOnlyElement(findJavaToolchain(targetIdeInfos));
assertThat(target.getDependenciesList()).containsExactly(javaToolchain.getLabel(), "//com/google/example:middle");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testJavaLibraryWithDiamondDependencies.
@Test
public void testJavaLibraryWithDiamondDependencies() throws Exception {
scratch.file("com/google/example/BUILD", "java_library(", " name = 'simple',", " srcs = ['simple/Simple.java']", ")", "java_library(", " name = 'complex',", " srcs = ['complex/Complex.java'],", " deps = [':simple']", ")", "java_library(", " name = 'complex1',", " srcs = ['complex1/Complex.java'],", " deps = [':simple']", ")", "java_library(", " name = 'extracomplex',", " srcs = ['extracomplex/ExtraComplex.java'],", " deps = [':complex', ':complex1']", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:extracomplex");
getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
getTargetIdeInfoAndVerifyLabel("//com/google/example:complex", targetIdeInfos);
getTargetIdeInfoAndVerifyLabel("//com/google/example:complex1", targetIdeInfos);
TargetIdeInfo extraComplexTarget = getTargetIdeInfoAndVerifyLabel("//com/google/example:extracomplex", targetIdeInfos);
assertThat(relativePathsForJavaSourcesOf(extraComplexTarget)).containsExactly("com/google/example/extracomplex/ExtraComplex.java");
assertThat(extraComplexTarget.getDependenciesList()).containsAllOf("//com/google/example:complex", "//com/google/example:complex1");
}
Aggregations