]> sigrok.org Git - sigrok-androidutils.git/blobdiff - build.xml
Makefile.am: Update URL in 'update-device-filter' target.
[sigrok-androidutils.git] / build.xml
index 401e87bd6d230133353d16aefedf06c4dfc9fe5a..e4af70ab6147fd7b79309e71841051dafda30416 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,9 +1,32 @@
+<!--
+
+   This file is part of the sigrok-androidutils project.
+
+   Copyright (C) 2014 Marcus Comstedt <marcus@mc.pp.se>
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+-->
+
 <project>
 
+  <property name="android.abi" value="armeabi"/>
+
   <target name="utils" >
     <mkdir dir="build"/>
     <javac srcdir="src" destdir="build" includeantruntime="no"
-       classpath="${android.sdk}/platforms/${android.platform}/android.jar"/>
+      classpath="${android.sdk}/platforms/${android.platform}/android.jar"/>
     <jar destfile="sigrok-androidutils.jar">
       <fileset dir="build" />
     </jar>
     </jar>
   </target>
 
+  <target name="-declare-anttasks">
+    <taskdef resource="anttasks.properties"
+      classpath="ant/sigrok-androidutils-anttasks.jar"/>
+  </target>
+
+  <target name="aar" depends="-declare-anttasks">
+    <copylibs todir="jni/${android.abi}" property="bundled_libs" rpath-link="${prefix}/lib">
+      <fileset file="${prefix}/lib/jni/libsigrok_java_core_classes.so" />
+      <exclude name="libc.so"/>
+      <exclude name="libm.so"/>
+      <exclude name="libdl.so"/>
+      <exclude name="liblog.so"/>
+      <exclude name="libstdc++.so"/>
+      <exclude name="libz.so"/>
+    </copylibs>
+    <copy file=".libs/libsigrokandroidutils.so" todir="jni/${android.abi}" />
+    <mkdir dir="aidl" />
+    <loadresource property="bindings.versioncode">
+      <propertyresource name="bindings.version" />
+      <filterchain>
+        <tokenfilter>
+          <filetokenizer />
+          <replaceregex pattern="[0-9]+" replace="0000\0" flags="g" />
+          <replaceregex pattern="0*([0-9]{3})\.?" replace="\1" flags="g" />
+          <replaceregex pattern="0*([1-9][0-9]*|0)([^0-9].*)?$" replace="\1" />
+        </tokenfilter>
+      </filterchain>
+    </loadresource>
+    <jar destfile="classes.jar">
+      <zipfileset includes="**/*.class" src="sigrok-androidutils.jar" />
+      <zipfileset includes="**/*.class" src="${prefix}/share/java/sigrok-core.jar" />
+    </jar>
+    <zip destfile="sigrok-core-android-${bindings.version}.aar">
+      <zipfileset dir="aidl" prefix="aidl" />
+      <zipfileset dir="jni" prefix="jni" />
+      <zipfileset dir="." includes="classes.jar" />
+      <mappedresources>
+        <concat>
+          <fileset file="AndroidManifest.xml.in" />
+          <filterchain>
+            <expandproperties />
+          </filterchain>
+        </concat>
+        <mergemapper to="AndroidManifest.xml" />
+      </mappedresources>
+      <mappedresources>
+        <concat><![CDATA[<?xml version='1.0' encoding='utf-8'?>
+<resources>
+       <array name="sigrok_androidutils_jni_libs">
+               ${bundled_libs}
+       </array>
+</resources>]]></concat>
+        <mergemapper to="res/values/sigrok_androidutils_jni_libs.xml" />
+      </mappedresources>
+      <zipfileset file="device_filter.xml" fullpath="res/xml/sigrok_androidutils_device_filter.xml"/>
+    </zip>
+  </target>
+
+  <target name="pom" >
+    <echo file="sigrok-core-android-${bindings.version}.pom"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<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"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.sigrok</groupId>
+  <artifactId>sigrok-core-android</artifactId>
+  <version>${bindings.version}</version>
+  <packaging>aar</packaging>
+</project>
+]]></echo>
+  </target>
+
 </project>