Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
69 changes: 26 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@

<properties>
<project.build.outputTimestamp>2024-07-03T21:22:33Z</project.build.outputTimestamp>
<doxiaVersion>1.12.0</doxiaVersion>
<doxia-sitetoolsVersion>1.11.1</doxia-sitetoolsVersion>
<doxiaVersion>2.0.0</doxiaVersion>
<reportingApiVersion>4.0.0-M12</reportingApiVersion>
<reportingImplVersion>4.0.0-M15</reportingImplVersion>
<mavenResolverVersion>1.4.1</mavenResolverVersion>

<!-- override plugins -->
<taglist-maven-plugin.version>${project.version}</taglist-maven-plugin.version>
Expand Down Expand Up @@ -161,60 +163,21 @@
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>3.1.1</version>
<version>${reportingApiVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>3.1.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
</exclusion>
</exclusions>
<version>${reportingImplVersion}</version>
</dependency>

<!-- Doxia -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-core</artifactId>
<version>${doxiaVersion}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
<version>${doxiaVersion}</version>
</dependency>

<!-- Doxia-sitetools -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>${doxia-sitetoolsVersion}</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- others -->
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -233,6 +196,18 @@
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId>
<version>${mavenResolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<version>${mavenResolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down Expand Up @@ -303,6 +278,9 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Duser.language=en</argLine>
<systemPropertyVariables>
<localRepository>${settings.localRepository}</localRepository>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -357,9 +335,14 @@

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
<!-- <version>3.1.0</version>-->
<version>${project.version}</version>
<configuration>
<tagListOptions>
Expand Down
24 changes: 9 additions & 15 deletions src/main/java/org/codehaus/mojo/taglist/FileAnalyser.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.Reader;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -73,7 +72,7 @@ public class FileAnalyser {
/**
* The Locale of the files to analyze.
*/
private final Locale locale;
private final Locale sourceFileLocale;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sourceFilesLocale, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a sourceFileLocale parameter of Mojo report ... so let to be consistent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, both need to be consistent with a TODO.


/**
* The directories to analyze.
Expand Down Expand Up @@ -122,7 +121,7 @@ public FileAnalyser(TagListReport report, List<TagClass> tagClasses) {
log = report.getLog();
sourceDirs = report.getSourceDirs();
encoding = report.getInputEncoding();
locale = report.getLocale();
sourceFileLocale = report.getSourceFileLocale();
this.tagClasses = tagClasses;
this.includes = report.getIncludesCommaSeparated();
this.excludes = report.getExcludesCommaSeparated();
Expand All @@ -133,7 +132,7 @@ public FileAnalyser(TagListReport report, List<TagClass> tagClasses) {
*
* @return a collection of TagReport objects.
*/
public Collection<TagReport> execute() {
public Collection<TagReport> execute() throws IOException {
List<File> fileList = findFilesToScan();

for (File file : fileList) {
Expand All @@ -156,15 +155,10 @@ public Collection<TagReport> execute() {
*
* @return a List of File objects.
*/
private List<File> findFilesToScan() {
private List<File> findFilesToScan() throws IOException {
List<File> filesList = new ArrayList<>();
try {
for (String sourceDir : sourceDirs) {
filesList.addAll(FileUtils.getFiles(new File(sourceDir), includes, excludes));
}
} catch (IOException e) {
// TODO - fix with Doxia 2.x - canGenerateReport will have a checked exception
throw new UncheckedIOException("Error while trying to find the files to scan.", e);
for (String sourceDir : sourceDirs) {
filesList.addAll(FileUtils.getFiles(new File(sourceDir), includes, excludes));
}
return filesList;
}
Expand All @@ -173,8 +167,8 @@ private List<File> findFilesToScan() {
* Access an input reader that uses the current file encoding.
*
* @param file the file to open in the reader.
* @throws IOException the IO exception.
* @return a reader with the current file encoding.
* @throws IOException the IO exception.
*/
private Reader getReader(File file) throws IOException {
InputStream in = Files.newInputStream(file.toPath());
Expand All @@ -194,7 +188,7 @@ public void scanFile(File file) {
int index;
// look for a tag on this line
for (TagClass tagClass : tagClasses) {
index = tagClass.tagMatchContains(currentLine, locale);
index = tagClass.tagMatchContains(currentLine, sourceFileLocale);
if (index != TagClass.NO_MATCH) {
// there's a tag on this line
String commentType = extractCommentType(currentLine, index);
Expand Down Expand Up @@ -247,7 +241,7 @@ public void scanFile(File file) {
// try to look if the next line is not a new tag
boolean newTagFound = false;
for (TagClass tc : tagClasses) {
if (tc.tagMatchStartsWith(currentComment, locale)) {
if (tc.tagMatchStartsWith(currentComment, sourceFileLocale)) {
newTagFound = true;
break;
}
Expand Down
Loading