Skip to content
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

Refresh project, parent 68, Maven 3.2.5 #5

Merged
merged 1 commit into from
Jun 24, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
82 changes: 35 additions & 47 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mojo-parent</artifactId>
<version>36</version>
<version>68</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>l10n-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>Localization Tools Maven Plugin</name>
<version>1.0-SNAPSHOT</version>

<description>
Allows you to do an automated pseudo-localization to test the completeness
of your project's internationalization effort. This technique simulates the
Expand All @@ -38,17 +40,15 @@ under the License.
For more general information on localization, see
http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/.
</description>
<url>http://www.mojohaus.org/l10n-maven-plugin/</url>

<url>https://www.mojohaus.org/l10n-maven-plugin/</url>

<prerequisites>
<maven>2.0.4</maven>
<maven>${mavenVersion}</maven>
</prerequisites>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/mojohaus/l10n-maven-plugin/issues</url>
</issueManagement>

<inceptionYear>2007</inceptionYear>

<developers>
<developer>
<id>mkleint</id>
Expand All @@ -74,69 +74,57 @@ under the License.
<licenses>
<license>
<name>Apache License 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<connection>scm:git:https://github.com/mojohaus/l10n-maven-plugin.git</connection>
<developerConnection>scm:git:ssh://git@github.com/mojohaus/l10n-maven-plugin.git</developerConnection>
<url>https://github.com/mojohaus/l10n-maven-plugin/</url>
<url>https://github.com/mojohaus/l10n-maven-plugin/tree/master</url>
</scm>

<properties>
<doxiaVersion>1.0</doxiaVersion>
<mavenVersion>2.0.6</mavenVersion>
<mavenVersion>3.2.5</mavenVersion>
<mojo.java.target>1.8</mojo.java.target>
</properties>

<dependencyManagement>
<!-- override scope for transitive Maven core artifacts -->
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>${mavenVersion}</version>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>2.0.4.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
<version>${doxiaVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>${doxiaVersion}</version>
<exclusions>
<exclusion>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.5.8</version>
<version>3.1.0</version>
</dependency>
</dependencies>

Expand Down
129 changes: 29 additions & 100 deletions src/main/java/org/codehaus/mojo/l10n/L10NStatusReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@
* under the License.
*/

import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.siterenderer.Renderer;
import org.apache.maven.model.Resource;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.AbstractMavenReportRenderer;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
Expand All @@ -49,133 +38,73 @@
import java.util.TreeSet;
import java.util.regex.Pattern;

import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.model.Resource;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.AbstractMavenReportRenderer;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;

/**
* A simple report for keeping track of l10n status. It lists all bundle properties
* files and the number of properties in them. For a configurable list of locales it also
* tracks the progress of localization.
*
* @author <a href="mkleint@codehaus.org">Milos Kleint</a>
* @goal report
*/
@Mojo( name = "report" )
public class L10NStatusReport
extends AbstractMavenReport
{

/**
* Report output directory.
*
* @parameter default-value="${project.build.directory}/generated-site/xdoc"
*/
private File outputDirectory;

/**
* Doxia Site Renderer.
* The projects in the reactor for aggregation report.
*
* @component
*/
private Renderer siteRenderer;
@Parameter(defaultValue = "${reactorProjects}", readonly = true)
protected List<MavenProject> reactorProjects;

/**
* A list of locale strings that are to be watched for l10n status.
*
* @parameter
*/
private List locales;

/**
* The Maven Project.
*
* @parameter expression="${project}"
* @required
* @readonly
*/
private MavenProject project;

/**
* The list of resources that are scanned for properties bundles.
*
* @parameter default-value="${project.resources}"
* @readonly
*/
private List resources;
@Parameter
private List<String> locales;

/**
* A list of exclude patterns to use. By default no files are excluded.
*
* @parameter
*/
private List excludes;
@Parameter
private List<String> excludes;

/**
* A list of include patterns to use. By default all <code>*.properties</code> files are included.
*
* @parameter
*/
private List includes;

/**
* The projects in the reactor for aggregation report.
*
* @parameter expression="${reactorProjects}"
* @readonly
*/
protected List reactorProjects;
@Parameter
private List<String> includes;

/**
* Whether to build an aggregated report at the root, or build individual reports.
*
* @parameter expression="${maven.l10n.aggregate}" default-value="false"
*/
@Parameter(defaultValue = "false", property = "maven.l10n.aggregate")
protected boolean aggregate;


private static final String[] DEFAULT_INCLUDES = {"**/*.properties"};

private static final String[] EMPTY_STRING_ARRAY = {};


/**
* @see org.apache.maven.reporting.AbstractMavenReport#getSiteRenderer()
*/
protected Renderer getSiteRenderer()
{
return siteRenderer;
}

/**
* @see org.apache.maven.reporting.AbstractMavenReport#getOutputDirectory()
*/
protected String getOutputDirectory()
{
return outputDirectory.getAbsolutePath();
}

/**
* @see org.apache.maven.reporting.AbstractMavenReport#getProject()
*/
protected MavenProject getProject()
{
return project;
}

public boolean canGenerateReport()
{
return canGenerateReport( constructResourceDirs() );
}

/**
* @param sourceDirs
* @return true if the report can be generated
*/
protected boolean canGenerateReport( Map sourceDirs )
{
boolean canGenerate = !sourceDirs.isEmpty();

if ( aggregate && !project.isExecutionRoot() )
{
canGenerate = false;
return false;
}
return canGenerate;

return !constructResourceDirs().isEmpty();
}

/**
Expand All @@ -193,16 +122,16 @@ protected Map constructResourceDirs()
MavenProject prj = (MavenProject) i.next();
if ( prj.getResources() != null && !prj.getResources().isEmpty() )
{
sourceDirs.put( prj, new ArrayList( prj.getResources() ) );
sourceDirs.put( prj, prj.getResources() );
}

}
}
else
{
if ( resources != null && !resources.isEmpty() )
if ( project.getResources() != null && !project.getResources().isEmpty() )
{
sourceDirs.put( project, new ArrayList( resources ) );
sourceDirs.put( project, project.getResources() );
}
}
return sourceDirs;
Expand Down