Search in sources :

Example 31 with TargetIdeInfo

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();
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 32 with TargetIdeInfo

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");
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 33 with TargetIdeInfo

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");
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 34 with TargetIdeInfo

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();
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 35 with TargetIdeInfo

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();
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Aggregations

TargetIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo)58 ByteString (com.google.protobuf.ByteString)55 Test (org.junit.Test)55 ArtifactLocation (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation)12 CIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CIdeInfo)10 ProtocolStringList (com.google.protobuf.ProtocolStringList)7 CToolchainIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CToolchainIdeInfo)5 JavaIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.JavaIdeInfo)3 Artifact (com.google.devtools.build.lib.actions.Artifact)2 LibraryArtifact (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact)2 Action (com.google.devtools.build.lib.actions.Action)1 BinaryFileWriteAction (com.google.devtools.build.lib.analysis.actions.BinaryFileWriteAction)1 SpawnAction (com.google.devtools.build.lib.analysis.actions.SpawnAction)1 AndroidIdeInfoProvider (com.google.devtools.build.lib.rules.android.AndroidIdeInfoProvider)1 CcToolchainProvider (com.google.devtools.build.lib.rules.cpp.CcToolchainProvider)1 CppCompilationContext (com.google.devtools.build.lib.rules.cpp.CppCompilationContext)1 CppConfiguration (com.google.devtools.build.lib.rules.cpp.CppConfiguration)1 JavaRuleOutputJarsProvider (com.google.devtools.build.lib.rules.java.JavaRuleOutputJarsProvider)1 JavaToolchainProvider (com.google.devtools.build.lib.rules.java.JavaToolchainProvider)1 TestInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TestInfo)1