Merge lp:~karni/ubuntu-sso-android-library/ant-setup into lp:ubuntu-sso-android-library

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
Reviewer Review Type Date Requested Status
Ubuntu One Android hackers Pending
Review via email: mp+99346@code.launchpad.net

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

Subscribers

People subscribed via source and target branches