ooo-build r14315 - trunk/extensions/coooder/ant



Author: cbosdo
Date: Wed Oct 15 15:46:30 2008
New Revision: 14315
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14315&view=rev

Log:
updated Ant script to automatically find out whether OOo is in version 2
or 3


Modified:
   trunk/extensions/coooder/ant/build.properties
   trunk/extensions/coooder/ant/build.xml

Modified: trunk/extensions/coooder/ant/build.properties
==============================================================================
--- trunk/extensions/coooder/ant/build.properties	(original)
+++ trunk/extensions/coooder/ant/build.properties	Wed Oct 15 15:46:30 2008
@@ -1,6 +1,11 @@
-office.program.dir=/usr/lib/openoffice/program
-office.unotypes.rdb=/usr/lib/openoffice/program/types.rdb
-#office.offapi.rdb
+# Configuration for OOo 2.x
+#sdk.dir=/usr/lib/openoffice/sdk
+#sdk.bin.dir=linux/bin
 
-sdk.dir=/usr/lib/openoffice/sdk
-sdk.bin.dir=linux/bin
\ No newline at end of file
+# Configuration for OOo 3.0
+sdk.dir=/usr/lib/openoffice/basis-link/sdk
+sdk.bin.dir=bin
+
+# Generic configuration
+office.install.dir=/usr/lib/openoffice
+java.debug=false

Modified: trunk/extensions/coooder/ant/build.xml
==============================================================================
--- trunk/extensions/coooder/ant/build.xml	(original)
+++ trunk/extensions/coooder/ant/build.xml	Wed Oct 15 15:46:30 2008
@@ -19,26 +19,73 @@
  -->
 <project name="COOoder" default="package-oxt" basedir="..">
 
+    <target name="check-ooo-version">
+        <property file="ant/build.properties"/>
+        
+	<property name="office.basis.dir" value="${office.install.dir}${file.separator}basis-link"/>
+        <property name="office.ure.dir" value="${office.basis.dir}${file.separator}ure-link"/>
+        
+        <!-- test whether building against OOo3 or not -->
+        <condition property="office.version3" value="true">
+            <and>
+                <available file="${office.basis.dir}" />
+                <available file="${office.ure.dir}"/>
+            </and>
+        </condition>
+    </target>
+
+    <target name="init-env-ooo3" depends="check-ooo-version" if="office.version3">
+	<echo message="Initializing the properties for OpenOffice 3.0"/>
+
+        <property name="office.libs.path" value="${office.install.dir}${file.separator}program${path.separator}${office.basis.dir}${file.separator}program${path.separator}${office.ure.dir}${file.separator}lib"/>
+
+	<echo message="Office libs path: ${office.libs.path}"/>
+
+        <path id="office.class.path">
+            <fileset dir="${office.basis.dir}${file.separator}program${file.separator}classes">
+                <include name="*.jar"/>
+            </fileset>
+            <fileset dir="${office.ure.dir}${file.separator}share${file.separator}java">
+                <include name="*.jar"/>
+            </fileset>
+        </path>
+
+        <property name="office.unotypes.rdb" 
+            value="${office.ure.dir}${file.separator}share${file.separator}misc${file.separator}types.rdb"/>
 
-	<target name="init-env">
-		<!-- set variables for the project structure -->
-		<property file=".unoproject"/>
-		<property file="package.properties"/>
-		<dirname property="project.dir" file="package.properties"/>
-		
-		<property name="build.dir" value="${project.build}"/>
-		<property name="build.classes.dir" value="${build.dir}/classes"/>
-		<property name="dist.dir" value="${build.dir}/dist"/>
-		
-		<!-- set variables from SDK and Office -->
+        <property name="office.offapi.rdb"
+            value="${office.basis.dir}${file.separator}program${file.separator}offapi.rdb"/>
+    </target>
+
+    <target name="init-env-ooo2" depends="check-ooo-version" unless="office.version3">
+        <property name="office.libs.path" value="${office.install.dir}${file.separator}program"/>
+        
+        <path id="office.class.path">
+            <fileset dir="${office.install.dir}${file.separator}program${file.separator}classes">
+                <include name="*.jar"/>
+            </fileset>
+        </path>
+        
+        <property name="office.unotypes.rdb" 
+            value="${office.install.dir}${file.separator}program${file.separator}types.rdb"/>
+    </target>
+
+    <target name="init-env" depends="init-env-ooo3, init-env-ooo2">
+        <!-- set variables for the project structure -->
+        <property file=".unoproject"/>
+        <property file="package.properties"/>
+        <dirname property="project.dir" file="package.properties"/>
+        
+        <property name="build.dir" value="${project.build}"/>
+        <property name="build.classes.dir" value="${build.dir}/classes"/>
+        <property name="dist.dir" value="${build.dir}/dist"/>
+        
+        <!-- set variables from SDK and Office -->
         <echo message="setting up UNO environment ..."/>
