maven-plugins/license/plugin.jelly
evenisse 85df922d35 Update to ASL v.2
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114795 13f79535-47bb-0310-9956-ffa450edef68
2004-03-04 18:40:25 +00:00

125 lines
4.3 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
-->
<project
xmlns:j="jelly:core"
xmlns:define="jelly:define"
xmlns:doc="doc"
xmlns:license="license"
xmlns:util="jelly:util">
<define:taglib uri="license">
<define:tag name="fileName">
<j:set var="licenseX" value='${maven.license.licenseFile}X'/>
<j:choose>
<j:when test="${licenseX != 'X'}">
<j:set var="licenseFile" value='${maven.license.licenseFile}'/>
</j:when>
<j:otherwise>
<j:set var="licenseFile" value='${basedir}/LICENSE.txt'/>
</j:otherwise>
</j:choose>
<j:whitespace trim="yes">${licenseFile}</j:whitespace>
</define:tag>
<define:tag name="relativeFileName" trim="yes">
<!-- get the license file and replace backslashes with forwards -->
<util:replace var="forwardSlashFile" oldChar="\" newChar="/" trim="yes">
<license:fileName />
</util:replace>
<!-- change basedir to have forward slashes too -->
<util:replace var="forwardSlashBaseDir" value="${basedir}"
oldChar="\" newChar="/" />
<j:if test="${!forwardSlashBaseDir.endsWith('/')}">
<j:set var="base" value="${forwardSlashBaseDir}/" />
</j:if>
<j:set var="relativePath">${forwardSlashFile.substring(base.length())}</j:set>
<j:whitespace trim="yes">${relativePath}</j:whitespace>
</define:tag>
</define:taglib>
<!-- ================================================================== -->
<!-- L I C E N S E -->
<!-- ================================================================== -->
<goal name="maven-license-plugin:register">
<doc:registerReport
name="Project License"
pluginName="maven-license-plugin"
link="license"
description="Displays the primary license for the project."/>
</goal>
<goal name="maven-license-plugin:deregister">
<doc:deregisterReport name="Project License"/>
</goal>
<goal name="maven-license-plugin:report"
description="Generate an XML file from the license.txt">
<attainGoal name="license"/>
</goal>
<goal name="license"
description="Generate an XML file from the license file"
prereqs="license:transfer"/>
<goal
name="license:transfer"
prereqs="xdoc:init"
description="Generate a xml file from your license file">
<j:set var="licenseFile"><license:fileName /></j:set>
<j:set var="genDocs" value="${maven.gen.docs}"/>
<util:available file="${licenseFile}">
<j:set var="licensePresent" value="true"/>
</util:available>
<j:if test="${licensePresent != 'true'}">
<echo>
======================================================================
= W A R N I N G =
======================================================================
= Your project doesn't contain a header file specified as: =
= ${licenseFile}
= The License Report Plugin needs it to display the license =
= for the project. =
= If it can't find this file, it creates a page mentioning that =
= no license file has been given to Maven. =
======================================================================
</echo>
<j:set var="licenseFile" value='${plugin.resources}/LICENSE.txt'/>
</j:if>
<doc:text-xdoc
title="Project License"
section="Project License"
output="${genDocs}/license.xml"
inputFile="${licenseFile}"/>
</goal>
</project>