custbuild.xml 7.15 KB
Newer Older
Jon Sharp's avatar
Jon Sharp committed
1
2
<?eclipse.ant.import?>
<!-- custom targets
Jon Sharp's avatar
Jon Sharp committed
3
4
5
6
7
8
9
10
11
To customise:
- Create a set of custom image files in a parallel directory structure to ./res
and change 'res_sol' below to the directory name. Change filenames to be copied below as required.
- Check changes in text below, and add your own.
- In Eclipse do File->Export, Ant buildfiles, select project name, Finish. 
This will create a build.xml file which will do an include on this one (because of the PI on the top line above)
- Do ant custom to run the customisations
- To build apk - in Eclipse do Project->Clean, then Run->Run As->Android application (this builds Release version of apk)

Jon Sharp's avatar
Jon Sharp committed
12
13
14
15
16
17
18
ref: http://ant.apache.org/manual/
-->
<project >

  <property name="CUST_DIR" value="./res_sol"/>
  <property name="RES_DIR" value="./res"/>

Jon Sharp's avatar
Jon Sharp committed
19
  <target depends="init,copyicons,editstrings,editwindowtitle"  description="All customisation" name="custom" >
Jon Sharp's avatar
Jon Sharp committed
20
    <echo message="Doing custom tasks"/>
Jon Sharp's avatar
Jon Sharp committed
21
  </target>
Jon Sharp's avatar
Jon Sharp committed
22
23
  
  
Jon Sharp's avatar
Jon Sharp committed
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
  <target depends="init"  description="copy icons" name="copyicons">
    <echo message="copying icons"/>

    <mkdir dir="${RES_DIR}/drawable/std"/>

    <copy file="${RES_DIR}/drawable/icon.png" todir="${RES_DIR}/drawable/std/" 
          overwrite="true" failonerror="false" verbose="true"/>
    <copy file="${CUST_DIR}/drawable/icon.png" todir="${RES_DIR}/drawable/"
          overwrite="true" failonerror="false" verbose="true"/>

    <copy file="${RES_DIR}/drawable/button.9.png" todir="${RES_DIR}/drawable/" 
          overwrite="true" failonerror="false" verbose="true"/>
    <copy file="${CUST_DIR}/drawable/button.9.png" todir="${RES_DIR}/drawable/"
          overwrite="true" failonerror="false" verbose="true"/>

    <copy file="${RES_DIR}/drawable/button_pressed.9.png" todir="${RES_DIR}/drawable/std/" 
          overwrite="true" failonerror="false" verbose="true"/>
    <copy file="${CUST_DIR}/drawable/button_pressed.9.png" todir="${RES_DIR}/drawable/"
          overwrite="true" failonerror="false" verbose="true"/>

    <copy file="${RES_DIR}/drawable/windowtitle_background.png" todir="${RES_DIR}/drawable/std/" 
          overwrite="true" failonerror="false" verbose="true"/>
    <copy file="${CUST_DIR}/drawable/windowtitle_background.png" todir="${RES_DIR}/drawable/"
          overwrite="true" failonerror="false" verbose="true"/>


    <property name="SCRSZ" value="-hdpi"/>
    <mkdir dir="${RES_DIR}/drawable${SCRSZ}/std"/>

    <copy file="${RES_DIR}/drawable${SCRSZ}/icon.png" todir="${RES_DIR}/drawable${SCRSZ}/std/" 
          overwrite="true" failonerror="false" verbose="true"/>
    <copy file="${CUST_DIR}/drawable${SCRSZ}/icon.png" todir="${RES_DIR}/drawable${SCRSZ}/"
          overwrite="true" failonerror="true" verbose="true"/>

    <property name="SCRSZxh" value="-xhdpi"/>
    <mkdir dir="${RES_DIR}/drawable${SCRSZxh}/std"/>

    <copy file="${RES_DIR}/drawable${SCRSZxh}/icon.png" todir="${RES_DIR}/drawable${SCRSZxh}/std/" 
          overwrite="true" failonerror="false" verbose="true"/>
    <copy file="${CUST_DIR}/drawable${SCRSZxh}/icon.png" todir="${RES_DIR}/drawable${SCRSZxh}/"
          overwrite="true" failonerror="true" verbose="true"/>

    <property name="SCRSZl" value="-ldpi"/>
    <mkdir dir="${RES_DIR}/drawable${SCRSZl}/std"/>

    <copy file="${RES_DIR}/drawable${SCRSZl}/icon.png" todir="${RES_DIR}/drawable${SCRSZl}/std/" 
          overwrite="true" failonerror="false" verbose="true"/>
    <copy file="${CUST_DIR}/drawable${SCRSZl}/icon.png" todir="${RES_DIR}/drawable${SCRSZl}/"
          overwrite="true" failonerror="true" verbose="true"/>

    <property name="SCRSZm" value="-mdpi"/>
    <mkdir dir="${RES_DIR}/drawable${SCRSZm}/std"/>

    <copy file="${RES_DIR}/drawable${SCRSZm}/icon.png" todir="${RES_DIR}/drawable${SCRSZm}/std/" 
          overwrite="true" failonerror="false" verbose="true"/>
    <copy file="${CUST_DIR}/drawable${SCRSZm}/icon.png" todir="${RES_DIR}/drawable${SCRSZm}/"
          overwrite="true" failonerror="true" verbose="true"/>

  </target>

