COLLECTIONS-281 - Change maven build to create Collections Test Framework jar

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@638061 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Niall Kegan Pemberton 2008-03-17 20:51:18 +00:00
parent 1ef83170fe
commit f7eadf09d7
4 changed files with 105 additions and 52 deletions

70
build-testframework.xml Normal file
View File

@ -0,0 +1,70 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Collections Test Framework jar" default="jar" basedir=".">
<!--
$Id$
-->
<!-- ========== Component Declarations ==================================== -->
<!-- The current version number of this component -->
<property name="component.version" value=""/>
<!-- The base directory for compiled test classes -->
<property name="test.classes" value="target/test-classes"/>
<!-- The base directory for distribution targets -->
<property name="dist.home" value="target"/>
<!-- JDK versions -->
<property name="maven.compile.source" value=""/>
<property name="maven.compile.target" value=""/>
<!-- ========== Executable Targets ======================================== -->
<target name="jar" description="Create Collections Test Framework jar">
<mkdir dir="${dist.home}"/>
<mkdir dir="${test.classes}/META-INF"/>
<copy file="LICENSE.txt" tofile="${test.classes}/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt" tofile="${test.classes}/META-INF/NOTICE.txt"/>
<jar jarfile="${dist.home}/commons-collections-testframework-${component.version}.jar">
<manifest>
<attribute name="Specification-Title" value="Commons Collections Test Framework"/>
<attribute name="Specification-Version" value="${component.version}"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="Commons Collections Test Framework"/>
<attribute name="Implementation-Version" value="${component.version}"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="X-Compile-Source-JDK" value="${maven.compile.source}"/>
<attribute name="X-Compile-Target-JDK" value="${maven.compile.target}"/>
</manifest>
<fileset dir="${test.classes}">
<include name="**/LICENSE.txt"/>
<include name="**/NOTICE.txt"/>
<include name="**/AbstractTest*.class"/>
<include name="**/BulkTest*.class"/>
</fileset>
</jar>
</target>
</project>

View File

@ -432,28 +432,15 @@
</fileset>
</copy>
<mkdir dir="${tf.build.tf}/META-INF"/>
<copy file="LICENSE.txt"
tofile="${tf.build.tf}/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt"
tofile="${tf.build.tf}/META-INF/NOTICE.txt"/>
<tstamp/>
<mkdir dir="${tf.build.conf}"/>
<copy todir="${tf.build.conf}" filtering="on">
<filterset>
<filter token="name" value="${tf.name}"/>
<filter token="title" value="${tf.title}"/>
<filter token="package" value="${tf.package}"/>
<filter token="version" value="${tf.version}"/>
</filterset>
<fileset dir="${source.conf}" includes="*.MF"/>
</copy>
<!-- NOTE: A jar built using JDK1.4 is incompatible with JDK1.2 -->
<jar jarfile="${tf.build.jar.name}"
basedir="${tf.build.tf}"
manifest="${tf.build.conf}/MANIFEST.MF"/>
<ant antfile="build-testframework.xml" target="jar">
<property name="test.classes" value="${tf.build.tf}"/>
<property name="dist.home" value="${tf.build.tf}"/>
<property name="component.version" value="${tf.version}"/>
<property name="maven.compile.source" value="1.2"/>
<property name="maven.compile.target" value="1.2"/>
</ant>
</target>
<!-- ====================================================================== -->

View File

@ -29,37 +29,11 @@
<!-- ============== JAR ================== -->
<postGoal name="jar:jar">
<j:set var="finalName" value="${pom.getPluginContext('maven-jar-plugin').getVariable('maven.final.name')}"/>
<j:set var="finalVersion" value="${finalName.substring(20)}" />
<j:set var="testfwkBase" value="${pom.artifactId}-testframework" />
<j:set var="testfwkName" value="${testfwkBase}-${finalVersion}" />
<ant:jar
jarfile="${maven.build.dir}/${testfwkName}.jar">
<j:set var="licenseFileName"><license:fileName/></j:set>
<util:file name="${licenseFileName}" var="licenseFile"/>
<ant:metainf dir="${licenseFile.canonicalFile.parent}">
<ant:include name="${licenseFile.canonicalFile.name}"/>
</ant:metainf>
<ant:manifest>
<ant:attribute name="Built-By" value="${user.name}"/>
<ant:attribute name="Created-By" value="Apache Jakarta Maven"/>
<ant:attribute name="Package" value="${pom.package}"/>
<ant:attribute name="Build-Jdk" value="${java.version}"/>
<!-- added supplementary entries -->
<ant:attribute name="Extension-Name" value="Commons Collections Test Framework"/>
<ant:attribute name="Specification-Version" value="${pom.specificationVersion}"/>
<ant:attribute name="Specification-Vendor" value="${pom.organization.name}"/>
<ant:attribute name="Specification-Title" value="Commons Collections Test Framework"/>
<ant:attribute name="Implementation-Version" value="${pom.currentVersion}"/>
<ant:attribute name="Implementation-Vendor" value="${pom.organization.name}"/>
<ant:attribute name="Implementation-Vendor-Id" value="${pom.organization.identifier}"/>
</ant:manifest>
<ant:fileset dir="${maven.build.dir}/test-classes">
<ant:include name="**/AbstractTest*.class"/>
<ant:include name="**/BulkTest*.class"/>
</ant:fileset>
</ant:jar>
<ant:ant antfile="build-testframework.xml" target="jar">
<property name="component.version" value="${pom.currentVersion}"/>
<property name="test.classes" value="${maven.build.dir}/test-classes"/>
<property name="dist.home" value="${maven.build.dir}"/>
</ant:ant>
</postGoal>
<postGoal name="jar:install">

22
pom.xml
View File

@ -398,6 +398,28 @@
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<ant antfile="build-testframework.xml" target="jar">
<property name="component.version" value="${project.version}"/>
<property name="test.classes" value="${project.build.directory}/test-classes"/>
<property name="dist.home" value="${project.build.directory}"/>
<property name="maven.compile.source" value="${maven.compile.source}"/>
<property name="maven.compile.target" value="${maven.compile.target}"/>
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>