1<?xml version="1.0" encoding="UTF-8"?> 2<!--*********************************************************** 3 * 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * 21 ***********************************************************--> 22 23 24<project default="all"> 25 <target name="init"> 26 <property environment="env"/> 27 <property name="ext" value="oxt"/> 28 <property name="officeroot" value="/export/home/mav/OFFICES/OOG680/m5_netbeans_pro"/> 29 <property name="office.home" value="${officeroot}"/> 30 31 <!-- fallbacks for locations, when solenv is not used --> 32 <condition property="target" value="wikiaddon"> 33 <not><isset property="target"/></not> 34 </condition> 35 <condition property="out" value="./build"> 36 <not><isset property="out"/></not> 37 </condition> 38 <condition property="solar.jar" value="${officeroot}/program/classes"> 39 <not><isset property="solar.jar"/></not> 40 </condition> 41 42 <!-- locations used throughout the build --> 43 <property name="name" value="wiki-publisher"/> 44 <property name="dist" value="${out}/bin"/> 45 <property name="classes" value="${out}/class"/> 46 <property name="classes.test" value="${out}/class-test"/> 47 <property name="officeclasses" value="${solar.jar}"/> 48 49 <!-- build options --> 50 <property name="sourcelevel" value="1.4"/> 51 <property name="verbose" value="false"/> 52 <property name="debug" value="${antdebug}"/> 53 54 <!-- build classpath --> 55 <path id="classpath"> 56 <pathelement location="${officeclasses}/juh.jar"/> 57 <pathelement location="${officeclasses}/jurt.jar"/> 58 <pathelement location="${officeclasses}/ridl.jar"/> 59 <pathelement location="${officeclasses}/unoil.jar"/> 60 <!-- 3rd party libs --> 61 <pathelement location="${commons-codec-jar}"/> 62 <pathelement location="${commons-httpclient-jar}"/> 63 <pathelement location="${commons-lang-jar}"/> 64 <pathelement location="${commons-logging-jar}"/> 65 </path> 66 67 <!-- create output directories --> 68 <mkdir dir="${classes}"/> 69 <mkdir dir="${classes.test}"/> 70 <mkdir dir="${dist}"/> 71 </target> 72 73 <target name="compile" depends="init"> 74 <javac debug="${debug}" debuglevel="lines,vars,source" destdir="${classes}" classpathref="classpath" 75 source="${sourcelevel}" verbose="${verbose}" includeantruntime="false"> 76 <src path="src"/> 77 </javac> 78 </target> 79 80 <target name="xcucheck" depends="init"> 81 <condition property="no.merge.present"> 82 <not> 83 <available file="${out}/misc/${target}/merge/org/openoffice/Office/Custom/WikiExtension.xcu" type="file"/> 84 </not> 85 </condition> 86 </target> 87 88 <target name="xcumerge" depends="xcucheck, init" if="no.merge.present"> 89 <copy todir="${out}/misc/${target}/merge"> 90 <fileset dir="${out}/misc/${target}/registry/data" includes="**/*.xcu" casesensitive="yes"/> 91 </copy> 92 </target> 93 94 <target name="jar" depends="compile, init"> 95 <jar basedir="${classes}" compress="true" jarfile="${dist}/${target}.jar"> 96 <manifest> 97 <!-- FIXME: Set Class-Path correctly for the system case !--> 98 <attribute name="Class-Path" value="file:///usr/local/share/java/classes/commons-codec.jar file:///usr/local/share/java/classes/commons-lang.jar file:///usr/local/share/java/classes/commons-httpclient.jar file:///usr/local/share/java/classes/commons-logging.jar"/> 99 <attribute name="RegistrationClassName" value="com.sun.star.wiki.WikiEditorImpl"/> 100 </manifest> 101 </jar> 102 </target> 103 104 <target name="tmpdir" depends="xcumerge, jar, init"> 105 <copy todir="${out}/misc/${target}/package_tmp" overwrite="true" encoding="UTF-8"> 106 <fileset dir="${out}/misc/${target}" includes="description.xml" casesensitive="yes"/> 107 <fileset dir="${out}/misc/${target}/registry/schema/org/openoffice/Office/Custom" includes="*.xcs" casesensitive="yes"/> 108 <fileset dir="${out}/misc/${target}/registry/data/org/openoffice/Office" includes="ProtocolHandler.xcu,Paths.xcu" casesensitive="yes"/> 109 <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office/Custom" includes="*.xcu" casesensitive="yes"/> 110 <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office" includes="*.xcu" casesensitive="yes"/> 111 <!-- FIXME: currently the build xcu files can not be used since the tag containing x-default attribute is thrown away, issue 99378 112 <fileset dir="${out}/misc/${target}/merge/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes"/> 113 --> 114 <fileset dir="src/registry/data/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes"/> 115 <fileset dir="${out}/misc/${target}" includes="help/component.txt" casesensitive="yes"/> 116 <filterset> 117 <filter token="WIKIEXTENSIONPRODUCTNAME" value="Wiki Publisher"/> 118 <filter token="WIKIEXTENSIONID" value="com.sun.wiki-publisher"/> 119 <filter token="WIKIEXTENSIONFILENAME" value="${name}"/> 120 </filterset> 121 </copy> 122 </target> 123 124 <target name="uno-package" depends="tmpdir, xcumerge, jar, init"> 125 <delete file="${dist}/${name}.${ext}"/> 126 <zip destfile="${dist}/${name}.${ext}"> 127 <fileset dir="${out}/misc/${target}/package_tmp" casesensitive="yes"/> 128 <fileset dir="${dist}" includes="${target}.jar" casesensitive="yes"/> 129 <zipfileset file="src/filter/odt2mediawiki.xsl" casesensitive="yes" fullpath="filter/odt2mediawiki.xsl"/> 130 <zipfileset file="src/filter/mediawiki.ott" casesensitive="yes" fullpath="templates/MediaWiki/mediawiki.ott"/> 131 <zipfileset dir="${solar.bin}/xslt/export/xsltml" casesensitive="yes" prefix="filter/math"/> 132 <zipfileset dir="src" includes="uno-extension-manifest.xml" casesensitive="yes" fullpath="META-INF/manifest.xml"/> 133 <zipfileset dir="dialogs" includes="**/*.xdl,**/*.xba,**/*.xlb" casesensitive="yes" prefix="WikiEditor"/> 134 <zipfileset dir="${out}/misc/${target}/license" includes="LICENSE*" casesensitive="yes" prefix="license"/> 135 <zipfileset dir="${out}/misc/${target}/help" includes="**/*.idxl/*,**/*.*_,**/*.jar" casesensitive="yes" prefix="help"/> 136 <zipfileset dir="${out}/misc/${target}/help" includes="**/*.xhp" casesensitive="yes" prefix="help"/> 137 <zipfileset dir="src" includes="THIRDPARTYLICENSEREADME.html" casesensitive="yes" prefix="license"/> 138 </zip> 139 </target> 140 141 <target name="development-package" depends="jar, init"> 142 <delete file="${dist}/${target}_develop.zip"/> 143 <zip destfile="${dist}/${target}_develop.zip"> 144 <zipfileset dir="${dist}" includes="${target}.jar" casesensitive="yes" filemode="664" dirmode="775"/> 145 <zipfileset dir="${out}/misc/${target}" includes="description.xml" casesensitive="yes" filemode="664" dirmode="775"/> 146 <zipfileset dir="${out}/misc/${target}/registry/schema/org/openoffice/Office/Custom" includes="*.xcs" casesensitive="yes" filemode="664" dirmode="775"/> 147 <zipfileset dir="${out}/misc/${target}/registry/data/org/openoffice/Office" includes="ProtocolHandler.xcu,Paths.xcu" casesensitive="yes" filemode="664" dirmode="775"/> 148 <zipfileset dir="${out}/misc/${target}/merge/org/openoffice/Office/Custom" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/> 149 <zipfileset dir="${out}/misc/${target}/merge/org/openoffice/Office" includes="*.xcu" excludes="**/ProtocolHandler.xcu,**/Paths.xcu" casesensitive="yes" filemode="664" dirmode="775"/> 150 <!-- FIXME: currently the build xcu files can not be used since the tag containing x-default attribute is thrown away, issue 99378 151 <fileset dir="${out}/misc/${target}/merge/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/> 152 --> 153 <zipfileset dir="src/registry/data/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/> 154 <zipfileset file="src/filter/odt2mediawiki.xsl" casesensitive="yes" fullpath="filter/odt2mediawiki.xsl" filemode="664" dirmode="775"/> 155 <zipfileset file="src/filter/mediawiki.ott" casesensitive="yes" fullpath="templates/MediaWiki/mediawiki.ott" filemode="664" dirmode="775"/> 156 <zipfileset dir="${out}/misc/${target}/help" includes="component.txt" casesensitive="yes" prefix="help" filemode="664" dirmode="775"/> 157 <zipfileset dir="${out}/misc/${target}_merge/help" includes="**/*.xhp" casesensitive="yes" prefix="help" filemode="664" dirmode="775"/> 158 <zipfileset dir="dialogs" includes="**/*.xdl,**/*.xba,**/*.xlb" casesensitive="yes" prefix="WikiEditor" filemode="664" dirmode="775"/> 159 <zipfileset dir="src" includes="uno-extension-manifest.xml" casesensitive="yes" fullpath="META-INF/manifest.xml" filemode="664" dirmode="775"/> 160 <zipfileset dir="${out}/misc/${target}/license" includes="LICENSE*" casesensitive="yes" prefix="license" filemode="664" dirmode="775"/> 161 <zipfileset dir="src" includes="THIRDPARTYLICENSEREADME.html" casesensitive="yes" prefix="license" filemode="664" dirmode="775"/> 162 </zip> 163 </target> 164 165 <target depends="init, jar, uno-package, development-package" description="Build everything." name="all"> 166 <echo message="${name} built."/> 167 </target> 168 169 <target depends="init" description="Clean all build products." name="clean"> 170 <delete dir="${classes}/com/sun/star/wiki"/> 171 <delete dir="${out}/misc/${target}"/> 172 <delete dir="${dist}/${target}.jar"/> 173 <delete dir="${dist}/${name}.${ext}"/> 174 <delete dir="${dist}/${target}_develop.zip"/> 175 </target> 176 177 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 178 179 <target name="uno-deploy" description="Deploys UNO extension package" depends="uno-package"> 180 <echo message="deploying UNO extension package ..."/> 181 <echo message="${office.unopkg} add -f ${uno.package.name}"/> 182 <exec executable="${office.unopkg}" dir="${office.program.dir}" failonerror="true"> 183 <arg value="add"/> 184 <arg value="-f"/> 185 <arg file="${uno.package.name}"/> 186 </exec> 187 </target> 188 189 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 190 191 <target name="uno-debug" description="Debugss UNO extension package in Target Office" depends="uno-package"> 192 <!-- security fail for executing this without netbeans --> 193 <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail> 194 <!-- start debugger and get connection address jpda.address --> 195 <nbjpdastart name="Debug Office" addressproperty="jpda.address" transport="dt_socket"> 196 <classpath path="${build.classes.dir}"/> 197 <sourcepath path="${src.dir}"/> 198 </nbjpdastart> 199 <!-- register component in temporaary user installation --> 200 <echo message="debugging UNO extension package ..."/> 201 <echo message="wait until preparation is finished."/> 202 <echo message=" deploying UNO extension package for debugging ..."/> 203 <echo message=" ${office.unopkg} add -f ${uno.package.name}"/> 204 <exec executable="${office.unopkg}" dir="${office.program.dir}"> 205 <arg value="add"/> 206 <arg value="-f"/> 207 <arg file="${uno.package.name}"/> 208 <env key="UserInstallation" value="${office.debug.user.directory}"/> 209 </exec> 210 <!-- start Office with debug Java and user installation --> 211 <echo message=" starting the Office with ..."/> 212 <echo message=" user installation: ${office.debug.user.directory}"/> 213 <echo message=" debug options: "-Xdebug" "-Xrunjdwp:transport=dt_socket,address=${jpda.address}""/> 214 <echo message=" ${office.soffice}"/> 215 <echo message="preparation finished."/> 216 <exec executable="${office.soffice}" dir="${office.program.dir}" failonerror="true"> 217 <env key="UserInstallation" value="${office.debug.user.directory}"/> 218 <env key="JAVA_TOOL_OPTIONS" value=""-Xdebug" "-Xrunjdwp:transport=dt_socket,address=${jpda.address}""/> 219 </exec> 220 </target> 221</project> 222