Search in sources :

Example 16 with JpsJavaCompilerConfiguration

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

the class AnnotationsExcludedJavaSourceRootProvider method isExcludedFromCompilation.

@Override
public boolean isExcludedFromCompilation(@NotNull JpsModule module, @NotNull JpsModuleSourceRoot root) {
    final JpsJavaCompilerConfiguration compilerConfig = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(module.getProject());
    final ProcessorConfigProfile profile = compilerConfig.getAnnotationProcessingProfile(module);
    if (!profile.isEnabled()) {
        return false;
    }
    final File outputDir = ProjectPaths.getAnnotationProcessorGeneratedSourcesOutputDir(module, JavaSourceRootType.TEST_SOURCE == root.getRootType(), profile);
    return outputDir != null && FileUtil.filesEqual(outputDir, root.getFile());
}
Also used : JpsJavaCompilerConfiguration(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration) ProcessorConfigProfile(org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile) File(java.io.File)

Example 17 with JpsJavaCompilerConfiguration

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

the class JpsEclipseCompilerOptionsSerializer method loadExtensionWithDefaultSettings.

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

Example 18 with JpsJavaCompilerConfiguration

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

the class JpsJavaCompilerConfigurationSerializer method loadExtension.

@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
    JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project);
    Element addNotNullTag = componentTag.getChild(ADD_NOTNULL_ASSERTIONS);
    if (addNotNullTag != null) {
        configuration.setAddNotNullAssertions(Boolean.parseBoolean(addNotNullTag.getAttributeValue(ENABLED, "true")));
    }
    readExcludes(componentTag.getChild(EXCLUDE_FROM_COMPILE), configuration.getCompilerExcludes());
    Element resourcePatternsTag = componentTag.getChild(WILDCARD_RESOURCE_PATTERNS);
    if (resourcePatternsTag == null) {
        for (String pattern : DEFAULT_WILDCARD_PATTERNS) {
            configuration.addResourcePattern(pattern);
        }
    } else {
        for (Element entry : resourcePatternsTag.getChildren(ENTRY)) {
            String pattern = entry.getAttributeValue(NAME);
            if (!StringUtil.isEmpty(pattern)) {
                configuration.addResourcePattern(pattern);
            }
        }
    }
    Element annotationProcessingTag = componentTag.getChild(ANNOTATION_PROCESSING);
    if (annotationProcessingTag != null) {
        List<Element> profiles = JDOMUtil.getChildren(annotationProcessingTag, "profile");
        for (Element profileTag : profiles) {
            boolean isDefault = Boolean.parseBoolean(profileTag.getAttributeValue("default"));
            if (isDefault) {
                AnnotationProcessorProfileSerializer.readExternal(configuration.getDefaultAnnotationProcessingProfile(), profileTag);
            } else {
                AnnotationProcessorProfileSerializer.readExternal(configuration.addAnnotationProcessingProfile(), profileTag);
            }
        }
    }
    Element targetLevelTag = componentTag.getChild(BYTECODE_TARGET_LEVEL);
    if (targetLevelTag != null) {
        configuration.setProjectByteCodeTargetLevel(targetLevelTag.getAttributeValue(TARGET_ATTRIBUTE));
        for (Element moduleTag : JDOMUtil.getChildren(targetLevelTag, MODULE)) {
            String moduleName = moduleTag.getAttributeValue(NAME);
            String level = moduleTag.getAttributeValue(TARGET_ATTRIBUTE);
            if (moduleName != null && level != null) {
                configuration.setModuleByteCodeTargetLevel(moduleName, level);
            }
        }
    }
    String compilerId = JDOMExternalizerUtil.readField(componentTag, "DEFAULT_COMPILER");
    if (compilerId != null) {
        configuration.setJavaCompilerId(compilerId);
    }
}
Also used : JpsJavaCompilerConfiguration(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration) Element(org.jdom.Element)

Example 19 with JpsJavaCompilerConfiguration

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

the class JpsJavaCompilerNotNullableSerializer method loadExtension.

@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
    JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project);
    List<String> annoNames = ContainerUtil.newArrayList();
    for (Element option : componentTag.getChildren("option")) {
        if ("myNotNulls".equals(option.getAttributeValue("name"))) {
            for (Element value : option.getChildren("value")) {
                for (Element list : value.getChildren("list")) {
                    for (Element item : list.getChildren("item")) {
                        ContainerUtil.addIfNotNull(annoNames, item.getAttributeValue("itemvalue"));
                    }
                }
            }
        }
    }
    if (annoNames.isEmpty()) {
        annoNames.addAll(DEFAULT_NOT_NULLS);
    }
    configuration.setNotNullAnnotations(annoNames);
}
Also used : JpsJavaCompilerConfiguration(org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration) Element(org.jdom.Element)

Example 20 with JpsJavaCompilerConfiguration

use of org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration 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

JpsJavaCompilerConfiguration (org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration)24 File (java.io.File)9 ProcessorConfigProfile (org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile)6 IOException (java.io.IOException)5 JpsCompilerExcludes (org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes)4 JpsModule (org.jetbrains.jps.model.module.JpsModule)4 NotNull (org.jetbrains.annotations.NotNull)3 JavaSourceRootDescriptor (org.jetbrains.jps.builders.java.JavaSourceRootDescriptor)3 JpsProject (org.jetbrains.jps.model.JpsProject)3 JpsJavaCompilerOptions (org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions)3 JpsFlexBuildConfiguration (com.intellij.flex.model.bc.JpsFlexBuildConfiguration)2 Set (java.util.Set)2 Element (org.jdom.Element)2 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)2 JpsJavaExtensionService (org.jetbrains.jps.model.java.JpsJavaExtensionService)2 EclipseCompilerOptions (org.jetbrains.jps.model.java.compiler.EclipseCompilerOptions)2 RmicCompilerOptions (org.jetbrains.jps.model.java.compiler.RmicCompilerOptions)2 FlexResourceBuildTarget (com.intellij.flex.build.FlexResourceBuildTarget)1 SmartList (com.intellij.util.SmartList)1 THashMap (gnu.trove.THashMap)1