blob: 0aa343c7c48c5535278fa02ceb2d8f7d929c539d [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project default="product">
<import file="../studio-build/build.xml"/>
<!-- Setting up OS Name-->
<condition property="studio-rcp.os.name" value="macosx" >
<os name="Mac OS X"/>
</condition>
<condition property="studio-rcp.os.name" value="linux" >
<os family="unix" />
</condition>
<condition property="studio-rcp.os.name" value="win32">
<os family="windows" />
</condition>
<!-- Setting up OS Extension-->
<condition property="studio-rcp.os.extension" value=".app" >
<equals arg1="${studio-rcp.os.name}" arg2="macosx"/>
</condition>
<condition property="studio-rcp.os.extension" value="" >
<equals arg1="${studio-rcp.os.name}" arg2="linux"/>
</condition>
<condition property="studio-rcp.os.extension" value=".exe">
<equals arg1="${studio-rcp.os.name}" arg2="win32"/>
</condition>
<!-- Setting up App Name Extension-->
<condition property="studio-rcp.appname" value="Apache Directory Studio" >
<or>
<equals arg1="${studio-rcp.os.name}" arg2="macosx"/>
<equals arg1="${studio-rcp.os.name}" arg2="win32"/>
</or>
</condition>
<condition property="studio-rcp.appname" value="ApacheDirectoryStudio" >
<equals arg1="${studio-rcp.os.name}" arg2="linux"/>
</condition>
<!-- Setting up OS Architecture-->
<property name="studio-rcp.os.arch" value="${os.arch}" />
<!-- Setting up Product properties -->
<property name="studio-rcp.dir" value="${target}/ApacheDirectoryStudio"/>
<property name="studio-rcp.dir.plugins" value="${studio-rcp.dir}/plugins"/>
<property name="studio-rcp.dir.features" value="${studio-rcp.dir}/features"/>
<property name="studio-rcp.eclipse.dir" value="../dependencies/eclipse" />
<property name="studio-rcp.eclipse.version" value="3.2" />
<property name="studio-rcp.eclipse.uiideplugin.filename" value="org.eclipse.ui.ide_3.2.1.M20060915-1030" />
<property name="studio-rcp.eclipse.uieditorsplugin.filename" value="org.eclipse.ui.editors_3.2.1.r321_v20060721" />
<property name="studio-rcp.eclipse.searchplugin.filename" value="org.eclipse.search_3.2.1.r321_v20060726" />
<!-- Setting up a special property if target OS is Mac OS X -->
<condition property="isTargetMacOSX" value="true" >
<equals arg1="${studio-rcp.os.name}" arg2="macosx"/>
</condition>
<!-- BUILD-CLASSPATH TASK -->
<target name="build-classpath" description="Computes the classpath" >
<echo>Building classpath for ${project.name} (${project.id}) version ${project.version}</echo>
<path id="classpath">
<!-- Project dependencies -->
<fileset dir="${lib.dir}" />
<!-- Eclipse dependencies -->
<fileset dir="../dependencies/eclipse/3.2">
<include name="**/*.jar"/>
</fileset>
</path>
</target>
<!-- PLUGIN TASK -->
<target name="plugin" depends="pre-plugin,studio-build.plugin" />
<!-- PRE-PLUGIN TASK -->
<target name="pre-plugin">
<mkdir dir="${target.build}"/>
<copy todir="${target.build}" failonerror="false">
<fileset dir="${basedir}">
<include name="about.ini" />
<include name="log4j.conf" />
<include name="plugin_customization.ini" />
<include name="product_lg.gif" />
<include name="splash.bmp" />
<include name="studio.png" />
</fileset>
</copy>
</target>
<!-- PRODUCT TASK -->
<target name="product" depends="plugin">
<!-- Creating the folder structure -->
<mkdir dir="${studio-rcp.dir}"/>
<mkdir dir="${studio-rcp.dir.features}" />
<mkdir dir="${studio-rcp.dir.plugins}" />
<!-- Copying the application and the plugins -->
<copy todir="${studio-rcp.dir}" failonerror="true" overwrite="true" preservelastmodified="yes">
<fileset dir="${studio-rcp.eclipse.dir}/${studio-rcp.eclipse.version}/${studio-rcp.os.name}/${studio-rcp.os.arch}/rcp/" />
</copy>
<copy todir="${studio-rcp.dir.plugins}" failonerror="true" overwrite="true">
<fileset dir="${studio-rcp.eclipse.dir}/${studio-rcp.eclipse.version}/${studio-rcp.os.name}/${studio-rcp.os.arch}" excludes="rcp/" />
<fileset dir="${studio-rcp.eclipse.dir}/${studio-rcp.eclipse.version}/plugins" />
</copy>
<!-- Replacing some plugin.xml to get rid of unused actions, menus, wizard, views, ... -->
<move
file="${studio-rcp.dir}/plugins/${studio-rcp.eclipse.searchplugin.filename}.plugin.xml"
tofile="${studio-rcp.dir.plugins}/plugin.xml" />
<zip destfile="${studio-rcp.dir.plugins}/${studio-rcp.eclipse.searchplugin.filename}.jar"
basedir="${studio-rcp.dir.plugins}"
includes="plugin.xml"
update="true"/>
<delete file="${studio-rcp.dir.plugins}/plugin.xml" />
<move
file="${studio-rcp.dir.plugins}/${studio-rcp.eclipse.uiideplugin.filename}.plugin.xml"
tofile="${studio-rcp.dir.plugins}/plugin.xml" />
<zip destfile="${studio-rcp.dir.plugins}/${studio-rcp.eclipse.uiideplugin.filename}.jar"
basedir="${studio-rcp.dir.plugins}"
includes="plugin.xml"
update="true"/>
<delete file="${studio-rcp.dir.plugins}/plugin.xml" />
<move
file="${studio-rcp.dir.plugins}/${studio-rcp.eclipse.uieditorsplugin.filename}.plugin.xml"
tofile="${studio-rcp.dir.plugins}/plugin.xml" />
<zip destfile="${studio-rcp.dir.plugins}/${studio-rcp.eclipse.uieditorsplugin.filename}.jar"
basedir="${studio-rcp.dir.plugins}"
includes="plugin.xml"
update="true"/>
<delete file="${studio-rcp.dir.plugins}/plugin.xml" />
<!-- Renaming the application-->
<move file="${studio-rcp.dir}/eclipse${studio-rcp.os.extension}" tofile="${studio-rcp.dir}/${studio-rcp.appname}${studio-rcp.os.extension}" />
<!-- Copying the generated plugin -->
<copy todir="${studio-rcp.dir.plugins}" failonerror="true">
<fileset dir="${target}">
<include name="*.jar" />
</fileset>
</copy>
<!-- Setting correct permission -->
<antcall target="setPermission_${studio-rcp.os.name}" />
<!-- Repackaging application for Mac OS X -->
<antcall target="repackage_MacOSX" />
</target>
<!-- SETPERMISSION_MACOSX TASK -->
<target name="setPermission_macosx" description="Sets the right permissions on Mac OS X">
<chmod file="${studio-rcp.dir}/${studio-rcp.appname}${studio-rcp.os.extension}/Contents/MacOS/ApacheDirectoryStudio" perm="755" />
</target>
<!-- SETPERMISSION_LINUX TASK -->
<target name="setPermission_linux" description="Sets the right permissions on Linux">
<chmod file="${studio-rcp.dir}/${studio-rcp.appname}${studio-rcp.os.extension}" perm="755" />
</target>
<!-- SETPERMISSION_WIN32 TASK -->
<target name="setPermission_win32" description="Sets the right permissions on windows">
<chmod file="${studio-rcp.dir}/${studio-rcp.appname}${studio-rcp.os.extension}" perm="755" />
</target>
<!-- REPACKAGE_MACOSX TASK -->
<target name="repackage_MacOSX" description="Special repackage for Mac OS X" if="isTargetMacOSX">
<property name="application" location="${studio-rcp.dir}/${studio-rcp.appname}${studio-rcp.os.extension}" />
<property name="java.dir" location="${application}/Contents/Resources/Java" />
<mkdir dir="${java.dir}"/>
<move todir="${java.dir}">
<fileset dir="${studio-rcp.dir}">
<exclude name="${studio-rcp.appname}${studio-rcp.os.extension}/**"/>
</fileset>
</move>
</target>
</project>