On Fri, 2002-07-05 at 12:27, St�phane MOR wrote:
> Hi,
>
> Here is new stuff for dependency/plugin.jelly.
> I added a new goal, named "dependencies-to-pom" which
> takes the dependencies computed in resolve-projects,
> and puts them back to the POM. This allows to have
> dependencies computed automatically.
>
> Along with plugin.jelly, there is the "createpom.dvsl" file
> that outputs the project.xml.new file (we should output to
> project.xml then). There is also a toolbox.props. Both
> go to src/plugins/dependency.
>
> I had to modify ProjectResolver to spit out a wrapper element,
> so that the xml blob can be easily included in the DVSL
> template.
Thanks Stephane, I will apply them and poke brian again to get your
account up and running.
> St�phane
> (waiting to be able to commit that myself !)
> ----
>
> # ============================================================================ #
> # 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
> ----
>
> toolbox.contextname = toolbox
> toolbox.tool.htmlescape = org.apache.velocity.anakia.Escape
> toolbox.tool.fileutil = org.apache.velocity.texen.util.FileUtil
> ----
>
> Index: src/plugins/dependency/plugin.jelly
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine-maven/src/plugins/dependency/plugin.jelly,v
> retrieving revision 1.6
> diff -u -r1.6 plugin.jelly
> --- src/plugins/dependency/plugin.jelly 4 Jul 2002 15:45:32 -0000 1.6
> +++ src/plugins/dependency/plugin.jelly 5 Jul 2002 18:19:56 -0000
> @@ -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 -->
>
>
> ----
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
jvz.
Jason van Zyl
[EMAIL PROTECTED]
http://tambora.zenplex.org
In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
-- Jacques Ellul, The Technological Society
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>