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
=== modified file '.bzrignore'
--- .bzrignore 2011-07-29 18:34:11 +0000
+++ .bzrignore 2012-03-26 15:01:18 +0000
@@ -1,4 +1,10 @@
1.project
2.classpath
3local.properties
4proguard.cfg
1bin5bin
2gen6gen
3libs/*7libs/libGoogleAnalytics.jar
4local.properties8libs/signpost-commonshttp4-*.jar
9libs/signpost-core-*.jar
10libs/libUbuntuSSO-*.jar
511
=== removed file '.classpath'
--- .classpath 2011-09-15 22:34:32 +0000
+++ .classpath 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="src" path="src"/>
4 <classpathentry kind="src" path="gen"/>
5 <classpathentry kind="lib" path="libs/*"/>
6 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
7 <classpathentry kind="output" path="bin"/>
8</classpath>
90
=== added file '.classpath.template'
--- .classpath.template 1970-01-01 00:00:00 +0000
+++ .classpath.template 2012-03-26 15:01:18 +0000
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="src" path="src"/>
4 <classpathentry kind="src" path="gen"/>
5 <classpathentry kind="lib" path="libs/signpost-core-1.2.1.1.jar"/>
6 <classpathentry kind="lib" path="libs/signpost-commonshttp4-1.2.1.1.jar"/>
7 <classpathentry kind="lib" path="libs/libUbuntuSSO-0.1.0.jar"/>
8 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
9 <classpathentry kind="output" path="bin"/>
10</classpath>
011
=== removed file '.project'
--- .project 2011-07-20 13:04:09 +0000
+++ .project 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>ubuntu-sso-android-client</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.jdt.core.javabuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 <buildCommand>
24 <name>com.android.ide.eclipse.adt.ApkBuilder</name>
25 <arguments>
26 </arguments>
27 </buildCommand>
28 </buildSpec>
29 <natures>
30 <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31 <nature>org.eclipse.jdt.core.javanature</nature>
32 </natures>
33</projectDescription>
340
=== added file '.project.template'
--- .project.template 1970-01-01 00:00:00 +0000
+++ .project.template 2012-03-26 15:01:18 +0000
@@ -0,0 +1,33 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>ubuntu-sso-android-library</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.jdt.core.javabuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 <buildCommand>
24 <name>com.android.ide.eclipse.adt.ApkBuilder</name>
25 <arguments>
26 </arguments>
27 </buildCommand>
28 </buildSpec>
29 <natures>
30 <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31 <nature>org.eclipse.jdt.core.javanature</nature>
32 </natures>
33</projectDescription>
034
=== modified file 'HACKING.txt'
--- HACKING.txt 2011-07-28 18:34:04 +0000
+++ HACKING.txt 2012-03-26 15:01:18 +0000
@@ -1,7 +1,3 @@
1To compile, run:1To download dependencies:
2$ ./setup.sh2$ ant setup
33
4Copy ubuntu-sso-java-client.jar into ubuntu-sso-android-client/libs
5(see HACKING.txt of lp:ubuntu-sso-java-client on how to build this jar)
6
7$ ant compile
84
=== added file 'ant.properties'
--- ant.properties 1970-01-01 00:00:00 +0000
+++ ant.properties 2012-03-26 15:01:18 +0000
@@ -0,0 +1,26 @@
1# Library versions.
2
3lib.google-analytics.ver=1.4.2
4lib.signpost.ver=1.2.1.1
5lib.ubuntu-sso-java-library.ver=0.1.0
6
7# Library jar file names.
8
9lib.google-analytics.zip=GoogleAnalyticsAndroid_${lib.google-analytics.ver}.zip
10lib.google-analytics.jar=libGoogleAnalytics.jar
11lib.signpost-core.jar=signpost-core-${lib.signpost.ver}.jar
12lib.signpost-commonshttp4.jar=signpost-commonshttp4-${lib.signpost.ver}.jar
13lib.ubuntu-sso-java-library.jar=libUbuntuSSO-${lib.ubuntu-sso-java-library.ver}.jar
14
15# Library jar download urls.
16
17url.goog=http://dl.google.com/gaformobileapps
18lib.google-analytics.url=${url.goog}/${lib.google-analytics.zip}
19
20url.oasp=http://oauth-signpost.googlecode.com/files
21lib.signpost-core.url=${url.oasp}/${lib.signpost-core.jar}
22lib.signpost-commonshttp4.url=${url.oasp}/${lib.signpost-commonshttp4.jar}
23
24url.lp=http://launchpad.net
25lib.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}
26
027
=== modified file 'build.xml'
--- build.xml 2011-07-21 21:33:36 +0000
+++ build.xml 2012-03-26 15:01:18 +0000
@@ -1,79 +1,148 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<project name="ubuntu-sso-android-client" default="help">2<project name="ubuntu-sso-android-library" basedir="." default="help">
33
4<!-- The local.properties file is created and updated by the 'android'4 <description>
5 tool.5 *** Ubuntu SSO Android library ***
6 It contains the path to the SDK. It should *NOT* be checked into6
7 Version Control Systems. -->7 Ubuntu Single Sign On Android library
8 <property file="local.properties" />8
99 http://one.ubuntu.com
10 <!-- The build.properties file can be created by you and is never touched10 http://one.ubuntu.com/developer
11 by the 'android' tool. This is the place to change some of the11 http://launchpad.net/ubuntu-sso-android-library
12 default property values used by the Ant rules.12
13 Here are some properties you may want to change/update:13 You can use this library to easily request authentication to Ubuntu One.
1414 If the official Ubuntu One Files app is installed on the device,
15 source.dir15 the user will be presented with be asked to authorize access to U1.
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
17 out.dir17 to retrieve an OAuth access token.
18 The name of the output directory. Default is 'bin'.18
1919 For example usage, see
20 Properties related to the SDK location or the project target should20 https://code.launchpad.net/ubuntu-sso-android-library
21 be updated using the 'android' tool with the 'update' action.21
2222 IRC: #ubuntuone @ irc.freenode.net
23 This file is an integral part of the build system for your23
24 application and should be checked into Version Control Systems.24 For instructions on building, see HACKING.txt
2525 </description>
26 -->26
27 <property file="build.properties" />27 <!-- Check if android is present. -->
2828 <exec executable="./tools.sh" failonerror="true">
29 <!-- The default.properties file is created and updated by the 'android'29 </exec>
30 tool, as well as ADT.30
31 This file is an integral part of the build system for your31 <loadproperties srcFile="project.properties" />
32 application and should be checked into Version Control Systems. -->32
33 <property file="default.properties" />33 <exec executable="android">
3434 <arg value="update" />
3535 <arg value="lib-project" />
36 <!-- Required pre-setup import -->36 <arg value="-p" />
37 <import file="${sdk.dir}/tools/ant/pre_setup.xml" />37 <arg value="." />
3838 <arg value="-t" />
39 <arg value="${target}" />
40 <!-- Watch out: using name argument will ignore the custom build.xml version-tag! -->
41 </exec>
42
43 <property file="local.properties" />
44
45 <!-- quick check on sdk.dir -->
46 <fail
47 message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
48 unless="sdk.dir"
49 />
50
51 <!-- The ant.properties file can be created by you. It is only edited by the
52 'android' tool to add properties to it.
53 This is the place to change some Ant specific build properties.
54 Here are some properties you may want to change/update:
55
56 source.dir
57 The name of the source directory. Default is 'src'.
58 out.dir
59 The name of the output directory. Default is 'bin'.
60
61 For other overridable properties, look at the beginning of the rules
62 files in the SDK, at tools/ant/build.xml
63
64 Properties related to the SDK location or the project target should
65 be updated using the 'android' tool with the 'update' action.
66
67 This file is an integral part of the build system for your
68 application and should be checked into Version Control Systems.
69
70 -->
71 <property file="ant.properties" />
72
73 <property name="libs" value="libs" />
74
75 <target name="clean-libs">
76 <delete dir="${libs}" quiet="true" />
77 <mkdir dir="${libs}" />
78 </target>
79
80 <target name="get-libs">
81 <mkdir dir="${libs}" />
82
83 <!-- Google Analytics -->
84 <get src="${lib.google-analytics.url}" dest="${libs}"
85 verbose="on" usetimestamp="true" maxtime="10" />
86 <unzip src="${libs}/${lib.google-analytics.zip}" dest="${libs}">
87 <patternset>
88 <include name="**/${lib.google-analytics.jar}" />
89 </patternset>
90 <mapper type="flatten"/>
91 </unzip>
92 <delete file="${libs}/${lib.google-analytics.zip}" quiet="true" />
93
94 <!-- SignPost Core -->
95 <get src="${lib.signpost-core.url}" dest="${libs}"
96 verbose="on" usetimestamp="true" maxtime="30" />
97
98 <!-- SignPost CommonsHttp4 -->
99 <get src="${lib.signpost-commonshttp4.url}" dest="${libs}"
100 verbose="on" usetimestamp="true" maxtime="30" />
101
102 <!-- Ubuntu SSO Java library -->
103 <get src="${lib.ubuntu-sso-java-library.url}" dest="${libs}"
104 verbose="on" usetimestamp="true" maxtime="30" />
105 </target>
106
107 <target name="setup" depends="get-libs"
108 description="Download porject dependencies.">
109 <echo message="Downloaded all project dependencies." />
110 </target>
39111
40<!-- extension targets. Uncomment the ones where you want to do custom work112<!-- extension targets. Uncomment the ones where you want to do custom work
41 in between standard targets -->113 in between standard targets -->
42<!--114<!--
43 <target name="-pre-build">115 <target name="-pre-build">
44 </target>116 </target>
45 <target name="-pre-compile">117 <target name="-pre-compile">
46 </target>118 </target>
47119
48 [This is typically used for code obfuscation.120 /* This is typically used for code obfuscation.
49 Compiled code location: ${out.classes.absolute.dir}121 Compiled code location: ${out.classes.absolute.dir}
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} */
51 <target name="-post-compile">123 <target name="-post-compile">
52 </target>124 </target>
53-->125-->
54126
55 <!-- Execute the Android Setup task that will setup some properties127 <!-- Import the actual build file.
56 specific to the target, and import the build rules files.128
57129 To customize existing targets, there are two options:
58 The rules file is imported from130 - Customize only one target:
59 <SDK>/tools/ant/131 - copy/paste the target into this file, *before* the
60 Depending on the project type it can be either:132 <import> task.
61 - main_rules.xml133 - customize it to your needs.
62 - lib_rules.xml134 - Customize the whole content of build.xml
63 - test_rules.xml135 - copy/paste the content of the rules files (minus the top node)
64136 into this file, replacing the <import> task.
65 To customize existing targets, there are two options:137 - customize to your needs.
66 - Customize only one target:138
67 - copy/paste the target into this file, *before* the139 ***********************
68 <setup> task.140 ****** IMPORTANT ******
69 - customize it to your needs.141 ***********************
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,
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"
72 into this file, *after* the <setup> task144 -->
73 - disable the import of the rules by changing the setup task145 <!-- version-tag: custom -->
74 below to <setup import="false" />.146 <import file="${sdk.dir}/tools/ant/build.xml" />
75 - customize to your needs.
76 -->
77 <setup />
78147
79</project>148</project>
80149
=== added directory 'libs'
=== removed directory 'libs'
=== modified file 'proguard.cfg'
--- proguard.cfg 2011-07-19 17:27:13 +0000
+++ proguard.cfg 2012-03-26 15:01:18 +0000
@@ -18,14 +18,18 @@
18 native <methods>;18 native <methods>;
19}19}
2020
21-keepclasseswithmembernames class * {21-keepclasseswithmembers class * {
22 public <init>(android.content.Context, android.util.AttributeSet);22 public <init>(android.content.Context, android.util.AttributeSet);
23}23}
2424
25-keepclasseswithmembernames class * {25-keepclasseswithmembers class * {
26 public <init>(android.content.Context, android.util.AttributeSet, int);26 public <init>(android.content.Context, android.util.AttributeSet, int);
27}27}
2828
29-keepclassmembers class * extends android.app.Activity {
30 public void *(android.view.View);
31}
32
29-keepclassmembers enum * {33-keepclassmembers enum * {
30 public static **[] values();34 public static **[] values();
31 public static ** valueOf(java.lang.String);35 public static ** valueOf(java.lang.String);
3236
=== added file 'project.properties'
--- project.properties 1970-01-01 00:00:00 +0000
+++ project.properties 2012-03-26 15:01:18 +0000
@@ -0,0 +1,12 @@
1# This file is automatically generated by Android Tools.
2# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3#
4# This file must be checked in Version Control Systems.
5#
6# To customize properties used by the Ant build system use,
7# "ant.properties", and override values to adapt the script to your
8# project structure.
9
10android.library=true
11# Project target.
12target=android-7
013
=== removed file 'setup.sh'
--- setup.sh 2011-08-09 14:35:20 +0000
+++ setup.sh 1970-01-01 00:00:00 +0000
@@ -1,93 +0,0 @@
1#!/bin/bash
2
3## TODO: One day, move all this into the build.xml file. The file tests are ripe for use by ant.
4
5if test "$1" = "cleanlib"; then
6 rm libs/*
7 bzr revert libs/
8fi
9
10PROJECTROOT=$(bzr root || pwd)
11
12ANDROIDBIN=$(which android)
13if test -z "${DOWNLOADER}"; then which wget >/dev/null && DOWNLOADER="$(which wget) --no-verbose -O "; fi
14if test -z "${DOWNLOADER}"; then which curl >/dev/null && DOWNLOADER="$(which curl) -o "; fi
15
16if test -z "${ANDROIDBIN}"; then
17 echo "Android SDK tools not in PATH." >&2
18 echo " PATH=\$PATH:/PathToSDK/tools" >&2
19 return 1
20fi
21
22if test -z "${DOWNLOADER}"; then
23 echo "Need wget or curl to download." >&2
24 return 1
25fi
26
27GITBIN=$(which git)
28if test -z "${GITBIN}"; then
29 echo "You need git to download GreenDroid lib." >&2
30fi
31
32trap "echo ' ==== Not Successful. ===='" EXIT
33set -e
34
35echo "Downloading dependencies."
36pushd "${PROJECTROOT}"/libs
37
38first() { printf -v $1 "%s" $2; }
39
40general_download() {
41 local filename=$1
42 local urlstart=$2
43 echo " - ${filename}"
44 if test -f "${filename}" && file "${filename}" | grep -i "zip" >/dev/null; then
45 :
46 else
47 rm -f "${filename}"
48 first nearby_copy ../../*/libs/${filename} >/dev/null
49 cp -l "${nearby_copy}" . || ${DOWNLOADER} "${filename}" "${urlstart}/${filename}" >/dev/null
50
51 # Unzip Google Analytics:
52 if grep -i "analytics" "${filename}" >/dev/null; then
53 jarname="libGoogleAnalytics.jar"
54 unzip "${filename}" "${jarname}"
55 # Remove the zip file.
56 rm -f "${filename}"
57 filename="${jarname}"
58 fi
59 fi
60 file "${filename}" |grep -i "zip archive" >/dev/null
61 return $?
62}
63
64launchpad_jar_download() {
65 local project_name=$1
66 local project_rev=$2
67
68 general_download "${project_name}-${project_rev}.jar" "http://launchpad.net/${project_name}/trunk/${project_rev}/+download"
69 return $?
70}
71
72# If you add new downloadable jar files here, please add a wildcard to
73# ".bzrignore" to match it in libs/ , and "bzr remove" the existing file if
74# it's in the branch.
75
76SIGNPOSTVER=1.2.1.1
77general_download "signpost-core-${SIGNPOSTVER}.jar" "http://oauth-signpost.googlecode.com/files"
78general_download "signpost-commonshttp4-${SIGNPOSTVER}.jar" "http://oauth-signpost.googlecode.com/files"
79USSO_JAVA_CLIENT_REV=rev14
80launchpad_jar_download "ubuntu-sso-java-client" "${USSO_JAVA_CLIENT_REV}"
81GOOGLE_ANALYTICS_VER=1.2
82general_download "GoogleAnalyticsAndroid_${GOOGLE_ANALYTICS_VER}.zip" "http://dl.google.com/gaformobileapps"
83
84
85popd
86
87echo "Updating local project files for this machine and SDK."
88APILEVELID=$(android list target |grep "android-7"|cut -d " " -f 2)
89test "${APILEVELID}" || { echo "Android SDK has no 2.1 API, (level 7). Please install. SDK/tools/android"; false; }
90android update lib-project --path ../ubuntu-sso-android-client --target "${APILEVELID}"
91
92echo
93trap EXIT
940
=== added file 'tools.sh'
--- tools.sh 1970-01-01 00:00:00 +0000
+++ tools.sh 2012-03-26 15:01:18 +0000
@@ -0,0 +1,10 @@
1#!/bin/bash
2
3ANDROIDBIN=$(which android)
4if test -z "${ANDROIDBIN}"; then
5 echo "Android SDK tools not in PATH, fix with:" >&2
6 echo " PATH=\$PATH:/PathToSDK/tools" >&2
7 exit 1
8fi
9
10exit 0

Subscribers

People subscribed via source and target branches