Refactor some tags out

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113126 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion committed 2003-03-17 02:44:35 +00:00
1 parent 89182f3b8c
commit db9d167068
1 file changed
+82 -53
+82 -53
View File
@@ -56,7 +56,7 @@
! @param groupId the groupId the license is for
!-->
<define:tag name="copyLicense">
<repository:urlFileName url="${url}" var="fileName" />
<repository:urlFileName var="fileName" url="${url}" />
<j:set var="localFileName">${systemScope['java.io.tmpdir']}${fileName}</j:set>
@@ -71,11 +71,10 @@
<echo>Setting permissions and group ownership in ${directory}'</echo>
<repository:exec>
cd ${directory};
chmod -R g+w *;
chmod -R a+r *;
chgrp -R ${maven.repository.group} *;
rm ${groupId}.license;
ln -s ${fileName} ${groupId}.license;
chmod -R g+w,a+r ${fileName};
chgrp -R ${maven.repository.group} *;
</repository:exec>
</define:tag>
@@ -84,50 +83,70 @@
! @param url the URL to process
! @param var the variable to place the filename into
!-->
<define:tag name="urlFileName">
<u:tokenize var="preQuery" delim="?">${url}</u:tokenize>
<u:tokenize var="preHash" delim="#">${preQuery[0]}</u:tokenize>
<u:tokenize var="slashes" delim="/">${preHash[0]}</u:tokenize>
<j:set var="${var}" scope="parent" value="${slashes[size(slashes)-1]}" />
</define:tag>
<!--
! @name the name of the value being checked
! @value the value that musn't be empty
! @message the message to be displayed when value is empty
!-->
<define:tag name="required">
<j:if test="${empty(message)}">
<j:set var="message">'${name}' must be specified</j:set>
</j:if>
<j:if test="${empty(value)}">
<fail>${message}</fail>
</j:if>
</define:tag>
<define:tag name="urlFileName">
<u:tokenize var="preQuery" delim="?">${url}</u:tokenize>
<u:tokenize var="preHash" delim="#">${preQuery[0]}</u:tokenize>
<u:tokenize var="slashes" delim="/">${preHash[0]}</u:tokenize>
<j:set var="${var}" scope="parent" value="${slashes[size(slashes)-1]}" />
</define:tag>
<!--
! set a variable called ${var} with the snapshot version
! of the given file
! @file the file to extract the snapshot version from
! @var the variable name to store the result in
!-->
<define:tag name="snapshotVersion">
<!-- artifact is format blah-blah-blah-yyyymmdd.hhmmss.jar -->
<u:tokenize var="jarDotBits" delim="-">${file}</u:tokenize>
<u:tokenize var="snapAndJar" delim=".">${jarDotBits[size(jarDotBits)-1]}</u:tokenize>
<j:set var="${var}" value="${snapAndJar[0]}.${snapAndJar[1]}" scope="parent"/>
</define:tag>
<!--
! @name the name of the value being checked
! @value the value that musn't be empty
! @message the message to be displayed when value is empty
!-->
<define:tag name="required">
<j:if test="${empty(message)}">
<j:set var="message">'${name}' must be specified</j:set>
</j:if>
<j:if test="${empty(value)}">
<fail>${message}</fail>
</j:if>
</define:tag>
</define:taglib>
<goal name="repository:audit-create-licenses"
description="create the license directories, for all groups in the audit file, in the repository">
<j:set var="directoryName" value="licenses"/>
<attainGoal name="repository:audit-create-directory" />
</goal>
<goal name="repository:audit-create-directory"
description="create the directory, specified by directoryName, for all groups in the audit file">
<!--
! parse audit file
! run ssh to create each <groupId>/licenses directory.
!-->
<repository:parseAudit var="audit"/>
<x:forEach var="group" select="$audit/licenses/project/groupId">
<echo>Processing project ${group.text}</echo>
<j:set var="directory" value="${maven.repo.central.directory}/${group.text}/licenses" />
<echo>Ensuring directory '${directory}' exists</echo>
<repository:exec>
mkdir -p ${directory};
chmod g+ws ${directory};
chgrp ${maven.repository.group} ${directory};
</repository:exec>
</x:forEach>
</goal>
<repository:required name="directoryName" value="${directoryName}" />
<repository:parseAudit var="audit"/>
<x:forEach var="group" select="$audit/licenses/project/groupId">
<j:set var="directory"
value="${maven.repo.central.directory}/${group.text}/${directoryName}" />
<echo>Ensuring directory '${directory}' exists</echo>
<repository:exec>
mkdir -p ${directory};
chmod g+ws ${directory};
chgrp ${maven.repository.group} ${directory};
</repository:exec>
</x:forEach>
</goal>
<goal name="repository:audit-copy-licenses"
description="copy all licenses in the audit file to the repository">
<!--
@@ -232,8 +251,7 @@
mkdir ${groupId}/licenses;
mkdir ${groupId}/poms;
chmod g+ws ${groupId};
chmod -R g+w ${groupId};
chmod -R a+r ${groupId};
chmod -R g+w,a+r ${groupId};
</repository:exec>
</goal>
@@ -260,28 +278,25 @@
<j:if test="${empty(artifactId)}">
<j:set var="artifactId">${groupId}</j:set>
</j:if>
<!-- work out snapshotVersion from artifact -->
<!-- artifact is format blah-yyyymmdd.hhmmss.jar -->
<u:tokenize var="jarDotBits" delim="-">${artifact}</u:tokenize>
<u:tokenize var="snapAndJar" delim=".">${jarDotBits[size(jarDotBits)-1]}</u:tokenize>
<j:set var="snapshotVersion" value="${snapAndJar[0]}.${snapAndJar[1]}"/>
<repository:snapshotVersion var="snapshotVersion" file="${artifact}" />
<echo>snapshotVersion = '${snapshotVersion}'</echo>
<attainGoal name="repository:copy-jar" />
<j:set var="directory" value="${maven.repo.central.directory}/${groupId}/jars/" />
<repository:copy from="${artifact}" toFileOrDir="${directory}" />
<u:file name="${artifact}" var="artifactFile"/>
<j:set var="artifactName">${artifactFile.canonicalFile.name}</j:set>
<echo>Setting up SNAPSHOT entries</echo>
<repository:exec>
cd ${directory};
md5sum ${artifactName} | sed 's/ .*$//' | tee ${artifactName}.md5;
ln -sf ${artifactName} ${artifactId}-SNAPSHOT.jar;
ln -sf ${artifactName}.md5 ${artifactId}-SNAPSHOT.jar.md5;
echo ${snapshotVersion} | tee ${artifactId}-snapshot-version;
chgrp ${maven.repository.group} *;
chmod g+w *;
chmod a+r *;
chgrp ${maven.repository.group} ${artifactId}-SNAPSHOT.jar*;
chmod g+w,a+r ${artifactId}-SNAPSHOT.jar*;
</repository:exec>
</goal>
@@ -294,7 +309,22 @@
<repository:required name="artifact" value="${artifact}" />
<repository:required name="groupId" value="${groupId}" />
<j:set var="directory" value="${maven.repo.central.directory}/${groupId}/jars/" />
<j:set var="type" value="jar" />
<attainGoal name="repository:copy-artifact" />
</goal>
<!--
! this uses any old file for copying
!-->
<goal name="repository:copy-artifact"
description="copy an artifact, specified by groupId, artifact and type, to the repository">
<repository:required name="artifact" value="${artifact}" />
<repository:required name="groupId" value="${groupId}" />
<repository:required name="type" value="${type}" />
<j:set var="directory" value="${maven.repo.central.directory}/${groupId}/${type}s/" />
<repository:copy from="${artifact}" toFileOrDir="${directory}" />
<u:file name="${artifact}" var="artifactFile"/>
@@ -304,8 +334,7 @@
cd ${directory};
md5sum ${artifactName} | sed 's/ .*$//' | tee ${artifactName}.md5;
chgrp ${maven.repository.group} *;
chmod g+w *;
chmod a+r *;
chmod g+w,a+r *;
</repository:exec>
</goal>