Search in sources :

Example 11 with CIdeInfo

use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CIdeInfo in project bazel by bazelbuild.

the class AndroidStudioInfoAspectTest method testTransitiveCCLibraryWithDefines.

@Test
public void testTransitiveCCLibraryWithDefines() throws Exception {
    scratch.file("com/google/example/BUILD", "cc_library(", "    name = 'lib2',", "    srcs = ['lib2/lib2.cc'],", "    hdrs = ['lib2/lib2.h'],", "    defines = ['COMPLEX_IMPL'],", ")", "cc_library(", "    name = 'lib1',", "    srcs = ['lib1/lib1.cc'],", "    hdrs = ['lib1/lib1.h'],", "    defines = ['VERSION2'],", "    deps = [':lib2'],", ")");
    Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:lib1");
    assertThat(targetIdeInfos).hasSize(3);
    TargetIdeInfo lib1 = getTargetIdeInfoAndVerifyLabel("//com/google/example:lib1", targetIdeInfos);
    assertThat(lib1.hasCIdeInfo()).isTrue();
    CIdeInfo cIdeInfo = lib1.getCIdeInfo();
    assertThat(cIdeInfo.getTargetDefineList()).containsExactly("VERSION2");
    // Make sure our understanding of where this attributes show up in other providers is correct.
    ProtocolStringList transDefineList = cIdeInfo.getTransitiveDefineList();
    assertThat(transDefineList).contains("VERSION2");
    assertThat(transDefineList).contains("COMPLEX_IMPL");
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) CIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CIdeInfo) ByteString(com.google.protobuf.ByteString) ProtocolStringList(com.google.protobuf.ProtocolStringList) Test(org.junit.Test)

Aggregations

CIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CIdeInfo)11 TargetIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo)10 ByteString (com.google.protobuf.ByteString)9 Test (org.junit.Test)9 ProtocolStringList (com.google.protobuf.ProtocolStringList)7 CToolchainIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CToolchainIdeInfo)5 ArtifactLocation (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation)3 Artifact (com.google.devtools.build.lib.actions.Artifact)2 LibraryArtifact (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact)2 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 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)1 JavaIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.JavaIdeInfo)1 TestInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TestInfo)1