-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
115 lines (99 loc) · 4.2 KB
/
build.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0"?>
<project name="Alt-Tab Enhanced" basedir="." default="package">
<property name="src" value="Alt_Tab_Enhanced@autarkper"/>
<property name="output" value="/tmp/alt-tab-release"/>
<property name="zip" value="/tmp/Alt-Tab-Enhanced.zip"/>
<property name="applet-dir" value="${user.home}/.local/share/cinnamon/applets"/>
<target name="package" depends="create">
<tempfile property="tag-output" deleteonexit="true"/>
<exec executable="git" output="${tag-output}">
<arg value="tag"/>
<arg value="-l"/>
<arg value="--contains"/>
<arg value="HEAD"/>
</exec>
<tempfile property="tag-output2" deleteonexit="true"/>
<exec executable="tail" output="${tag-output2}">
<arg value="-1"/>
<arg value="${tag-output}"/>
</exec>
<loadfile property="last-tag" srcFile="${tag-output2}">
<filterchain><striplinebreaks/></filterchain>
</loadfile>
<condition property="tag-set">
<isset property="last-tag" />
</condition>
<tempfile property="status-output-file" deleteonexit="true"/>
<exec executable="git" output="${status-output-file}">
<arg value="status"/>
<arg value="--porcelain"/>
<arg value="--untracked=no"/>
</exec>
<loadfile property="status-output" srcFile="${status-output-file}">
<filterchain><striplinebreaks/></filterchain>
</loadfile>
<echo>${status-output}</echo>
<condition property="unclean-status">
<isset property="status-output" />
</condition>
<condition property="can-set-tag">
<and>
<isset property="last-tag" />
<not>
<isset property="status-output" />
</not>
</and>
</condition>
<tempfile property="date-output" deleteonexit="true"/>
<exec executable="date" output="${date-output}">
<arg value="--rfc-3339=seconds"/>
</exec>
<loadfile property="package-date" srcFile="${date-output}">
<filterchain><striplinebreaks/></filterchain>
</loadfile>
<echo>${package-date}</echo>
<copy todir="${output}/${src}">
<fileset dir="${src}" excludes="extension.js"/>
</copy>
<copy file="README.md" todir="${output}/${src}"/>
<copy file="CREDITS" todir="${output}/${src}"/>
<copy file="LICENSE" todir="${output}/${src}"/>
<antcall target="no-set-version"></antcall>
<antcall target="set-version"></antcall>
<replaceregexp byline="true">
<regexp pattern="("package-date"\s*:\s*)".*""/>
<substitution expression="\1"${package-date}""/>
<fileset dir="${output}/${src}">
<include name="**/metadata.json"/>
</fileset>
</replaceregexp>
<zip destfile="${zip}" basedir="${output}" />
</target>
<target name="no-set-version" unless="can-set-tag">
<echo>Skip setting version tag - no tag for latest commit, or unclean status</echo>
</target>
<target name="set-version" if="can-set-tag">
<echo>Set version tag: ${last-tag}</echo>
<replaceregexp byline="true">
<regexp pattern="("version"\s*:\s*)".*""/>
<substitution expression="\1"${last-tag}""/>
<fileset dir="${output}/${src}">
<include name="**/metadata.json"/>
</fileset>
</replaceregexp>
</target>
<target name="uninstall">
<symlink action="delete" link="${applet-dir}/${src}" />
<delete dir="${applet-dir}/${src}" followSymlinks="false" removeNotFollowedSymlinks="true" includeemptydirs="true" quiet="true" failonerror="false" />
</target>
<target name="install" depends="package, uninstall">
<unzip src="${zip}" dest="${applet-dir}" overwrite="true" />
</target>
<target name="clean">
<delete dir="${output}"/>
<delete file="${zip}"/>
</target>
<target name="create" depends="clean">
<mkdir dir="${output}"/>
</target>
</project>