|
1 | 1 | <?xml version="1.0"?>
|
2 | 2 | <!--
|
3 |
| - Copyright 2007 The Apache Software Foundation |
| 3 | + Copyright 2007, 2008 The Apache Software Foundation |
4 | 4 |
|
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License");
|
6 | 6 | you may not use this file except in compliance with the License.
|
|
15 | 15 | limitations under the License.
|
16 | 16 | -->
|
17 | 17 |
|
18 |
| -<project default="generate"> |
| 18 | +<project default="generate" xmlns:mvn="urn:maven-artifact-ant"> |
19 | 19 |
|
20 | 20 | <!-- Requires Ant 1.7.0 to execute! -->
|
21 | 21 |
|
22 | 22 | <property name="target.dir" value="target"/>
|
23 | 23 | <!-- Binary and source distributions, in .zip and .tar.gz formats, go here. -->
|
24 | 24 | <property name="dists.dir" value="${target.dir}/dist"/>
|
| 25 | + <!-- Directory that contains the image for the binary distro. --> |
| 26 | + <property name="binimage.dir" value="${target.dir}/bin-image"/> |
| 27 | + |
| 28 | + <property name="group" value="org.apache.tapestry"/> |
25 | 29 |
|
26 | 30 |
|
27 | 31 | <!-- Read the Maven POM ... -->
|
|
36 | 40 | <property name="bin.zip" value="${dists.dir}/tapestry-bin-${version}.zip"/>
|
37 | 41 | <property name="src.zip" value="${dists.dir}/tapestry-src-${version}.zip"/>
|
38 | 42 |
|
39 |
| - <!-- This has to be kept synchronized with the modules, as they change. We include just the "runtime" modules, |
40 |
| - no the ones used only within a Maven build; if the user is using Maven, they know how to (let Maven) get |
41 |
| - the code. --> |
| 43 | + <macrodef name="copyto"> |
| 44 | + <attribute name="dir"/> |
| 45 | + <attribute name="filesetid"/> |
42 | 46 |
|
43 |
| - <target name="assemble" description="Build distribution files."> |
44 |
| - <mkdir dir="${dists.dir}"/> |
| 47 | + <sequential> |
| 48 | + <mkdir dir="@{dir}"/> |
| 49 | + <copy todir="@{dir}" flatten="true"> |
| 50 | + <fileset refid="@{filesetid}"/> |
| 51 | + </copy> |
| 52 | + </sequential> |
| 53 | + </macrodef> |
45 | 54 |
|
46 |
| - <echo>*** Building distribution for project version ${version} ***</echo> |
| 55 | + <macrodef name="copy-licenses"> |
| 56 | + <attribute name="module"/> |
47 | 57 |
|
48 |
| - <echo>Building binary distribution</echo> |
| 58 | + <sequential> |
| 59 | + <copy todir="${binimage.dir}" flatten="true"> |
| 60 | + <fileset dir="@{module}" includes="${licenses}"/> |
| 61 | + <globmapper from="*" to="@{module}-*"/> |
| 62 | + </copy> |
| 63 | + </sequential> |
49 | 64 |
|
50 |
| - <zip destfile="${bin.zip}"> |
51 |
| - <fileset dir="." includes="LICENSE*,*.txt"/> |
52 | 65 |
|
53 |
| - <!-- Folds the licences and the JARs into the subfolder. Repetitive but such is life. --> |
| 66 | + </macrodef> |
54 | 67 |
|
55 |
| - <zipfileset prefix="tapestry-annotations" dir="tapestry-annotations" includes="${licenses}"/> |
56 |
| - <zipfileset prefix="tapestry-annotations" dir="tapestry-annotations/target" includes="*.jar"/> |
57 | 68 |
|
58 |
| - <zipfileset prefix="tapestry-core" dir="tapestry-core" includes="${licenses}"/> |
59 |
| - <zipfileset prefix="tapestry-core" dir="tapestry-core/target" includes="*.jar"/> |
| 69 | + <target name="-maven-setup" unless="maven-ant-tasks.classpath"> |
| 70 | + <path id="maven-ant-tasks.classpath" path="support/maven-ant-tasks-2.0.8.jar"/> |
60 | 71 |
|
61 |
| - <zipfileset prefix="tapestry-hibernate" dir="tapestry-hibernate" includes="${licenses}"/> |
62 |
| - <zipfileset prefix="tapestry-hibernate" dir="tapestry-hibernate/target" includes="*.jar"/> |
| 72 | + <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" |
| 73 | + classpathref="maven-ant-tasks.classpath"/> |
63 | 74 |
|
64 |
| - <zipfileset prefix="tapestry-ioc" dir="tapestry-ioc" includes="${licenses}"/> |
65 |
| - <zipfileset prefix="tapestry-ioc" dir="tapestry-ioc/target" includes="*.jar"/> |
| 75 | + <echo>Maven Ant Tasks loaded.</echo> |
| 76 | + </target> |
66 | 77 |
|
67 |
| - <zipfileset prefix="tapestry-spring" dir="tapestry-spring" includes="${licenses}"/> |
68 |
| - <zipfileset prefix="tapestry-spring" dir="tapestry-spring/target" includes="*.jar"/> |
69 | 78 |
|
70 |
| - <zipfileset prefix="tapestry-test" dir="tapestry-test" includes="${licenses}"/> |
71 |
| - <zipfileset prefix="tapestry-test" dir="tapestry-test/target" includes="*.jar"/> |
| 79 | + <target name="assemble-bin" depends="-maven-setup"> |
| 80 | + <echo>Building binary distribution</echo> |
72 | 81 |
|
73 |
| - <zipfileset prefix="tapestry-upload" dir="tapestry-upload" includes="${licenses}"/> |
74 |
| - <zipfileset prefix="tapestry-upload" dir="tapestry-upload/target" includes="*.jar"/> |
| 82 | + <mvn:dependencies filesetid="bin.dependency.fileset" sourcesfilesetid="bin.dependency.sources.fileset"> |
| 83 | + <dependency groupid="${group}" artifactid="tapestry-upload" version="${pom.version}"/> |
| 84 | + <dependency groupid="${group}" artifactid="tapestry-hibernate" version="${pom.version}"/> |
| 85 | + <dependency groupid="${group}" artifactid="tapestry-spring" version="${pom.version}"/> |
75 | 86 |
|
76 |
| - <zipfileset prefix="tapestry-tutorial1" dir="tapestry-tutorial1" includes="${licenses}"/> |
77 |
| - <zipfileset prefix="tapestry-tutorial1" dir="tapestry-tutorial1/target" includes="*.war"/> |
| 87 | + <!-- All else will be dragged in. --> |
| 88 | + </mvn:dependencies> |
78 | 89 |
|
79 |
| - </zip> |
| 90 | + <copyto dir="${binimage.dir}/lib" filesetid="bin.dependency.fileset"/> |
| 91 | + <copyto dir="${binimage.dir}/lib-src" filesetid="bin.dependency.sources.fileset"/> |
80 | 92 |
|
81 |
| - <!-- Build the other formats from the .zip --> |
| 93 | + <!-- We don't package tapestry-test because of its huge number of large dependencies. --> |
82 | 94 |
|
83 |
| - <tar destfile="${dists.dir}/tapestry-bin-${version}.tar.gz" compression="gzip"> |
84 |
| - <zipfileset src="${bin.zip}"/> |
85 |
| - </tar> |
| 95 | + <copy-licenses module="tapestry-ioc"/> |
| 96 | + <copy-licenses module="tapestry-core"/> |
| 97 | + <copy-licenses module="tapestry-hibernate"/> |
| 98 | + <copy-licenses module="tapestry-spring"/> |
| 99 | + <copy-licenses module="tapestry-upload"/> |
86 | 100 |
|
87 |
| - <tar destfile="${dists.dir}/tapestry-bin-${version}.tar.bz2" compression="bzip2"> |
88 |
| - <zipfileset src="${bin.zip}"/> |
89 |
| - </tar> |
| 101 | + <mkdir dir="${dists.dir}"/> |
90 | 102 |
|
91 |
| - <echo>Building source distribution</echo> |
| 103 | + <parallel> |
| 104 | + <zip destfile="${bin.zip}"> |
| 105 | + <fileset dir="${binimage.dir}"/> |
| 106 | + </zip> |
| 107 | + <tar destfile="${dists.dir}/tapestry-bin-${version}.tar.gz" compression="gzip"> |
| 108 | + <fileset dir="${binimage.dir}"/> |
| 109 | + </tar> |
92 | 110 |
|
93 |
| - <!-- Now on to the source files. --> |
| 111 | + <tar destfile="${dists.dir}/tapestry-bin-${version}.tar.bz2" compression="bzip2"> |
| 112 | + <fileset dir="${binimage.dir}"/> |
| 113 | + </tar> |
| 114 | + |
| 115 | + </parallel> |
| 116 | + |
| 117 | + </target> |
| 118 | + |
| 119 | + <target name="-announce"> |
| 120 | + <echo>*** Building distribution for project version ${version} ***</echo> |
| 121 | + </target> |
| 122 | + |
| 123 | + <target name="assemble-src"> |
94 | 124 |
|
95 | 125 | <zip destfile="${src.zip}">
|
96 | 126 | <fileset dir="." includes="${licenses}"/>
|
|
123 | 153 | <checksum fileext=".md5">
|
124 | 154 | <fileset dir="${dists.dir}" includes="*.bz2,*.gz,*.zip"/>
|
125 | 155 | </checksum>
|
| 156 | + </target> |
| 157 | + |
| 158 | + <!-- This has to be kept synchronized with the modules, as they change. We include just the "runtime" modules, |
| 159 | + no the ones used only within a Maven build; if the user is using Maven, they know how to (let Maven) get |
| 160 | + the code. --> |
| 161 | + |
| 162 | + <target name="assemble" description="Build distribution files." depends="-announce,assemble-bin,assemble-src"> |
| 163 | + |
| 164 | + <echo>Building source distribution</echo> |
| 165 | + |
| 166 | + <!-- Now on to the source files. --> |
| 167 | + |
126 | 168 |
|
127 | 169 | <echo>*** Please sign the distributions using GPG before uploading the files. ***
|
128 | 170 |
|
|
139 | 181 |
|
140 | 182 | <target name="clean" description="Remove distribution directory.">
|
141 | 183 | <delete dir="${dists.dir}" quiet="true"/>
|
| 184 | + <delete dir="${binimage.dir}" quiet="true"/> |
142 | 185 | </target>
|
143 | 186 |
|
144 | 187 | <target name="generate" description="Generate and deploy the build.">
|
|
0 commit comments