-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
200 lines (185 loc) · 8.53 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
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
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="GoogleAuthenticator" basedir="." default="release">
<typedef resource="bb-ant-defs.xml" />
<taskdef resource="antenna.properties" />
<property file="application.properties" />
<property file="local.properties" />
<property name="src.dir" value="src" />
<property name="res.dir" value="res" />
<property name="build.dir" value="build" />
<property name="release.dir" value="release" />
<path id="src.path">
<fileset dir="${src.dir}">
<include name="**/*.*" />
</fileset>
</path>
<target name="clean">
<delete failonerror="false" includeEmptyDirs="true">
<fileset dir="${build.dir}" />
<fileset dir="${release.dir}/google-authenticator-${version}" />
</delete>
</target>
<target name="genfiles">
<echo file="${src.dir}/com/google/authenticator/blackberry/Build.java">package com.google.authenticator.blackberry;
public interface Build {
String DOWNLOAD_URL = "${appengine.url}";
}
</echo>
</target>
<target name="release" depends="clean,genfiles">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir}/BlackBerry-45" />
<mkdir dir="${build.dir}/BlackBerry-46" />
<mkdir dir="${build.dir}/BlackBerry-47" />
<mkdir dir="${build.dir}/BlackBerry-50" />
<mkdir dir="${build.dir}/BlackBerry-60" />
<!-- Note: The icon file size is limited, so use 8-bit PNGs -->
<copy file="${res.dir}/drawable-mdpi/${icon}" todir="${build.dir}/BlackBerry-45" />
<copy file="${res.dir}/drawable-hdpi/${icon}" todir="${build.dir}/BlackBerry-46" />
<copy file="${res.dir}/drawable-hdpi/${icon}" todir="${build.dir}/BlackBerry-47" />
<copy file="${res.dir}/drawable-hdpi/${icon}" todir="${build.dir}/BlackBerry-50" />
<copy file="${res.dir}/drawable-hdpi/${icon}" todir="${build.dir}/BlackBerry-60" />
<rapc nowarn="true" generatesourcelist="true" output="com_google_authenticator" destdir="${build.dir}/BlackBerry-45" jdehome="${jdehome45}">
<jdp file="application.properties">
<entry file="entry/startup.properties" />
</jdp>
<src refid="src.path" />
</rapc>
<rapc nowarn="true" generatesourcelist="true" output="com_google_authenticator" destdir="${build.dir}/BlackBerry-46" jdehome="${jdehome46}">
<jdp file="application.properties">
<entry file="entry/startup.properties" />
</jdp>
<src refid="src.path" />
</rapc>
<rapc nowarn="true" generatesourcelist="true" output="com_google_authenticator" destdir="${build.dir}/BlackBerry-47" jdehome="${jdehome47}">
<jdp file="application.properties">
<entry file="entry/startup.properties" />
</jdp>
<src refid="src.path" />
</rapc>
<rapc nowarn="true" generatesourcelist="true" output="com_google_authenticator" destdir="${build.dir}/BlackBerry-50" jdehome="${jdehome50}">
<jdp file="application.properties">
<entry file="entry/startup.properties" />
</jdp>
<src refid="src.path" />
</rapc>
<rapc nowarn="true" generatesourcelist="true" output="com_google_authenticator" destdir="${build.dir}/BlackBerry-60" jdehome="${jdehome60}">
<jdp file="application.properties">
<entry file="entry/startup.properties" />
</jdp>
<src refid="src.path" />
</rapc>
<sigtool jdehome="${jdehome}">
<fileset dir="${build.dir}" includes="**/*.cod" />
</sigtool>
<mkdir dir="${release.dir}" />
<mkdir dir="${release.dir}/google-authenticator-${version}" />
<mkdir dir="${release.dir}/google-authenticator-${version}/alx" />
<mkdir dir="${release.dir}/google-authenticator-${version}/ota" />
<mkdir dir="${release.dir}/google-authenticator-${version}/alx/BlackBerry-45" />
<mkdir dir="${release.dir}/google-authenticator-${version}/alx/BlackBerry-46" />
<mkdir dir="${release.dir}/google-authenticator-${version}/alx/BlackBerry-47" />
<mkdir dir="${release.dir}/google-authenticator-${version}/alx/BlackBerry-50" />
<mkdir dir="${release.dir}/google-authenticator-${version}/alx/BlackBerry-60" />
<mkdir dir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-45" />
<mkdir dir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-46" />
<mkdir dir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-47" />
<mkdir dir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-50" />
<mkdir dir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-60" />
<alx destdir="${release.dir}/google-authenticator-${version}/alx" filename="GoogleAuthenticator.alx">
<application file="application.properties">
<codset greaterthanequal="4.5" lessthan="4.6" dir="BlackBerry-45">
<fileset dir="${build.dir}/BlackBerry-45" includes="*.cod" />
</codset>
<codset greaterthanequal="4.6" lessthan="4.7" dir="BlackBerry-46">
<fileset dir="${build.dir}/BlackBerry-46" includes="*.cod" />
</codset>
<codset greaterthanequal="4.7" lessthan="5.0" dir="BlackBerry-47">
<fileset dir="${build.dir}/BlackBerry-47" includes="*.cod" />
</codset>
<codset greaterthanequal="5.0" lessthan="6.0" dir="BlackBerry-50">
<fileset dir="${build.dir}/BlackBerry-50" includes="*.cod" />
</codset>
<codset greaterthanequal="6.0" dir="BlackBerry-60">
<fileset dir="${build.dir}/BlackBerry-60" includes="*.cod" />
</codset>
</application>
</alx>
<jadtool input="${build.dir}/BlackBerry-45/com_google_authenticator.jad" destdir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-45">
<fileset dir="${build.dir}/BlackBerry-45" includes="*.cod" />
<override key="MIDlet-Name" value="${title}" />
</jadtool>
<jadtool input="${build.dir}/BlackBerry-46/com_google_authenticator.jad" destdir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-46">
<fileset dir="${build.dir}/BlackBerry-46" includes="*.cod" />
<override key="MIDlet-Name" value="${title}" />
</jadtool>
<jadtool input="${build.dir}/BlackBerry-47/com_google_authenticator.jad" destdir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-47">
<fileset dir="${build.dir}/BlackBerry-47" includes="*.cod" />
<override key="MIDlet-Name" value="${title}" />
</jadtool>
<jadtool input="${build.dir}/BlackBerry-50/com_google_authenticator.jad" destdir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-50">
<fileset dir="${build.dir}/BlackBerry-50" includes="*.cod" />
<override key="MIDlet-Name" value="${title}" />
</jadtool>
<jadtool input="${build.dir}/BlackBerry-60/com_google_authenticator.jad" destdir="${release.dir}/google-authenticator-${version}/ota/BlackBerry-60">
<fileset dir="${build.dir}/BlackBerry-60" includes="*.cod" />
<override key="MIDlet-Name" value="${title}" />
</jadtool>
<replace dir="${release.dir}/google-authenticator-${version}/ota/" includes="**/*.jad" token="RIM-COD-URL: " value="RIM-COD-URL-0: " />
<replace dir="${release.dir}/google-authenticator-${version}/ota/" includes="**/*.jad" token="RIM-COD-Size: " value="RIM-COD-Size-0: " />
<zip destfile="${release.dir}/google-authenticator-${version}.zip" basedir="${release.dir}/google-authenticator-${version}" />
<move file="${release.dir}/google-authenticator-${version}.zip" todir="${release.dir}/google-authenticator-${version}" />
<echo file="${release.dir}/google-authenticator-${version}/app.yaml"># Google App Engine Python Application Configuration
application: ${appengine.application}
version: ${appengine.version}
runtime: python
api_version: 1
handlers:
- url: /ota/(.*)\.jad
static_files: ota/\1.jad
upload: ota/(.*)\.jad
mime_type: text/vnd.sun.j2me.app-descriptor
- url: /ota/(.*)\.cod
static_files: ota/\1.cod
upload: ota/(.*)\.cod
mime_type: application/vnd.rim.cod
- url: /google-authenticator\.zip
static_files: google-authenticator-${version}.zip
upload: .*\.zip
- url: /
script: main.py</echo>
<echo file="${release.dir}/google-authenticator-${version}/main.py">#!/usr/bin/env python
import os
# Example: BlackBerry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
ua = os.environ.get('HTTP_USER_AGENT', 'unknown')
if ua.startswith('BlackBerry'):
if '/6.' in ua:
platform = 'BlackBerry-60'
elif '/5.0.' in ua:
platform = 'BlackBerry-50'
elif '/4.7.' in ua:
platform = 'BlackBerry-47'
elif '/4.6.' in ua:
platform = 'BlackBerry-46'
elif '/4.5.' in ua:
platform = 'BlackBerry-45'
else:
platform = None
else:
platform = None
if platform:
host = os.environ.get('HTTP_HOST')
path = '/ota/%s/com_google_authenticator.jad' % platform
if host:
url = 'http://' + host + path
else:
url = path
print 'Status: 302 Moved'
print 'Location: %s' % url
print
else:
print 'Content-Type: text/plain'
print
print 'Unsupported Platform:', ua</echo>
</target>
</project>