-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
54 lines (47 loc) · 2.43 KB
/
build.xml
File metadata and controls
54 lines (47 loc) · 2.43 KB
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
<project name="MyProject" default="createPomFromInput" basedir=".">
<description>
This will replace the version number in the maven file with the current revision
within Subversion. This requires a machine with a c-shell and subversion installed.
</description>
<property name="svn-url">http://closure-library.googlecode.com/svn/trunk/</property>
<property name="git-url">https://code.google.com/p/closure-library/</property>
<property name="git-branch">HEAD</property>
<target name="createPomFromGit" depends="gitInfo" description="Will copy the pom-template.xml to pom.xml, making the appropriate replacements.">
<copy file="pom-template.xml" tofile="pom.xml" filtering="yes" overwrite="yes">
<filterset>
<filter token="REPO_VERSION" value="${build.version}-SNAPSHOT" />
</filterset>
</copy>
</target>
<target name="createPomFromSvn" depends="svnInfo" description="Will copy the pom-template.xml to pom.xml, making the appropriate replacements.">
<copy file="pom-template.xml" tofile="pom.xml" filtering="yes" overwrite="yes">
<filterset>
<filter token="REPO_VERSION" value="${build.version}-SNAPSHOT" />
</filterset>
</copy>
</target>
<target name="createPomFromInput" description="Will copy the pom-template.xml to pom.xml, making the appropriate replacements.">
<fail unless="repo.version">You forgot to set 'repo.version'!</fail>
<echo message="setting repository version from git to ${repo.version}" />
<copy file="pom-template.xml" tofile="pom.xml" filtering="yes" overwrite="yes">
<filterset>
<filter token="REPO_VERSION" value="${repo.version}-SNAPSHOT" />
</filterset>
</copy>
<echo message="Template created" />
</target>
<target name="svnInfo" description="Open a c-shell and execute a subversion command to get the current version">
<exec executable="sh" outputproperty="build.version">
<arg value="-c" />
<arg value="svn --non-interactive info ${svn-url} | grep Revision | awk '{print $2}'" />
</exec>
<echo message="setting repository version from subversion to ${build.version}" />
</target>
<target name="gitInfo" description="Open a c-shell and execute a git command to get the current version">
<exec executable="sh" outputproperty="build.version">
<arg value="-c" />
<arg value="git ls-remote ${git-url} --branch ${git-branch} | awk '{print $1}' | cut -c1-6" />
</exec>
<echo message="setting repository version from git to ${build.version}" />
</target>
</project>