Search in sources :

Example 1 with BuildResult

use of org.jetbrains.jps.builders.BuildResult in project kotlin by JetBrains.

the class KannotatorJpsTest method makeAll.

@NotNull
@Override
protected BuildResult makeAll() {
    System.out.println("'Make all' started");
    BuildResult result = super.makeAll();
    System.out.println("'Make all' finished");
    return result;
}
Also used : BuildResult(org.jetbrains.jps.builders.BuildResult) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with BuildResult

use of org.jetbrains.jps.builders.BuildResult in project android by JetBrains.

the class AndroidBuilderTest method testGeneratedSources.

public void testGeneratedSources() throws Exception {
    final MyExecutor executor = new MyExecutor("com.example.simple");
    final JpsModule module = setUpSimpleAndroidStructure(new String[] { "src", "gen" }, executor, null).getFirst();
    rebuildAll();
    checkBuildLog(executor, "expected_log");
    checkMakeUpToDate(executor);
    change(getProjectPath("gen/com/example/simple/R.java"), AndroidCommonUtils.AUTOGENERATED_JAVA_FILE_HEADER + "\n\n" + "package com.example.simple;\n" + "public class R {}");
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_1");
    assertCompiled(JavaBuilder.BUILDER_NAME, "targets/java-production/module/android/copied_sources/com/example/simple/MyGeneratedClass.java");
    checkMakeUpToDate(executor);
    change(getProjectPath("gen/com/example/simple/R.java"));
    checkMakeUpToDate(executor);
    change(getProjectPath("gen/com/example/simple/MyGeneratedClass.java"));
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_3");
    assertCompiled(JavaBuilder.BUILDER_NAME, "targets/java-production/module/android/copied_sources/com/example/simple/MyGeneratedClass.java");
    checkMakeUpToDate(executor);
    change(getProjectPath("gen/com/example/simple/MyGeneratedClass.java"), AndroidCommonUtils.AUTOGENERATED_JAVA_FILE_HEADER + "\n\n" + "package com.example.simple;\n" + "public class MyGeneratedClass {}");
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_4");
    assertCompiled(JavaBuilder.BUILDER_NAME);
    checkMakeUpToDate(executor);
    change(getProjectPath("gen/com/example/simple/MyGeneratedClass.java"), "package com.example.simple;\n" + "public class MyGeneratedClass {}");
    change(getProjectPath("src/com/example/simple/MyActivity.java"), "package com.example.simple;\n" + "import android.app.Activity;\n" + "import android.os.Bundle;\n" + "public class MyActivity extends Activity {\n" + "    public void onCreate(Bundle savedInstanceState) {\n" + "        super.onCreate(savedInstanceState);\n" + "        new MyGeneratedClass();" + "    }\n" + "}\n");
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_5");
    assertCompiled(JavaBuilder.BUILDER_NAME, "root/src/com/example/simple/MyActivity.java", "targets/java-production/module/android/copied_sources/com/example/simple/MyGeneratedClass.java");
    checkMakeUpToDate(executor);
    final JpsJavaCompilerConfiguration compilerConfig = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(myProject);
    final ProcessorConfigProfile profile = compilerConfig.getAnnotationProcessingProfile(module);
    profile.setEnabled(true);
    profile.setOutputRelativeToContentRoot(true);
    profile.setGeneratedSourcesDirectoryName("gen", false);
    final BuildResult result = makeAll();
    result.assertFailed();
    final List<BuildMessage> warnMessages = result.getMessages(BuildMessage.Kind.WARNING);
    boolean containsForciblyExcludedRootWarn = false;
    for (BuildMessage message : warnMessages) {
        if (message.getMessageText().endsWith("was forcibly excluded by the IDE, so custom generated files won't be compiled")) {
            containsForciblyExcludedRootWarn = true;
        }
    }
    assertTrue(containsForciblyExcludedRootWarn);
}
Also used : BuildMessage(org.jetbrains.jps.incremental.messages.BuildMessage) JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsJavaCompilerConfiguration(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration) BuildResult(org.jetbrains.jps.builders.BuildResult) ProcessorConfigProfile(org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile)

Example 3 with BuildResult

use of org.jetbrains.jps.builders.BuildResult in project intellij-community by JetBrains.

the class IncrementalTestCase method doTestBuild.

protected BuildResult doTestBuild(int makesCount) {
    StringBuilder log = new StringBuilder();
    String rootPath = FileUtil.toSystemIndependentName(workDir.getAbsolutePath()) + "/";
    final ProjectDescriptor pd = createProjectDescriptor(new BuildLoggingManager(new StringProjectBuilderLogger(rootPath, log)));
    BuildResult result = null;
    try {
        doBuild(pd, CompileScopeTestBuilder.rebuild().allModules()).assertSuccessful();
        for (int idx = 0; idx < makesCount; idx++) {
            modify(idx);
            result = doBuild(pd, CompileScopeTestBuilder.make().allModules());
        }
        File logFile = new File(baseDir.getAbsolutePath() + ".log");
        if (!logFile.exists()) {
            logFile = new File(baseDir, "build.log");
        }
        assertSameLinesWithFile(logFile.getAbsolutePath(), log.toString());
    } finally {
        pd.release();
    }
    assertNotNull(result);
    if (result.isSuccessful()) {
        checkMappingsAreSameAfterRebuild(result);
    }
    return result;
}
Also used : BuildResult(org.jetbrains.jps.builders.BuildResult) ProjectDescriptor(org.jetbrains.jps.cmdline.ProjectDescriptor) BuildLoggingManager(org.jetbrains.jps.builders.logging.BuildLoggingManager) File(java.io.File)

Example 4 with BuildResult

use of org.jetbrains.jps.builders.BuildResult in project intellij-community by JetBrains.

the class JpsMavenJavaBuildingTest method testCompileJava.

public void testCompileJava() throws IOException {
    File srcDir = PathManagerEx.findFileUnderProjectHome("plugins/maven/jps-plugin/testData/compiler/classpathTest", getClass());
    File workDir = FileUtil.createTempDirectory("mavenJavaBuild", null);
    FileUtil.copyDir(srcDir, workDir);
    addJdk("1.6");
    loadProject(workDir.getAbsolutePath());
    BuildResult result = doBuild(CompileScopeTestBuilder.rebuild().allModules());
    result.assertFailed();
    BuildMessage message = assertOneElement(result.getMessages(BuildMessage.Kind.ERROR));
    assertTrue(message.toString(), message.getMessageText().contains("Maven project configuration") && message.getMessageText().contains("isn't available."));
}
Also used : BuildMessage(org.jetbrains.jps.incremental.messages.BuildMessage) BuildResult(org.jetbrains.jps.builders.BuildResult) File(java.io.File)

Aggregations

BuildResult (org.jetbrains.jps.builders.BuildResult)4 File (java.io.File)2 BuildMessage (org.jetbrains.jps.incremental.messages.BuildMessage)2 NotNull (org.jetbrains.annotations.NotNull)1 BuildLoggingManager (org.jetbrains.jps.builders.logging.BuildLoggingManager)1 ProjectDescriptor (org.jetbrains.jps.cmdline.ProjectDescriptor)1 JpsJavaCompilerConfiguration (org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration)1 ProcessorConfigProfile (org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile)1 JpsModule (org.jetbrains.jps.model.module.JpsModule)1