use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testJavaLibraryWithTransitiveDependencies.
@Test
public void testJavaLibraryWithTransitiveDependencies() 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 = '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 extraComplexTarget = getTargetIdeInfoAndVerifyLabel("//com/google/example:extracomplex", targetIdeInfos);
assertThat(relativePathsForJavaSourcesOf(extraComplexTarget)).containsExactly("com/google/example/extracomplex/ExtraComplex.java");
assertThat(extraComplexTarget.getDependenciesList()).contains("//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 testAndroidLibraryGeneratesResourceClass.
@Test
public void testAndroidLibraryGeneratesResourceClass() throws Exception {
scratch.file("java/com/google/example/BUILD", "android_library(", " name = 'resource_files',", " resource_files = ['res/drawable/a.png'],", " manifest = 'AndroidManifest.xml',", ")", "android_library(", " name = 'manifest',", " manifest = 'AndroidManifest.xml',", ")", "android_library(", " name = 'neither',", " srcs = ['FooBar.java'],", " deps = [':resource_files', ':manifest']", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//java/com/google/example:neither");
TargetIdeInfo neither = getTargetIdeInfoAndVerifyLabel("//java/com/google/example:neither", targetIdeInfos);
TargetIdeInfo resourceFiles = getTargetIdeInfoAndVerifyLabel("//java/com/google/example:resource_files", targetIdeInfos);
TargetIdeInfo manifest = getTargetIdeInfoAndVerifyLabel("//java/com/google/example:manifest", targetIdeInfos);
assertThat(neither.getAndroidIdeInfo().getGenerateResourceClass()).isFalse();
assertThat(resourceFiles.getAndroidIdeInfo().getGenerateResourceClass()).isTrue();
assertThat(manifest.getAndroidIdeInfo().getGenerateResourceClass()).isTrue();
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testAndroidInferredPackage.
@Test
public void testAndroidInferredPackage() throws Exception {
scratch.file("java/com/google/example/BUILD", "android_library(", " name = 'l',", " manifest = 'AndroidManifest.xml',", ")", "android_binary(", " name = 'b',", " srcs = ['Main.java'],", " deps = [':l'],", " manifest = 'AndroidManifest.xml',", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//java/com/google/example:b");
TargetIdeInfo lTarget = getTargetIdeInfoAndVerifyLabel("//java/com/google/example:l", targetIdeInfos);
TargetIdeInfo bTarget = getTargetIdeInfoAndVerifyLabel("//java/com/google/example:b", targetIdeInfos);
assertThat(bTarget.getAndroidIdeInfo().getJavaPackage()).isEqualTo("com.google.example");
assertThat(lTarget.getAndroidIdeInfo().getJavaPackage()).isEqualTo("com.google.example");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testSimpleCCLibraryWithDefines.
@Test
public void testSimpleCCLibraryWithDefines() throws Exception {
scratch.file("com/google/example/BUILD", "cc_library(", " name = 'simple',", " srcs = ['simple/simple.cc'],", " hdrs = ['simple/simple.h'],", " defines = ['VERSION2'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:simple");
assertThat(targetIdeInfos).hasSize(2);
TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
assertThat(targetIdeInfo.hasCIdeInfo()).isTrue();
CIdeInfo cTargetIdeInfo = targetIdeInfo.getCIdeInfo();
assertThat(cTargetIdeInfo.getTargetDefineList()).containsExactly("VERSION2");
// Make sure our understanding of where this attributes show up in other providers is correct.
ProtocolStringList transDefineList = cTargetIdeInfo.getTransitiveDefineList();
assertThat(transDefineList).contains("VERSION2");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testSimpleCCLibraryWithDeps.
@Test
public void testSimpleCCLibraryWithDeps() throws Exception {
// Specify '-fPIC' so that compilation output filenames are consistent for mac and linux.
scratch.file("com/google/example/BUILD", "cc_library(", " name = 'lib',", " srcs = ['lib/lib.cc'],", " hdrs = ['lib/lib.h'],", ")", "cc_library(", " name = 'simple',", " srcs = ['simple/simple.cc'],", " hdrs = ['simple/simple.h'],", " deps = [':lib'],", " nocopts = '-fPIC',", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:simple");
assertThat(targetIdeInfos).hasSize(3);
TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
assertThat(targetIdeInfo.getDependenciesList()).contains("//com/google/example:lib");
assertThat(targetIdeInfo.getDependenciesList()).hasSize(2);
assertThat(getIdeCompileFiles()).containsExactly("com/google/example/_objs/simple/com/google/example/simple/simple.o");
}
Aggregations