Processor-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
October 2009
- 3 participants
- 15 discussions
r281 - trunk/maven-processor-plugin/src/main/java/org/nuiton/processor
by tchemit@users.nuiton.org 10 Oct '09
by tchemit@users.nuiton.org 10 Oct '09
10 Oct '09
Author: tchemit
Date: 2009-10-10 15:44:17 +0200 (Sat, 10 Oct 2009)
New Revision: 281
Removed:
trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/
Log:
remove package ant
1
0
Author: tchemit
Date: 2009-10-09 19:56:12 +0200 (Fri, 09 Oct 2009)
New Revision: 280
Added:
trunk/ant-processor-task/
trunk/ant-processor-task/LICENSE.txt
trunk/ant-processor-task/README.txt
trunk/ant-processor-task/changelog.txt
trunk/ant-processor-task/pom.xml
trunk/ant-processor-task/src/
trunk/ant-processor-task/src/main/
trunk/ant-processor-task/src/main/java/
trunk/ant-processor-task/src/main/java/org/
trunk/ant-processor-task/src/main/java/org/nuiton/
trunk/ant-processor-task/src/main/java/org/nuiton/processor/
trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/
trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java
trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/ProcessorTask.java
trunk/ant-processor-task/src/main/resources/
trunk/ant-processor-task/src/site/
trunk/ant-processor-task/src/site/apt/
trunk/ant-processor-task/src/site/apt/index.apt
trunk/ant-processor-task/src/site/site.xml
Removed:
trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java
trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/ProcessorTask.java
Modified:
trunk/maven-processor-plugin/pom.xml
trunk/pom.xml
Log:
Evolution #81: creer un module pour les taches ant
Property changes on: trunk/ant-processor-task
___________________________________________________________________
Added: svn:ignore
+ target
Added: trunk/ant-processor-task/LICENSE.txt
===================================================================
--- trunk/ant-processor-task/LICENSE.txt (rev 0)
+++ trunk/ant-processor-task/LICENSE.txt 2009-10-09 17:56:12 UTC (rev 280)
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Added: trunk/ant-processor-task/README.txt
===================================================================
--- trunk/ant-processor-task/README.txt (rev 0)
+++ trunk/ant-processor-task/README.txt 2009-10-09 17:56:12 UTC (rev 280)
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
Added: trunk/ant-processor-task/changelog.txt
===================================================================
--- trunk/ant-processor-task/changelog.txt (rev 0)
+++ trunk/ant-processor-task/changelog.txt 2009-10-09 17:56:12 UTC (rev 280)
@@ -0,0 +1 @@
+No more used, we will soon make optional multi-module childs changelog.txt (mavenpom>1.0.0)
\ No newline at end of file
Added: trunk/ant-processor-task/pom.xml
===================================================================
--- trunk/ant-processor-task/pom.xml (rev 0)
+++ trunk/ant-processor-task/pom.xml 2009-10-09 17:56:12 UTC (rev 280)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>processor</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.nuiton.processor</groupId>
+ <artifactId>ant-processor-task</artifactId>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>nuiton-processor</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </dependency>
+
+ <!-- tests dependencies -->
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>Nuiton processor ant task</name>
+ <inceptionYear>2009</inceptionYear>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+</project>
Copied: trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java (from rev 277, trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java)
===================================================================
--- trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java (rev 0)
+++ trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java 2009-10-09 17:56:12 UTC (rev 280)
@@ -0,0 +1,158 @@
+/*
+ * *##%
+ * Nuiton processor maven plugin
+ * Copyright (C) 2006 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
+
+package org.nuiton.processor.ant;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.nuiton.processor.I18nExtractor;
+
+/**
+ * I18nExtractorTask.
+ *
+ * Created: Aug 16, 2004
+ *
+ * @author Cédric Pineau <pineau(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * by : $Author$
+ */
+public class I18nExtractorTask extends MatchingTask {
+
+ public static final int MSG_VERBOSE = Project.MSG_VERBOSE;
+
+ protected File srcDir;
+
+ protected File destFile;
+
+ protected String[] includes = new String[] {};
+
+ protected String[] excludes = new String[] {};
+
+ protected String[] srcFileNames;
+
+ public I18nExtractorTask() {
+
+ }
+
+ protected void doExecute() throws BuildException {
+ // creation du repertoire pour le fichier destination
+ destFile.getParentFile().mkdirs();
+ List<File> fileList = new ArrayList<File>();
+ for (int i = 0; i < srcFileNames.length; i++) {
+ fileList.add(new File(srcFileNames[i]));
+ }
+ try {
+ new I18nExtractor()
+ .extract(fileList.toArray(new File[0]), destFile);
+ } catch (IOException eee) {
+ throw new BuildException(eee);
+ }
+ }
+
+ public void setSrcdir(File srcDir) {
+ this.srcDir = srcDir;
+ }
+
+ public void setDestFile(File destFile) {
+ this.destFile = destFile;
+ }
+
+ @Override
+ public void execute() throws BuildException {
+ // first of all, make sure that we've got a srcdir
+ if (srcDir == null) {
+ throw new BuildException("srcdir attribute must be set!",
+ getLocation());
+ }
+ if (!srcDir.exists()) {
+ throw new BuildException("srcdir \"" + srcDir.getPath()
+ + "\" does not exist!", getLocation());
+ }
+
+ if (destFile == null) {
+ throw new BuildException("destFile attribute must be set!",
+ getLocation());
+ }
+
+ // Build the list of files to compute
+ buildFileList();
+
+ // generate the source files
+ doExecute();
+ }
+
+ protected void buildFileList() {
+
+ // Obtain this list of files within the source directory
+ DirectoryScanner ds = getDirectoryScanner(srcDir);
+
+ String[] ins = getIncludes();
+ if (ins.length > 0) {
+ ds.setIncludes(ins);
+ }
+ String[] exs = getExcludes();
+ if (exs.length > 0) {
+ ds.setExcludes(exs);
+ }
+
+ ds.scan();
+
+ // on met le resultat dans files
+ srcFileNames = ds.getIncludedFiles();
+ }
+
+ protected boolean isNewer(String filein, String fileout) {
+ boolean result = new File(filein).lastModified() > new File(fileout)
+ .lastModified();
+ if (result) {
+ log(filein + " is newer than " + fileout, MSG_VERBOSE);
+ }
+ return result;
+ }
+
+ protected String[] getExcludes() {
+ return excludes;
+ }
+
+ protected String[] getIncludes() {
+ return includes;
+ }
+
+ @Override
+ public void setIncludes(String includes) {
+ this.includes = includes.split(",");
+ }
+
+ @Override
+ public void setExcludes(String excludes) {
+ this.excludes = excludes.split(",");
+ }
+
+}
Copied: trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/ProcessorTask.java (from rev 276, trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/ProcessorTask.java)
===================================================================
--- trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/ProcessorTask.java (rev 0)
+++ trunk/ant-processor-task/src/main/java/org/nuiton/processor/ant/ProcessorTask.java 2009-10-09 17:56:12 UTC (rev 280)
@@ -0,0 +1,245 @@
+/*
+ * *##%
+ * Nuiton processor maven plugin
+ * Copyright (C) 2006 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
+package org.nuiton.processor.ant;
+
+import java.io.File;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.nuiton.processor.Processor;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.nuiton.processor.ProcessorUtil;
+
+/**
+ * Tache ant pour lutinprocessor.
+ *
+ * To use this task, put this code in ant build file:
+ * <pre>
+ * <taskdef name="processor" classname="org.nuiton.processor.ant.ProcessorTask"
+ * classpath="lib/lutinprocessor.jar" />
+ * </pre>
+ *
+ * and use it with:
+ * <pre>
+ * <processor srcdir="${src}" destdir="${targetgen}" filters="org.nuiton.processor.filters.GeneratorTemplatesFilter" />
+ * </pre>
+ * Created: 14 janv. 2004
+ *
+ * @author Benjamin Poussin <poussin(a)codelutin.com> Copyright Code Lutin
+ *
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$ par : $Author$
+ */
+public class ProcessorTask extends MatchingTask { // ProcessorTask
+
+ public static final int MSG_VERBOSE = Project.MSG_VERBOSE;
+ protected File srcDir;
+ protected File destDir;
+ protected String[] includes = new String[]{};
+ protected String[] excludes = new String[]{};
+ protected String[] files;
+ protected String fileInPattern = "";
+ protected String fileOutPattern = "";
+ protected String filters = "org.nuiton.processor.filters.NoActionFilter";
+ protected boolean overwrite = true;
+ protected boolean verbose = false;
+
+ public ProcessorTask() {
+ }
+
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ public void setOverwrite(boolean overwrite) {
+ this.overwrite = overwrite;
+ }
+
+ public void setFileOutPattern(String fileOutPattern) {
+ this.fileOutPattern = fileOutPattern;
+ }
+
+ public void setFileInPattern(String fileInPattern) {
+ this.fileInPattern = fileInPattern;
+ }
+
+ public void setSrcdir(File srcDir) {
+ this.srcDir = srcDir;
+ }
+
+ public void setDestdir(File destDir) {
+ this.destDir = destDir;
+ }
+
+ public void setFilters(String filters) {
+ this.filters = filters;
+ }
+
+ protected String applyTransformationFilename(String filename) {
+ return filename.replaceAll(fileInPattern, fileOutPattern);
+ }
+
+ protected void doExecute() throws BuildException {
+ Processor processor=null;
+ try {
+ processor = ProcessorUtil.newProcessor(this.filters, ",");
+ } catch (Exception ex) {
+ throw new BuildException("Could nto instanciate processor for reason : "+ex.getMessage(), ex);
+ }
+// Processor processor = new Processor(getFilters());
+ int numberFiles;
+ for (numberFiles = 0; numberFiles < files.length; numberFiles++) {
+ String inputFileName = absoluteSourceName(files[numberFiles]);
+ String outputFileName = absoluteDestinationName(applyTransformationFilename(files[numberFiles]));
+ if (verbose) {
+ log("Using " + inputFileName);
+ }
+ if (overwrite || isNewer(inputFileName, outputFileName)) {
+ if (verbose) {
+ log("Generating " + outputFileName);
+ }
+ // creation du repertoire pour le fichier destination
+ new File(outputFileName).getParentFile().mkdirs();
+ try {
+ processor.process(new FileReader(inputFileName),
+ new FileWriter(outputFileName));
+ } catch (IOException eee) {
+ throw new BuildException(eee);
+ }
+ }
+ }
+ log("Generating " + numberFiles + " files to " + destDir);
+ }
+
+// protected Filter[] getFilters() throws BuildException {
+// Filter[] result;
+// try {
+// result = ProcessorUtil.getFilters(filters, ",");
+// } catch (Exception eee) {
+// throw new BuildException(eee.getMessage(), eee);
+// }
+//// String[] filterList = filters.split(",");
+//// Filter[] result = new Filter[filterList.length];
+//// for (int i = 0; i < filterList.length; i++) {
+//// try {
+//// // Class.forName semble fonctionner maintenant
+//// // avant il fallait utiliser getClass().forName
+//// result[i] = (Filter) Class.forName(filterList[i].trim())
+//// .newInstance();
+//// } catch (Exception eee) {
+//// throw new BuildException("Error during looking for '"
+//// + filterList[i].trim() + "' class", eee);
+//// }
+//// }
+// return result;
+// }
+
+ @Override
+ public void execute() throws BuildException {
+ // first of all, make sure that we've got a srcdir
+ if (srcDir == null) {
+ throw new BuildException("srcdir attribute must be set!",
+ getLocation());
+ }
+ if (!srcDir.exists()) {
+ throw new BuildException("srcdir \"" + srcDir.getPath() + "\" does not exist!", getLocation());
+ }
+
+ if (destDir == null) {
+ destDir = srcDir;
+ }
+ if (!destDir.isDirectory()) {
+ throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", getLocation());
+ }
+
+ // Build the list of files to compute
+ buildFileList();
+
+ // generate the source files
+ doExecute();
+ }
+
+ protected void buildFileList() {
+
+ // Obtain this list of files within the source directory
+ DirectoryScanner ds = getDirectoryScanner(srcDir);
+
+ String[] in = getIncludes();
+ if (in.length > 0) {
+ ds.setIncludes(in);
+ }
+ String[] ex = getExcludes();
+ if (ex.length > 0) {
+ ds.setExcludes(ex);
+ }
+
+ ds.scan();
+
+ // on recherche ceux que l'on doit vraiment refaire
+ files = ds.getIncludedFiles();
+ }
+
+ protected boolean isNewer(String filein, String fileout) {
+ boolean result = new File(filein).lastModified() > new File(fileout).lastModified();
+ if (result) {
+ log(filein + " is newer than " + fileout, MSG_VERBOSE);
+ }
+ return result;
+ }
+
+ protected String[] getExcludes() {
+ return excludes;
+ }
+
+ protected String[] getIncludes() {
+ return includes;
+ }
+
+ public void setIncludes(String[] includes) {
+ this.includes = includes;
+ }
+
+ @Override
+ public void setIncludes(String includes) {
+ setIncludes(includes.split(","));
+ }
+
+ public void setExcludes(String[] excludes) {
+ this.excludes = excludes;
+ }
+
+ @Override
+ public void setExcludes(String excludes) {
+ setExcludes(excludes.split(","));
+ }
+
+ protected String absoluteDestinationName(String fileName) {
+ return destDir.getPath() + File.separator + fileName;
+ }
+
+ protected String absoluteSourceName(String fileName) {
+ return srcDir.getPath() + File.separator + fileName;
+ }
+} // ProcessorTask
Added: trunk/ant-processor-task/src/site/apt/index.apt
===================================================================
--- trunk/ant-processor-task/src/site/apt/index.apt (rev 0)
+++ trunk/ant-processor-task/src/site/apt/index.apt 2009-10-09 17:56:12 UTC (rev 280)
@@ -0,0 +1,29 @@
+----
+Ant-processor-task
+----
+----
+2009-08-22
+----
+
+
+Présentation
+
+ Le module <ant-processor-task> permet l'utilisation depuis ant de
+ Nuiton Processor. Pour plus de détails sur Nuiton Processor veuillez consulter
+ {{{http://maven-site.nuiton.org./processor/nuiton-processor}l'adresse suivante}}.
+
+Utilisation dans le pom.xml
+
+ Voici une déclaration d'une utilisation de ant-processor-task dans un
+ build.xml. Il permet dans ce cas utiliser les fitres nécessaires pour
+ {{{http://maven-site.nuiton.org/topia}ToPIA}}.
+
+------------------------------------------------------------
+
+ <taskdef name="processor" classname="org.nuiton.processor.ant.ProcessorTask"
+ classpath="lib/nuiton-processor.jar" />
+
+ <processor srcdir="${src}" destdir="${targetgen}"
+ filters="org.nuiton.processor.filters.GeneratorTemplatesFilter" />
+
+------------------------------------------------------------
Added: trunk/ant-processor-task/src/site/site.xml
===================================================================
--- trunk/ant-processor-task/src/site/site.xml (rev 0)
+++ trunk/ant-processor-task/src/site/site.xml 2009-10-09 17:56:12 UTC (rev 280)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+ <links>
+ <item name="Nuiton Processor" href="../nuiton-processor"/>
+ </links>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="${project.url}" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur">
+ <item href="index.html" name="Accueil"/>
+ </menu>
+
+ <menu name="Téléchargement">
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}.jar"
+ name="Librairie (jar)"/>
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar"
+ name="Javadoc (jar)"/>
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar"
+ name="Sources (jar)"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ </body>
+</project>
Modified: trunk/maven-processor-plugin/pom.xml
===================================================================
--- trunk/maven-processor-plugin/pom.xml 2009-10-09 15:20:57 UTC (rev 279)
+++ trunk/maven-processor-plugin/pom.xml 2009-10-09 17:56:12 UTC (rev 280)
@@ -36,11 +36,6 @@
<artifactId>plexus-utils</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </dependency>
-
<!-- tests dependencies -->
<dependency>
Deleted: trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java
===================================================================
--- trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java 2009-10-09 15:20:57 UTC (rev 279)
+++ trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java 2009-10-09 17:56:12 UTC (rev 280)
@@ -1,158 +0,0 @@
-/*
- * *##%
- * Nuiton processor maven plugin
- * Copyright (C) 2006 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * ##%*
- */
-
-package org.nuiton.processor.ant;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.nuiton.processor.I18nExtractor;
-
-/**
- * I18nExtractorTask.
- *
- * Created: Aug 16, 2004
- *
- * @author Cédric Pineau <pineau(a)codelutin.com>
- * @version $Revision$
- *
- * Last update : $Date$
- * by : $Author$
- */
-public class I18nExtractorTask extends MatchingTask {
-
- public static final int MSG_VERBOSE = Project.MSG_VERBOSE;
-
- protected File srcDir;
-
- protected File destFile;
-
- protected String[] includes = new String[] {};
-
- protected String[] excludes = new String[] {};
-
- protected String[] srcFileNames;
-
- public I18nExtractorTask() {
-
- }
-
- protected void doExecute() throws BuildException {
- // creation du repertoire pour le fichier destination
- destFile.getParentFile().mkdirs();
- List<File> fileList = new ArrayList<File>();
- for (int i = 0; i < srcFileNames.length; i++) {
- fileList.add(new File(srcFileNames[i]));
- }
- try {
- new I18nExtractor()
- .extract(fileList.toArray(new File[0]), destFile);
- } catch (IOException eee) {
- throw new BuildException(eee);
- }
- }
-
- public void setSrcdir(File srcDir) {
- this.srcDir = srcDir;
- }
-
- public void setDestFile(File destFile) {
- this.destFile = destFile;
- }
-
- @Override
- public void execute() throws BuildException {
- // first of all, make sure that we've got a srcdir
- if (srcDir == null) {
- throw new BuildException("srcdir attribute must be set!",
- getLocation());
- }
- if (!srcDir.exists()) {
- throw new BuildException("srcdir \"" + srcDir.getPath()
- + "\" does not exist!", getLocation());
- }
-
- if (destFile == null) {
- throw new BuildException("destFile attribute must be set!",
- getLocation());
- }
-
- // Build the list of files to compute
- buildFileList();
-
- // generate the source files
- doExecute();
- }
-
- protected void buildFileList() {
-
- // Obtain this list of files within the source directory
- DirectoryScanner ds = getDirectoryScanner(srcDir);
-
- String[] ins = getIncludes();
- if (ins.length > 0) {
- ds.setIncludes(ins);
- }
- String[] exs = getExcludes();
- if (exs.length > 0) {
- ds.setExcludes(exs);
- }
-
- ds.scan();
-
- // on met le resultat dans files
- srcFileNames = ds.getIncludedFiles();
- }
-
- protected boolean isNewer(String filein, String fileout) {
- boolean result = new File(filein).lastModified() > new File(fileout)
- .lastModified();
- if (result) {
- log(filein + " is newer than " + fileout, MSG_VERBOSE);
- }
- return result;
- }
-
- protected String[] getExcludes() {
- return excludes;
- }
-
- protected String[] getIncludes() {
- return includes;
- }
-
- @Override
- public void setIncludes(String includes) {
- this.includes = includes.split(",");
- }
-
- @Override
- public void setExcludes(String excludes) {
- this.excludes = excludes.split(",");
- }
-
-}
Deleted: trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/ProcessorTask.java
===================================================================
--- trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/ProcessorTask.java 2009-10-09 15:20:57 UTC (rev 279)
+++ trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/ProcessorTask.java 2009-10-09 17:56:12 UTC (rev 280)
@@ -1,245 +0,0 @@
-/*
- * *##%
- * Nuiton processor maven plugin
- * Copyright (C) 2006 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * ##%*
- */
-package org.nuiton.processor.ant;
-
-import java.io.File;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.nuiton.processor.Processor;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.nuiton.processor.ProcessorUtil;
-
-/**
- * Tache ant pour lutinprocessor.
- *
- * To use this task, put this code in ant build file:
- * <pre>
- * <taskdef name="processor" classname="org.nuiton.processor.ant.ProcessorTask"
- * classpath="lib/lutinprocessor.jar" />
- * </pre>
- *
- * and use it with:
- * <pre>
- * <processor srcdir="${src}" destdir="${targetgen}" filters="org.nuiton.processor.filters.GeneratorTemplatesFilter" />
- * </pre>
- * Created: 14 janv. 2004
- *
- * @author Benjamin Poussin <poussin(a)codelutin.com> Copyright Code Lutin
- *
- * @version $Revision$
- *
- * Mise a jour: $Date$ par : $Author$
- */
-public class ProcessorTask extends MatchingTask { // ProcessorTask
-
- public static final int MSG_VERBOSE = Project.MSG_VERBOSE;
- protected File srcDir;
- protected File destDir;
- protected String[] includes = new String[]{};
- protected String[] excludes = new String[]{};
- protected String[] files;
- protected String fileInPattern = "";
- protected String fileOutPattern = "";
- protected String filters = "org.nuiton.processor.filters.NoActionFilter";
- protected boolean overwrite = true;
- protected boolean verbose = false;
-
- public ProcessorTask() {
- }
-
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-
- public void setOverwrite(boolean overwrite) {
- this.overwrite = overwrite;
- }
-
- public void setFileOutPattern(String fileOutPattern) {
- this.fileOutPattern = fileOutPattern;
- }
-
- public void setFileInPattern(String fileInPattern) {
- this.fileInPattern = fileInPattern;
- }
-
- public void setSrcdir(File srcDir) {
- this.srcDir = srcDir;
- }
-
- public void setDestdir(File destDir) {
- this.destDir = destDir;
- }
-
- public void setFilters(String filters) {
- this.filters = filters;
- }
-
- protected String applyTransformationFilename(String filename) {
- return filename.replaceAll(fileInPattern, fileOutPattern);
- }
-
- protected void doExecute() throws BuildException {
- Processor processor=null;
- try {
- processor = ProcessorUtil.newProcessor(this.filters, ",");
- } catch (Exception ex) {
- throw new BuildException("Could nto instanciate processor for reason : "+ex.getMessage(), ex);
- }
-// Processor processor = new Processor(getFilters());
- int numberFiles;
- for (numberFiles = 0; numberFiles < files.length; numberFiles++) {
- String inputFileName = absoluteSourceName(files[numberFiles]);
- String outputFileName = absoluteDestinationName(applyTransformationFilename(files[numberFiles]));
- if (verbose) {
- log("Using " + inputFileName);
- }
- if (overwrite || isNewer(inputFileName, outputFileName)) {
- if (verbose) {
- log("Generating " + outputFileName);
- }
- // creation du repertoire pour le fichier destination
- new File(outputFileName).getParentFile().mkdirs();
- try {
- processor.process(new FileReader(inputFileName),
- new FileWriter(outputFileName));
- } catch (IOException eee) {
- throw new BuildException(eee);
- }
- }
- }
- log("Generating " + numberFiles + " files to " + destDir);
- }
-
-// protected Filter[] getFilters() throws BuildException {
-// Filter[] result;
-// try {
-// result = ProcessorUtil.getFilters(filters, ",");
-// } catch (Exception eee) {
-// throw new BuildException(eee.getMessage(), eee);
-// }
-//// String[] filterList = filters.split(",");
-//// Filter[] result = new Filter[filterList.length];
-//// for (int i = 0; i < filterList.length; i++) {
-//// try {
-//// // Class.forName semble fonctionner maintenant
-//// // avant il fallait utiliser getClass().forName
-//// result[i] = (Filter) Class.forName(filterList[i].trim())
-//// .newInstance();
-//// } catch (Exception eee) {
-//// throw new BuildException("Error during looking for '"
-//// + filterList[i].trim() + "' class", eee);
-//// }
-//// }
-// return result;
-// }
-
- @Override
- public void execute() throws BuildException {
- // first of all, make sure that we've got a srcdir
- if (srcDir == null) {
- throw new BuildException("srcdir attribute must be set!",
- getLocation());
- }
- if (!srcDir.exists()) {
- throw new BuildException("srcdir \"" + srcDir.getPath() + "\" does not exist!", getLocation());
- }
-
- if (destDir == null) {
- destDir = srcDir;
- }
- if (!destDir.isDirectory()) {
- throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", getLocation());
- }
-
- // Build the list of files to compute
- buildFileList();
-
- // generate the source files
- doExecute();
- }
-
- protected void buildFileList() {
-
- // Obtain this list of files within the source directory
- DirectoryScanner ds = getDirectoryScanner(srcDir);
-
- String[] in = getIncludes();
- if (in.length > 0) {
- ds.setIncludes(in);
- }
- String[] ex = getExcludes();
- if (ex.length > 0) {
- ds.setExcludes(ex);
- }
-
- ds.scan();
-
- // on recherche ceux que l'on doit vraiment refaire
- files = ds.getIncludedFiles();
- }
-
- protected boolean isNewer(String filein, String fileout) {
- boolean result = new File(filein).lastModified() > new File(fileout).lastModified();
- if (result) {
- log(filein + " is newer than " + fileout, MSG_VERBOSE);
- }
- return result;
- }
-
- protected String[] getExcludes() {
- return excludes;
- }
-
- protected String[] getIncludes() {
- return includes;
- }
-
- public void setIncludes(String[] includes) {
- this.includes = includes;
- }
-
- @Override
- public void setIncludes(String includes) {
- setIncludes(includes.split(","));
- }
-
- public void setExcludes(String[] excludes) {
- this.excludes = excludes;
- }
-
- @Override
- public void setExcludes(String excludes) {
- setExcludes(excludes.split(","));
- }
-
- protected String absoluteDestinationName(String fileName) {
- return destDir.getPath() + File.separator + fileName;
- }
-
- protected String absoluteSourceName(String fileName) {
- return srcDir.getPath() + File.separator + fileName;
- }
-} // ProcessorTask
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-10-09 15:20:57 UTC (rev 279)
+++ trunk/pom.xml 2009-10-09 17:56:12 UTC (rev 280)
@@ -18,6 +18,7 @@
<modules>
<module>nuiton-processor</module>
<module>maven-processor-plugin</module>
+ <module>ant-processor-task</module>
</modules>
<dependencyManagement>
1
0
Author: tchemit
Date: 2009-10-09 17:20:57 +0200 (Fri, 09 Oct 2009)
New Revision: 279
Modified:
trunk/maven-processor-plugin/pom.xml
Log:
fix javadoc aggregate mode
Modified: trunk/maven-processor-plugin/pom.xml
===================================================================
--- trunk/maven-processor-plugin/pom.xml 2009-10-09 09:49:21 UTC (rev 278)
+++ trunk/maven-processor-plugin/pom.xml 2009-10-09 15:20:57 UTC (rev 279)
@@ -267,13 +267,7 @@
</tagletArtifact>
</taglet>
</taglets>
- </configuration>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- </execution>
- </executions>
-
+ </configuration>
</plugin>
</plugins>
@@ -456,6 +450,14 @@
</taglet>
</taglets>
</configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>javadoc</report>
+ <report>test-javadoc</report>
+ </reports>
+ </reportSet>
+ </reportSets>
</plugin>
</plugins>
</reporting>
1
0
r278 - in trunk: . nuiton-processor/src/test/java/org/nuiton/processor
by tchemit@users.nuiton.org 09 Oct '09
by tchemit@users.nuiton.org 09 Oct '09
09 Oct '09
Author: tchemit
Date: 2009-10-09 11:49:21 +0200 (Fri, 09 Oct 2009)
New Revision: 278
Modified:
trunk/nuiton-processor/src/test/java/org/nuiton/processor/LicenseProcessorTest.java
trunk/pom.xml
Log:
bump log4j version + clean pom and unqiue test
Modified: trunk/nuiton-processor/src/test/java/org/nuiton/processor/LicenseProcessorTest.java
===================================================================
--- trunk/nuiton-processor/src/test/java/org/nuiton/processor/LicenseProcessorTest.java 2009-10-09 09:48:16 UTC (rev 277)
+++ trunk/nuiton-processor/src/test/java/org/nuiton/processor/LicenseProcessorTest.java 2009-10-09 09:49:21 UTC (rev 278)
@@ -28,10 +28,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.plexus.util.IOUtil;
-import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
@@ -54,14 +52,6 @@
testdir.mkdirs();
}
- @AfterClass
- public static void afterClass() throws Exception {
- }
-
- @Before
- public void setUp() throws Exception {
- }
-
@Test
public void testProcessor() throws IOException {
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-10-09 09:48:16 UTC (rev 277)
+++ trunk/pom.xml 2009-10-09 09:49:21 UTC (rev 278)
@@ -239,7 +239,7 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.9</version>
+ <version>1.2.14</version>
</dependency>
</dependencies>
@@ -262,9 +262,7 @@
<properties>
<!-- pour un muli module on doit fixer le projectId -->
<projectId>processor</projectId>
- <!-- must be removed after mavenpom release, avoid hudson to break -->
- <helper.version>1.1.0-SNAPSHOT</helper.version>
- <!--<helper.includeAttached>true</helper.includeAttached>-->
+
</properties>
<build>
1
0
r277 - in trunk/maven-processor-plugin/src/main/java/org/nuiton/processor: ant plugin
by tchemit@users.nuiton.org 09 Oct '09
by tchemit@users.nuiton.org 09 Oct '09
09 Oct '09
Author: tchemit
Date: 2009-10-09 11:48:16 +0200 (Fri, 09 Oct 2009)
New Revision: 277
Modified:
trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java
trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java
Log:
Evolution #80: ajouter des logs dans le plugin
Modified: trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java
===================================================================
--- trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java 2009-09-29 11:39:53 UTC (rev 276)
+++ trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java 2009-10-09 09:48:16 UTC (rev 277)
@@ -113,13 +113,13 @@
// Obtain this list of files within the source directory
DirectoryScanner ds = getDirectoryScanner(srcDir);
- String[] includes = getIncludes();
- if (includes.length > 0) {
- ds.setIncludes(includes);
+ String[] ins = getIncludes();
+ if (ins.length > 0) {
+ ds.setIncludes(ins);
}
- String[] excludes = getExcludes();
- if (excludes.length > 0) {
- ds.setExcludes(excludes);
+ String[] exs = getExcludes();
+ if (exs.length > 0) {
+ ds.setExcludes(exs);
}
ds.scan();
Modified: trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java
===================================================================
--- trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java 2009-09-29 11:39:53 UTC (rev 276)
+++ trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java 2009-10-09 09:48:16 UTC (rev 277)
@@ -23,6 +23,7 @@
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
+import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.maven.project.MavenProject;
@@ -30,6 +31,7 @@
import org.nuiton.processor.Processor;
import org.nuiton.processor.ProcessorUtil;
import org.nuiton.io.MirroredFileUpdater;
+import org.nuiton.plugin.PluginHelper;
/**
* Maven2 plugin for Nuiton Processor.
@@ -100,12 +102,12 @@
* @parameter expression="${processor.fileInPattern}" default-value=""
* @since 0.10
*/
- protected String fileInPattern="";
+ protected String fileInPattern = "";
/**
* @parameter expression="${processor.fileOutPattern}" default-value=""
* @since 0.10
*/
- protected String fileOutPattern="";
+ protected String fileOutPattern = "";
/**
* Les filtres a utiliser par le processor, séparés par des virgules
*
@@ -127,7 +129,9 @@
* @since 0.10
*/
private boolean verbose;
-
+ /**
+ * Les fichiers à traiter
+ */
protected Map<String, String> filesToTreate;
public ProcessorPlugin() {
@@ -157,40 +161,56 @@
@Override
protected boolean init() throws Exception {
- boolean doGenerate = filters.length() > 0;
+ if (filters.isEmpty()) {
+ getLog().warn("No filters to use, skip execution.");
+ return false;
+ }
- if (doGenerate) {
+ MirroredFileUpdater updater = overwrite ? null : new MirroredFileUpdater(fileInPattern, fileOutPattern, srcDir, destDir);
- MirroredFileUpdater updater = overwrite ? null : new MirroredFileUpdater(fileInPattern, fileOutPattern, srcDir, destDir);
+ updater.setDestinationDirectory(destDir);
+ String[] aIncludes = includes.split(",");
+ String[] aExcludes = excludes == null ? null : excludes.split(",");
- updater.setDestinationDirectory(destDir);
- String[] aIncludes = includes.split(",");
- String[] aExcludes = excludes == null ? null : excludes.split(",");
+ filesToTreate = getFilesToTreate(aIncludes, aExcludes, srcDir, updater);
- filesToTreate = getFilesToTreate(aIncludes, aExcludes, srcDir, updater);
-
- doGenerate = !filesToTreate.isEmpty();
- }
-
- return doGenerate;
+ return true;
}
@Override
protected void doAction() throws Exception {
+ if (filesToTreate.isEmpty()) {
+ getLog().info("No file to process.");
+ return;
+ }
+ if (isVerbose()) {
+ printConfig();
+ }
+
+ long t0 = System.nanoTime();
+
Processor processor = ProcessorUtil.newProcessor(filters, ",");
+ getLog().info("Processing " + filesToTreate.size() + " files(s).");
+
for (Entry<String, String> entry : filesToTreate.entrySet()) {
File srcFile = new File(srcDir, entry.getKey());
File dstFile = new File(entry.getValue());
+ if (isVerbose()) {
+ getLog().info("Process " + srcFile);
+ }
// creation du repertoire pour le fichier destination
dstFile.getParentFile().mkdirs();
processor.process(new FileReader(srcFile), new FileWriter(dstFile));
}
+ if (isVerbose()) {
+ getLog().info("done in " + PluginHelper.convertTime(System.nanoTime() - t0));
+ }
// on indique que le repertoire entrant n'est plus dans le build
// car sinon on va avoir des classes dupliquées
removeCompileSourceRoots(srcDir);
@@ -199,4 +219,22 @@
addCompileSourceRoots(destDir);
}
+ protected void printConfig() {
+ getLog().info("config - srcDir " + srcDir);
+ getLog().info("config - destDir " + destDir);
+ getLog().info("config - includes " + includes);
+ getLog().info("config - filters " + Arrays.asList(PluginHelper.splitAndTrim(filters, ",")));
+ if (excludes != null) {
+ getLog().info("config - excludes " + excludes);
+ }
+ if (!fileInPattern.isEmpty()) {
+ getLog().info("config - fileInPattern " + fileInPattern);
+ }
+ if (!fileOutPattern.isEmpty()) {
+ getLog().info("config - fileOutPattern " + fileOutPattern);
+ }
+ if (overwrite) {
+ getLog().info("config - overwrite " + overwrite);
+ }
+ }
}
1
0