use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testSimplePyBinary.
@Test
public void testSimplePyBinary() throws Exception {
scratch.file("com/google/example/BUILD", "py_binary(", " name = 'simple',", " srcs = ['simple/simple.py'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:simple");
assertThat(targetIdeInfos).hasSize(2);
TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
ArtifactLocation location = targetIdeInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString()).isEqualTo(Paths.get("com/google/example/BUILD").toString());
assertThat(targetIdeInfo.getKindString()).isEqualTo("py_binary");
assertThat(targetIdeInfo.getDependenciesCount()).isEqualTo(1);
assertThat(relativePathsForPySourcesOf(targetIdeInfo)).containsExactly("com/google/example/simple/simple.py");
assertThat(targetIdeInfo.hasPyIdeInfo()).isTrue();
assertThat(targetIdeInfo.hasJavaIdeInfo()).isFalse();
assertThat(targetIdeInfo.hasCIdeInfo()).isFalse();
assertThat(targetIdeInfo.hasAndroidIdeInfo()).isFalse();
assertThat(getIdeResolveFiles()).containsExactly("com/google/example/simple/simple.py");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testAndroidBinaryIsSerialized.
@Test
public void testAndroidBinaryIsSerialized() throws Exception {
TargetIdeInfo.Builder builder = TargetIdeInfo.newBuilder();
builder.setKindString("android_binary");
ByteString byteString = builder.build().toByteString();
TargetIdeInfo result = TargetIdeInfo.parseFrom(byteString);
assertThat(result.getKindString()).isEqualTo("android_binary");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testNoPackageManifestForExports.
@Test
public void testNoPackageManifestForExports() throws Exception {
scratch.file("com/google/example/BUILD", "java_library(", " name = 'foobar',", " srcs = ['FooBar.java'],", ")", "java_import(", " name = 'imp',", " jars = ['a.jar', 'b.jar'],", " deps = [':foobar'],", " exports = [':foobar'],", ")", "java_library(", " name = 'lib',", " srcs = ['Lib.java'],", " deps = [':imp'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:lib");
TargetIdeInfo libInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:lib", targetIdeInfos);
TargetIdeInfo impInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:imp", targetIdeInfos);
assertThat(!impInfo.getJavaIdeInfo().hasPackageManifest()).isTrue();
assertThat(libInfo.getJavaIdeInfo().hasPackageManifest()).isTrue();
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testRuntimeDepsAddedToProto.
@Test
public void testRuntimeDepsAddedToProto() throws Exception {
scratch.file("com/google/example/BUILD", "java_library(", " name = 'foobar',", " srcs = ['FooBar.java'],", ")", "java_library(", " name = 'foobar2',", " srcs = ['FooBar2.java'],", ")", "java_library(", " name = 'lib',", " srcs = ['Lib.java'],", " deps = [':lib2'],", " runtime_deps = [':foobar'],", ")", "java_library(", " name = 'lib2',", " srcs = ['Lib2.java'],", " runtime_deps = [':foobar2'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:lib");
// Fails if aspect was not propagated
TargetIdeInfo lib = getTargetIdeInfoAndVerifyLabel("//com/google/example:lib", targetIdeInfos);
TargetIdeInfo lib2 = getTargetIdeInfoAndVerifyLabel("//com/google/example:lib2", targetIdeInfos);
assertThat(lib.getRuntimeDepsList()).containsExactly("//com/google/example:foobar");
assertThat(lib2.getRuntimeDepsList()).containsExactly("//com/google/example:foobar2");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testJavaPlugin.
@Test
public void testJavaPlugin() throws Exception {
scratch.file("java/com/google/example/BUILD", "java_plugin(", " name = 'plugin',", " srcs = ['Plugin.java'],", " processor_class = 'com.google.example.Plugin',", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//java/com/google/example:plugin");
TargetIdeInfo plugin = getTargetIdeInfoAndVerifyLabel("//java/com/google/example:plugin", targetIdeInfos);
assertThat(plugin.getKindString()).isEqualTo("java_plugin");
assertThat(transform(plugin.getJavaIdeInfo().getJarsList(), LIBRARY_ARTIFACT_TO_STRING)).containsExactly(jarString("java/com/google/example", "libplugin.jar", "libplugin-hjar.jar", "libplugin-src.jar"));
}
Aggregations