Merge lp:~karni/ubuntu-sso-android-library/ant-setup into lp:ubuntu-sso-android-library
- ant-setup
- Merge into trunk
Proposed by
Michał Karnicki
Status: | Merged |
---|---|
Merged at revision: | 44 |
Proposed branch: | lp:~karni/ubuntu-sso-android-library/ant-setup |
Merge into: | lp:ubuntu-sso-android-library |
Diff against target: |
546 lines (+247/-215) 12 files modified
.bzrignore (+8/-2) .classpath (+0/-8) .classpath.template (+10/-0) .project (+0/-33) .project.template (+33/-0) HACKING.txt (+3/-7) ant.properties (+26/-0) build.xml (+139/-70) proguard.cfg (+6/-2) project.properties (+12/-0) setup.sh (+0/-93) tools.sh (+10/-0) |
To merge this branch: | bzr merge lp:~karni/ubuntu-sso-android-library/ant-setup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu One Android hackers | Pending | ||
Review via email: mp+99346@code.launchpad.net |
Commit message
Description of the change
Updated ant setup with dependency on libUbuntuSSO.
Moved classpath and project dot files to templates.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2011-07-29 18:34:11 +0000 | |||
3 | +++ .bzrignore 2012-03-26 15:01:18 +0000 | |||
4 | @@ -1,4 +1,10 @@ | |||
5 | 1 | .project | ||
6 | 2 | .classpath | ||
7 | 3 | local.properties | ||
8 | 4 | proguard.cfg | ||
9 | 1 | bin | 5 | bin |
10 | 2 | gen | 6 | gen |
13 | 3 | libs/* | 7 | libs/libGoogleAnalytics.jar |
14 | 4 | local.properties | 8 | libs/signpost-commonshttp4-*.jar |
15 | 9 | libs/signpost-core-*.jar | ||
16 | 10 | libs/libUbuntuSSO-*.jar | ||
17 | 5 | 11 | ||
18 | === removed file '.classpath' | |||
19 | --- .classpath 2011-09-15 22:34:32 +0000 | |||
20 | +++ .classpath 1970-01-01 00:00:00 +0000 | |||
21 | @@ -1,8 +0,0 @@ | |||
22 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
23 | 2 | <classpath> | ||
24 | 3 | <classpathentry kind="src" path="src"/> | ||
25 | 4 | <classpathentry kind="src" path="gen"/> | ||
26 | 5 | <classpathentry kind="lib" path="libs/*"/> | ||
27 | 6 | <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
28 | 7 | <classpathentry kind="output" path="bin"/> | ||
29 | 8 | </classpath> | ||
30 | 9 | 0 | ||
31 | === added file '.classpath.template' | |||
32 | --- .classpath.template 1970-01-01 00:00:00 +0000 | |||
33 | +++ .classpath.template 2012-03-26 15:01:18 +0000 | |||
34 | @@ -0,0 +1,10 @@ | |||
35 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
36 | 2 | <classpath> | ||
37 | 3 | <classpathentry kind="src" path="src"/> | ||
38 | 4 | <classpathentry kind="src" path="gen"/> | ||
39 | 5 | <classpathentry kind="lib" path="libs/signpost-core-1.2.1.1.jar"/> | ||
40 | 6 | <classpathentry kind="lib" path="libs/signpost-commonshttp4-1.2.1.1.jar"/> | ||
41 | 7 | <classpathentry kind="lib" path="libs/libUbuntuSSO-0.1.0.jar"/> | ||
42 | 8 | <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
43 | 9 | <classpathentry kind="output" path="bin"/> | ||
44 | 10 | </classpath> | ||
45 | 0 | 11 | ||
46 | === removed file '.project' | |||
47 | --- .project 2011-07-20 13:04:09 +0000 | |||
48 | +++ .project 1970-01-01 00:00:00 +0000 | |||
49 | @@ -1,33 +0,0 @@ | |||
50 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
51 | 2 | <projectDescription> | ||
52 | 3 | <name>ubuntu-sso-android-client</name> | ||
53 | 4 | <comment></comment> | ||
54 | 5 | <projects> | ||
55 | 6 | </projects> | ||
56 | 7 | <buildSpec> | ||
57 | 8 | <buildCommand> | ||
58 | 9 | <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> | ||
59 | 10 | <arguments> | ||
60 | 11 | </arguments> | ||
61 | 12 | </buildCommand> | ||
62 | 13 | <buildCommand> | ||
63 | 14 | <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> | ||
64 | 15 | <arguments> | ||
65 | 16 | </arguments> | ||
66 | 17 | </buildCommand> | ||
67 | 18 | <buildCommand> | ||
68 | 19 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
69 | 20 | <arguments> | ||
70 | 21 | </arguments> | ||
71 | 22 | </buildCommand> | ||
72 | 23 | <buildCommand> | ||
73 | 24 | <name>com.android.ide.eclipse.adt.ApkBuilder</name> | ||
74 | 25 | <arguments> | ||
75 | 26 | </arguments> | ||
76 | 27 | </buildCommand> | ||
77 | 28 | </buildSpec> | ||
78 | 29 | <natures> | ||
79 | 30 | <nature>com.android.ide.eclipse.adt.AndroidNature</nature> | ||
80 | 31 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
81 | 32 | </natures> | ||
82 | 33 | </projectDescription> | ||
83 | 34 | 0 | ||
84 | === added file '.project.template' | |||
85 | --- .project.template 1970-01-01 00:00:00 +0000 | |||
86 | +++ .project.template 2012-03-26 15:01:18 +0000 | |||
87 | @@ -0,0 +1,33 @@ | |||
88 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
89 | 2 | <projectDescription> | ||
90 | 3 | <name>ubuntu-sso-android-library</name> | ||
91 | 4 | <comment></comment> | ||
92 | 5 | <projects> | ||
93 | 6 | </projects> | ||
94 | 7 | <buildSpec> | ||
95 | 8 | <buildCommand> | ||
96 | 9 | <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> | ||
97 | 10 | <arguments> | ||
98 | 11 | </arguments> | ||
99 | 12 | </buildCommand> | ||
100 | 13 | <buildCommand> | ||
101 | 14 | <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> | ||
102 | 15 | <arguments> | ||
103 | 16 | </arguments> | ||
104 | 17 | </buildCommand> | ||
105 | 18 | <buildCommand> | ||
106 | 19 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
107 | 20 | <arguments> | ||
108 | 21 | </arguments> | ||
109 | 22 | </buildCommand> | ||
110 | 23 | <buildCommand> | ||
111 | 24 | <name>com.android.ide.eclipse.adt.ApkBuilder</name> | ||
112 | 25 | <arguments> | ||
113 | 26 | </arguments> | ||
114 | 27 | </buildCommand> | ||
115 | 28 | </buildSpec> | ||
116 | 29 | <natures> | ||
117 | 30 | <nature>com.android.ide.eclipse.adt.AndroidNature</nature> | ||
118 | 31 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
119 | 32 | </natures> | ||
120 | 33 | </projectDescription> | ||
121 | 0 | 34 | ||
122 | === modified file 'HACKING.txt' | |||
123 | --- HACKING.txt 2011-07-28 18:34:04 +0000 | |||
124 | +++ HACKING.txt 2012-03-26 15:01:18 +0000 | |||
125 | @@ -1,7 +1,3 @@ | |||
133 | 1 | To compile, run: | 1 | To download dependencies: |
134 | 2 | $ ./setup.sh | 2 | $ ant setup |
135 | 3 | 3 | ||
129 | 4 | Copy ubuntu-sso-java-client.jar into ubuntu-sso-android-client/libs | ||
130 | 5 | (see HACKING.txt of lp:ubuntu-sso-java-client on how to build this jar) | ||
131 | 6 | |||
132 | 7 | $ ant compile | ||
136 | 8 | 4 | ||
137 | === added file 'ant.properties' | |||
138 | --- ant.properties 1970-01-01 00:00:00 +0000 | |||
139 | +++ ant.properties 2012-03-26 15:01:18 +0000 | |||
140 | @@ -0,0 +1,26 @@ | |||
141 | 1 | # Library versions. | ||
142 | 2 | |||
143 | 3 | lib.google-analytics.ver=1.4.2 | ||
144 | 4 | lib.signpost.ver=1.2.1.1 | ||
145 | 5 | lib.ubuntu-sso-java-library.ver=0.1.0 | ||
146 | 6 | |||
147 | 7 | # Library jar file names. | ||
148 | 8 | |||
149 | 9 | lib.google-analytics.zip=GoogleAnalyticsAndroid_${lib.google-analytics.ver}.zip | ||
150 | 10 | lib.google-analytics.jar=libGoogleAnalytics.jar | ||
151 | 11 | lib.signpost-core.jar=signpost-core-${lib.signpost.ver}.jar | ||
152 | 12 | lib.signpost-commonshttp4.jar=signpost-commonshttp4-${lib.signpost.ver}.jar | ||
153 | 13 | lib.ubuntu-sso-java-library.jar=libUbuntuSSO-${lib.ubuntu-sso-java-library.ver}.jar | ||
154 | 14 | |||
155 | 15 | # Library jar download urls. | ||
156 | 16 | |||
157 | 17 | url.goog=http://dl.google.com/gaformobileapps | ||
158 | 18 | lib.google-analytics.url=${url.goog}/${lib.google-analytics.zip} | ||
159 | 19 | |||
160 | 20 | url.oasp=http://oauth-signpost.googlecode.com/files | ||
161 | 21 | lib.signpost-core.url=${url.oasp}/${lib.signpost-core.jar} | ||
162 | 22 | lib.signpost-commonshttp4.url=${url.oasp}/${lib.signpost-commonshttp4.jar} | ||
163 | 23 | |||
164 | 24 | url.lp=http://launchpad.net | ||
165 | 25 | lib.ubuntu-sso-java-library.url=${url.lp}/ubuntu-sso-java-library/trunk/${lib.ubuntu-sso-java-library.ver}/+download/${lib.ubuntu-sso-java-library.jar} | ||
166 | 26 | |||
167 | 0 | 27 | ||
168 | === modified file 'build.xml' | |||
169 | --- build.xml 2011-07-21 21:33:36 +0000 | |||
170 | +++ build.xml 2012-03-26 15:01:18 +0000 | |||
171 | @@ -1,79 +1,148 @@ | |||
172 | 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
210 | 2 | <project name="ubuntu-sso-android-client" default="help"> | 2 | <project name="ubuntu-sso-android-library" basedir="." default="help"> |
211 | 3 | 3 | ||
212 | 4 | <!-- The local.properties file is created and updated by the 'android' | 4 | <description> |
213 | 5 | tool. | 5 | *** Ubuntu SSO Android library *** |
214 | 6 | It contains the path to the SDK. It should *NOT* be checked into | 6 | |
215 | 7 | Version Control Systems. --> | 7 | Ubuntu Single Sign On Android library |
216 | 8 | <property file="local.properties" /> | 8 | |
217 | 9 | 9 | http://one.ubuntu.com | |
218 | 10 | <!-- The build.properties file can be created by you and is never touched | 10 | http://one.ubuntu.com/developer |
219 | 11 | by the 'android' tool. This is the place to change some of the | 11 | http://launchpad.net/ubuntu-sso-android-library |
220 | 12 | default property values used by the Ant rules. | 12 | |
221 | 13 | Here are some properties you may want to change/update: | 13 | You can use this library to easily request authentication to Ubuntu One. |
222 | 14 | 14 | If the official Ubuntu One Files app is installed on the device, | |
223 | 15 | source.dir | 15 | the user will be presented with be asked to authorize access to U1. |
224 | 16 | The name of the source directory. Default is 'src'. | 16 | Otherwise, a dialog will be shown where the user can log in to Ubuntu One |
225 | 17 | out.dir | 17 | to retrieve an OAuth access token. |
226 | 18 | The name of the output directory. Default is 'bin'. | 18 | |
227 | 19 | 19 | For example usage, see | |
228 | 20 | Properties related to the SDK location or the project target should | 20 | https://code.launchpad.net/ubuntu-sso-android-library |
229 | 21 | be updated using the 'android' tool with the 'update' action. | 21 | |
230 | 22 | 22 | IRC: #ubuntuone @ irc.freenode.net | |
231 | 23 | This file is an integral part of the build system for your | 23 | |
232 | 24 | application and should be checked into Version Control Systems. | 24 | For instructions on building, see HACKING.txt |
233 | 25 | 25 | </description> | |
234 | 26 | --> | 26 | |
235 | 27 | <property file="build.properties" /> | 27 | <!-- Check if android is present. --> |
236 | 28 | 28 | <exec executable="./tools.sh" failonerror="true"> | |
237 | 29 | <!-- The default.properties file is created and updated by the 'android' | 29 | </exec> |
238 | 30 | tool, as well as ADT. | 30 | |
239 | 31 | This file is an integral part of the build system for your | 31 | <loadproperties srcFile="project.properties" /> |
240 | 32 | application and should be checked into Version Control Systems. --> | 32 | |
241 | 33 | <property file="default.properties" /> | 33 | <exec executable="android"> |
242 | 34 | 34 | <arg value="update" /> | |
243 | 35 | 35 | <arg value="lib-project" /> | |
244 | 36 | <!-- Required pre-setup import --> | 36 | <arg value="-p" /> |
245 | 37 | <import file="${sdk.dir}/tools/ant/pre_setup.xml" /> | 37 | <arg value="." /> |
246 | 38 | 38 | <arg value="-t" /> | |
247 | 39 | <arg value="${target}" /> | ||
248 | 40 | <!-- Watch out: using name argument will ignore the custom build.xml version-tag! --> | ||
249 | 41 | </exec> | ||
250 | 42 | |||
251 | 43 | <property file="local.properties" /> | ||
252 | 44 | |||
253 | 45 | <!-- quick check on sdk.dir --> | ||
254 | 46 | <fail | ||
255 | 47 | message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" | ||
256 | 48 | unless="sdk.dir" | ||
257 | 49 | /> | ||
258 | 50 | |||
259 | 51 | <!-- The ant.properties file can be created by you. It is only edited by the | ||
260 | 52 | 'android' tool to add properties to it. | ||
261 | 53 | This is the place to change some Ant specific build properties. | ||
262 | 54 | Here are some properties you may want to change/update: | ||
263 | 55 | |||
264 | 56 | source.dir | ||
265 | 57 | The name of the source directory. Default is 'src'. | ||
266 | 58 | out.dir | ||
267 | 59 | The name of the output directory. Default is 'bin'. | ||
268 | 60 | |||
269 | 61 | For other overridable properties, look at the beginning of the rules | ||
270 | 62 | files in the SDK, at tools/ant/build.xml | ||
271 | 63 | |||
272 | 64 | Properties related to the SDK location or the project target should | ||
273 | 65 | be updated using the 'android' tool with the 'update' action. | ||
274 | 66 | |||
275 | 67 | This file is an integral part of the build system for your | ||
276 | 68 | application and should be checked into Version Control Systems. | ||
277 | 69 | |||
278 | 70 | --> | ||
279 | 71 | <property file="ant.properties" /> | ||
280 | 72 | |||
281 | 73 | <property name="libs" value="libs" /> | ||
282 | 74 | |||
283 | 75 | <target name="clean-libs"> | ||
284 | 76 | <delete dir="${libs}" quiet="true" /> | ||
285 | 77 | <mkdir dir="${libs}" /> | ||
286 | 78 | </target> | ||
287 | 79 | |||
288 | 80 | <target name="get-libs"> | ||
289 | 81 | <mkdir dir="${libs}" /> | ||
290 | 82 | |||
291 | 83 | <!-- Google Analytics --> | ||
292 | 84 | <get src="${lib.google-analytics.url}" dest="${libs}" | ||
293 | 85 | verbose="on" usetimestamp="true" maxtime="10" /> | ||
294 | 86 | <unzip src="${libs}/${lib.google-analytics.zip}" dest="${libs}"> | ||
295 | 87 | <patternset> | ||
296 | 88 | <include name="**/${lib.google-analytics.jar}" /> | ||
297 | 89 | </patternset> | ||
298 | 90 | <mapper type="flatten"/> | ||
299 | 91 | </unzip> | ||
300 | 92 | <delete file="${libs}/${lib.google-analytics.zip}" quiet="true" /> | ||
301 | 93 | |||
302 | 94 | <!-- SignPost Core --> | ||
303 | 95 | <get src="${lib.signpost-core.url}" dest="${libs}" | ||
304 | 96 | verbose="on" usetimestamp="true" maxtime="30" /> | ||
305 | 97 | |||
306 | 98 | <!-- SignPost CommonsHttp4 --> | ||
307 | 99 | <get src="${lib.signpost-commonshttp4.url}" dest="${libs}" | ||
308 | 100 | verbose="on" usetimestamp="true" maxtime="30" /> | ||
309 | 101 | |||
310 | 102 | <!-- Ubuntu SSO Java library --> | ||
311 | 103 | <get src="${lib.ubuntu-sso-java-library.url}" dest="${libs}" | ||
312 | 104 | verbose="on" usetimestamp="true" maxtime="30" /> | ||
313 | 105 | </target> | ||
314 | 106 | |||
315 | 107 | <target name="setup" depends="get-libs" | ||
316 | 108 | description="Download porject dependencies."> | ||
317 | 109 | <echo message="Downloaded all project dependencies." /> | ||
318 | 110 | </target> | ||
319 | 39 | 111 | ||
320 | 40 | <!-- extension targets. Uncomment the ones where you want to do custom work | 112 | <!-- extension targets. Uncomment the ones where you want to do custom work |
322 | 41 | in between standard targets --> | 113 | in between standard targets --> |
323 | 42 | <!-- | 114 | <!-- |
328 | 43 | <target name="-pre-build"> | 115 | <target name="-pre-build"> |
329 | 44 | </target> | 116 | </target> |
330 | 45 | <target name="-pre-compile"> | 117 | <target name="-pre-compile"> |
331 | 46 | </target> | 118 | </target> |
332 | 47 | 119 | ||
338 | 48 | [This is typically used for code obfuscation. | 120 | /* This is typically used for code obfuscation. |
339 | 49 | Compiled code location: ${out.classes.absolute.dir} | 121 | Compiled code location: ${out.classes.absolute.dir} |
340 | 50 | If this is not done in place, override ${out.dex.input.absolute.dir}] | 122 | If this is not done in place, override ${out.dex.input.absolute.dir} */ |
341 | 51 | <target name="-post-compile"> | 123 | <target name="-post-compile"> |
342 | 52 | </target> | 124 | </target> |
343 | 53 | --> | 125 | --> |
344 | 54 | 126 | ||
368 | 55 | <!-- Execute the Android Setup task that will setup some properties | 127 | <!-- Import the actual build file. |
369 | 56 | specific to the target, and import the build rules files. | 128 | |
370 | 57 | 129 | To customize existing targets, there are two options: | |
371 | 58 | The rules file is imported from | 130 | - Customize only one target: |
372 | 59 | <SDK>/tools/ant/ | 131 | - copy/paste the target into this file, *before* the |
373 | 60 | Depending on the project type it can be either: | 132 | <import> task. |
374 | 61 | - main_rules.xml | 133 | - customize it to your needs. |
375 | 62 | - lib_rules.xml | 134 | - Customize the whole content of build.xml |
376 | 63 | - test_rules.xml | 135 | - copy/paste the content of the rules files (minus the top node) |
377 | 64 | 136 | into this file, replacing the <import> task. | |
378 | 65 | To customize existing targets, there are two options: | 137 | - customize to your needs. |
379 | 66 | - Customize only one target: | 138 | |
380 | 67 | - copy/paste the target into this file, *before* the | 139 | *********************** |
381 | 68 | <setup> task. | 140 | ****** IMPORTANT ****** |
382 | 69 | - customize it to your needs. | 141 | *********************** |
383 | 70 | - Customize the whole script. | 142 | In all cases you must update the value of version-tag below to read 'custom' instead of an integer, |
384 | 71 | - copy/paste the content of the rules files (minus the top node) | 143 | in order to avoid having your file be overridden by tools such as "android update project" |
385 | 72 | into this file, *after* the <setup> task | 144 | --> |
386 | 73 | - disable the import of the rules by changing the setup task | 145 | <!-- version-tag: custom --> |
387 | 74 | below to <setup import="false" />. | 146 | <import file="${sdk.dir}/tools/ant/build.xml" /> |
365 | 75 | - customize to your needs. | ||
366 | 76 | --> | ||
367 | 77 | <setup /> | ||
388 | 78 | 147 | ||
389 | 79 | </project> | 148 | </project> |
390 | 80 | 149 | ||
391 | === added directory 'libs' | |||
392 | === removed directory 'libs' | |||
393 | === modified file 'proguard.cfg' | |||
394 | --- proguard.cfg 2011-07-19 17:27:13 +0000 | |||
395 | +++ proguard.cfg 2012-03-26 15:01:18 +0000 | |||
396 | @@ -18,14 +18,18 @@ | |||
397 | 18 | native <methods>; | 18 | native <methods>; |
398 | 19 | } | 19 | } |
399 | 20 | 20 | ||
401 | 21 | -keepclasseswithmembernames class * { | 21 | -keepclasseswithmembers class * { |
402 | 22 | public <init>(android.content.Context, android.util.AttributeSet); | 22 | public <init>(android.content.Context, android.util.AttributeSet); |
403 | 23 | } | 23 | } |
404 | 24 | 24 | ||
406 | 25 | -keepclasseswithmembernames class * { | 25 | -keepclasseswithmembers class * { |
407 | 26 | public <init>(android.content.Context, android.util.AttributeSet, int); | 26 | public <init>(android.content.Context, android.util.AttributeSet, int); |
408 | 27 | } | 27 | } |
409 | 28 | 28 | ||
410 | 29 | -keepclassmembers class * extends android.app.Activity { | ||
411 | 30 | public void *(android.view.View); | ||
412 | 31 | } | ||
413 | 32 | |||
414 | 29 | -keepclassmembers enum * { | 33 | -keepclassmembers enum * { |
415 | 30 | public static **[] values(); | 34 | public static **[] values(); |
416 | 31 | public static ** valueOf(java.lang.String); | 35 | public static ** valueOf(java.lang.String); |
417 | 32 | 36 | ||
418 | === added file 'project.properties' | |||
419 | --- project.properties 1970-01-01 00:00:00 +0000 | |||
420 | +++ project.properties 2012-03-26 15:01:18 +0000 | |||
421 | @@ -0,0 +1,12 @@ | |||
422 | 1 | # This file is automatically generated by Android Tools. | ||
423 | 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
424 | 3 | # | ||
425 | 4 | # This file must be checked in Version Control Systems. | ||
426 | 5 | # | ||
427 | 6 | # To customize properties used by the Ant build system use, | ||
428 | 7 | # "ant.properties", and override values to adapt the script to your | ||
429 | 8 | # project structure. | ||
430 | 9 | |||
431 | 10 | android.library=true | ||
432 | 11 | # Project target. | ||
433 | 12 | target=android-7 | ||
434 | 0 | 13 | ||
435 | === removed file 'setup.sh' | |||
436 | --- setup.sh 2011-08-09 14:35:20 +0000 | |||
437 | +++ setup.sh 1970-01-01 00:00:00 +0000 | |||
438 | @@ -1,93 +0,0 @@ | |||
439 | 1 | #!/bin/bash | ||
440 | 2 | |||
441 | 3 | ## TODO: One day, move all this into the build.xml file. The file tests are ripe for use by ant. | ||
442 | 4 | |||
443 | 5 | if test "$1" = "cleanlib"; then | ||
444 | 6 | rm libs/* | ||
445 | 7 | bzr revert libs/ | ||
446 | 8 | fi | ||
447 | 9 | |||
448 | 10 | PROJECTROOT=$(bzr root || pwd) | ||
449 | 11 | |||
450 | 12 | ANDROIDBIN=$(which android) | ||
451 | 13 | if test -z "${DOWNLOADER}"; then which wget >/dev/null && DOWNLOADER="$(which wget) --no-verbose -O "; fi | ||
452 | 14 | if test -z "${DOWNLOADER}"; then which curl >/dev/null && DOWNLOADER="$(which curl) -o "; fi | ||
453 | 15 | |||
454 | 16 | if test -z "${ANDROIDBIN}"; then | ||
455 | 17 | echo "Android SDK tools not in PATH." >&2 | ||
456 | 18 | echo " PATH=\$PATH:/PathToSDK/tools" >&2 | ||
457 | 19 | return 1 | ||
458 | 20 | fi | ||
459 | 21 | |||
460 | 22 | if test -z "${DOWNLOADER}"; then | ||
461 | 23 | echo "Need wget or curl to download." >&2 | ||
462 | 24 | return 1 | ||
463 | 25 | fi | ||
464 | 26 | |||
465 | 27 | GITBIN=$(which git) | ||
466 | 28 | if test -z "${GITBIN}"; then | ||
467 | 29 | echo "You need git to download GreenDroid lib." >&2 | ||
468 | 30 | fi | ||
469 | 31 | |||
470 | 32 | trap "echo ' ==== Not Successful. ===='" EXIT | ||
471 | 33 | set -e | ||
472 | 34 | |||
473 | 35 | echo "Downloading dependencies." | ||
474 | 36 | pushd "${PROJECTROOT}"/libs | ||
475 | 37 | |||
476 | 38 | first() { printf -v $1 "%s" $2; } | ||
477 | 39 | |||
478 | 40 | general_download() { | ||
479 | 41 | local filename=$1 | ||
480 | 42 | local urlstart=$2 | ||
481 | 43 | echo " - ${filename}" | ||
482 | 44 | if test -f "${filename}" && file "${filename}" | grep -i "zip" >/dev/null; then | ||
483 | 45 | : | ||
484 | 46 | else | ||
485 | 47 | rm -f "${filename}" | ||
486 | 48 | first nearby_copy ../../*/libs/${filename} >/dev/null | ||
487 | 49 | cp -l "${nearby_copy}" . || ${DOWNLOADER} "${filename}" "${urlstart}/${filename}" >/dev/null | ||
488 | 50 | |||
489 | 51 | # Unzip Google Analytics: | ||
490 | 52 | if grep -i "analytics" "${filename}" >/dev/null; then | ||
491 | 53 | jarname="libGoogleAnalytics.jar" | ||
492 | 54 | unzip "${filename}" "${jarname}" | ||
493 | 55 | # Remove the zip file. | ||
494 | 56 | rm -f "${filename}" | ||
495 | 57 | filename="${jarname}" | ||
496 | 58 | fi | ||
497 | 59 | fi | ||
498 | 60 | file "${filename}" |grep -i "zip archive" >/dev/null | ||
499 | 61 | return $? | ||
500 | 62 | } | ||
501 | 63 | |||
502 | 64 | launchpad_jar_download() { | ||
503 | 65 | local project_name=$1 | ||
504 | 66 | local project_rev=$2 | ||
505 | 67 | |||
506 | 68 | general_download "${project_name}-${project_rev}.jar" "http://launchpad.net/${project_name}/trunk/${project_rev}/+download" | ||
507 | 69 | return $? | ||
508 | 70 | } | ||
509 | 71 | |||
510 | 72 | # If you add new downloadable jar files here, please add a wildcard to | ||
511 | 73 | # ".bzrignore" to match it in libs/ , and "bzr remove" the existing file if | ||
512 | 74 | # it's in the branch. | ||
513 | 75 | |||
514 | 76 | SIGNPOSTVER=1.2.1.1 | ||
515 | 77 | general_download "signpost-core-${SIGNPOSTVER}.jar" "http://oauth-signpost.googlecode.com/files" | ||
516 | 78 | general_download "signpost-commonshttp4-${SIGNPOSTVER}.jar" "http://oauth-signpost.googlecode.com/files" | ||
517 | 79 | USSO_JAVA_CLIENT_REV=rev14 | ||
518 | 80 | launchpad_jar_download "ubuntu-sso-java-client" "${USSO_JAVA_CLIENT_REV}" | ||
519 | 81 | GOOGLE_ANALYTICS_VER=1.2 | ||
520 | 82 | general_download "GoogleAnalyticsAndroid_${GOOGLE_ANALYTICS_VER}.zip" "http://dl.google.com/gaformobileapps" | ||
521 | 83 | |||
522 | 84 | |||
523 | 85 | popd | ||
524 | 86 | |||
525 | 87 | echo "Updating local project files for this machine and SDK." | ||
526 | 88 | APILEVELID=$(android list target |grep "android-7"|cut -d " " -f 2) | ||
527 | 89 | test "${APILEVELID}" || { echo "Android SDK has no 2.1 API, (level 7). Please install. SDK/tools/android"; false; } | ||
528 | 90 | android update lib-project --path ../ubuntu-sso-android-client --target "${APILEVELID}" | ||
529 | 91 | |||
530 | 92 | echo | ||
531 | 93 | trap EXIT | ||
532 | 94 | 0 | ||
533 | === added file 'tools.sh' | |||
534 | --- tools.sh 1970-01-01 00:00:00 +0000 | |||
535 | +++ tools.sh 2012-03-26 15:01:18 +0000 | |||
536 | @@ -0,0 +1,10 @@ | |||
537 | 1 | #!/bin/bash | ||
538 | 2 | |||
539 | 3 | ANDROIDBIN=$(which android) | ||
540 | 4 | if test -z "${ANDROIDBIN}"; then | ||
541 | 5 | echo "Android SDK tools not in PATH, fix with:" >&2 | ||
542 | 6 | echo " PATH=\$PATH:/PathToSDK/tools" >&2 | ||
543 | 7 | exit 1 | ||
544 | 8 | fi | ||
545 | 9 | |||
546 | 10 | exit 0 |