use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testAndroidLibraryWithAidlWithoutImportRoot.
@Test
public void testAndroidLibraryWithAidlWithoutImportRoot() throws Exception {
scratch.file("java/com/google/example/BUILD", "android_library(", " name = 'no_idl_import_root',", " idl_srcs = ['a.aidl'],", ")");
String idlTarget = "//java/com/google/example:no_idl_import_root";
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo(idlTarget);
TargetIdeInfo idlTargetIdeInfo = getTargetIdeInfoAndVerifyLabel(idlTarget, targetIdeInfos);
assertThat(idlTargetIdeInfo.getAndroidIdeInfo().getIdlImportRoot()).isEmpty();
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testJavaLibraryWithTransitiveExports.
@Test
public void testJavaLibraryWithTransitiveExports() 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'],", " exports = [':complex'],", ")", "java_library(", " name = 'megacomplex',", " srcs = ['megacomplex/MegaComplex.java'],", " deps = [':extracomplex'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:megacomplex");
getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
getTargetIdeInfoAndVerifyLabel("//com/google/example:complex", targetIdeInfos);
getTargetIdeInfoAndVerifyLabel("//com/google/example:extracomplex", targetIdeInfos);
TargetIdeInfo megaComplexTarget = getTargetIdeInfoAndVerifyLabel("//com/google/example:megacomplex", targetIdeInfos);
assertThat(relativePathsForJavaSourcesOf(megaComplexTarget)).containsExactly("com/google/example/megacomplex/MegaComplex.java");
assertThat(megaComplexTarget.getDependenciesList()).containsAllOf("//com/google/example:simple", "//com/google/example:complex", "//com/google/example:extracomplex");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testAndroidLibraryWithoutSourcesExportsDependencies.
@Test
public void testAndroidLibraryWithoutSourcesExportsDependencies() throws Exception {
scratch.file("java/com/google/example/BUILD", "android_library(", " name = 'lib',", " srcs = ['Test.java']", ")", "android_library(", " name = 'forward',", " deps = [':lib'],", ")", "android_library(", " name = 'super',", " deps = [':forward'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//java/com/google/example:super");
TargetIdeInfo target = getTargetIdeInfoAndVerifyLabel("//java/com/google/example:super", targetIdeInfos);
assertThat(target.getDependenciesList()).containsAllOf("//java/com/google/example:forward", "//java/com/google/example:lib");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testFilteredGenJarNotCreatedForSourceOnlyRule.
@Test
public void testFilteredGenJarNotCreatedForSourceOnlyRule() throws Exception {
scratch.file("com/google/example/BUILD", "java_library(", " name = 'simple',", " srcs = ['Test.java']", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:simple");
TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
assertThat(targetIdeInfo.getJavaIdeInfo().hasFilteredGenJar()).isFalse();
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testAlias.
@Test
public void testAlias() throws Exception {
scratch.file("com/google/example/BUILD", "java_library(", " name = 'test',", " srcs = ['Test.java'],", " deps = [':alias']", ")", "alias(", " name = 'alias',", " actual = ':alias2',", ")", "alias(", " name = 'alias2',", " actual = ':real',", ")", "java_library(", " name = 'real',", " srcs = ['Real.java'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:test");
TargetIdeInfo testInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:test", targetIdeInfos);
assertThat(testInfo.getDependenciesList()).contains("//com/google/example:real");
assertThat(getTargetIdeInfoAndVerifyLabel("//com/google/example:real", targetIdeInfos)).isNotNull();
}
Aggregations