From de86f0a79b723c726861c16336ab9e76098e6652 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr>
Date: Tue, 13 Mar 2012 21:51:49 +0000
Subject: [PATCH] - working version (on MacOS) or Proguard

---
 html/micro.html           |  2 +-
 plugins/android/build.xml | 39 +++++++++++++++++++++++++++++++++++----
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/html/micro.html b/html/micro.html
index 2e17d91f..a6badf6a 100644
--- a/html/micro.html
+++ b/html/micro.html
@@ -116,7 +116,7 @@ The resulting sizes to be embedded are the following:
 <th><td>standard</td><td>micro</td><td>micro*</td><td>pico</td><td>align</td></th>
 <tr><td>align.jar</td><td>16k</td><td>16k</td><td>16k</td><td>16k</td><td>16k</td></tr>
 <tr><td>ontowrap.jar</td><td>61k</td><td>-</td><td></td><td></td><td></td></tr>
-<tr><td>procalign.jar</td><td>238k</td><td>154k</td><td>95k?</td><td>152k</td><td></td></tr>
+<tr><td>procalign.jar</td><td>238k</td><td>154k</td><td>99k</td><td>152k</td><td></td></tr>
 <tr><td>alignsvc.jar</td><td>98k</td><td>-</td><td></td><td></td><td></td></tr>
 <tr><td>lib</td><td>29232k</td><td>7444k</td><td>7444k</td><td>2272k</td><td></td></tr>
 </table>
diff --git a/plugins/android/build.xml b/plugins/android/build.xml
index 83dfe531..0fdd4d67 100644
--- a/plugins/android/build.xml
+++ b/plugins/android/build.xml
@@ -15,9 +15,9 @@
     <file name="log4j/slf4j-api.jar"/>
     <file name="log4j/slf4j-log4j.jar"/>
     <file name="xerces/resolver.jar"/>
-    <file name="xerces/xercesImpl.jar"/>
+    <file name="xerces/xercesImpl.jar"/>            <!-- redundancy in the two following -->
     <file name="xsdlib/xsdlib.jar"/>
-    <file name="xsdlib/relaxngDatatype.jar"/>
+    <!--file name="xsdlib/relaxngDatatype.jar"/-->  <!-- is this one in the JDK? -->
   </filelist>
 
   <fileset id="musrc" dir="../../src">
@@ -47,7 +47,10 @@
   <path id="classpath">
     <filelist refid="mujar"/>
   </path>
-    
+
+  <taskdef resource="proguard/ant/task.properties"
+	   classpath="../../tools/proguard/proguard.jar" />
+
   <!-- tested -->
   <target name="usage" depends="init">
     <echo>ant _target_ _options_
@@ -152,8 +155,36 @@
     <antcall target="compile"/>
   </target>
 
+  <target name="shrink" depends="jar">
+    <proguard shrink="true" optimize="true" obfuscate="false" warn="true"
+	      skipnonpubliclibraryclasses="false" optimizationpasses="2">
+      <optimizations filter="!code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable" />
+      <keepattributes filter="SourceFile,SourceDir,LineNumberTable,LocalVariableTable,LocalVariableTypeTable" />
+      <libraryjar refid="classpath" />
+      <!-- MacOS X way to call ${java.home}/lib/rt.jar -->
+      <libraryjar file="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar" />
+      <injar file="lib/microalign.jar" />
+      <outjar file="lib/microalign2.jar" />
+      <!-- we do not have these -->
+      <!--keepclassmembers access="public" type="class" name="*">
+	<method access="public" name="Main" type="void" parameters="java.lang.String[]" />
+      </keepclassmembers-->
+      <keep type="class" access="public" name="*" implements="org.semanticweb.owl.align.Alignment" />
+      <keep type="class" access="public" name="*" implements="org.semanticweb.owl.align.Relation" />
+      <keep type="class" access="public" name="*" implements="org.semanticweb.owl.align.Cell" />
+      <keep type="class" access="public" name="*" implements="org.semanticweb.owl.align.Evaluator" />
+      <keep type="class" access="public" name="*" implements="org.semanticweb.owl.align.AlignmentVisitor" />
+      <keep type="class" access="public" name="fr.inrialpes.exmo.align.parser.*Parser" />
+      <keepclassmembers access="public" type="class" name="fr.inrialpes.exmo.align.impl.rel.*">
+	<method access="public" name="getInstance" />
+      </keepclassmembers>
+      <keep type="class" access="public" name="fr.inrialpes.exmo.ontowrap.jena25.JENAOntologyFactory" />
+      <keep type="class" access="public" name="fr.inrialpes.exmo.ontowrap.skoslite.SKOSLiteOntologyFactory" />
+    </proguard>
+  </target>
+
   <!-- tested -->
-  <target name="jar" depends="compile">
+  <target name="jar" depends="compileall">
     <echo message="Jarchiving..."/>
     <delete file="lib/microalign.jar"/>
     <jar jarfile="lib/microalign.jar">
-- 
GitLab