mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-139559 Maven: maven-processor-plugin: options passed as <compilerArguments> (old style) are not recognized
This commit is contained in:
+5
-3
@@ -157,9 +157,11 @@ public class MavenAnnotationProcessorConfigurer extends MavenModuleConfigurer {
|
||||
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
else if (p == mergedProfile || isSimilarProfiles(mergedProfile, moduleProfile)) {
|
||||
mergedProfile.addModuleNames(moduleProfile.getModuleNames());
|
||||
moduleProfile.clearModuleNames();
|
||||
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
|
||||
if(moduleProfile != mergedProfile) {
|
||||
mergedProfile.addModuleNames(moduleProfile.getModuleNames());
|
||||
moduleProfile.clearModuleNames();
|
||||
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
if (p != mergedProfile) {
|
||||
mergedProfile.addModuleNames(p.getModuleNames());
|
||||
p.clearModuleNames();
|
||||
|
||||
@@ -442,14 +442,7 @@ public class MavenProject {
|
||||
Map<String, String> res = new LinkedHashMap<String, String>();
|
||||
|
||||
String compilerArgument = compilerConfig.getChildText("compilerArgument");
|
||||
if (!StringUtil.isEmptyOrSpaces(compilerArgument)) {
|
||||
ParametersList parametersList = new ParametersList();
|
||||
parametersList.addParametersString(compilerArgument);
|
||||
|
||||
for (String param : parametersList.getParameters()) {
|
||||
addAnnotationProcessorOption(param, res);
|
||||
}
|
||||
}
|
||||
addAnnotationProcessorOptionFomrParametersString(compilerArgument, res);
|
||||
|
||||
Element compilerArgs = compilerConfig.getChild("compilerArgs");
|
||||
if (compilerArgs != null) {
|
||||
@@ -474,6 +467,17 @@ public class MavenProject {
|
||||
return res;
|
||||
}
|
||||
|
||||
private static void addAnnotationProcessorOptionFomrParametersString(String compilerArguments, Map<String, String> res) {
|
||||
if (!StringUtil.isEmptyOrSpaces(compilerArguments)) {
|
||||
ParametersList parametersList = new ParametersList();
|
||||
parametersList.addParametersString(compilerArguments);
|
||||
|
||||
for (String param : parametersList.getParameters()) {
|
||||
addAnnotationProcessorOption(param, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addAnnotationProcessorOption(String compilerArg, Map<String, String> optionsMap) {
|
||||
if (compilerArg == null || compilerArg.trim().isEmpty()) return;
|
||||
|
||||
@@ -494,6 +498,9 @@ public class MavenProject {
|
||||
}
|
||||
LinkedHashMap<String, String> res = new LinkedHashMap<String, String>();
|
||||
if (cfg != null) {
|
||||
String compilerArguments = cfg.getChildText("compilerArguments");
|
||||
addAnnotationProcessorOptionFomrParametersString(compilerArguments, res);
|
||||
|
||||
final Element optionsElement = cfg.getChild("options");
|
||||
if (optionsElement != null) {
|
||||
for (Element option : optionsElement.getChildren()) {
|
||||
|
||||
+12
-1
@@ -128,9 +128,13 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
|
||||
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.MAVEN_DEFAULT_ANNOTATION_PROFILE).getModuleNames() == new HashSet<String>(["module1", "module4"])
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.MAVEN_BSC_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + 'module2').getProcessors() == new HashSet<String>(["com.test.SourceCodeGeneratingAnnotationProcessor2"])
|
||||
|
||||
def projectProfile = compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + 'project')
|
||||
assert projectProfile.getModuleNames() == new HashSet<String>(["module2"])
|
||||
assert projectProfile.getProcessors() == new HashSet<String>(["com.test.SourceCodeGeneratingAnnotationProcessor2"])
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + 'module3') == null
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + 'module3_1') == null
|
||||
assert compilerConfiguration.moduleProcessorProfiles.size() == 2
|
||||
}
|
||||
|
||||
public void testOverrideGeneratedOutputDir() {
|
||||
@@ -218,6 +222,12 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<outputDirectory>target/metamodel</outputDirectory>
|
||||
<!-- STANDARD WAY -->
|
||||
<compilerArguments>-Amyoption1=TRUE</compilerArguments>
|
||||
<!-- NEW FEATURE FROM VERSION 2.0.4-->
|
||||
<options>
|
||||
<myoption2>TRUE</myoption2>
|
||||
</options>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
@@ -242,6 +252,7 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
|
||||
def profile = compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + "project")
|
||||
assert profile.getGeneratedSourcesDirectoryName(false).replace('\\', '/').endsWith("target/metamodel")
|
||||
assert profile.getGeneratedSourcesDirectoryName(true).replace('\\', '/').endsWith("target/metamodelTest")
|
||||
assert new HashMap(profile.getProcessorOptions()) == ['myoption1' : 'TRUE', 'myoption2' : 'TRUE']
|
||||
}
|
||||
|
||||
public void testMavenProcessorPluginDefault() {
|
||||
|
||||
Reference in New Issue
Block a user