]> sigrok.org Git - sigrok-androidutils.git/blob - build.xml
Make update-device-filter generate valid usb-device tags
[sigrok-androidutils.git] / build.xml
1 <!--
2
3    This file is part of the sigrok-androidutils project.
4
5    Copyright (C) 2014 Marcus Comstedt <marcus@mc.pp.se>
6
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 -->
21
22 <project>
23
24   <property name="android.abi" value="armeabi"/>
25
26   <target name="utils" >
27     <mkdir dir="build"/>
28     <javac srcdir="src" destdir="build" includeantruntime="no"
29       classpath="${android.sdk}/platforms/${android.platform}/android.jar"/>
30     <jar destfile="sigrok-androidutils.jar">
31       <fileset dir="build" />
32     </jar>
33   </target>
34
35   <target name="anttasks" >
36     <mkdir dir="ant/build"/>
37     <javac srcdir="ant/src" destdir="ant/build" includeantruntime="yes"/>
38     <jar destfile="ant/sigrok-androidutils-anttasks.jar">
39       <fileset dir="ant/build" />
40       <fileset dir="ant/resources"/>
41     </jar>
42   </target>
43
44   <target name="-declare-anttasks">
45     <taskdef resource="anttasks.properties"
46       classpath="ant/sigrok-androidutils-anttasks.jar"/>
47   </target>
48
49   <target name="aar" depends="-declare-anttasks">
50     <copylibs todir="jni/${android.abi}" property="bundled_libs" rpath-link="${prefix}/lib">
51       <fileset file="${prefix}/lib/jni/libsigrok_java_core_classes.so" />
52       <exclude name="libc.so"/>
53       <exclude name="libm.so"/>
54       <exclude name="libdl.so"/>
55       <exclude name="liblog.so"/>
56       <exclude name="libstdc++.so"/>
57       <exclude name="libz.so"/>
58     </copylibs>
59     <copy file=".libs/libsigrokandroidutils.so" todir="jni/${android.abi}" />
60     <mkdir dir="aidl" />
61     <loadresource property="bindings.versioncode">
62       <propertyresource name="bindings.version" />
63       <filterchain>
64         <tokenfilter>
65           <filetokenizer />
66           <replaceregex pattern="[0-9]+" replace="0000\0" flags="g" />
67           <replaceregex pattern="0*([0-9]{3})\.?" replace="\1" flags="g" />
68           <replaceregex pattern="0*([1-9][0-9]*|0)([^0-9].*)?$" replace="\1" />
69         </tokenfilter>
70       </filterchain>
71     </loadresource>
72     <jar destfile="classes.jar">
73       <zipfileset includes="**/*.class" src="sigrok-androidutils.jar" />
74       <zipfileset includes="**/*.class" src="${prefix}/share/java/sigrok-core.jar" />
75     </jar>
76     <zip destfile="sigrok-core-android-${bindings.version}.aar">
77       <zipfileset dir="aidl" prefix="aidl" />
78       <zipfileset dir="jni" prefix="jni" />
79       <zipfileset dir="." includes="classes.jar" />
80       <mappedresources>
81         <concat>
82           <fileset file="AndroidManifest.xml.in" />
83           <filterchain>
84             <expandproperties />
85           </filterchain>
86         </concat>
87         <mergemapper to="AndroidManifest.xml" />
88       </mappedresources>
89       <mappedresources>
90         <concat><![CDATA[<?xml version='1.0' encoding='utf-8'?>
91 <resources>
92         <array name="sigrok_androidutils_jni_libs">
93                 ${bundled_libs}
94         </array>
95 </resources>]]></concat>
96         <mergemapper to="res/values/sigrok_androidutils_jni_libs.xml" />
97       </mappedresources>
98       <zipfileset file="device_filter.xml" fullpath="res/xml/sigrok_androidutils_device_filter.xml"/>
99     </zip>
100   </target>
101
102   <target name="pom" >
103     <echo file="sigrok-core-android-${bindings.version}.pom"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
104 <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
105     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
106   <modelVersion>4.0.0</modelVersion>
107   <groupId>org.sigrok</groupId>
108   <artifactId>sigrok-core-android</artifactId>
109   <version>${bindings.version}</version>
110   <packaging>aar</packaging>
111 </project>
112 ]]></echo>
113   </target>
114
115 </project>