-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
179 lines (140 loc) · 7.71 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
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="migratesdk" default="warn" basedir=".">
<property name="name" value="migrate-sdk"/>
<property name="migrate.service.dir" value="${basedir}/../migrate"/>
<property name="migrate.client.dir" value="${basedir}/../migrate-client/android/migrate-client"/>
<property name="migrate.browser.dir" value="${basedir}/samples/migrate-browser"/>
<property name="migrate.sdk.artifact" value="migrate-sdk-beta"/>
<property name="samples" value="${basedir}/samples"/>
<property name="lib" value="lib"/>
<property name="deps" value="deps"/>
<property name="src" value="src"/>
<property name="build.home" value="${basedir}/build"/>
<property name="build.classes" value="${build.home}/classes"/>
<property name="build.dist" value="${build.home}/dist"/>
<property name="build.dist.artifact.dir" value="${build.home}/dist/${migrate.sdk.artifact}"/>
<property name="build.dist.lib" value="${build.dist.artifact.dir}/lib"/>
<property name="build.dist.lib.api" value="${build.dist.lib}/api"/>
<property name="build.dist.lib.impl" value="${build.dist.lib}/impl"/>
<target name="rebuild" depends="clean,dist"/>
<property name="ivy.install.version" value="2.3.0-rc1"/>
<property name="ivy.jar.dir" value="${basedir}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}"/>
<!--
download Ivy from web site so that it can be used even without any special installation
-->
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<!--
try to load ivy here from local ivy dir, in case the user has not already dropped it into
ant's lib dir (note that the latter copy will always take precedence). We will not fail as
long as local lib dir exists (it may be empty) and ivy is in at least one of ant's lib dir
or the local lib dir.
-->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="resolve" description="--> resolve ivy dependencies" depends="install-ivy">
<property name="ivy.dep.file" value="${basedir}/ivy.xml" />
<property name="ivy.lib.dir" value="${build.dist.lib.impl}" />
<ivy:retrieve />
</target>
<target name="clean" description="Delete old build and dist directories">
<delete dir="${build.home}"/>
</target>
<path id="compile.classpath">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${build.dist.lib.impl}">
<include name="*.jar"/>
</fileset>
<fileset dir="deps">
<include name="*.jar"/>
</fileset>
</path>
<target name="compile" depends="resolve">
<mkdir dir="${build.classes}"/>
<javac srcdir="${src}" destdir="${build.classes}">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="warn" depends="dist">
<echo message="WARNING: If you only want to use the migrate binary SDK, please follow the ./README instructions for getting started. Building the SDK is for advanced users only."/>
<echo message=""/>
<echo message=""/>
<sleep seconds="10"/>
</target>
<target name="dist" depends="compile" description="Create binary distribution">
<mkdir dir="${build.dist.lib.impl}"/>
<exec dir="samples/MigrateContacts" command="ant clean"/>
<exec dir="samples/migrate-browser" command="ant clean"/>
<exec executable="cp">
<arg value="-r"/>
<arg value="samples"/>
<arg value="${build.dist.artifact.dir}"/>
</exec>
<copy todir="${build.dist.lib.api}/">
<fileset dir="lib" includes="*.jar"/>
</copy>
<copy todir="${build.dist.lib.impl}/">
<fileset dir="deps" includes="*.jar"/>
</copy>
<copy todir="${build.dist.artifact.dir}/">
<fileset dir="${basedir}" includes="migrate-sdk.xml"/>
</copy>
<jar jarfile="${build.dist.lib.impl}/${name}.jar" basedir="${build.classes}" preserve0permissions="true"/>
</target>
<target name="build.migrate.client">
<ant antfile="${migrate.client.dir}/build.xml" usenativebasedir="true" target="dist"/>
<ant antfile="${migrate.client.dir}/build-libs.xml" usenativebasedir="true" target="dist"/>
</target>
<target name="build.migrate.service">
<ant antfile="${migrate.service.dir}/build.xml" usenativebasedir="true" target="local.dist"/>
</target>
<target name="build.migrate.browser">
<copy file="${migrate.client.dir}/build/dist/libs/migrate-api.jar" todir="${migrate.browser.dir}/lib"/>
<ant antfile="${migrate.browser.dir}/build.xml" usenativebasedir="true" target="dist"/>
</target>
<target name="prepare.deps" depends="build.migrate.service,build.migrate.client,build.migrate.browser">
<copy file="${basedir}/README.md" todir="${build.dist.artifact.dir}"/>
<copy file="${basedir}/tools/install_client.sh" todir="${build.dist.artifact.dir}"/>
<copy file="${basedir}/tools/install_service.sh" todir="${build.dist.artifact.dir}"/>
<chmod file="${build.dist.artifact.dir}/install_client.sh" perm="755"/>
<chmod file="${build.dist.artifact.dir}/install_service.sh" perm="755"/>
<copy file="${basedir}/migrate.xml" todir="${build.dist.artifact.dir}"/>
<copy file="${basedir}/migrate.properties" todir="${build.dist.artifact.dir}"/>
<copy file="${migrate.service.dir}/dist/migrate.war" todir="${build.dist.artifact.dir}"/>
<copy file="${migrate.service.dir}/dist/migrate-model.jar" todir="${build.home}"/>
<copy file="${migrate.client.dir}/build/dist/libs/migrate-api.jar" todir="${lib}"/>
<copy file="${migrate.client.dir}/migrate/build/outputs/apk/migrate-debug-unaligned.apk" tofile="${build.dist.artifact.dir}/migrate-client.apk"/>
<copy file="${migrate.browser.dir}/bin/migrate-browser.apk" todir="${build.dist.artifact.dir}"/>
</target>
<target name="dist.deps" depends="prepare.deps,dist" >
<!--Build the final jar.-->
<!--Thank you Java for not preserving file perms. Ugh...-->
<exec executable="zip" dir="${build.dist}" >
<arg value="-r"/>
<arg value="${migrate.sdk.artifact}.zip"/>
<arg value="${migrate.sdk.artifact}"/>
</exec>
</target>
<target name="deps.clean" depends="clean">
<ant antfile="${samples}/migrate-browser/build.xml" usenativebasedir="true" target="clean"/>
<ant antfile="${samples}/MigrateContacts/build.xml" usenativebasedir="true" target="clean"/>
<ant antfile="${migrate.client.dir}/build.xml" usenativebasedir="true" target="clean"/>
<ant antfile="${migrate.service.dir}/build.xml" usenativebasedir="true" target="clean"/>
</target>
<!--Alias thats easier to remember?-->
<target name="dist.deps.clean" depends="deps.clean" />
<target name="dist.deps.local.install" depends="deps.clean,dist.deps">
<exec executable="${build.dist.artifact.dir}/install_client.sh"/>
<exec executable="${build.dist.artifact.dir}/install_service.sh"/>
</target>
</project>