use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.
the class IntellijAspectTestFixtureBuilder method main.
public static void main(String[] args) {
try {
String paramsFile = args[0].substring(1);
String fileContents = new String(Files.readAllBytes(Paths.get(paramsFile)), UTF_8);
List<String> realArgs = Splitter.on('\n').splitToList(fileContents);
IntellijAspectTestFixture.Builder builder = IntellijAspectTestFixture.newBuilder();
String outputFilePath = realArgs.get(0);
String[] aspectFiles = realArgs.get(1).split(":");
builder.addAllTargets(parseTargets(aspectFiles));
for (int i = 2; i < realArgs.size(); i += 2) {
String name = realArgs.get(i);
List<String> paths = Splitter.on(':').omitEmptyStrings().splitToList(realArgs.get(i + 1));
builder.addOutputGroups(OutputGroup.newBuilder().setName(name).addAllFilePaths(paths).build());
}
IntellijAspectTestFixture result = builder.build();
try (OutputStream outputStream = new FileOutputStream(outputFilePath)) {
outputStream.write(result.toByteArray());
}
} catch (IOException e) {
System.err.println(e.toString());
System.exit(-1);
}
}
use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.
the class CcBinaryTest method testCcBinary.
@Test
public void testCcBinary() throws Exception {
IntellijAspectTestFixture testFixture = loadTestFixture(":simple_fixture");
TargetIdeInfo target = findTarget(testFixture, ":simple");
assertThat(target.getKindString()).isEqualTo("cc_binary");
assertThat(target.hasCIdeInfo()).isTrue();
assertThat(target.hasJavaIdeInfo()).isFalse();
assertThat(target.hasAndroidIdeInfo()).isFalse();
CIdeInfo cTargetIdeInfo = target.getCIdeInfo();
assertThat(cTargetIdeInfo.getTargetCoptList()).isEmpty();
assertThat(cTargetIdeInfo.getTargetDefineList()).isEmpty();
assertThat(cTargetIdeInfo.getTargetIncludeList()).isEmpty();
// Can't test for this because the cc code stuffs source artifacts into
// the output group
// assertThat(testFixture.getIntellijResolveFilesList()).isEmpty();
assertThat(getOutputGroupFiles(testFixture, "intellij-info-cpp")).contains(testRelative("simple.intellij-info.txt"));
assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
}
use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.
the class JavaBinaryTest method testJavaBinary.
@Test
public void testJavaBinary() throws Exception {
IntellijAspectTestFixture testFixture = loadTestFixture(":foo_fixture");
TargetIdeInfo binaryInfo = findTarget(testFixture, ":foo");
assertThat(binaryInfo.getKindString()).isEqualTo("java_binary");
assertThat(relativePathsForArtifacts(binaryInfo.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("FooMain.java"));
assertThat(dependenciesForTarget(binaryInfo)).contains(dep(":foolib"));
assertThat(binaryInfo.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("foo.jar"), null, testRelative("foo-src.jar")));
assertThat(binaryInfo.getJavaIdeInfo().getMainClass()).isEqualTo("com.google.MyMainClass");
assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("foolib.java-manifest"), testRelative("foolib.intellij-info.txt"), testRelative("foo.java-manifest"), testRelative("foo.intellij-info.txt"));
assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsAllOf(testRelative("libfoolib.jar"), testRelative("libfoolib-hjar.jar"), testRelative("libfoolib-src.jar"), testRelative("foo.jar"), testRelative("foo-src.jar"));
assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).containsExactly(testRelative("libfoolib.jar"), testRelative("foo.jar"));
assertThat(binaryInfo.getJavaIdeInfo().getJdeps().getRelativePath()).isEqualTo(testRelative("foo.jdeps"));
assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
}
use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.
the class JavaTestTest method testJavaTest.
@Test
public void testJavaTest() throws Exception {
IntellijAspectTestFixture testFixture = loadTestFixture(":footest_fixture");
TargetIdeInfo testInfo = findTarget(testFixture, ":FooTest");
assertThat(testInfo.getKindString()).isEqualTo("java_test");
assertThat(relativePathsForArtifacts(testInfo.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("FooTest.java"));
assertThat(testInfo.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("FooTest.jar"), null, testRelative("FooTest-src.jar")));
assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("FooTest.java-manifest"), testRelative("FooTest.intellij-info.txt"));
assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsAllOf(testRelative("FooTest.jar"), testRelative("FooTest-src.jar"));
assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).contains(testRelative("FooTest.jar"));
assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("FooTest.java-manifest"), testRelative("FooTest.intellij-info.txt"));
assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
assertThat(testInfo.getJavaIdeInfo().getJdeps().getRelativePath()).isEqualTo(testRelative("FooTest.jdeps"));
assertThat(testInfo.getTestInfo().getSize()).isEqualTo("large");
}
use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.
the class PyBinaryTest method testPyBinary.
@Test
public void testPyBinary() throws Exception {
IntellijAspectTestFixture testFixture = loadTestFixture(":simple_fixture");
TargetIdeInfo target = findTarget(testFixture, ":simple");
assertThat(target.getKindString()).isEqualTo("py_binary");
assertThat(relativePathsForArtifacts(target.getPyIdeInfo().getSourcesList())).containsExactly(testRelative("simple.py"));
assertThat(getOutputGroupFiles(testFixture, "intellij-info-py")).containsExactly(testRelative("simple.intellij-info.txt"));
assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
}
Aggregations