r1759 - in trunk: . src/main/java/org/nuiton/license/plugin src/site src/site/fr/apt src/site/resources
Author: tchemit Date: 2010-04-16 19:17:45 +0200 (Fri, 16 Apr 2010) New Revision: 1759 Log: - finalize documentation - improve xsd generation (keep it in src/site/resources) - improve final log of update-file-header Added: trunk/src/site/resources/ trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd Modified: trunk/pom.xml trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java trunk/src/site/fr/apt/descriptor.apt trunk/src/site/fr/apt/index.apt Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-04-16 16:32:53 UTC (rev 1758) +++ trunk/pom.xml 2010-04-16 17:17:45 UTC (rev 1759) @@ -321,9 +321,13 @@ <!-- Source control management. --> <scm> - <connection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk</connection> - <developerConnection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk</developerConnection> - <url>http://www.nuiton.org/repositories/browse/maven-license-plugin/trunk</url> + <connection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk + </connection> + <developerConnection> + scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk + </developerConnection> + <url>http://www.nuiton.org/repositories/browse/maven-license-plugin/trunk + </url> </scm> <!-- ************************************************************* --> @@ -334,14 +338,16 @@ <properties> - <siteSourcesType>apt</siteSourcesType> - + <!-- processor version --> <processor.version>1.0.2</processor.version> - <!-- version of project license descriptor model --> + <!-- license project descriptor model version --> <mdoVersion>1.0.0</mdoVersion> - <!-- documentation is in english --> + <!-- documentation is in apt format --> + <siteSourcesType>apt</siteSourcesType> + + <!-- documentation is in english then french --> <siteLocales>en,fr</siteLocales> </properties> @@ -359,6 +365,9 @@ <version>${mdoVersion}</version> <lineLength>80</lineLength> <useJava5>true</useJava5> + <models> + <model>src/main/mdo/descriptor.mdo</model> + </models> </configuration> <executions> <execution> @@ -366,9 +375,7 @@ <phase>generate-sources</phase> <goals> <goal>xpp3-reader</goal> - <goal>xpp3-writer</goal> <goal>java</goal> - <goal>xsd</goal> </goals> <configuration> <models> @@ -377,16 +384,13 @@ </configuration> </execution> <execution> - <id>mdo-site</id> - <phase>pre-site</phase> + <id>mdo-xsd</id> + <phase>generate-resources</phase> <goals> - <goal>xdoc</goal> <goal>xsd</goal> </goals> <configuration> - <models> - <model>src/main/mdo/descriptor.mdo</model> - </models> + <outputDirectory>src/site/resources</outputDirectory> </configuration> </execution> </executions> @@ -460,7 +464,7 @@ </activation> <build> - + <plugins> <plugin> @@ -474,28 +478,8 @@ </executions> </plugin> - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <!-- TC-20100117 : 1.3 does not works here --> - <version>1.2</version> - <executions> - <!-- copy generated xsd to site --> - <execution> - <id>copy-descriptor-xsd</id> - <phase>pre-site</phase> - <configuration> - <tasks> - <copy verbose="${maven.verbose}" failonerror="false" overwrite="false" file="target/generated-site/xsd/licenseProjectDescriptor-${mdoVersion}.xsd" tofile="target/site/licenseProjectDescriptor-${mdoVersion}.xsd"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> </plugins> - + </build> </profile> Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-04-16 16:32:53 UTC (rev 1758) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-04-16 17:17:45 UTC (rev 1759) @@ -245,7 +245,7 @@ if (isUpdateCopyright()) { - getLog().warn("updateCopyright is not still available..."); + getLog().warn("\n\nupdateCopyright is not still available...\n\n"); //TODO-TC20100409 checks scm // checks scm is ok // for the moment, will only deal with svn except if scm @@ -267,6 +267,8 @@ @Override public void doAction() throws Exception { + long t0 = System.nanoTime(); + clear(); processedFiles = new HashSet<File>(); @@ -281,18 +283,34 @@ } finally { - StringBuilder buffer = new StringBuilder(); + int nbFiles = getProcessedFiles().size(); + if (nbFiles == 0) { + getLog().warn("No file to scan."); + } else { + String delay = PluginHelper.convertTime(System.nanoTime() - t0); + String message = String.format( + "Scan %s file%s header done in %s.", + nbFiles, + nbFiles > 1 ? "s" : "", + delay + ); + getLog().info(message); + } + Set<FileState> states = result.keySet(); + if (states.size() == 1 && states.contains(FileState.uptodate)) { + // all files where up to date + getLog().info("All files are up-to-date."); + } else { - String format = "Operation result on %1$s file(s) :"; - buffer.append(String.format(format, getProcessedFiles().size())); + StringBuilder buffer = new StringBuilder(); + for (FileState state : FileState.values()) { - for (FileState state : FileState.values()) { + reportType(state, buffer); + } - reportType(state, buffer); + getLog().info(buffer.toString()); } - getLog().info(buffer.toString()); - // clean internal states if (isClearAfterOperation()) { clear(); Modified: trunk/src/site/fr/apt/descriptor.apt =================================================================== --- trunk/src/site/fr/apt/descriptor.apt 2010-04-16 16:32:53 UTC (rev 1758) +++ trunk/src/site/fr/apt/descriptor.apt 2010-04-16 17:17:45 UTC (rev 1759) @@ -40,7 +40,7 @@ xsd - Ce fichier est géré par un {{{./licenseProjectDescriptor-1.0.0.xsd}fichier xsd}}. + Ce fichier est géré par un {{{../licenseProjectDescriptor-1.0.0.xsd}fichier xsd}}. Exemple Modified: trunk/src/site/fr/apt/index.apt =================================================================== --- trunk/src/site/fr/apt/index.apt 2010-04-16 16:32:53 UTC (rev 1758) +++ trunk/src/site/fr/apt/index.apt 2010-04-16 17:17:45 UTC (rev 1759) @@ -86,15 +86,20 @@ Le plugin a les goals suivants : - * {{{./update-project-license-mojo.html}update-project-license}} ajoute ou met à jour les fichiers de license du projet (depuis 2.1). + * {{{./update-project-license-mojo.html}update-project-license}} ajoute ou + met à jour les fichiers de license du projet (depuis 2.1). - * {{{./update-file-header-mojo.html}update-file-header}} ajoute ou met à jour les headers de license des fichiers (depuis 2.1). + * {{{./update-file-header-mojo.html}update-file-header}} ajoute ou met à jour + les headers de license des fichiers (depuis 2.1). - * {{{./add-third-party-mojo.html}add-third-party}} crée le fichier THIRD-PARTY.txt dans le build. + * {{{./add-third-party-mojo.html}add-third-party}} crée le fichier + <THIRD-PARTY.txt> dans le build. - * {{{./comment-style-list-mojo.html}comment-style-list}} Affiche la liste des styles de commentaire disponibles (depuis 2.1). + * {{{./license-list-mojo.html}license-list}} Affiche la liste des licenses + disponibles. - * {{{./license-list-mojo.html}license-list}} Affiche la liste des licenses disponibles. + * {{{./comment-style-list-mojo.html}comment-style-list}} Affiche la liste des + styles de commentaire disponibles (depuis 2.1). * {{{./help-mojo.html}help}} Affiche l'aide du plugin (goals, usage). Added: trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd =================================================================== --- trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd (rev 0) +++ trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd 2010-04-16 17:17:45 UTC (rev 1759) @@ -0,0 +1,254 @@ +<?xml version="1.0"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" targetNamespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"> + <xs:element name="project" type="LicenseProjectDescriptor"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + The license project descriptor describe licenses used in a project. + <p/> + <ul> + <li>mainLicense of the project</li> + <li>headers to update (or add) on sources of the project</li> + </ul> + + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:complexType name="LicenseProjectDescriptor"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + The license project descriptor describe licenses used in a project. + <p/> + <ul> + <li>mainLicense of the project</li> + <li>headers to update (or add) on sources of the project</li> + </ul> + + </xs:documentation> + </xs:annotation> + <xs:all> + <xs:element minOccurs="0" name="mainLicense" type="xs:string"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + The main license of the project (or module). The LICENSE.txt will + contains the content of this license. + + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="headers"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + Collection of header. + + {@link Header} + + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="header" minOccurs="0" maxOccurs="unbounded" type="Header"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element minOccurs="0" name="header" type="Header"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + To add a single header. + + {@link Header} + + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:all> + </xs:complexType> + <xs:complexType name="Header"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + A Header represents a set of resources using the same {@code header type}. + <p/> + The licenseName can be inherited by the mainLicense of the project. + + </xs:documentation> + </xs:annotation> + <xs:all> + <xs:element minOccurs="0" name="licenseName" type="xs:string"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + The license to apply in this set. If not fill, will use + the main license. + + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="commentStyle" type="xs:string"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + The style of the comment which box the header to generate (or updates). + + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="fileSets"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + Specifies file sets to include in the license set. A fileSet is + specified by providing one or more of <licenseSet> subelements. + + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="fileSet" minOccurs="0" maxOccurs="unbounded" type="FileSet"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element minOccurs="0" name="fileSet" type="FileSet"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + Specifies a single file sets to include in the license set. A fileSet is + specified by providing one or more of <licenseSet> subelements. + + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:all> + </xs:complexType> + <xs:complexType name="FileSet"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + A fileSet allows the inclusion of groups of files into the license set + and defines also the type of header to generate. + + </xs:documentation> + </xs:annotation> + <xs:all> + <xs:element minOccurs="0" name="useDefaultExcludes" type="xs:boolean" default="true"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + Whether standard exclusion patterns, such as those matching CVS and + Subversion + metadata files, should be used when calculating the files affected + by this set. + For backward compatibility, the default value is true. (Since 2.2) + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="basedir" type="xs:string"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + Sets the basedir directory relative to the root + of the root directory of the assembly. For example, + "log" will put the specified files in the log directory. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="includes"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + When <include> subelements are present, they define a set of + files and directory to include. If none is present, then + <includes> represents all valid values. + + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="include" minOccurs="0" maxOccurs="unbounded" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element minOccurs="0" name="include" type="xs:string"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + <p> + To add a single include. + </p> + When <include> subelements are present, they define a set of + files and directory to include. If none is present, then + <includes> represents all valid values. + + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="excludes"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + When <exclude> subelements are present, they define a set of + files and directory to exclude. If none is present, then + <excludes> represents no exclusions. + + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="exclude" minOccurs="0" maxOccurs="unbounded" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element minOccurs="0" name="exclude" type="xs:string"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + <p> + To add a single exclude. + </p> + When <exclude> subelements are present, they define a set of + files and directory to exclude. If none is present, then + <excludes> represents no exclusions. + + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="lineEnding" type="xs:string"> + <xs:annotation> + <xs:documentation source="version">1.0.0+</xs:documentation> + <xs:documentation source="description"> + + Sets the line-endings of the files in this fileSet. + Valid values: + <ul> + <li><b>"keep"</b> - Preserve all line endings</li> + <li><b>"unix"</b> - Use Unix-style line endings</li> + <li><b>"lf"</b> - Use a single line-feed line endings</li> + <li><b>"dos"</b> - Use DOS-style line endings</li> + <li><b>"crlf"</b> - Use Carraige-return, line-feed line endings</li> + </ul> + + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:all> + </xs:complexType> +</xs:schema> \ No newline at end of file Property changes on: trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL
participants (1)
-
tchemit@users.nuiton.org