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());
}
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());
}
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);
}
}
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);
}
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());
}
Aggregations