-        <property file="ant/build.properties"/>
-        	
-        <property name="office.unopkg" value="${office.program.dir}${file.separator}unopkg"/>
-        <property name="office.soffice" value="${office.program.dir}${file.separator}soffice"/>
 
-		<property environment="env"/>
-		<property name="office.tool.path" value="${env.PATH}${path.separator}${office.program.dir}"/>
+
+        <property environment="env"/>
+        <property name="office.tool.path" value="${env.PATH}${path.separator}${office.libs.path}"/>
     
         <property name="sdk.idl.dir" location="${sdk.dir}${file.separator}idl"/> 
         <property name="sdk.idlc" value="${sdk.dir}${file.separator}${sdk.bin.dir}${file.separator}idlc"/>
@@ -47,7 +94,7 @@
     
         <property name="uno.package.name" value="${project.dir}${file.separator}${dist.dir}${file.separator}${ant.project.name}.oxt"/>
         <property name="src.dir.absolute" value="${project.dir}${project.srcdir}"/>
-		<property name="idl.dir" value="${project.dir}${project.idl}"/>
+        <property name="idl.dir" value="${project.dir}${project.idl}"/>
     
         <property name="idl.out" value="${project.dir}${file.separator}${build.dir}${file.separator}idl"/>
         <property name="idl.out.urd" value="${idl.out}${file.separator}urd"/>
@@ -55,81 +102,79 @@
         <property name="idl.rdb.name" value="types.rdb"/>
         <property name="idl.rdb.fullpath" value="${idl.out.rdb}${file.separator}${idl.rdb.name}"/>
     
-		<mkdir dir="${build.dir}" />
+        <mkdir dir="${build.dir}" />
         <mkdir dir="${idl.out}"/>
         <mkdir dir="${idl.out.urd}"/>
         <mkdir dir="${idl.out.rdb}"/>
-		<mkdir dir="${build.classes.dir}"/>
-		<mkdir dir="${dist.dir}"/>
-	</target>
+        <mkdir dir="${build.classes.dir}"/>
+        <mkdir dir="${dist.dir}"/>
+    </target>
     
     <target name="clean" depends="init-env">
         <delete dir="${build.dir}"/>
     </target>
-	
+    
     <target name="package-oxt" depends="package-jar">
