Skip to content

Convert to JSR 330 component #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@ See the Apache License Version 2.0 for the specific language governing permissio
<version>0.0.8-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
</dependencies>

Expand All @@ -51,16 +50,18 @@ See the Apache License Version 2.0 for the specific language governing permissio
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-maven-plugin</artifactId>
<version>1.3.8</version>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.3.5</version>
<executions>
<execution>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
<execution>
<id>index-project</id>
<goals>
<goal>main-index</goal>
<goal>test-index</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@

package org.sonatype.plexus.build.incremental;

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

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.Scanner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Filesystem based non-incremental build context implementation which behaves as if all files
Expand All @@ -34,9 +37,11 @@
* isIncremental returns false
* getValue always returns null
*/
@Component( role = BuildContext.class, hint = "default")
public class DefaultBuildContext extends AbstractLogEnabled implements BuildContext {
@Named("default")
@Singleton
public class DefaultBuildContext implements BuildContext {

private final Logger logger = LoggerFactory.getLogger(DefaultBuildContext.class);
/** {@inheritDoc} */
public boolean hasDelta(String relpath) {
return true;
Expand Down Expand Up @@ -125,10 +130,10 @@ public void addWarning(File file, int line, int column, String message, Throwabl
public void addMessage(File file, int line, int column, String message, int severity, Throwable cause) {
switch(severity) {
case BuildContext.SEVERITY_ERROR:
getLogger().error(getMessage(file, line, column, message), cause);
logger.error(getMessage(file, line, column, message), cause);
return;
case BuildContext.SEVERITY_WARNING:
getLogger().warn(getMessage(file, line, column, message), cause);
logger.warn(getMessage(file, line, column, message), cause);
return;
}
throw new IllegalArgumentException("severity=" + severity);
Expand Down