Jon Sharp's avatar
Jon Sharp committed
84

Jon Sharp's avatar
Jon Sharp committed
85
86
87
88
89
90
91
92
  <target depends="init"  description="edit custom strings" name="editstrings">
    <!-- this makes a copy of the original file in the std dir
        If run a second time - it will not overwrite the saved file, and will not make changes
        to the main one as the token will not now match - hopefully what we want!
        Note: if a different language than default is used  - then the lang specific files will need to 
        be manually changed -->
    <echo message="editing custom strings"/>
    <mkdir dir="${RES_DIR}/values/std"/>
Jon Sharp's avatar
Jon Sharp committed
93
94

    <!-- <upload.base.uri>http://solent-mahara.catalystdemo.co.uk</upload.base.uri>   -->
Jon Sharp's avatar
Jon Sharp committed
95
96
97
98
99
100
    <copy file="${RES_DIR}/values/strings.xml"  todir="${RES_DIR}/values/std/" 
          overwrite="false" failonerror="false" verbose="true"/>
    <replace file="${RES_DIR}/values/strings.xml" 
          token="&lt;string name=&quot;pref_base_url_default&quot;&gt;&lt;/string&gt;" 
          value="&lt;string name=&quot;pref_base_url_default&quot;&gt;http://solent-mahara.catalystdemo.co.uk&lt;/string&gt;" 
          summary="true"/>
Jon Sharp's avatar
Jon Sharp committed
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
          
      <!-- string name="app_name">MaharaDroid</string-->
      <replace file="${RES_DIR}/values/strings.xml" 
          token="&lt;string name=&quot;app_name&quot;&gt;MaharaDroid&lt;/string&gt;" 
          value="&lt;string name=&quot;app_name&quot;&gt;myPortfolio&lt;/string&gt;" 
          summary="true"/>
  </target>
  
  
  <target depends="init"  description="edit windowtitle" name="editwindowtitle">
    <!-- this makes a copy of the original file in the std dir
         Notes as for editstrings - though this cannot reliably detect if content is already there
     -->
    <echo message="adding custom windowtitle element"/>
    <mkdir dir="${RES_DIR}/values/std"/>

    <copy file="${RES_DIR}/layout/windowtitle.xml"  todir="${RES_DIR}/layout/std/" 
          overwrite="false" failonerror="false" verbose="true"/>
    <replace file="${RES_DIR}/layout/windowtitle.xml" 
          token="&lt;/LinearLayout&gt;"
          value="       &lt;!--  custom icon on right of header --&gt;&#xa;
     &lt;ImageView&#xa;
        android:id=&quot;@+id/windowtitle_cust_icon&quot;&#xa;
        android:src=&quot;@drawable/windowtitle_cust_icon&quot;&#xa;
        android:layout_width=&quot;wrap_content&quot;&#xa;
        android:layout_height=&quot;wrap_content&quot;&#xa;
        android:layout_gravity=&quot;right&quot;&#xa;
        android:layout_weight=&quot;0&quot;&#xa;
        android:padding=&quot;0dp&quot;&#xa;
        android:layout_margin=&quot;0dp&quot;&#xa;
        android:scaleType=&quot;fitStart&quot;&#xa;
        /&gt;&#xa;
&lt;/LinearLayout&gt;&#xa;"
          summary="true"/>
Jon Sharp's avatar
Jon Sharp committed
135
136
137
  </target>
  
  
Jon Sharp's avatar
Jon Sharp committed
138
  
Jon Sharp's avatar
Jon Sharp committed
139
  <!-- see above for build information -->
Jon Sharp's avatar
Jon Sharp committed
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
  <target depends="init"  description="copy apk" name="copyapk">
    <echo message="copying apk"/>
    <echo message="now copy ./bin/ArtefactExpandableListAdapterActivity.apk to server"/>
  </target>

  <target description="generate qr code from config.xml" name="genqr">
    <!-- qrencode -o config.png < config.xml -->
    <exec executable="qrencode" input="config.xml">
      <arg value="-o"/>
      <arg value="config.png"/>
    </exec>
  </target>

  <target description="run draw9patch" name="draw9patch">
    <exec executable="draw9patch" >
    </exec>
  </target>


</project>