-    	<!-- The manifest.xml file is extracted from the package build with Eclipse -->
-    	
-    	<zip destfile="${uno.package.name}" includes="${contents}">
-    		<fileset dir="." includes="${contents}"/>
-    		<zipfileset dir="descriptions" includes="**/*.txt" prefix="descriptions"/>
-    		<zipfileset file="ant/manifest.xml" fullpath="META-INF/manifest.xml"/>
-    		<zipfileset file="${dist.dir}/${ant.project.name}.jar" 
-    			fullpath="${ant.project.name}.jar"/>
-    		<zipfileset file="${idl.rdb.fullpath}" fullpath="types.rdb"/>
-    	</zip>
-    </target>
-	
-	<target name="package-jar" depends="compile-java">
-		<jar destfile="${dist.dir}/${ant.project.name}.jar">
-			<manifest>
-				<attribute name="RegistrationClassName" value="${regclassname}"/>
-			</manifest>
-			<fileset dir="${build.classes.dir}">
-				<include name="**/*.class"/>
-			</fileset>
-			<fileset dir="${src.dir.absolute}">
-				<exclude name="**/*.java"/>
-			</fileset>
-		</jar>
-	</target>
-	
-	<target name="compile-java" depends="types">
-		<echo message="build classes: ${build.classes.dir}"/>
-		<javac srcdir="${src.dir.absolute}" source="1.4" target="1.4" encoding="UTF-8"
-			destdir="${build.classes.dir}" excludes="**/*Test*">
-			<classpath>
-				<fileset dir="${office.program.dir}${file.separator}classes">
-					<include name="*.jar"/>
-				</fileset>
-				<pathelement location="${build.classes.dir}"/>
-			</classpath>
-		</javac>
-	</target>
-	
-	<target name="types" depends="merge-urd">
-		<echo message="Generating java class files from rdb..."/>
-		<condition property="args.offapi" value=" -X${office.offapi.rdb}" else="">
-			<length string="${office.offapi.rdb}" when="equal" length="0" trim="true"/>
-		</condition>
+        <!-- The manifest.xml file is extracted from the package build with Eclipse -->
+        
+        <zip destfile="${uno.package.name}" includes="${contents}">
+            <fileset dir="." includes="${contents}"/>
+            <zipfileset dir="descriptions" includes="**/*.txt" prefix="descriptions"/>
+            <zipfileset file="ant/manifest.xml" fullpath="META-INF/manifest.xml"/>
+            <zipfileset file="${dist.dir}/${ant.project.name}.jar" 
+                fullpath="${ant.project.name}.jar"/>
+            <zipfileset file="${idl.rdb.fullpath}" fullpath="types.rdb"/>
+        </zip>
+    </target>
+    
+    <target name="package-jar" depends="compile-java">
+        <jar destfile="${dist.dir}/${ant.project.name}.jar">
+            <manifest>
+                <attribute name="RegistrationClassName" value="${regclassname}"/>
+            </manifest>
+            <fileset dir="${build.classes.dir}">
+                <include name="**/*.class"/>
+            </fileset>
+            <fileset dir="${src.dir.absolute}">
+                <exclude name="**/*.java"/>
+            </fileset>
+        </jar>
+    </target>
+    
+    <target name="compile-java" depends="types">
+        <echo message="build classes: ${build.classes.dir}"/>
+        <javac srcdir="${src.dir.absolute}" source="1.4" target="1.4" encoding="UTF-8"
+            destdir="${build.classes.dir}" excludes="**/*Test*">
+            <classpath>
+                <pathelement location="${build.classes.dir}"/>
+                <path refid="office.class.path"/>
+            </classpath>
+        </javac>
+    </target>
+    
+    <target name="types" depends="merge-urd">
+        <echo message="Generating java class files from rdb..."/>
+        <condition property="args.offapi" value=" -X${office.offapi.rdb}" else="">
+            <length string="${office.offapi.rdb}" when="greater" length="0" trim="true"/>
+        </condition>
 
-        <exec executable="${sdk.javamaker}" dir="${office.program.dir}" failonerror="true">
+        <exec executable="${sdk.javamaker}" failonerror="true">
             <env key="PATH" path="${office.tool.path}"/>    
             <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
             <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/>
-			<arg value="-nD"/>
-			<arg value="-Gc"/>
+            <arg value="-nD"/>
+            <arg value="-Gc"/>
             <arg value="-BUCR"/>
             <arg value="-O"/>
             <arg value="${project.dir}${file.separator}${build.classes.dir}"/>
             <arg file="${idl.rdb.fullpath}"/>
-            <arg value="-X${office.unotypes.rdb}${args.offapi}"/>
+            <arg line="-X${office.unotypes.rdb}${args.offapi}"/>
         </exec>
-	</target>
-	
-	<target name="merge-urd" depends="compile-idl">
-		<delete file="${idl.rdb.fullpath}"/>    
-        <apply executable="${sdk.regmerge}" dir="${office.program.dir}" failonerror="true">
+    </target>
+    
+    <target name="merge-urd" depends="compile-idl">
+        <delete file="${idl.rdb.fullpath}"/>    
+        <apply executable="${sdk.regmerge}" failonerror="true">
             <env key="PATH" path="${office.tool.path}"/>
             <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
             <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/> 
@@ -137,13 +182,13 @@
             <arg value="/UCR"/>
             <fileset dir="${idl.out.urd}" includes="**/*.urd" casesensitive="yes"/>
         </apply>
-	</target>
-	
-	<target name="compile-idl" depends="init-env">
-		<echo message="${sdk.idlc}"/>
+    </target>
+    
+    <target name="compile-idl" depends="init-env">
+        <echo message="${sdk.idlc}"/>
         <echo message="${office.tool.path}"/>
 
-        <apply executable="${sdk.idlc}" dir="${office.program.dir}" failonerror="true">
+        <apply executable="${sdk.idlc}" failonerror="true">
             <env key="PATH" path="${office.tool.path}"/>
             <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
             <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/>
@@ -156,6 +201,6 @@
             <arg value="${sdk.idl.dir}"/>
             <fileset dir="${idl.dir}" includes="**/*.idl" casesensitive="yes"/>
         </apply>
-	</target>
-	
+    </target>
+    
 </project>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]