Skip to content

Commit

Permalink
Switch to SISU annotations and plugin, fixes #217 (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet authored Oct 28, 2023
1 parent 0d01dc2 commit e5a2ed7
Show file tree
Hide file tree
Showing 16 changed files with 83 additions and 44 deletions.
4 changes: 2 additions & 2 deletions plexus-compiler-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<artifactId>plexus-compiler-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
*/

import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.Map;

/**
* @author <a href="mailto:[email protected]">Trygve Laugst&oslash;l</a>
*/
@Component( role = CompilerManager.class )
@Named
public class DefaultCompilerManager
implements CompilerManager
{
@Requirement
@Inject
private Map<String, Compiler> compilers;

// ----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions plexus-compilers/plexus-compiler-aspectj/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.aspectj.tools.ajc.Main;
import org.codehaus.plexus.compiler.AbstractCompiler;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerOutputStyle;
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.DirectoryScanner;

import javax.inject.Named;
import javax.inject.Singleton;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -287,7 +287,7 @@
*
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*/
@Component( role = Compiler.class, hint = "aspectj")
@Named("aspectj")
public class AspectJCompiler
extends AbstractCompiler
{
Expand Down
4 changes: 2 additions & 2 deletions plexus-compilers/plexus-compiler-csharp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
*/

import org.codehaus.plexus.compiler.AbstractCompiler;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerOutputStyle;
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.Os;
Expand All @@ -34,6 +32,7 @@
import org.codehaus.plexus.util.cli.StreamConsumer;
import org.codehaus.plexus.util.cli.WriterStreamConsumer;

import javax.inject.Named;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
Expand All @@ -57,7 +56,7 @@
* @author <a href="mailto:[email protected]">Matthew Pocock</a>
* @author <a href="mailto:[email protected]">Chris Stevenson</a>
*/
@Component( role = Compiler.class, hint = "csharp" )
@Named( "csharp" )
public class CSharpCompiler
extends AbstractCompiler
{
Expand Down
4 changes: 2 additions & 2 deletions plexus-compilers/plexus-compiler-eclipse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<version>3.33.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* SOFTWARE.
*/

import javax.inject.Named;
import javax.inject.Singleton;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
import javax.tools.JavaCompiler;
Expand All @@ -44,21 +46,20 @@
import java.util.Map.Entry;
import java.util.ServiceLoader;
import org.codehaus.plexus.compiler.AbstractCompiler;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerOutputStyle;
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.jdt.core.compiler.CompilationProgress;
import org.eclipse.jdt.core.compiler.batch.BatchCompiler;

/**
*
*/
@Component( role = Compiler.class, hint = "eclipse" )
@Named( "eclipse" )
@Singleton
public class EclipseJavaCompiler
extends AbstractCompiler
{
Expand Down
4 changes: 2 additions & 2 deletions plexus-compilers/plexus-compiler-j2objc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,20 @@
*/

import org.codehaus.plexus.compiler.AbstractCompiler;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerMessage.Kind;
import org.codehaus.plexus.compiler.CompilerOutputStyle;
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
import org.codehaus.plexus.util.cli.StreamConsumer;
import org.codehaus.plexus.util.cli.WriterStreamConsumer;

import javax.inject.Named;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
Expand All @@ -51,7 +50,7 @@
* Ma&icirc;tre</a>
*
*/
@Component( role = Compiler.class, hint = "j2objc")
@Named( "j2objc" )
public class J2ObjCCompiler
extends AbstractCompiler
{
Expand Down
4 changes: 2 additions & 2 deletions plexus-compilers/plexus-compiler-javac-errorprone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<version>${errorprone.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@

import com.google.errorprone.ErrorProneJavaCompiler;

import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.compiler.javac.InProcessCompiler;
import org.codehaus.plexus.compiler.javac.JavacCompiler;
import org.codehaus.plexus.compiler.javac.JavaxToolsCompiler;
import org.codehaus.plexus.component.annotations.Component;

import javax.inject.Named;
import javax.tools.JavaCompiler;

import java.net.MalformedURLException;
Expand All @@ -40,7 +39,7 @@
*
* @author <a href="mailto:[email protected]">Alex Eagle</a>
*/
@Component( role = Compiler.class, hint = "javac-with-errorprone")
@Named("javac-with-errorprone")
public class JavacCompilerWithErrorProne
extends JavacCompiler
{
Expand Down
4 changes: 2 additions & 2 deletions plexus-compilers/plexus-compiler-javac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,31 @@
import java.util.concurrent.CopyOnWriteArrayList;

import org.codehaus.plexus.compiler.AbstractCompiler;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerOutputStyle;
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

/**
* @author <a href="mailto:[email protected]">Trygve Laugst&oslash;l</a>
* @author <a href="mailto:[email protected]">Matthew Pocock</a>
* @author <a href="mailto:[email protected]">J&ouml;rg Wa&szlig;mer</a>
* @author Others
*
*/
@Component( role = Compiler.class, hint = "javac" )
@Named("javac")
@Singleton
public class JavacCompiler
extends AbstractCompiler
{
Expand All @@ -107,7 +109,7 @@ public class JavacCompiler

private final List<Class<?>> javaccClasses = new CopyOnWriteArrayList<>();

@Requirement
@Inject
private InProcessCompiler inProcessCompiler;

// ----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import org.codehaus.plexus.compiler.CompilerMessage;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Named;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticCollector;
import javax.tools.JavaCompiler;
Expand All @@ -45,7 +45,7 @@
* @author <a href="mailto:[email protected]">David M. Lloyd</a>
* @since 2.0
*/
@Component( role = InProcessCompiler.class )
@Named
public class JavaxToolsCompiler implements InProcessCompiler
{
private final Logger log = LoggerFactory.getLogger( getClass() );
Expand Down
47 changes: 43 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
<artifactId>plexus-component-annotations</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
Expand All @@ -100,6 +105,16 @@
<artifactId>plexus-testing</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>0.9.0.M2</version>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.inject</artifactId>
<version>0.9.0.M2</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
Expand All @@ -123,6 +138,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<proc>none</proc>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -154,10 +172,16 @@
<artifactId>plexus-component-metadata</artifactId>
<executions>
<execution>
<goals>
<goal>generate-metadata</goal>
<goal>merge-metadata</goal>
</goals>
<id>process-classes</id>
<phase>none</phase>
</execution>
<execution>
<id>process-test-classes</id>
<phase>none</phase>
</execution>
<execution>
<id>default</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -205,6 +229,21 @@
</executions>
</plugin>

<plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.9.0.M2</version>
<executions>
<execution>
<id>index-project</id>
<goals>
<goal>main-index</goal>
<goal>test-index</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down

0 comments on commit e5a2ed7

Please sign in to comment.