Search in sources :

Example 1 with JpsJavaCompilerOptions

use of org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions in project intellij-community by JetBrains.

the class MavenProjectImporter method removeOutdatedCompilerConfigSettings.

private void removeOutdatedCompilerConfigSettings() {
    ApplicationManager.getApplication().assertWriteAccessAllowed();
    final JpsJavaCompilerOptions javacOptions = JavacConfiguration.getOptions(myProject, JavacConfiguration.class);
    String options = javacOptions.ADDITIONAL_OPTIONS_STRING;
    // Old IDEAs saved
    options = options.replaceFirst("(-target (\\S+))", "");
    javacOptions.ADDITIONAL_OPTIONS_STRING = options;
}
Also used : JpsJavaCompilerOptions(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions)

Example 2 with JpsJavaCompilerOptions

use of org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions in project intellij-community by JetBrains.

the class JpsCompilerConfigurationTest method doTest.

private void doTest(final String path) {
    loadProject(path);
    JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(myProject);
    assertNotNull(configuration);
    assertFalse(configuration.isClearOutputDirectoryOnRebuild());
    assertFalse(configuration.isAddNotNullAssertions());
    ProcessorConfigProfile defaultProfile = configuration.getDefaultAnnotationProcessingProfile();
    assertTrue(defaultProfile.isEnabled());
    assertFalse(defaultProfile.isObtainProcessorsFromClasspath());
    assertEquals(FileUtil.toSystemDependentName(JpsPathUtil.urlToPath(getUrl("src"))), defaultProfile.getProcessorPath());
    assertEquals("b", defaultProfile.getProcessorOptions().get("a"));
    assertEquals("d", defaultProfile.getProcessorOptions().get("c"));
    assertEquals("gen", defaultProfile.getGeneratedSourcesDirectoryName(false));
    JpsCompilerExcludes excludes = configuration.getCompilerExcludes();
    assertFalse(isExcluded(excludes, "src/nonrec/x/Y.java"));
    assertTrue(isExcluded(excludes, "src/nonrec/Y.java"));
    assertTrue(isExcluded(excludes, "src/rec/x/Y.java"));
    assertTrue(isExcluded(excludes, "src/rec/Y.java"));
    assertTrue(isExcluded(excludes, "src/A.java"));
    assertFalse(isExcluded(excludes, "src/B.java"));
    JpsJavaCompilerOptions options = configuration.getCurrentCompilerOptions();
    assertNotNull(options);
    assertEquals(512, options.MAXIMUM_HEAP_SIZE);
    assertFalse(options.DEBUGGING_INFO);
    assertTrue(options.GENERATE_NO_WARNINGS);
    assertEquals("-Xlint", options.ADDITIONAL_OPTIONS_STRING);
}
Also used : JpsJavaCompilerConfiguration(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration) JpsCompilerExcludes(org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes) JpsJavaCompilerOptions(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions) ProcessorConfigProfile(org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile)

Example 3 with JpsJavaCompilerOptions

use of org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions in project intellij-community by JetBrains.

the class JpsJavaCompilerOptionsSerializer method loadExtension.

@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
    JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project);
    JpsJavaCompilerOptions options = XmlSerializer.deserialize(componentTag, JpsJavaCompilerOptions.class);
    configuration.setCompilerOptions(myCompilerId, options);
}
Also used : JpsJavaCompilerConfiguration(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration) JpsJavaCompilerOptions(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions)

Example 4 with JpsJavaCompilerOptions

use of org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions in project intellij-community by JetBrains.

the class JavacConfiguration method getState.

@Override
@NotNull
public JpsJavaCompilerOptions getState() {
    JpsJavaCompilerOptions state = new JpsJavaCompilerOptions();
    XmlSerializerUtil.copyBean(mySettings, state);
    state.ADDITIONAL_OPTIONS_STRING = PathMacroManager.getInstance(myProject).collapsePathsRecursively(state.ADDITIONAL_OPTIONS_STRING);
    return state;
}
Also used : JpsJavaCompilerOptions(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with JpsJavaCompilerOptions

use of org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions in project intellij-community by JetBrains.

the class JpsJavaCompilerOptionsSerializer method loadExtensionWithDefaultSettings.

@Override
public void loadExtensionWithDefaultSettings(@NotNull JpsProject project) {
    JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project);
    configuration.setCompilerOptions(myCompilerId, new JpsJavaCompilerOptions());
}
Also used : JpsJavaCompilerConfiguration(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration) JpsJavaCompilerOptions(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions)

Aggregations

JpsJavaCompilerOptions (org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions)7 JpsJavaCompilerConfiguration (org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration)3 NotNull (org.jetbrains.annotations.NotNull)2 LanguageLevel (com.intellij.pom.java.LanguageLevel)1 JpsCompilerExcludes (org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes)1 ProcessorConfigProfile (org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile)1