Index: lutinprocessor/src/java/org/codelutin/processor/ant/ProcessorTask.java diff -u lutinprocessor/src/java/org/codelutin/processor/ant/ProcessorTask.java:1.7 lutinprocessor/src/java/org/codelutin/processor/ant/ProcessorTask.java:1.8 --- lutinprocessor/src/java/org/codelutin/processor/ant/ProcessorTask.java:1.7 Wed Jan 4 13:28:07 2006 +++ lutinprocessor/src/java/org/codelutin/processor/ant/ProcessorTask.java Mon Jan 23 14:02:41 2006 @@ -1,33 +1,32 @@ -/* *##% -* Copyright (C) 2002, 2003 Code Lutin -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* 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 Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ - -/* * -* GeneratorTemplatesTask.java -* -* Created: 14 janv. 2004 -* -* @author Benjamin Poussin -* Copyright Code Lutin -* @version $Revision: 1.7 $ -* -* Mise a jour: $Date: 2006/01/04 13:28:07 $ -* par : $Author: bpoussin $ -*/ +/* + * *##% Copyright (C) 2002, 2003 Code Lutin + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 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 Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. ##% + */ + +/******************************************************************************* + * GeneratorTemplatesTask.java + * + * Created: 14 janv. 2004 + * + * @author Benjamin Poussin Copyright Code Lutin + * + * @version $Revision: 1.8 $ + * + * Mise a jour: $Date: 2006/01/23 14:02:41 $ par : $Author: bpoussin $ + */ package org.codelutin.processor.ant; @@ -55,15 +54,13 @@ Processor processor = new Processor(getFilters()); for (int i = 0; i < files.length; i++) { String inputFileName = absoluteSourceName(files[i]); - String outputFileName = - absoluteDestinationName(applyTransformationFilename(files[i])); - if(overwrite || isNewer(inputFileName, outputFileName)){ + String outputFileName = absoluteDestinationName(applyTransformationFilename(files[i])); + if (overwrite || isNewer(inputFileName, outputFileName)) { // creation du repertoire pour le fichier destination new File(outputFileName).getParentFile().mkdirs(); try { - processor.process( - new FileReader(inputFileName), - new FileWriter(outputFileName)); + processor.process(new FileReader(inputFileName), + new FileWriter(outputFileName)); } catch (IOException eee) { throw new BuildException(eee); } @@ -74,18 +71,24 @@ static int MSG_VERBOSE = Project.MSG_VERBOSE; protected File srcDir; + protected File destDir; - protected String[] includes = new String[] { - }; - protected String[] excludes = new String[] { - }; + + protected String[] includes = new String[] {}; + + protected String[] excludes = new String[] {}; + protected String[] files; + protected String fileInPattern = ""; + protected String fileOutPattern = ""; + protected String filters = "org.codelutin.processor.filters.NoActionFilter"; + protected boolean overwrite = true; - public void setOverwrite(boolean v){ + public void setOverwrite(boolean v) { overwrite = v; } @@ -114,15 +117,12 @@ Filter[] result = new Filter[filterList.length]; for (int i = 0; i < filterList.length; i++) { try { - // Warning : don't replace that for a Class.forName(...) has it does NOT behave the same way ! - result[i] = - (Filter) getClass().forName(filterList[i].trim()).newInstance(); + // 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); + throw new BuildException("Error during looking for '" + + filterList[i].trim() + "' class", eee); } } return result; @@ -131,24 +131,19 @@ 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()); + throw new BuildException("srcdir attribute must be set!", + getLocation()); } if (!srcDir.exists()) { - throw new BuildException( - "srcdir \"" + srcDir.getPath() + "\" does not exist!", - getLocation()); + 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()); + throw new BuildException("destination directory \"" + destDir + + "\" does not exist or is not a directory", getLocation()); } // Build the list of files to compute @@ -177,8 +172,8 @@ } protected boolean isNewer(String filein, String fileout) { - boolean result = - new File(filein).lastModified() > new File(fileout).lastModified(); + boolean result = new File(filein).lastModified() > new File(fileout) + .lastModified(); if (result) log(filein + " is newer than " + fileout, MSG_VERBOSE); return result;