Skip to content

Commit

Permalink
Rewrite the plugin using standard javax.tools API instead of Plexus. (
Browse files Browse the repository at this point in the history
#271)

* Rewrite the plugin using standard `javax.tools` API instead of Plexus.
Other aspects that are rewritten include incremental build mechanism
and how the overwriting of `module-info.java` in tests is handled.
For details and impact on users, see pull request description at
#271

* Temporarily disable the MCOMPILER-346 integration test.
It will be re-enabled after Maven 4.0.0-beta-6 release.

apache/maven#1865

* Remove the replacement of `/` by `\` on the Windows platform in GLOB syntax.
It appears that the GLOB matcher expects `/` even on Windows.

* Add a log at the error level when the compiler threw an exception instead of returning the Boolean `false` value.
Adjust what is the cause and what is the suppressed exception.

* Set the `maven-plugin-testing-harness` version to 4.0.0-beta-2.

* Dummy change for forcing a new CI build.
  • Loading branch information
desruisseaux authored Nov 14, 2024
1 parent 72921a5 commit 46b207b
Show file tree
Hide file tree
Showing 218 changed files with 6,892 additions and 4,613 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
with:
# maven-args: "-Dinvoker.parallelThreads=2" cannot do this as this generate some concurrent download issues
ff-maven: "4.0.0-beta-3" # Maven version for fail-fast-build
ff-maven: "4.0.0-beta-5" # Maven version for fail-fast-build
jdk-distribution-matrix: '[ "temurin", "zulu", "microsoft", "adopt-openj9" ]'
jdk-matrix: '[ "17", "21" ]'
maven-matrix: '[ "4.0.0-beta-3" ]' # Maven versions matrix for verify builds
maven-matrix: '[ "4.0.0-beta-5" ]' # Maven versions matrix for verify builds
126 changes: 26 additions & 100 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ under the License.
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
<version>42</version>
<version>43</version>
<relativePath />
</parent>

Expand All @@ -39,6 +39,20 @@ under the License.
<contributor>
<name>Jan Sievers</name>
</contributor>
<contributor>
<name>Trygve Laugstøl</name>
<email>[email protected]</email>
</contributor>
<contributor>
<name>Jason van Zyl</name>
<email>[email protected]</email>
</contributor>
<contributor>
<name>Andreas Gudian</name>
</contributor>
<contributor>
<name>Martin Desruisseaux</name>
</contributor>
</contributors>

<prerequisites>
Expand Down Expand Up @@ -68,7 +82,7 @@ under the License.

<properties>
<javaVersion>17</javaVersion>
<mavenVersion>4.0.0-beta-3</mavenVersion>
<mavenVersion>4.0.0-beta-5</mavenVersion>

<asmVersion>9.7</asmVersion>
<groovyVersion>2.4.21</groovyVersion>
Expand All @@ -78,33 +92,21 @@ under the License.
<junit4Version>4.13.2</junit4Version>
<junitVersion>5.10.1</junitVersion>
<mockitoVersion>5.12.0</mockitoVersion>
<mavenPluginTestingHarnessVersion>4.0.0-beta-2-SNAPSHOT</mavenPluginTestingHarnessVersion>
<mavenPluginTestingHarnessVersion>4.0.0-beta-2</mavenPluginTestingHarnessVersion>
<plexusCompilerVersion>2.15.0</plexusCompilerVersion>
<plexusJavaVersion>1.2.0</plexusJavaVersion>
<sisuPlexusVersion>0.9.0.M2</sisuPlexusVersion>
<slf4jVersion>2.0.13</slf4jVersion>
<surefire.version>3.2.1</surefire.version>
<version.maven-invoker-plugin>3.7.0</version.maven-invoker-plugin>
<version.maven-plugin-tools-3.x>3.13.1</version.maven-plugin-tools-3.x>
<version.maven-plugin-tools>4.0.0-beta-2-SNAPSHOT</version.maven-plugin-tools>
<version.plexus-xml>4.0.1</version.plexus-xml>
<version.maven-plugin-tools>4.0.0-beta-1</version.maven-plugin-tools>

<invoker.junitPackageName>org.apache.maven.plugins.compiler.its</invoker.junitPackageName>
<maven.it.failure.ignore>false</maven.it.failure.ignore>

<project.build.outputTimestamp>2024-06-26T08:45:58Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2024-11-14T13:00:00Z</project.build.outputTimestamp>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.1-jre</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Maven -->
<dependency>
Expand All @@ -113,88 +115,11 @@ under the License.
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-di</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-meta</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-model</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-xml</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>${sisuPlexusVersion}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-java</artifactId>
<version>${plexusJavaVersion}</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>${asmVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
</dependency>

<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
<version>${plexusCompilerVersion}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-manager</artifactId>
<version>${plexusCompilerVersion}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac</artifactId>
<version>${plexusCompilerVersion}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
Expand Down Expand Up @@ -237,17 +162,18 @@ under the License.
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>${javaVersion}</release>
</configuration>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
Expand Down
36 changes: 18 additions & 18 deletions src/it/MCOMPILER-129/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

invoker.goals = clean compile
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

invoker.goals = clean compile
5 changes: 0 additions & 5 deletions src/it/MCOMPILER-129/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ under the License.
<version>@project.version@</version>
<configuration>
<fork>true</fork>
<!-- this has been deprecated, but still works
<compilerArguments>
<J-Duser.language>en_us</J-Duser.language>
</compilerArguments>
-->
<compilerArgs>
<compilerArg>-J-Duser.language=en_us</compilerArg>
</compilerArgs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,19 @@
import java.io.Writer;
import java.util.Set;

@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedSourceVersion(SourceVersion.RELEASE_17)
@SupportedAnnotationTypes("org.issue.SimpleAnnotation")
public class SimpleAnnotationProcessor extends AbstractProcessor {

@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Filer filer = processingEnv.getFiler();

Elements elementUtils = processingEnv.getElementUtils();

Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(SimpleAnnotation.class);

for (Element element : elements) {
Name name = element.getSimpleName();

PackageElement packageElement = elementUtils.getPackageOf(element);

try {
FileObject resource = filer.createResource(
StandardLocation.SOURCE_OUTPUT, packageElement.getQualifiedName(), name + ".txt", element);
Expand All @@ -64,7 +60,6 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
throw new RuntimeException(e);
}
}

return !elements.isEmpty();
}
}
4 changes: 2 additions & 2 deletions src/it/MCOMPILER-157/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down
4 changes: 2 additions & 2 deletions src/it/MCOMPILER-170/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down
4 changes: 2 additions & 2 deletions src/it/MCOMPILER-190/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down
2 changes: 0 additions & 2 deletions src/it/MCOMPILER-190/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ under the License.
<version>@pom.version@</version>
<configuration>
<compilerId>eclipse</compilerId>
<source>1.5</source>
<target>1.5</target>
</configuration>
<dependencies>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions src/it/MCOMPILER-192/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down
Loading

0 comments on commit 46b207b

Please sign in to comment.