-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta.xml
206 lines (196 loc) · 9.39 KB
/
meta.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE project>
<project name="Metadata" xmlns:if="ant:if" xmlns:unless="ant:unless">
<!-- ================================================================== -->
<!-- macros -->
<!-- ================================================================== -->
<macrodef name="signatureprompt" description="ask the user for specified cryptographic signature details">
<attribute
name="fileproperty"
default=""
description="name of a property in which to store the location of the cryptographic signature file" />
<attribute
name="filepassproperty"
default=""
description="name of a property in which to store the password of the cryptographic signature file" />
<attribute
name="fileformat"
description="cryptographic signature file format" />
<attribute
name="keyproperty"
default=""
description="name of a property in which to store the name of the cryptographic signature itself" />
<attribute
name="keypassproperty"
default=""
description="name of a property in which to store the password of the cryptographic signature itself" />
<attribute
name="signedfiledescription"
description="short phase describing the file or files to be cryptographically signed" />
<sequential>
<local name="file.needed" />
<condition property="file.needed">
<not>
<or>
<length string="@{fileproperty}" trim="yes" length="0" when="equal" />
<isset property="@{fileproperty}" />
</or>
</not>
</condition>
<local name="file.password.needed" />
<condition property="file.password.needed">
<not>
<or>
<length string="@{filepassproperty}" trim="yes" length="0" when="equal" />
<isset property="@{filepassproperty}" />
</or>
</not>
</condition>
<local name="signature.needed" />
<condition property="signature.needed">
<not>
<or>
<length string="@{keyproperty}" trim="yes" length="0" when="equal" />
<isset property="@{keyproperty}" />
</or>
</not>
</condition>
<local name="signature.password.needed" />
<condition property="signature.password.needed">
<not>
<or>
<length string="@{keypassproperty}" trim="yes" length="0" when="equal" />
<isset property="@{keypassproperty}" />
</or>
</not>
</condition>
<local name="description.needed" />
<condition property="description.needed">
<or>
<isset property="file.needed" />
<isset property="file.password.needed" />
<isset property="signature.needed" />
<isset property="signature.password.needed" />
</or>
</condition>
<echo
level="info"
if:set="description.needed"
message="The @{signedfiledescription} must be cryptographically signed for distribution. Publishing a @{fileformat} file" />
<echo
level="info"
if:set="description.needed"
message="would undermine its ability to provide security, so no such file is included in the Git repository." />
<echo level="info"
if:set="description.needed"
message="You will need to supply your own to continue." />
<input message="Please enter the location of the @{fileformat} file:" addproperty="@{fileproperty}" if:set="file.needed" />
<input message="Please enter the @{fileformat} file password:" addproperty="@{filepassproperty}" if:set="file.password.needed" />
<input message="Please enter the name of the signature to use: " addproperty="@{keyproperty}" if:set="signature.needed" />
<input message="Please enter the signature password: " addproperty="@{keypassproperty}" if:set="signature.password.needed" />
</sequential>
</macrodef>
<!-- ================================================================== -->
<!-- targets -->
<!-- ================================================================== -->
<target name="all" description="get all general metadata" depends="maintainer.name.get, maintainer.email.get, timestamp, version.get, version.last.get" />
<target name="maintainer.name.get" description="get the maintainer's name from git">
<exec executable="git" logError="true" outputproperty="maintainer.name" failonerror="true">
<arg value="config" />
<arg value="user.name" />
</exec>
<condition property="maintainer.name.error">
<or>
<not>
<isset property="maintainer.name" />
</not>
<length string="${maintainer.name}" trim="yes" length="0" when="equal" />
</or>
</condition>
<fail message="The Git user name field is not set." if="${maintainer.name.error}" />
<echo message="The repository maintainer's name is ${maintainer.name}." level="info" />
</target>
<target name="maintainer.email.get" description="get the maintainer's e-mail address from git">
<exec executable="git" logError="true" outputproperty="maintainer.email" failonerror="true">
<arg value="config" />
<arg value="user.email" />
</exec>
<condition property="maintainer.email.error">
<or>
<not>
<isset property="maintainer.email" />
</not>
<length string="${maintainer.email}" trim="yes" length="0" when="equal" />
</or>
</condition>
<fail message="The Git user e-mail address field is not set." if="${maintainer.email.error}" />
<echo message="The repository maintainer's current e-mail address is ${maintainer.email}." level="info" />
</target>
<target name="timestamp" description="fetch timestamp information from the system">
<tstamp>
<format property="TSTAMP" pattern="K:mm a" />
<format property="TODAY" pattern="MMMM d, yyyy" />
</tstamp>
<echo message="Current time is ${TSTAMP} on ${TODAY}." level="info" />
</target>
<target name="version.get" description="get the version from git">
<local name="version.raw" />
<exec executable="git" logError="true" outputproperty="version.raw" failonerror="true">
<arg value="describe" />
<arg value="--tags" />
<arg value="--always" />
<arg value="HEAD" />
</exec>
<local name="dirty.raw" />
<exec executable="git" logError="true" outputproperty="dirty.raw" failonerror="true">
<arg value="status" />
<arg value="--porcelain" />
</exec>
<condition property="version.error">
<or>
<not>
<isset property="version.raw" />
</not>
<length string="${version.raw}" trim="yes" length="0" when="equal" />
</or>
</condition>
<local name="dirty" />
<condition property="dirty">
<resourcecount when="greater" count="0">
<tokens>
<concat>
<filterchain>
<tokenfilter>
<linetokenizer />
</tokenfilter>
</filterchain>
<propertyresource name="dirty.raw" />
</concat>
</tokens>
</resourcecount>
</condition>
<fail message="Version is blank." if="${version.error}" />
<property name="version" value="${version.raw}" unless:set="dirty" />
<property name="version" value="${version.raw}-dirty" if:set="dirty" />
<echo message="The version is currently ${version}." level="info" />
</target>
<target name="version.last.get" description="get the most recent release version from git">
<exec executable="git" logError="true" outputproperty="version.last" failonerror="true">
<arg value="describe" />
<arg value="--tags" />
<arg value="--abbrev=0" />
<arg value="HEAD" />
</exec>
<local name="error" />
<condition property="error">
<or>
<not>
<isset property="version.last" />
</not>
<length string="${version.last}" trim="yes" length="0" when="equal" />
</or>
</condition>
<fail message="Last release version is blank." if="${error}" />
<echo message="The version of the most recent release is ${version.last}." level="info" />
</target>
</project>