use of com.intellij.compiler.CompilerConfigurationImpl in project intellij-community by JetBrains.
the class MavenAnnotationProcessorConfigurer method configure.
@Override
public void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module) {
if (module == null)
return;
Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (sdk != null) {
String versionString = sdk.getVersionString();
if (versionString != null) {
if (versionString.contains("1.5") || versionString.contains("1.4") || versionString.contains("1.3") || versionString.contains("1.2")) {
return;
}
}
}
final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl) CompilerConfiguration.getInstance(project);
final MavenProject rootProject = ObjectUtils.notNull(MavenProjectsManager.getInstance(project).findRootProject(mavenProject), mavenProject);
if (shouldEnableAnnotationProcessors(mavenProject)) {
final String moduleProfileName;
String annotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(mavenProject, false);
if (annotationProcessorDirectory == null) {
annotationProcessorDirectory = DEFAULT_ANNOTATION_PATH_OUTPUT;
}
String testAnnotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(mavenProject, true);
if (testAnnotationProcessorDirectory == null) {
testAnnotationProcessorDirectory = DEFAULT_TEST_ANNOTATION_OUTPUT;
}
final boolean isDefault;
if (isMavenDefaultAnnotationProcessorConfiguration(annotationProcessorDirectory, testAnnotationProcessorDirectory, mavenProject)) {
moduleProfileName = MAVEN_DEFAULT_ANNOTATION_PROFILE;
isDefault = true;
} else if (isMavenProcessorPluginDefaultConfiguration(annotationProcessorDirectory, testAnnotationProcessorDirectory, mavenProject)) {
moduleProfileName = MAVEN_BSC_DEFAULT_ANNOTATION_PROFILE;
isDefault = true;
} else {
moduleProfileName = PROFILE_PREFIX + module.getName();
isDefault = false;
}
ProcessorConfigProfile moduleProfile = compilerConfiguration.findModuleProcessorProfile(moduleProfileName);
if (moduleProfile == null) {
moduleProfile = new ProcessorConfigProfileImpl(moduleProfileName);
compilerConfiguration.addModuleProcessorProfile(moduleProfile);
}
moduleProfile.setOutputRelativeToContentRoot(true);
moduleProfile.setEnabled(true);
moduleProfile.setObtainProcessorsFromClasspath(true);
moduleProfile.setGeneratedSourcesDirectoryName(annotationProcessorDirectory, false);
moduleProfile.setGeneratedSourcesDirectoryName(testAnnotationProcessorDirectory, true);
moduleProfile.clearProcessorOptions();
for (Map.Entry<String, String> entry : mavenProject.getAnnotationProcessorOptions().entrySet()) {
moduleProfile.setOption(entry.getKey(), entry.getValue());
}
moduleProfile.clearProcessors();
final List<String> processors = mavenProject.getDeclaredAnnotationProcessors();
if (processors != null) {
for (String processor : processors) {
moduleProfile.addProcessor(processor);
}
}
moduleProfile.addModuleName(module.getName());
cleanAndMergeModuleProfiles(rootProject, compilerConfiguration, moduleProfile, isDefault, module);
} else {
cleanAndMergeModuleProfiles(rootProject, compilerConfiguration, null, false, module);
}
}
use of com.intellij.compiler.CompilerConfigurationImpl in project intellij-community by JetBrains.
the class AnnotationProcessorsConfigurable method isModified.
public boolean isModified() {
final CompilerConfigurationImpl config = (CompilerConfigurationImpl) CompilerConfiguration.getInstance(myProject);
if (!config.getDefaultProcessorProfile().equals(myMainPanel.getDefaultProfile())) {
return true;
}
final Map<String, ProcessorConfigProfile> configProfiles = new java.util.HashMap<>();
for (ProcessorConfigProfile profile : config.getModuleProcessorProfiles()) {
configProfiles.put(profile.getName(), profile);
}
final List<ProcessorConfigProfile> panelProfiles = myMainPanel.getModuleProfiles();
if (configProfiles.size() != panelProfiles.size()) {
return true;
}
for (ProcessorConfigProfile panelProfile : panelProfiles) {
final ProcessorConfigProfile configProfile = configProfiles.get(panelProfile.getName());
if (configProfile == null || !configProfile.equals(panelProfile)) {
return true;
}
}
return false;
}
use of com.intellij.compiler.CompilerConfigurationImpl in project intellij-community by JetBrains.
the class AnnotationProcessorsConfigurable method reset.
public void reset() {
final CompilerConfigurationImpl config = (CompilerConfigurationImpl) CompilerConfiguration.getInstance(myProject);
myMainPanel.initProfiles(config.getDefaultProcessorProfile(), config.getModuleProcessorProfiles());
}
use of com.intellij.compiler.CompilerConfigurationImpl in project intellij-community by JetBrains.
the class CompilerUIConfigurable method reset.
public void reset() {
final CompilerConfigurationImpl configuration = (CompilerConfigurationImpl) CompilerConfiguration.getInstance(myProject);
final CompilerWorkspaceConfiguration workspaceConfiguration = CompilerWorkspaceConfiguration.getInstance(myProject);
myCbAutoShowFirstError.setSelected(workspaceConfiguration.AUTO_SHOW_ERRORS_IN_EDITOR);
myCbDisplayNotificationPopup.setSelected(workspaceConfiguration.DISPLAY_NOTIFICATION_POPUP);
myCbClearOutputDirectory.setSelected(workspaceConfiguration.CLEAR_OUTPUT_DIRECTORY);
myCbAssertNotNull.setSelected(configuration.isAddNotNullAssertions());
myCbEnableAutomake.setSelected(workspaceConfiguration.MAKE_PROJECT_ON_SAVE);
myCbParallelCompilation.setSelected(workspaceConfiguration.PARALLEL_COMPILATION);
myCbRebuildOnDependencyChange.setSelected(workspaceConfiguration.REBUILD_ON_DEPENDENCY_CHANGE);
// for compatibility with older projects
final int javacPreferred = JavacConfiguration.getOptions(myProject, JavacConfiguration.class).MAXIMUM_HEAP_SIZE;
myHeapSizeField.setText(String.valueOf(configuration.getBuildProcessHeapSize(javacPreferred)));
final String options = workspaceConfiguration.COMPILER_PROCESS_ADDITIONAL_VM_OPTIONS;
myVMOptionsField.setText(options == null ? "" : options.trim());
mySharedVMOptionsField.setText(configuration.getBuildProcessVMOptions());
configuration.convertPatterns();
myResourcePatternsField.setText(patternsToString(configuration.getResourceFilePatterns()));
if (PowerSaveMode.isEnabled()) {
myEnableAutomakeLegendLabel.setText("(disabled in Power Save mode)");
myEnableAutomakeLegendLabel.setFont(myEnableAutomakeLegendLabel.getFont().deriveFont(Font.BOLD));
} else {
myEnableAutomakeLegendLabel.setText("(only works while not running / debugging)");
myEnableAutomakeLegendLabel.setFont(myEnableAutomakeLegendLabel.getFont().deriveFont(Font.PLAIN));
}
}
use of com.intellij.compiler.CompilerConfigurationImpl in project intellij-community by JetBrains.
the class CompilerExcludes method isAvailable.
public static boolean isAvailable(Project project) {
final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl) CompilerConfiguration.getInstance(project);
final ExcludeEntryDescription[] excludeEntryDescriptions = compilerConfiguration.getExcludedEntriesConfiguration().getExcludeEntryDescriptions();
return excludeEntryDescriptions.length > 0;
}
Aggregations