forked from functionaljava/functionaljava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-maven.xml
93 lines (81 loc) · 4.22 KB
/
build-maven.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0"?>
<project name="Functional Java Maven Build" default="maven-deploy" basedir=".">
<import file="buildj.xml" optional="true"/>
<property name="maven-build.dir" value="${build.dir}/maven"/>
<!-- Note. Artifact ID must match that in pom.xml -->
<property name="artifact-id" value="fj"/>
<property name="project.jar" value="${archive.file}"/>
<property name="sources.jar" value="${artifact-id}-${build.number}-sources.jar"/>
<property name="javadoc.jar" value="${artifact-id}-${build.number}-javadoc.jar"/>
<property name="maven-bundle.jar" value="${artifact-id}-${build.number}-bundle.jar"/>
<target name="-maven-bundle" depends="archive,javadoc" description="Creates Maven bundle files">
<fail unless="build.number" message="set the build.number property"/>
<mkdir dir="${maven-build.dir}"/>
<copy file="${build.dir}/archive/${archive.file}" tofile="${maven-build.dir}/${project.jar}"/>
<copy file="pom.xml" todir="${maven-build.dir}"/>
<zip destfile="${maven-build.dir}/${javadoc.jar}">
<zipfileset dir="${build.dir}/javadoc"/>
</zip>
<zip destfile="${maven-build.dir}/${sources.jar}">
<zipfileset dir="${build.dir}/src"/>
<zipfileset dir="${build.dir}/test-src"/>
</zip>
<zip destfile="${maven-build.dir}/${maven-bundle.jar}">
<zipfileset dir="${maven-build.dir}">
<include name="${project.jar}"/>
<include name="${sources.jar}"/>
<include name="${javadoc.jar}"/>
<include name="pom.xml"/>
</zipfileset>
</zip>
</target>
<target name="maven-deploy" depends="archive,-maven-bundle" description="Deploys Maven artefacts to local repo">
<fail unless="build.number" message="set the build.number property"/>
<tempfile property="maven-repo.dir" destdir="${maven-build.dir}"/>
<property name="maven-repo-release.dir" value="${maven-repo.dir}/org/functionaljava/fj/${build.number}"/>
<mkdir dir="${maven-repo.dir}"/>
<java classname="org.tmatesoft.svn.cli.SVN" fork="true">
<classpath refid="libs.path"/>
<arg value="checkout"/>
<arg value="${repository}/maven"/>
<arg value="${maven-repo.dir}"/>
<arg value="--username"/>
<arg value="${build.username}"/>
<arg value="--password"/>
<arg value="${build.password}"/>
</java>
<exec dir="${basedir}" executable="mvn" failonerror="true" os="Mac OS X,Linux">
<arg value="deploy:deploy-file"/>
<arg value="-Durl=file://${maven-repo.dir}"/>
<arg value="-DrepositoryId=local-svn-artifacts"/>
<arg value="-Dfile=${maven-build.dir}/${project.jar}"/>
<arg value="-DpomFile=${basedir}/pom.xml"/>
</exec>
<copy file="${maven-build.dir}/${maven-bundle.jar}" todir="${maven-repo-release.dir}"/>
<copy file="${maven-build.dir}/${sources.jar}" todir="${maven-repo-release.dir}"/>
<copy file="${maven-build.dir}/${javadoc.jar}" todir="${maven-repo-release.dir}"/>
<checksum file="${maven-repo-release.dir}/${maven-bundle.jar}" algorithm="MD5" forceOverwrite="yes" fileext=".md5"/>
<checksum file="${maven-repo-release.dir}/${maven-bundle.jar}" algorithm="SHA" forceOverwrite="yes" fileext=".sha1"/>
<checksum file="${maven-repo-release.dir}/${sources.jar}" algorithm="MD5" forceOverwrite="yes" fileext=".md5"/>
<checksum file="${maven-repo-release.dir}/${sources.jar}" algorithm="SHA" forceOverwrite="yes" fileext=".sha1"/>
<checksum file="${maven-repo-release.dir}/${javadoc.jar}" algorithm="MD5" forceOverwrite="yes" fileext=".md5"/>
<checksum file="${maven-repo-release.dir}/${javadoc.jar}" algorithm="SHA" forceOverwrite="yes" fileext=".sha1"/>
<java classname="org.tmatesoft.svn.cli.SVN" fork="true">
<classpath refid="libs.path"/>
<arg value="add"/>
<arg value="${maven-repo-release.dir}"/>
<arg value="--force"/>
</java>
<java classname="org.tmatesoft.svn.cli.SVN" fork="true">
<classpath refid="libs.path"/>
<arg value="commit"/>
<arg value="${maven-repo.dir}"/>
<arg value="--message"/>
<arg value="Maven artefacts for release ${build.number}"/>
<arg value="--username"/>
<arg value="${build.username}"/>
<arg value="--password"/>
<arg value="${build.password}"/>
</java>
</target>
</project>