Search in sources :

Example 6 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class ScalaMacroLibraryTest method testScalaLibrary.

@Test
public void testScalaLibrary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":simple_fixture");
    TargetIdeInfo target = findTarget(testFixture, ":simple");
    assertThat(target.getKindString()).isEqualTo("scala_macro_library");
    assertThat(relativePathsForArtifacts(target.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("Foo.scala"));
    assertThat(target.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(Collectors.toList())).containsExactly(jarString(testRelative("simple.jar"), null, null));
    // Also contains ijars for scala-library.
    // Also contains jars + srcjars for liblibrary.
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).contains(testRelative("simple.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).contains(testRelative("simple.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).contains(testRelative("simple.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
    assertThat(target.getJavaIdeInfo().getMainClass()).isEmpty();
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) IntellijAspectTest(com.google.idea.blaze.aspect.IntellijAspectTest) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Example 7 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class ScalaTestTest method testScalaTest.

@Test
public void testScalaTest() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":footest_fixture");
    TargetIdeInfo testInfo = findTarget(testFixture, ":FooTest");
    assertThat(testInfo.getKindString()).isEqualTo("scala_test");
    assertThat(relativePathsForArtifacts(testInfo.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("FooTest.scala"));
    assertThat(testInfo.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(Collectors.toList())).containsExactly(jarString(testRelative("FooTest.jar"), null, null));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).contains(testRelative("FooTest.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).contains(testRelative("FooTest.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).contains(testRelative("FooTest.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
    assertThat(testInfo.getTestInfo().getSize()).isEqualTo("large");
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) IntellijAspectTest(com.google.idea.blaze.aspect.IntellijAspectTest) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Example 8 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class JavaLibraryTest method testJavaLibrary.

@Test
public void testJavaLibrary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":simple_fixture");
    TargetIdeInfo target = findTarget(testFixture, ":simple");
    assertThat(target.getKindString()).isEqualTo("java_library");
    assertThat(target.hasJavaIdeInfo()).isTrue();
    assertThat(target.hasCIdeInfo()).isFalse();
    assertThat(target.hasAndroidIdeInfo()).isFalse();
    assertThat(target.hasPyIdeInfo()).isFalse();
    assertThat(target.hasProtoLibraryLegacyJavaIdeInfo()).isFalse();
    assertThat(relativePathsForArtifacts(target.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("Foo.java"));
    assertThat(target.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("libsimple.jar"), testRelative("libsimple-hjar.jar"), testRelative("libsimple-src.jar")));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("simple.java-manifest"), testRelative("simple.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsExactly(testRelative("libsimple.jar"), testRelative("libsimple-hjar.jar"), testRelative("libsimple-src.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).containsExactly(testRelative("libsimple.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
    assertThat(target.getJavaIdeInfo().getJdeps().getRelativePath()).isEqualTo(testRelative("libsimple.jdeps"));
    assertThat(target.getJavaIdeInfo().getMainClass()).isEmpty();
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) IntellijAspectTest(com.google.idea.blaze.aspect.IntellijAspectTest) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Example 9 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class JavaPluginTest method testJavaPlugin.

@Test
public void testJavaPlugin() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":java_plugin_fixture");
    TargetIdeInfo plugin = findTarget(testFixture, ":plugin");
    assertThat(plugin.getKindString()).isEqualTo("java_plugin");
    assertThat(plugin.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("libplugin.jar"), testRelative("libplugin-hjar.jar"), testRelative("libplugin-src.jar")));
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) IntellijAspectTest(com.google.idea.blaze.aspect.IntellijAspectTest) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Example 10 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class JavaProtoLibraryTest method testJavaProtoLibrary.

@Test
public void testJavaProtoLibrary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":lib_fixture");
    TargetIdeInfo lib = findTarget(testFixture, ":lib");
    assertThat(lib).isNotNull();
    TargetIdeInfo jpl = findTarget(testFixture, ":bar_java_proto");
    assertThat(jpl).isNotNull();
    // We don't want java_proto_library to be rolling up any jars
    assertThat(jpl.getJavaIdeInfo().getJarsList()).isEmpty();
    // We shouldn't have reached the underlying base proto_library's
    assertThat(findTarget(testFixture, ":bar_proto")).isNull();
    assertThat(findTarget(testFixture, ":foo_proto")).isNull();
    TargetIdeInfo barProto = findAspectTarget(testFixture, ":bar_proto", "JavaProtoAspect");
    TargetIdeInfo fooProto = findAspectTarget(testFixture, ":foo_proto", "JavaProtoAspect");
    assertThat(barProto).isNotNull();
    assertThat(fooProto).isNotNull();
    // jpl -> (proto + jpl aspect)
    assertThat(jpl.getDepsList()).contains(Dependency.newBuilder().setDependencyType(DependencyType.COMPILE_TIME).setTarget(barProto.getKey()).build());
    // Make sure we suppress the proto_library legacy provider info
    assertThat(barProto.hasProtoLibraryLegacyJavaIdeInfo()).isFalse();
    assertThat(barProto.hasJavaIdeInfo()).isTrue();
    List<String> jarStrings = barProto.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList());
    assertThat(jarStrings).containsExactly(jarString(testRelative("libbar_proto-speed.jar"), testRelative("libbar_proto-speed-hjar.jar"), testRelative("bar_proto-speed-src.jar")));
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) IntellijAspectTest(com.google.idea.blaze.aspect.IntellijAspectTest) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Aggregations

IntellijAspectTestFixture (com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture)10 TargetIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo)10 BazelIntellijAspectTest (com.google.idea.blaze.BazelIntellijAspectTest)10 IntellijAspectTest (com.google.idea.blaze.aspect.IntellijAspectTest)10 Test (org.junit.Test)10