-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
125 lines (92 loc) · 3.96 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
<project name="Create & Update a PhoneGap BlackBerry Widget Project" default="help">
<!-- LOAD PROPERTIES -->
<property name="template.dir" location="template" />
<property name="phonegap-js.file" location="lib/javascript/phonegap.js" />
<property name="phonegap-js.src" location="js" />
<property name="ext.file" location="lib/ext/phonegap.jar" />
<property name="ext.src" location="framework/ext/src" />
<!-- BUILD JAVASCRIPT -->
<target name="build-javascript">
<dirname property="phonegap-js.dir" file="${phonegap-js.file}" />
<mkdir dir="${phonegap-js.dir}" />
<concat destfile="${phonegap-js.file}" append="false">
<fileset dir="${phonegap-js.src}">
<include name="*.js" />
</fileset>
</concat>
<echo message="Created: ${phonegap-js.file}" />
</target>
<!-- BUILD WIDGET EXTENSION -->
<target name="build-extension">
<dirname property="ext.dir" file="${ext.file}" />
<mkdir dir="${ext.dir}" />
<zip destfile="${ext.file}">
<fileset dir="${ext.src}" includes="library.xml" />
<fileset dir="${ext.src}" includes="**/*.java" />
</zip>
<echo message="Created: ${ext.file}" />
</target>
<!-- CREATE A PROJECT -->
<target name="create" depends="build-javascript, build-extension">
<fail unless="project.path" message="You must give a project PATH. Use the argument -Dproject.path="C:\dev\my_project"" />
<available file="${project.path}" property="project.exists" />
<fail if="project.exists" message="The project path must be an empty directory." />
<!-- copy template directory -->
<mkdir dir="${project.path}" />
<copy todir="${project.path}">
<fileset dir="${template.dir}" />
</copy>
<!-- copy phonegap.js -->
<copy todir="${project.path}/www/javascript">
<fileset dir="${phonegap-js.dir}" />
</copy>
<!-- copy ext/ -->
<copy todir="${project.path}/www/ext">
<fileset dir="${ext.dir}" />
</copy>
<echo>
Congratulations! Your new project has been created.
GETTING STARTED
cd ${project.path}
ant help
</echo>
</target>
<!-- UPDATE A PROJECT -->
<target name="update" depends="build-javascript, build-extension">
<fail unless="project.path" message="You must give a project PATH. Use the argument -Dproject.path="C:\dev\my_project"" />
<available file="${project.path}" property="project.exists" />
<fail unless="project.exists" message="The project path cannot be empty." />
<!-- build.xml -->
<copy todir="${project.path}" file="${template.dir}/build.xml" />
<!-- phonegap.js -->
<copy todir="${project.path}/www/javascript">
<fileset dir="${phonegap-js.dir}" />
</copy>
<!-- ext/phonegap.jar -->
<copy todir="${project.path}/www/ext">
<fileset dir="${ext.dir}" />
</copy>
</target>
<!-- HELP -->
<target name="help">
<echo>
NAME
${ant.project.name}
SYNOPSIS
ant COMMAND [-D<argument>=<value>]...
DESCRIPTION
This tool allows you to create and update PhoneGap-BlackBerry-Widget projects.
You will want to run update after you have updated the framework source.
In other words, when you <git pull origin master>.
COMMANDS
help ..... Show this help menu.
ant, ant help
create ... Create a new project
ant create PATH
ant create -Dproject.path="C:\dev\my_project"
update ... Update an existing project
ant update PATH
ant update -Dproject.path="C:\dev\my_project"
</echo>
</target>
</project>