Search in sources :

Example 51 with TargetIdeInfo

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

the class AndroidStudioInfoAspectTest method testAndroidLibraryWithAidlWithImportRoot.

@Test
public void testAndroidLibraryWithAidlWithImportRoot() throws Exception {
    scratch.file("java/com/google/example/BUILD", "android_library(", "  name = 'has_idl_import_root',", "  idl_import_root = 'idl',", "  idl_srcs = ['idl/com/google/example/a.aidl'],", ")");
    String idlTarget = "//java/com/google/example:has_idl_import_root";
    Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo(idlTarget);
    TargetIdeInfo idlTargetIdeInfo = getTargetIdeInfoAndVerifyLabel(idlTarget, targetIdeInfos);
    assertThat(idlTargetIdeInfo.getAndroidIdeInfo().getIdlImportRoot()).isEqualTo("idl");
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 52 with TargetIdeInfo

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

the class AndroidStudioInfoAspectTest method testSimpleAndroidBinaryThatDependsOnCCLibrary.

@Test
public void testSimpleAndroidBinaryThatDependsOnCCLibrary() throws Exception {
    scratch.file("com/google/example/BUILD", "android_library(", "    name = 'androidlib',", "    srcs = ['Lib.java'],", "    deps = ['simple'],", ")", "cc_library(", "    name = 'simple',", "    srcs = ['simple/simple.cc'],", "    hdrs = ['simple/simple.h'],", ")");
    Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:androidlib");
    TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:androidlib", targetIdeInfos);
    assertThat(targetIdeInfo.getDependenciesList()).contains("//com/google/example:simple");
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 53 with TargetIdeInfo

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

the class AndroidStudioInfoAspectTest method testJavaLibraryWithExports.

@Test
public void testJavaLibraryWithExports() 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'],", "    deps = [':complex']", ")");
    Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:extracomplex");
    getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
    getTargetIdeInfoAndVerifyLabel("//com/google/example:complex", targetIdeInfos);
    TargetIdeInfo complexTarget = getTargetIdeInfoAndVerifyLabel("//com/google/example:complex", targetIdeInfos);
    TargetIdeInfo extraComplexTarget = getTargetIdeInfoAndVerifyLabel("//com/google/example:extracomplex", targetIdeInfos);
    assertThat(complexTarget.getDependenciesList()).contains("//com/google/example:simple");
    assertThat(extraComplexTarget.getDependenciesList()).containsAllOf("//com/google/example:simple", "//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");
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 54 with TargetIdeInfo

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

the class AndroidStudioInfoAspectTest method testAndroidLibraryExportsDoNotOverReport.

@Test
public void testAndroidLibraryExportsDoNotOverReport() throws Exception {
    scratch.file("com/google/example/BUILD", "android_library(", "  name = 'lib',", "  deps = [':middle'],", ")", "android_library(", "  name = 'middle',", "  srcs = ['Middle.java'],", "  deps = [':exported'],", ")", "android_library(", "  name = 'exported',", "  srcs = ['Exported.java'],", ")");
    Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:lib");
    TargetIdeInfo target = getTargetIdeInfoAndVerifyLabel("//com/google/example:lib", targetIdeInfos);
    TargetIdeInfo javaToolchain = Iterables.getOnlyElement(findJavaToolchain(targetIdeInfos));
    assertThat(target.getDependenciesList()).containsExactly(javaToolchain.getLabel(), "//com/google/example:middle");
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 55 with TargetIdeInfo

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

the class AndroidStudioInfoAspectTest method testJavaLibraryWithDiamondDependencies.

@Test
public void testJavaLibraryWithDiamondDependencies() 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 = 'complex1',", "    srcs = ['complex1/Complex.java'],", "    deps = [':simple']", ")", "java_library(", "    name = 'extracomplex',", "    srcs = ['extracomplex/ExtraComplex.java'],", "    deps = [':complex', ':complex1']", ")");
    Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:extracomplex");
    getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
    getTargetIdeInfoAndVerifyLabel("//com/google/example:complex", targetIdeInfos);
    getTargetIdeInfoAndVerifyLabel("//com/google/example:complex1", targetIdeInfos);
    TargetIdeInfo extraComplexTarget = getTargetIdeInfoAndVerifyLabel("//com/google/example:extracomplex", targetIdeInfos);
    assertThat(relativePathsForJavaSourcesOf(extraComplexTarget)).containsExactly("com/google/example/extracomplex/ExtraComplex.java");
    assertThat(extraComplexTarget.getDependenciesList()).containsAllOf("//com/google/example:complex", "//com/google/example:complex1");
}
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