|
134 | 134 | <attribute name="version" /> |
135 | 135 | <attribute name="fromDir" default="${dist.dir}" /> |
136 | 136 | <attribute name="stageDir" default="${build.maven}" /> |
| 137 | + <attribute name="artifact" default="@{stageDir}/${m2.groupDir}/@{artifactId}/@{version}" /> |
137 | 138 | <attribute name="basename" default="@{artifactId}-@{version}" /> |
138 | 139 | <sequential> |
139 | 140 | <!-- Clean the staging directory. --> |
140 | | - <delete dir="@{stageDir}" /> |
141 | | - <mkdir dir="@{stageDir}" /> |
| 141 | + <delete dir="@{stageDir}/${m2.groupDir}" /> |
| 142 | + <mkdir dir="@{artifact}" /> |
142 | 143 |
|
143 | 144 | <!-- Copy over the primary artifact from @{fromDir} to the staging area. --> |
144 | | - <copy file="@{fromDir}/@{artifactId}.jar" tofile="@{stageDir}/@{basename}.jar" /> |
| 145 | + <copy file="@{fromDir}/@{artifactId}.jar" tofile="@{artifact}/@{basename}.jar" /> |
145 | 146 |
|
146 | 147 | <!-- The source and Javadoc are already prepared (but add the version to the name). --> |
147 | | - <copy file="@{fromDir}/sources.jar" tofile="@{stageDir}/@{basename}-sources.jar" /> |
148 | | - <copy file="@{fromDir}/javadoc.jar" tofile="@{stageDir}/@{basename}-javadoc.jar" /> |
| 148 | + <copy file="@{fromDir}/sources.jar" tofile="@{artifact}/@{basename}-sources.jar" /> |
| 149 | + <copy file="@{fromDir}/javadoc.jar" tofile="@{artifact}/@{basename}-javadoc.jar" /> |
149 | 150 |
|
150 | 151 | <!-- Create the POM from the given template with placeholders replaced. --> |
151 | | - <copy file="maven/pom-template.xml" tofile="@{stageDir}/@{basename}.pom"> |
| 152 | + <copy file="maven/pom-template.xml" tofile="@{artifact}/@{basename}.pom"> |
152 | 153 | <filterset> |
153 | 154 | <filter token="PROJECT-VERSION" value="@{version}" /> |
154 | 155 | <filter token="ARTIFACT-ID" value="@{artifactId}" /> |
155 | 156 | </filterset> |
156 | 157 | </copy> |
157 | 158 |
|
158 | 159 | <!-- Sign everything. --> |
159 | | - <sign-all stageDir="@{stageDir}" artifactId="@{artifactId}" version="@{version}" /> |
| 160 | + <sign-all artifact="@{artifact}" artifactId="@{artifactId}" version="@{version}" /> |
160 | 161 |
|
161 | | - <!-- JAR-up the entire contents of the staging directory. --> |
162 | | - <jar jarfile="${pubs.dir}/@{basename}-bundle.jar"> |
| 162 | + <!-- Checksum JARs and POMs --> |
| 163 | + <checksum-pom-jar artifact="@{artifact}" /> |
| 164 | + |
| 165 | + <!-- ZIP-up the entire contents of the staging directory. --> |
| 166 | + <zip destfile="${pubs.dir}/@{basename}-bundle.zip"> |
163 | 167 | <fileset dir="@{stageDir}" /> |
164 | | - </jar> |
| 168 | + </zip> |
165 | 169 | </sequential> |
166 | 170 | </macrodef> |
167 | 171 |
|
|
171 | 175 | <macrodef name="m2-bundle-gradle"> |
172 | 176 | <attribute name="artifactId" /> |
173 | 177 | <attribute name="version" /> |
174 | | - <attribute name="fromDir" default="${gradle.repo}/${m2.groupDir}/@{artifactId}/@{version}" /> |
| 178 | + <attribute name="fromDir" default="${gradle.repo}" /> |
175 | 179 | <attribute name="stageDir" default="${build.maven}" /> |
| 180 | + <attribute name="artifact" default="@{stageDir}/${m2.groupDir}/@{artifactId}/@{version}" /> |
176 | 181 | <attribute name="basename" default="@{artifactId}-@{version}" /> |
177 | 182 | <sequential> |
178 | | - <!-- Validate the POM --> |
179 | | - <validate-pom file="@{fromdir}/@{basename}.pom" /> |
180 | | - |
181 | 183 | <!-- Clean the staging directory. --> |
182 | | - <delete dir="@{stageDir}" /> |
183 | | - <mkdir dir="@{stageDir}" /> |
| 184 | + <delete dir="@{stageDir}/${m2.groupDir}" /> |
| 185 | + <mkdir dir="@{artifact}" /> |
184 | 186 |
|
185 | 187 | <!-- Copy over all the artifacts from @{fromDir} to the staging area. --> |
186 | 188 | <copy todir="@{stageDir}"> |
187 | 189 | <fileset dir="@{fromDir}"> |
188 | | - <include name="*.jar" /> |
189 | | - <include name="*.pom" /> |
| 190 | + <include name="**/*.jar" /> |
| 191 | + <include name="**/*.pom" /> |
190 | 192 | </fileset> |
191 | 193 | </copy> |
192 | 194 |
|
| 195 | + <!-- Validate the POM --> |
| 196 | + <validate-pom file="@{artifact}/@{basename}.pom" /> |
| 197 | + |
193 | 198 | <!-- Sign everything. --> |
194 | | - <sign-all stageDir="@{stageDir}" artifactId="@{artifactId}" version="@{version}" /> |
| 199 | + <sign-all artifact="@{artifact}" artifactId="@{artifactId}" version="@{version}" /> |
| 200 | + |
| 201 | + <!-- Checksum JARs and POMs --> |
| 202 | + <checksum-pom-jar artifact="@{artifact}" /> |
195 | 203 |
|
196 | | - <!-- JAR-up the entire contents of the staging directory. --> |
197 | | - <jar jarfile="${pubs.dir}/@{basename}-bundle.jar"> |
| 204 | + <!-- ZIP-up the entire contents of the staging directory. --> |
| 205 | + <zip destfile="${pubs.dir}/@{basename}-bundle.zip"> |
198 | 206 | <fileset dir="@{stageDir}" /> |
199 | | - </jar> |
| 207 | + </zip> |
200 | 208 | </sequential> |
201 | 209 | </macrodef> |
202 | 210 |
|
203 | | - <!-- Add detached signature for single artifact in staging directory. --> |
| 211 | + <!-- Add detached signature for single artifact in artifact directory. --> |
204 | 212 | <macrodef name="sign-detached"> |
205 | 213 | <attribute name="file" /> |
206 | | - <attribute name="stageDir" /> |
| 214 | + <attribute name="artifact" /> |
207 | 215 | <sequential> |
208 | 216 | <!-- Generate a detached signature for each artifact in the bundle. --> |
209 | | - <exec executable="gpg" dir="@{stageDir}"> |
| 217 | + <exec executable="gpg" dir="@{artifact}"> |
210 | 218 | <arg value="-ab" /> |
211 | 219 | <arg value="@{file}" /> |
212 | 220 | </exec> |
213 | 221 | </sequential> |
214 | 222 | </macrodef> |
215 | 223 |
|
216 | | - <!-- Add detached signatures for group of artifacts in staging directory. --> |
| 224 | + <!-- Add detached signatures for group of artifacts in specified arifact directory. --> |
217 | 225 | <macrodef name="sign-all"> |
218 | 226 | <attribute name="artifactId" /> |
219 | 227 | <attribute name="version" /> |
220 | | - <attribute name="stageDir" /> |
| 228 | + <attribute name="artifact" /> |
221 | 229 | <attribute name="basename" default="@{artifactId}-@{version}" /> |
222 | 230 | <sequential> |
223 | | - <sign-detached stageDir="@{stageDir}" file="@{basename}.pom" /> |
224 | | - <sign-detached stageDir="@{stageDir}" file="@{basename}.jar" /> |
225 | | - <sign-detached stageDir="@{stageDir}" file="@{basename}-sources.jar" /> |
226 | | - <sign-detached stageDir="@{stageDir}" file="@{basename}-javadoc.jar" /> |
| 231 | + <sign-detached artifact="@{artifact}" file="@{basename}.pom" /> |
| 232 | + <sign-detached artifact="@{artifact}" file="@{basename}.jar" /> |
| 233 | + <sign-detached artifact="@{artifact}" file="@{basename}-sources.jar" /> |
| 234 | + <sign-detached artifact="@{artifact}" file="@{basename}-javadoc.jar" /> |
227 | 235 | </sequential> |
228 | 236 | </macrodef> |
229 | 237 |
|
| 238 | + <!-- Add checksums for for JAR and POM files in specified arifact directory. --> |
| 239 | + <macrodef name="checksum-pom-jar"> |
| 240 | + <attribute name="artifact" /> |
| 241 | + <sequential> |
| 242 | + <!-- MD5 Checksum everything --> |
| 243 | + <checksum algorithm="MD5" fileext=".md5"> |
| 244 | + <fileset dir="@{artifact}"> |
| 245 | + <include name="*.jar" /> |
| 246 | + <include name="*.pom" /> |
| 247 | + </fileset> |
| 248 | + </checksum> |
| 249 | + |
| 250 | + <!-- SHA-1 Checksum everything --> |
| 251 | + <checksum algorithm="SHA-1" fileext=".sha1"> |
| 252 | + <fileset dir="@{artifact}"> |
| 253 | + <include name="*.jar" /> |
| 254 | + <include name="*.pom" /> |
| 255 | + </fileset> |
| 256 | + </checksum> |
| 257 | + </sequential> |
| 258 | + </macrodef> |
| 259 | + |
230 | 260 | <!-- Validate a Maven POM . --> |
231 | 261 | <macrodef name="validate-pom"> |
232 | 262 | <attribute name="file" /> |
|
0 commit comments