jvanzyl 2002/07/05 13:35:05
Modified: src/plugins/dependency plugin.jelly
Added: src/plugins/dependency createpom.dvsl toolbox.props
Log:
o Applying stephanes patches for the automatic insertions of dependencies
for a project gleaned directly from the sources.
Revision Changes Path
1.7 +86 -24 jakarta-turbine-maven/src/plugins/dependency/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins/dependency/plugin.jelly,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- plugin.jelly 4 Jul 2002 15:45:32 -0000 1.6
+++ plugin.jelly 5 Jul 2002 20:35:05 -0000 1.7
@@ -7,8 +7,42 @@
xmlns:maven="jelly:org.apache.maven.jelly.tags.project.MavenTagLibrary">
<!-- ================================================================== -->
+ <!-- P A C K A G E T O P R O J E C T M A P -->
+ <!-- ================================================================== -->
+ <!-- Create the map used to resolve package references into -->
+ <!-- project references. Used in the process of analysing sources to -->
+ <!-- determine a project's first order dependencies. -->
+ <!-- ================================================================== -->
+
+ <goal
+ name="package-project-map">
+
+ <define:taglib uri="depTagLib">
+ <define:jellybean
+ name="packageProjectMap"
+ className="org.apache.maven.dependency.PackageProjectMap"
+ method="execute"
+ />
+ </define:taglib>
+
+ <echo>Generating package to project id map ...</echo>
+ <echo>descriptorDir: ${maven.descriptorDir}</echo>
+
+ <dep:packageProjectMap
+ descriptorDir="${maven.descriptorDir}"
+ map="${maven.home}/package-project.map">
+ </dep:packageProjectMap>
+
+ </goal>
+
+ <!-- ================================================================== -->
<!-- C H E C K O U T S O U R C E S -->
<!-- ================================================================== -->
+ <!-- This takes the POMs in the subdirectories of -->
+ <!-- ${maven.descriptorDir}, retrieves the CVS info, and checks out the -->
+ <!-- source to ${maven.tmpDir}. We need to check if the project has -->
+ <!-- already been checked out, and then simply update the project. -->
+ <!-- ================================================================== -->
<goal
name="checkout-sources">
@@ -47,6 +81,10 @@
<!-- ================================================================== -->
<!-- R E S O L V E P R O J E C T S F R O M S O U R C E -->
<!-- ================================================================== -->
+ <!-- From the sources that we checked out in "checkout-sources", we -->
+ <!-- retrieve the package informations, and write the mappings to -->
+ <!-- ${maven.home}/package-project.map. -->
+ <!-- ================================================================== -->
<goal
name="resolve-projects">
@@ -77,7 +115,7 @@
<dep:resolveProjects
base="${file}"
mapFile="${maven.home}/package-project.map"
- packageExcludes="java,javax">
+ packageExcludes="${file},java,javax">
</dep:resolveProjects>
</j:forEach>
@@ -85,32 +123,48 @@
</goal>
<!-- ================================================================== -->
- <!-- P A C K A G E T O P R O J E C T M A P -->
+ <!-- D E P E N D E N C I E S T O P O M -->
<!-- ================================================================== -->
- <!-- Create the map used to resolve package references into -->
- <!-- project references. Used in the process of analysing sources to -->
- <!-- determine a project's first order dependencies. -->
+ <!-- Puts the dependencies generated in resolve-projects back to the -->
+ <!-- POM. -->
<!-- ================================================================== -->
- <goal
- name="package-project-map">
+ <goal name="dependencies-to-pom">
+
+ <fileScanner var="scanner">
+ <fileset dir="${maven.descriptorDir}" includes="**/project.xml"/>
+ </fileScanner>
+
+ <taskdef
+ name="dvsl"
+ classname="org.apache.tools.dvsl.DVSLTask">
+ <classpath refid="maven-classpath"/>
+ </taskdef>
+
+ <j:forEach var="file" items="${scanner.iterator()}">
+
+ <echo>
+ project file : ${file.absolutePath}
+ dependencies file : ${maven.tmpDir}/${file.ParentFile.name}/deps.xml
+ </echo>
+
+ <dvsl
+
+ in="${file.absolutePath}"
+ out="${file.absolutePath}.new/"
+ extension=".xml"
+ force="true"
+ toolboxfile="${maven.home}/plugins/dependency/toolbox.props"
+ style="${maven.home}/plugins/dependency/createpom.dvsl"
+ outputencoding="${maven.docs.outputencoding}">
+
+ <tool name="toolbox.string.basedir" value="${basedir}"/>
+ <tool name="toolbox.string.projectDependencies"
value="${maven.tmpDir}/${file.ParentFile.name}/deps.xml"/>
+
+ </dvsl>
+
+ </j:forEach>
- <define:taglib uri="depTagLib">
- <define:jellybean
- name="packageProjectMap"
- className="org.apache.maven.dependency.PackageProjectMap"
- method="execute"
- />
- </define:taglib>
-
- <echo>Generating package to project id map ...</echo>
- <echo>descriptorDir: ${maven.descriptorDir}</echo>
-
- <dep:packageProjectMap
- descriptorDir="${maven.descriptorDir}"
- map="${maven.home}/package-project.map">
- </dep:packageProjectMap>
-
</goal>
<!-- ================================================================= -->
@@ -127,6 +181,13 @@
<!-- the source, and this takes care of your POM and dependencies. -->
<!-- It may also be used during the whole lifetime of the project, if -->
<!-- project maintainers end up having a missing dependencies section. -->
+ <!-- -->
+ <!-- This is the purpose for dependencies-to-pom. As soon as your -->
+ <!-- Project Object Model changes, this could be used to regenerate -->
+ <!-- the dependencies, so that your code always has appropriate -->
+ <!-- dependencies. -->
+ <!-- We need something that allows us to keep the dependencies that -->
+ <!-- the user defines, for any reason. -->
<!-- ================================================================= -->
<goal
@@ -137,12 +198,13 @@
Until we can't simply update the sources instead of checking them out
everytime, it's wiser to do it by hand.
+ <attainGoal name="package-project-map"/>
<attainGoal name="checkout-sources"/>
-->
- <attainGoal name="package-project-map"/>
<attainGoal name="resolve-projects"/>
+ <attainGoal name="dependencies-to-pom"/>
<!-- Then, we need to put those dependencies back into the POM -->
1.1 jakarta-turbine-maven/src/plugins/dependency/createpom.dvsl
Index: createpom.dvsl
===================================================================
# ============================================================================ #
# D E P E N D E N C I E S T O P O M #
# ============================================================================ #
# Generation of the POM. This takes the current POM, removes its dependencies, #
# and copy the generated ones instead. #
# #
# With a bit of DVSL, we should be able to keep the previous ones and simply #
# update them with the infos from the generated dependencies. #
# This would avoid having to delete dependencies that a user specifies by hand #
# ============================================================================ #
#match("project")
# ISO-8859-1 allows non-english caracters
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
$context.applyTemplates()
</project>
#end
# ============================================================================ #
# Here, we check that the file "deps.xml" that we created in #
# ${maven.tmpDir}/${project.id} exists, and if so, the file is parsed and the #
# dependencies are added to the POM. #
# ============================================================================ #
#match("dependencies")
<dependencies>
#if(
$context.toolbox.fileutil.file("$context.toolbox.projectDependencies").exists() )
#set( $deps =
$node.selectNodes("document('$context.toolbox.projectDependencies')") )
#foreach( $dep in $deps )
<dependency>
<id>$!dep.id</id>
<version>$!dep.version</version>
<url>$!dep.url</url>
</dependency>
#end
#else
#end
</dependencies>
#end
#match("*")
$node.copy()
#end
1.1 jakarta-turbine-maven/src/plugins/dependency/toolbox.props
Index: toolbox.props
===================================================================
toolbox.contextname = toolbox
toolbox.tool.htmlescape = org.apache.velocity.anakia.Escape
toolbox.tool.fileutil = org.apache.velocity.texen.util.FileUtil
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>