[Lutinutil-commits] r1031 - in trunk: . maven-license-switcher-plugin maven-license-switcher-plugin/src maven-license-switcher-plugin/src/main maven-license-switcher-plugin/src/main/java maven-license-switcher-plugin/src/main/java/org maven-license-switcher-plugin/src/main/java/org/codelutin maven-license-switcher-plugin/src/main/java/org/codelutin/license maven-license-switcher-plugin/src/main/resources maven-license-switcher-plugin/src/main/resources/lgpl maven-license-switcher-plugin/src/site maven-licen
Author: tchemit Date: 2008-08-16 16:49:04 +0000 (Sat, 16 Aug 2008) New Revision: 1031 Added: trunk/maven-license-switcher-plugin/ trunk/maven-license-switcher-plugin/pom.xml trunk/maven-license-switcher-plugin/src/ trunk/maven-license-switcher-plugin/src/main/ trunk/maven-license-switcher-plugin/src/main/java/ trunk/maven-license-switcher-plugin/src/main/java/org/ trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/ trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/ trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseFilter.java trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseProcessor.java trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseType.java trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/SwitchLicenseMojo.java trunk/maven-license-switcher-plugin/src/main/resources/ trunk/maven-license-switcher-plugin/src/main/resources/lgpl/ trunk/maven-license-switcher-plugin/src/main/resources/lgpl/header.txt trunk/maven-license-switcher-plugin/src/main/resources/lgpl/license.txt trunk/maven-license-switcher-plugin/src/site/ trunk/maven-license-switcher-plugin/src/site/apt/ trunk/maven-license-switcher-plugin/src/site/apt/index.apt trunk/maven-license-switcher-plugin/src/site/apt/usage.apt trunk/maven-license-switcher-plugin/src/site/fml/ trunk/maven-license-switcher-plugin/src/site/fml/faq.fml trunk/maven-license-switcher-plugin/src/site/site.xml trunk/maven-license-switcher-plugin/src/site/xdoc/ trunk/maven-license-switcher-plugin/src/site/xdoc/fr/ trunk/maven-license-switcher-plugin/src/site/xdoc/fr/rst/ trunk/maven-license-switcher-plugin/src/site/xdoc/fr/rst/Todo.rst Log: nouveau plugin maven pour switcher la license d'un projet maven Property changes on: trunk/maven-license-switcher-plugin ___________________________________________________________________ Name: svn:ignore + target Added: trunk/maven-license-switcher-plugin/pom.xml =================================================================== --- trunk/maven-license-switcher-plugin/pom.xml (rev 0) +++ trunk/maven-license-switcher-plugin/pom.xml 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,131 @@ +<?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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinproject</artifactId> + <version>2.4</version> + </parent> + + <groupId>org.codelutin.plugin</groupId> + <artifactId>maven-license-switcher-plugin</artifactId> + + <dependencies> + + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0.4</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>2.0.4</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>lutinlib</groupId> + <artifactId>lutinprocessor</artifactId> + <version>0.13-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>xalan</groupId> + <artifactId>xalan</artifactId> + <version>2.7.0</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>lutinpluginutil</artifactId> + <version>0.1</version> + <scope>compile</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Plugin maven pour switcher les licenses</name> + <version>0.1</version> + <description>Plugin pour switcher de license dans un module maven 2</description> + <inceptionYear>2008</inceptionYear> + + <!-- BE WARE, this value must rewritten here since it will be otherwise suffixed by inheritance --> + <url>${labs.project.url}</url> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>maven-plugin</packaging> + + <build> + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + </plugin> + + <!-- jrst --> + <plugin> + <groupId>lutinplugin</groupId> + <artifactId>maven-jrst-plugin</artifactId> + </plugin> + + </plugins> + </build> + + <properties> + + <!-- id du projet du labs --> + <labs.id>12</labs.id> + + <!-- nom du projet sur le labs --> + <labs.project>lutinutil</labs.project> + + <!-- BE WARE, this value must rewritten here since it will be otherwise suffixed by inheritance --> + <maven.scm.url>https://${labs.host}/plugins/scmsvn/viewcvs.php/trunk/${pom.artifactId}?root=${labs.project} + </maven.scm.url> + + </properties> + + <!-- ************************************************************* --> + <!-- *** Build Environment ************************************** --> + <!-- ************************************************************* --> + + <scm> + <url>${maven.scm.url}</url> + </scm> + + <reporting> + <plugins> + <!--Site report's plugin--> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + </plugin> + </plugins> + </reporting> + +</project> Added: trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseFilter.java =================================================================== --- trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseFilter.java (rev 0) +++ trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseFilter.java 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,76 @@ +/** + * *##% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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. + * ##%* + */ +package org.codelutin.license; + +import org.codelutin.processor.filters.DefaultFilter; + +/** + * Un filtre pour remplacer la license d'un fichier source java. + * <p/> + * fixme : il faut ne pas autoriser le process de fichier java qui ne sont pas valide selon le header - footer... + * + * @author chemit + */ +public class LicenseFilter extends DefaultFilter { + + protected String header = "*##%"; + protected String footer = "##%*"; + /** + * la licence a insere dans le header du fichier source. Ce header est formatte en commentaire (chaque ligne + * commence par un ' * ', sauf pour la premiere et derniere ligne). + */ + protected String licenseHeader; + + /** flag pour indiquer si la licence a ete trouvee entre le header et le footer */ + protected boolean touched; + + public LicenseFilter(String licenseHeader) { + this.licenseHeader = " " + licenseHeader + " "; + } + + protected String performInFilter(String ch) { + if (wasTouched()) { + // on autorise pas deux process de la licence dans un fichier java + throw new IllegalStateException("has find more one time the license processor tags"); + } + touched = true; + return header + licenseHeader + footer; + } + + protected String performOutFilter(String ch) { + return ch; + } + + protected String getHeader() { + return header; + } + + protected String getFooter() { + return footer; + } + + @Override + public String flush() { + return super.flush(); + } + + public boolean wasTouched() { + return touched; + } + + public void reset() { + touched = false; + } +} Added: trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseProcessor.java =================================================================== --- trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseProcessor.java (rev 0) +++ trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseProcessor.java 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,39 @@ +/** + * *##% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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. + * ##%* + */ +package org.codelutin.license; + +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + +/** @author chemit */ +public class LicenseProcessor extends org.codelutin.processor.Processor { + + protected LicenseFilter licenseFilter; + + public LicenseProcessor(String header) { + licenseFilter = new LicenseFilter(header); + setInputFilter(licenseFilter); + } + + public LicenseFilter getLicenceFilter() { + return licenseFilter; + } + + public void process(File filein, File fileout) throws IOException { + process(new FileReader(filein), new FileWriter(fileout)); + } +} Added: trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseType.java =================================================================== --- trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseType.java (rev 0) +++ trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/LicenseType.java 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,54 @@ +/** + * *##% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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. + * ##%* + */ +package org.codelutin.license; + +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UnsupportedEncodingException; + +/** + * Une enumeration pour definir le type d'une licence a utiliser. + * <p/> + * Chaque licence doit definir 2 fichiers textes (licence.txt et header.txt) dans le repertoire <code>name().toLowerCase()</code> + * du classpath. + * <p/> + * La methode {@link #getLicenceFileReader(String)} permet de recuperer le contenu de la licence. + * <p/> + * La methode {@link #getLicenceHeaderReader(String)} permet de recuperer le contenu de l'en-tete de la licence a appliquer. + * + * @author chemit + */ +public enum LicenseType { + GPL, + LGPL; + + public Reader getLicenceFileReader(String encoding) throws UnsupportedEncodingException { + InputStream resource = getClass().getResourceAsStream(File.separator + name().toLowerCase() + File.separator + "license.txt"); + if (resource == null) { + throw new IllegalStateException("could not find license for " + this); + } + return new InputStreamReader(resource, encoding); + } + + public Reader getLicenceHeaderReader(String encoding) throws UnsupportedEncodingException { + InputStream resource = getClass().getResourceAsStream(File.separator + name().toLowerCase() + File.separator + "header.txt"); + if (resource == null) { + throw new IllegalStateException("could not find license header for " + this); + } + return new InputStreamReader(resource, encoding); + } +} Added: trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/SwitchLicenseMojo.java =================================================================== --- trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/SwitchLicenseMojo.java (rev 0) +++ trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/SwitchLicenseMojo.java 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,274 @@ +/** + * *##% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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. + * ##%* + */ +package org.codelutin.license; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.DirectoryScanner; +import org.codelutin.util.FileUtil; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.util.Calendar; +import java.util.Date; + +/** + * Le goal pour switcher les licenses de tous les sources java d'un module maven et de positionner le fichier LICENSE.txt + * + * @author chemit + * @goal switch + * @phase process-sources + */ +public class SwitchLicenseMojo extends AbstractMojo { + + /** + * Dependance du projet. + * + * @parameter default-value="${project}" + * @readonly + */ + protected MavenProject project; + + /** + * l'annee de creation du module (sera place dans le header) + * + * @parameter default-value="${project.inceptionYear}" + * @required + */ + protected String inceptionYear; + + /** + * le nom de l'organisation ( sera place dans le header) + * + * @parameter default-value="${project.organization.name}" + * @required + * @readonly + */ + protected String organizationName; + + /** + * le nom du projet ( sera place dans le header) + * + * @parameter default-value="${project.name}" + * @required + * @readonly + */ + protected String projectName; + + + /** + * encoding a utiliser pour lire et ecrire les fichiers. + * + * @parameter expression="${licence-switcher.encoding}" default-value="${maven.compile.encoding}" + * @required + */ + protected String encoding; + + /** + * Repertoire des fichiers sources a traiter. + * + * @parameter expression="${license-switcher.src}" default-value="${basedir}/src/main/java" + * @required + * @readonly + */ + protected File src; + + /** + * Fichier de la licence du module. + * + * @parameter expression="${license-switcher.licenceFile}" default-value="${basedir}/LICENSE.txt" + * @required + * @readonly + */ + protected File licenseFile; + + /** + * Le type de license a appliquer. + * + * @parameter expression="${license-switcher.licenseType}" default-value="LGPL" + * @required + */ + protected String licenseType; + + /** + * un flag pour conserver un backup des fichiers modifies + * + * @parameter expression="${license-switcher.keepBackup}" default-value="false" + */ + protected boolean keepBackup; + + /** + * un flag pour avoir les traces + * + * @parameter expression="${license-switcher.verbose}" default-value="false" + */ + protected boolean verbose; + + + /** le header a ajouter dans chaque fichier java */ + protected String licenseHeaderContent; + + /** le texte de la licence a placer dans le fichier ${basedir}/LICENSE.txt */ + protected String licenseFileContent; + + /** la liste des chemin relatifs des sources java a traiter a partir de {@link #src} */ + protected String[] javaFilesToTreate; + + protected long timestamp; + + public void execute() throws MojoExecutionException, MojoFailureException { + try { + init(); + } catch (IOException e) { + throw new MojoExecutionException("could not init goal for reason : " + e.getMessage(), e); + } + + // write project license + writeLicense(); + + if (javaFilesToTreate.length == 0) { + getLog().warn("no java source files to treate."); + return; + } + + // create a licence processor with given header + LicenseProcessor p = new LicenseProcessor(licenseHeaderContent); + + for (String javaRelativePath : javaFilesToTreate) { + + File sourceFile = new File(src, javaRelativePath); + + try { + processJavaSource(p, sourceFile); + } catch (Exception e) { + throw new MojoExecutionException("could not treate java source file " + sourceFile + " for reason : " + e.getMessage(), e); + } + } + } + + protected void writeLicense() throws MojoExecutionException { + if (licenseFile.exists() && keepBackup) { + if (verbose) { + getLog().info("backup " + licenseFile); + } + // copy it to backup file + File backup = new File(licenseFile.getAbsolutePath() + "~"); + licenseFile.renameTo(backup); + } + try { + FileUtil.writeString(licenseFile, licenseFileContent, encoding); + } catch (IOException e) { + throw new MojoExecutionException("could not write license file " + licenseFile + " for reason : " + e.getMessage(), e); + } + } + + /** + * @param p license processor + * @param sourceFile the java source file where to switch (or add the licence) + * @throws java.io.IOException if IO pb + */ + protected void processJavaSource(LicenseProcessor p, File sourceFile) throws Exception { + if (verbose) { + getLog().info("treate file " + sourceFile); + } + + File processFile = new File(sourceFile.getAbsolutePath() + "_" + timestamp); + + try { + p.process(sourceFile, processFile); + + if (!p.getLicenceFilter().wasTouched()) { + addLicenseToJavaSourceFile(sourceFile, processFile); + } + + if (keepBackup) { + File backupFile = new File(sourceFile.getAbsolutePath() + "~"); + if (verbose) { + getLog().debug("backup original file " + sourceFile); + } + sourceFile.renameTo(backupFile); + } + processFile.renameTo(sourceFile); + + } catch (Exception e) { + getLog().error("could not process file " + sourceFile + " for reason " + e.getMessage(), e); + processFile.delete(); + throw e; + } finally { + p.getLicenceFilter().reset(); + } + } + + protected void addLicenseToJavaSourceFile(File sourceFile, File processFile) throws IOException { + getLog().warn("no license was found on file " + sourceFile + ", adding one"); + String content = FileUtil.readAsString(sourceFile, encoding); + content = "/**\n * *##% " + licenseHeaderContent + " ##%*\n */\n" + content; + FileUtil.writeString(processFile, content, encoding); + } + + protected void init() throws IOException { + + timestamp = System.nanoTime(); + + LicenseType type = LicenseType.valueOf(licenseType); + + // obtain content of license file + licenseFileContent = FileUtil.readAsString(type.getLicenceFileReader(encoding)); + + // obtain content of license header + String tmpHeader = FileUtil.readAsString(type.getLicenceHeaderReader(encoding)); + + // defined inceptionYear (if year is older than now suffix with a - thisYear) + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + String thisYear = cal.get(Calendar.YEAR) + ""; + if (!thisYear.equals(inceptionYear)) { + inceptionYear = inceptionYear + " - " + thisYear; + } + + // format header with projet informations + tmpHeader = String.format(tmpHeader, projectName, inceptionYear, organizationName); + + // add " * " before each line + BufferedReader reader = new BufferedReader(new java.io.StringReader(tmpHeader)); + StringBuilder sb = new StringBuilder(); + + String line = reader.readLine(); + sb.append(line).append('\n'); + while ((line = reader.readLine()) != null) { + sb.append(" * ").append(line).append("\n"); + } + tmpHeader = sb.toString(); + licenseHeaderContent = tmpHeader.substring(0, tmpHeader.length() - 1); + + if (verbose) { + getLog().info("header to write on java source files \n" + licenseHeaderContent); + } + + // init directory scanner + DirectoryScanner ds = new DirectoryScanner(); + ds.setBasedir(src); + ds.setIncludes(new String[]{"**\\/*.java"}); + + // scan + ds.scan(); + + // get files + javaFilesToTreate = ds.getIncludedFiles(); + } +} Added: trunk/maven-license-switcher-plugin/src/main/resources/lgpl/header.txt =================================================================== --- trunk/maven-license-switcher-plugin/src/main/resources/lgpl/header.txt (rev 0) +++ trunk/maven-license-switcher-plugin/src/main/resources/lgpl/header.txt 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,15 @@ +%1$s +Copyright (C) %2$s %3$s + +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/>. Added: trunk/maven-license-switcher-plugin/src/main/resources/lgpl/license.txt =================================================================== --- trunk/maven-license-switcher-plugin/src/main/resources/lgpl/license.txt (rev 0) +++ trunk/maven-license-switcher-plugin/src/main/resources/lgpl/license.txt 2008-08-16 16:49:04 UTC (rev 1031) @@ -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/maven-license-switcher-plugin/src/site/apt/index.apt =================================================================== --- trunk/maven-license-switcher-plugin/src/site/apt/index.apt (rev 0) +++ trunk/maven-license-switcher-plugin/src/site/apt/index.apt 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,28 @@ + ------ + Introduction + ------ + Tony Chemit + ------ + August 2008 + ------ + +Maven licence-switcher Plugin + + The Maven Licence Switcher Plugin is used to switch the licence on java sources of a maven module. + +* Goals Overview + + The plugin has the following goals: + + * {{{switch-mojo.html}llicence-switcher:switch}} parse Java sources and switch licence header. + + + * {{{help-mojo.html}licence-switcher:help}} display help. + +* Usage + + Instructions on how to use the Plugin can be found {{{usage.html}here}}. + +* Examples + + to be done. Added: trunk/maven-license-switcher-plugin/src/site/apt/usage.apt =================================================================== --- trunk/maven-license-switcher-plugin/src/site/apt/usage.apt (rev 0) +++ trunk/maven-license-switcher-plugin/src/site/apt/usage.apt 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,22 @@ + ------ + Usage + ------ + Tony Chemit + ------ + August 2008 + ------ + +Usage + + Below are the different goals and configurations of the plugin. + +* The <<<switch>>> Mojo + + The <<<switch>>> mojo is used to switch licence header on each java source files and add a LICENCE.txt file on the + basedir of the project. + ++-----+ +mvn switch-licence:switch ++-----+ + +To be done. Added: trunk/maven-license-switcher-plugin/src/site/fml/faq.fml =================================================================== --- trunk/maven-license-switcher-plugin/src/site/fml/faq.fml (rev 0) +++ trunk/maven-license-switcher-plugin/src/site/fml/faq.fml 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,33 @@ +<?xml version="1.0"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<faqs id="FAQ" title="Frequently Asked Questions"> + <part id="General"> + <faq id="Test question?"> + <question>test question?</question> + <answer> + <p> + The first answer :) + </p> + </answer> + </faq> + </part> +</faqs> \ No newline at end of file Added: trunk/maven-license-switcher-plugin/src/site/site.xml =================================================================== --- trunk/maven-license-switcher-plugin/src/site/site.xml (rev 0) +++ trunk/maven-license-switcher-plugin/src/site/site.xml 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="${project.name}"> + + <skin> + <groupId>lutinlib</groupId> + <artifactId>lutin-site-skin</artifactId> + <version>0.1</version> + </skin> + + <bannerLeft> + <name>${project.name}</name> + </bannerLeft> + + <bannerRight> + <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> + <href>${project.organization.url}</href> + </bannerRight> + + <poweredBy> + <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> + <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> + <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" + img="images/restructuredtext-logo.png"/> + </poweredBy> + + <body> + <links> + <item name="Labs" href="http://labs.libre-entreprise.org/"/> + <item name="${project.organization.name}" href="${project.organization.url}"/> + </links> + + <menu name="Utilisateur"> + <item name="Introduction" href="index.html"/> + <item name="Goals" href="plugin-info.html"/> + <item name="Usage" href="usage.html"/> + <item name="FAQ" href="faq.html"/> + </menu> + <menu name="Examples"> + <item name="To be done"/> + <!--item name="To be done" href="/examples/describe-configuration.html"/--> + </menu> + + <menu name="Téléchargement"> + <item href="${labs.builder.url}/lutinplugin/${project.artifactId}/${project.version}" + name="Télécharger la dernière version"/> + <item href="${labs.builder.url}/lutinplugin/${project.artifactId}" + name="Voir toutes les versions"/> + </menu> + + <menu name="Développeur"> + <item name="A faire" href="Todo.html"/> + </menu> + + <menu ref="reports"/> + + </body> +</project> Added: trunk/maven-license-switcher-plugin/src/site/xdoc/fr/rst/Todo.rst =================================================================== --- trunk/maven-license-switcher-plugin/src/site/xdoc/fr/rst/Todo.rst (rev 0) +++ trunk/maven-license-switcher-plugin/src/site/xdoc/fr/rst/Todo.rst 2008-08-16 16:49:04 UTC (rev 1031) @@ -0,0 +1,4 @@ +TODO +==== + +Any idea ?
participants (1)
-
tchemit@users.labs.libre-entreprise.org