Search in sources :

Example 1 with CompilerTester

use of com.intellij.testFramework.CompilerTester in project intellij-community by JetBrains.

the class MavenCompilingTestCase method compile.

private void compile(final CompileScope scope) {
    try {
        CompilerTester tester = new CompilerTester(myProject, Arrays.asList(scope.getAffectedModules()));
        UIUtil.invokeAndWaitIfNeeded(new Runnable() {

            @Override
            public void run() {
                new MavenResourceCompilerConfigurationGenerator(myProject, MavenProjectsManager.getInstance(myProject).getProjectsTreeForTests()).generateBuildConfiguration(false);
            }
        });
        try {
            List<CompilerMessage> messages = tester.make(scope);
            for (CompilerMessage message : messages) {
                if (message.getCategory() == CompilerMessageCategory.ERROR) {
                    fail("Compilation failed with error: " + message.getMessage());
                }
            }
        } finally {
            tester.tearDown();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : MavenResourceCompilerConfigurationGenerator(org.jetbrains.idea.maven.project.MavenResourceCompilerConfigurationGenerator) CompilerMessage(com.intellij.openapi.compiler.CompilerMessage) CompilerTester(com.intellij.testFramework.CompilerTester) IOException(java.io.IOException)

Example 2 with CompilerTester

use of com.intellij.testFramework.CompilerTester in project intellij-community by JetBrains.

the class CompilerReferencesFindUsagesTest method setUp.

@Override
public void setUp() throws Exception {
    myDefaultEnableState = CompilerReferenceService.IS_ENABLED_KEY.asBoolean();
    CompilerReferenceService.IS_ENABLED_KEY.setValue(true);
    super.setUp();
    myCompilerTester = new CompilerTester(myModule);
    LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_8);
}
Also used : CompilerTester(com.intellij.testFramework.CompilerTester)

Aggregations

CompilerTester (com.intellij.testFramework.CompilerTester)2 CompilerMessage (com.intellij.openapi.compiler.CompilerMessage)1 IOException (java.io.IOException)1 MavenResourceCompilerConfigurationGenerator (org.jetbrains.idea.maven.project.MavenResourceCompilerConfigurationGenerator)1