r1752 - in trunk/src: it/update-file-header it/update-file-header/src it/update-file-header/src/files it/update-file-header/src/files/apt it/update-file-header/src/files/properties it/update-file-header/src/files/rst it/update-file-header/src/files/xml it/update-file-header/src/license main/java/org/nuiton/license/plugin main/java/org/nuiton/license/plugin/header/transformer site/rst
Author: tchemit Date: 2010-04-15 21:00:41 +0200 (Thu, 15 Apr 2010) New Revision: 1752 Log: - Anomalie #526: rst and apt header are not stable - fix rst headers - uniformize add-thrid-party with update-project-license Added: trunk/src/it/update-file-header/src/files/ trunk/src/it/update-file-header/src/files/apt/ trunk/src/it/update-file-header/src/files/apt/index.apt trunk/src/it/update-file-header/src/files/apt/index2.apt trunk/src/it/update-file-header/src/files/properties/ trunk/src/it/update-file-header/src/files/properties/test.properties trunk/src/it/update-file-header/src/files/properties/test2.properties trunk/src/it/update-file-header/src/files/rst/ trunk/src/it/update-file-header/src/files/rst/index.rst trunk/src/it/update-file-header/src/files/rst/index2.rst trunk/src/it/update-file-header/src/files/xml/ trunk/src/it/update-file-header/src/files/xml/test.xml trunk/src/it/update-file-header/src/files/xml/test2.xml Modified: trunk/src/it/update-file-header/pom.xml trunk/src/it/update-file-header/src/license/project.xml trunk/src/it/update-file-header/verify.groovy trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java trunk/src/site/rst/descriptor.rst trunk/src/site/rst/header.rst trunk/src/site/rst/index.rst trunk/src/site/rst/usage.rst Modified: trunk/src/it/update-file-header/pom.xml =================================================================== --- trunk/src/it/update-file-header/pom.xml 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/it/update-file-header/pom.xml 2010-04-15 19:00:41 UTC (rev 1752) @@ -43,6 +43,7 @@ <version>@pom.version@</version> <configuration> <verbose>true</verbose> + <addSvnKeyWords>true</addSvnKeyWords> </configuration> <executions> <execution> Added: trunk/src/it/update-file-header/src/files/apt/index.apt =================================================================== --- trunk/src/it/update-file-header/src/files/apt/index.apt (rev 0) +++ trunk/src/it/update-file-header/src/files/apt/index.apt 2010-04-15 19:00:41 UTC (rev 1752) @@ -0,0 +1 @@ +My file Property changes on: trunk/src/it/update-file-header/src/files/apt/index.apt ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-file-header/src/files/apt/index2.apt =================================================================== --- trunk/src/it/update-file-header/src/files/apt/index2.apt (rev 0) +++ trunk/src/it/update-file-header/src/files/apt/index2.apt 2010-04-15 19:00:41 UTC (rev 1752) @@ -0,0 +1,25 @@ +~~~ +~~ #%L +~~ License Test :: update-file-header +~~ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2012 License Test +~~ %% +~~ 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 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 Public License for more details. +~~ +~~ You should have received a copy of the GNU General Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/gpl-3.0.html>. +~~ #L% +~~~ +My file Property changes on: trunk/src/it/update-file-header/src/files/apt/index2.apt ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-file-header/src/files/properties/test.properties =================================================================== --- trunk/src/it/update-file-header/src/files/properties/test.properties (rev 0) +++ trunk/src/it/update-file-header/src/files/properties/test.properties 2010-04-15 19:00:41 UTC (rev 1752) @@ -0,0 +1 @@ +my.key=true \ No newline at end of file Property changes on: trunk/src/it/update-file-header/src/files/properties/test.properties ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-file-header/src/files/properties/test2.properties =================================================================== --- trunk/src/it/update-file-header/src/files/properties/test2.properties (rev 0) +++ trunk/src/it/update-file-header/src/files/properties/test2.properties 2010-04-15 19:00:41 UTC (rev 1752) @@ -0,0 +1,26 @@ +### +# #%L +# License Test :: update-file-header +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2012 License Test +# %% +# 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 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 Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/gpl-3.0.html>. +# #L% +### + +my.key=true \ No newline at end of file Property changes on: trunk/src/it/update-file-header/src/files/properties/test2.properties ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-file-header/src/files/rst/index.rst =================================================================== --- trunk/src/it/update-file-header/src/files/rst/index.rst (rev 0) +++ trunk/src/it/update-file-header/src/files/rst/index.rst 2010-04-15 19:00:41 UTC (rev 1752) @@ -0,0 +1 @@ +My File \ No newline at end of file Property changes on: trunk/src/it/update-file-header/src/files/rst/index.rst ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-file-header/src/files/rst/index2.rst =================================================================== --- trunk/src/it/update-file-header/src/files/rst/index2.rst (rev 0) +++ trunk/src/it/update-file-header/src/files/rst/index2.rst 2010-04-15 19:00:41 UTC (rev 1752) @@ -0,0 +1,26 @@ +My file + +.. - +.. * #%L +.. * Maven License Plugin +.. * +.. * $Id$ +.. * $HeadURL$ +.. * %% +.. * Copyright (C) 2008 - 2010 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>. +.. * #L% +.. \ No newline at end of file Property changes on: trunk/src/it/update-file-header/src/files/rst/index2.rst ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-file-header/src/files/xml/test.xml =================================================================== --- trunk/src/it/update-file-header/src/files/xml/test.xml (rev 0) +++ trunk/src/it/update-file-header/src/files/xml/test.xml 2010-04-15 19:00:41 UTC (rev 1752) @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<yo/> \ No newline at end of file Property changes on: trunk/src/it/update-file-header/src/files/xml/test.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-file-header/src/files/xml/test2.xml =================================================================== --- trunk/src/it/update-file-header/src/files/xml/test2.xml (rev 0) +++ trunk/src/it/update-file-header/src/files/xml/test2.xml 2010-04-15 19:00:41 UTC (rev 1752) @@ -0,0 +1,27 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- + #%L + License Test :: update-file-header + + $Id$ + $HeadURL$ + %% + Copyright (C) 2012 License Test + %% + 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 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 Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> + +<yo/> \ No newline at end of file Property changes on: trunk/src/it/update-file-header/src/files/xml/test2.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/it/update-file-header/src/license/project.xml =================================================================== --- trunk/src/it/update-file-header/src/license/project.xml 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/it/update-file-header/src/license/project.xml 2010-04-15 19:00:41 UTC (rev 1752) @@ -3,11 +3,47 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-1.0.0.xsd"> <mainLicense>gpl_v3</mainLicense> - <header> - <commentStyle>java</commentStyle> - <fileSet> - <basedir>src/main/java</basedir> - <include>**/*.java</include> - </fileSet> - </header> + <headers> + + <header> + <commentStyle>java</commentStyle> + <fileSet> + <basedir>src/main/java</basedir> + <include>**/*.java</include> + </fileSet> + </header> + + <header> + <commentStyle>apt</commentStyle> + <fileSet> + <basedir>src/files</basedir> + <include>**/*.apt</include> + </fileSet> + </header> + + <header> + <commentStyle>rst</commentStyle> + <fileSet> + <basedir>src/files</basedir> + <include>**/*.rst</include> + </fileSet> + </header> + + <header> + <commentStyle>xml</commentStyle> + <fileSet> + <basedir>src/files</basedir> + <include>**/*.xml</include> + </fileSet> + </header> + + <header> + <commentStyle>properties</commentStyle> + <fileSet> + <basedir>src/files</basedir> + <include>**/*.properties</include> + </fileSet> + </header> + + </headers> </project> Modified: trunk/src/it/update-file-header/verify.groovy =================================================================== --- trunk/src/it/update-file-header/verify.groovy 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/it/update-file-header/verify.groovy 2010-04-15 19:00:41 UTC (rev 1752) @@ -21,4 +21,91 @@ assert content.contains( ' * yet another license' ); assert content.contains( ' * Copyright (C) 2000 Codelutin Do not update!' ); +file = new File(basedir, 'src/files/apt/index.apt'); +assert file.exists(); + +content = file.text; +assert content.contains( 'Copyright (C)' ); +assert content.contains( '~~ #%L' ); +assert content.contains( '~~ #L%' ); +assert content.contains( '$Id' ); +assert ! content.contains( '~~ ~~'); + + +file = new File(basedir, 'src/files/apt/index2.apt'); +assert file.exists(); + +content = file.text; +assert content.contains( 'Copyright (C)' ); +assert content.contains( '~~ #%L' ); +assert content.contains( '~~ #L%' ); +assert content.contains( '$Id' ); +assert ! content.contains( '~~ ~~'); + + +file = new File(basedir, 'src/files/rst/index.rst'); +assert file.exists(); + +content = file.text; +assert content.contains( 'Copyright (C)' ); +assert content.contains( '.. * #%L' ); +assert content.contains( '.. * #L%' ); +assert content.contains( '$Id' ); +assert ! content.contains( '.. * .. *'); + + +file = new File(basedir, 'src/files/rst/index2.rst'); +assert file.exists(); + +content = file.text; +assert content.contains( 'Copyright (C)' ); +assert content.contains( '.. * #%L' ); +assert content.contains( '.. * #L%' ); +assert content.contains( '$Id' ); +assert ! content.contains( '.. * .. *'); + + +file = new File(basedir, 'src/files/xml/test.xml'); +assert file.exists(); + +content = file.text; +assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" ); +assert content.contains( 'Copyright (C)' ); +assert content.contains( '#%L' ); +assert content.contains( '#L%' ); +assert content.contains( '$Id' ); + + +file = new File(basedir, 'src/files/xml/test2.xml'); +assert file.exists(); + +content = file.text; +assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" ); +assert content.contains( 'Copyright (C)' ); +assert content.contains( '#%L' ); +assert content.contains( '#L%' ); +assert content.contains( '$Id' ); + +file = new File(basedir, 'src/files/properties/test.properties'); +assert file.exists(); + +content = file.text; +assert content.contains( 'Copyright (C)' ); +assert content.contains( '# #%L' ); +assert content.contains( '# #L%' ); +assert !content.contains( '# # \n' ); +assert content.contains( '$Id' ); + + +file = new File(basedir, 'src/files/properties/test2.properties'); +assert file.exists(); + +content = file.text; +assert content.contains( 'Copyright (C)' ); +assert content.contains( '# #%L' ); +assert content.contains( '# #L%' ); +assert content.contains( '# #%L' ); +assert !content.contains( '# # \n' ); +assert content.contains( '$Id' ); + return true; Modified: trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java 2010-04-15 19:00:41 UTC (rev 1752) @@ -103,10 +103,21 @@ * * @parameter expression="${license.generateBundle}" default-value="false" * @since 1.0.0 + * @deprecated since 2.2 (use instead {@code generateBundle} */ + @Deprecated protected boolean copyToMETA_INF; /** + * Un flag pour faire une copie nommé dans META-INF (prefixe avec le nom de + * l'artifact). + * + * @parameter expression="${license.generateBundle}" default-value="false" + * @since 1.0.0 + */ + protected boolean generateBundle; + + /** * Local Repository. * * @parameter expression="${localRepository}" @@ -184,6 +195,10 @@ setVerbose(true); } + if (copyToMETA_INF) { + generateBundle = true; + } + doGenerate = true; thirdPartyFile = new File(outputDirectory, thirdPartyFilename); @@ -235,7 +250,7 @@ } writeFile(thirdPartyFile, thirdPartyFileContent, getEncoding()); } - if (copyToMETA_INF) { + if (generateBundle) { copyFile(thirdPartyFile, new File( outputDirectory, "META-INF" + File.separator + getProject().getArtifactId() + Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-04-15 19:00:41 UTC (rev 1752) @@ -284,6 +284,15 @@ // remove comment prefix line = line.substring(index + prefixLength); + } else { + String s = getCommentLinePrefix().trim(); + if (line.startsWith(s)) { + if (line.length() <= s.length()) { + line = ""; + } + } else { + line = line.substring(s.length()); + } } buffer.append(line).append(LINE_SEPARATOR); } Modified: trunk/src/site/rst/descriptor.rst =================================================================== --- trunk/src/site/rst/descriptor.rst 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/site/rst/descriptor.rst 2010-04-15 19:00:41 UTC (rev 1752) @@ -13,7 +13,7 @@ .. - .. * #%L .. * Maven License Plugin -.. * .. * +.. * .. * $Id$ .. * $HeadURL$ .. * %% Modified: trunk/src/site/rst/header.rst =================================================================== --- trunk/src/site/rst/header.rst 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/site/rst/header.rst 2010-04-15 19:00:41 UTC (rev 1752) @@ -13,7 +13,7 @@ .. - .. * #%L .. * Maven License Plugin -.. * .. * +.. * .. * $Id$ .. * $HeadURL$ .. * %% Modified: trunk/src/site/rst/index.rst =================================================================== --- trunk/src/site/rst/index.rst 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/site/rst/index.rst 2010-04-15 19:00:41 UTC (rev 1752) @@ -13,7 +13,7 @@ .. - .. * #%L .. * Maven License Plugin -.. * .. * +.. * .. * $Id$ .. * $HeadURL$ .. * %% Modified: trunk/src/site/rst/usage.rst =================================================================== --- trunk/src/site/rst/usage.rst 2010-04-15 13:57:24 UTC (rev 1751) +++ trunk/src/site/rst/usage.rst 2010-04-15 19:00:41 UTC (rev 1752) @@ -12,7 +12,7 @@ .. - .. * #%L .. * Maven License Plugin -.. * .. * +.. * .. * $Id$ .. * $HeadURL$ .. * %%
participants (1)
-
tchemit@users.nuiton.org