Source

Apache Directory Studio / build.xml

Full commit
<!--
  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 name="ldapstudio-complete" default="bundle">
    <property name="project.name" value="ldapstudio-complete" />
    <property name="project.version" value="1.0.0" />
    <property name="ldapstudio-complete.output" value="${basedir}/target" />
    <property name="ldapstudio-complete.build" value="${ldapstudio-complete.output}/LDAP Studio" />    
    <property name="ldapstudio-complete.userguides" value="${ldapstudio-complete.output}/userguides" />    
    
    <!-- Setting up OS Name-->
    <condition property="ldapstudio-rcp.os.name" value="macosx" >
            <os name="Mac OS X"/>
    </condition>
    <condition property="ldapstudio-rcp.os.name" value="linux" >
            <os family="unix" />
    </condition>
    <condition property="ldapstudio-rcp.os.name" value="win32">
            <os family="windows" />
    </condition>

    <!-- Setting up OS Extension-->
    <condition property="ldapstudio-rcp.os.extension" value=".app" >
        <equals arg1="${ldapstudio-rcp.os.name}" arg2="macosx"/>
    </condition>
    <condition property="ldapstudio-rcp.os.extension" value="" >
        <equals arg1="${ldapstudio-rcp.os.name}" arg2="linux"/>
    </condition>
    <condition property="ldapstudio-rcp.os.extension" value=".exe">
        <equals arg1="${ldapstudio-rcp.os.name}" arg2="win32"/>
    </condition>

    <!-- Setting up a special property if target OS is Mac OS X-->
    <condition property="isTargetMacOSX" value="true" >
            <equals arg1="${ldapstudio-rcp.os.name}" arg2="macosx"/>
    </condition>

    <!-- ================================== -->
    <!--                HELP                -->
    <!-- ================================== -->
    <target name="help" description="Shows help">
        <echo>Available commands:</echo>
	<echo>  bundle - Generate and bundles a complete version of LDAP Studio</echo>
	<echo>      When bundling you can specify the target operating system using this option:</echo>
	<echo>          o -Dldapstudio-rcp.os.name=macosx for Mac OS X</echo>
	<echo>          o -Dldapstudio-rcp.os.name=linux for Linux</echo>
	<echo>          o -Dldapstudio-rcp.os.name=win32 for Windows</echo>
	<echo>      and the target architecture using this option:</echo>
	<echo>          o -Dldapstudio-rcp.os.arch=i386 for i386 architecture (Linux and Mac OS X)</echo>
	<echo>          o -Dldapstudio-rcp.os.arch=x86 for x86 architecture (Windows only)</echo>
	<echo>          o -Dldapstudio-rcp.os.arch=ppc for PowerPC architecture</echo>
        <echo>  clean - Delete any generated file (javadoc, classes, jars, distribution)</echo>
        <echo>  javadoc - Generate Javadoc files</echo>
        <echo>  userguides - Generate HTML and PDF user guides</echo>
	<echo>  resolve - Resolves the library dependencies using Ivy</echo>
    </target>

    <!-- ================================== -->
    <!--               BUNDLE               -->
    <!-- ================================== -->
    <target name="bundle" description="Bundles the complete application">
        <!-- Creation of the folders -->
        <mkdir dir="${ldapstudio-complete.build}" />

        <!-- Creation of the LDAP Studio RCP application -->
        <ant dir="ldapstudio-rcp" inheritAll="no" />
        <!-- Copy of the RCP app -->
        <copy todir="${ldapstudio-complete.build}">
            <fileset dir="${basedir}/ldapstudio-rcp/target/LDAP Studio">
                <include name="**" />
            </fileset>
        </copy>

        <!-- Creation of the LDAP Studio RCP Help application -->
        <ant dir="ldapstudio-rcp-help" inheritAll="no" />
        <!-- Copy of the LDAP Studio RCP Help Plugin in the "plugins" folder of the RCP app -->
        <copy todir="${ldapstudio-complete.build}/plugins">
            <fileset dir="${basedir}/ldapstudio-rcp-help/target/">
                <include name="*.jar" />
            </fileset>
        </copy>

        <!-- Creation of the Schemas Editor Plugin -->
        <ant dir="ldapstudio-schemas-plugin" inheritAll="no" />
        <!-- Copy of the Schemas Editor Plugin in the "plugins" folder of the RCP app -->
        <copy todir="${ldapstudio-complete.build}/plugins">
            <fileset dir="${basedir}/ldapstudio-schemas-plugin/target">
                <include name="*.jar" />
            </fileset>
        </copy>

        <!-- Creation of the Schemas Editor Help Plugin -->
        <ant dir="ldapstudio-schemas-help" inheritAll="no" />
        <!-- Copy of the Schemas Editor Help Plugin in the "plugins" folder of the RCP app -->
        <copy todir="${ldapstudio-complete.build}/plugins">
            <fileset dir="${basedir}/ldapstudio-schemas-help/target">
                <include name="*.jar" />
            </fileset>
        </copy>

        <!-- Creation of the Browser Core Plugin -->
        <ant dir="ldapstudio-browser-core" inheritAll="no" />
        <!-- Copy of the Browser Core Plugin in the "plugins" folder of the RCP app -->
        <copy todir="${ldapstudio-complete.build}/plugins">
            <fileset dir="${basedir}/ldapstudio-browser-core/target">
                <include name="*.jar" />
            </fileset>
        </copy>

        <!-- Creation of the Browser UI Plugin -->
        <ant dir="ldapstudio-browser-ui" inheritAll="no" />
        <!-- Copy of the Browser UI Plugin in the "plugins" folder of the RCP app -->
        <copy todir="${ldapstudio-complete.build}/plugins">
            <fileset dir="${basedir}/ldapstudio-browser-ui/target">
                <include name="*.jar" />
            </fileset>
        </copy>

        <!-- Creation of the Browser Help Plugin -->
        <ant dir="ldapstudio-browser-help" inheritAll="no" />
        <!-- Copy of the Browser Help Plugin in the "plugins" folder of the RCP app -->
        <copy todir="${ldapstudio-complete.build}/plugins">
            <fileset dir="${basedir}/ldapstudio-browser-help/target">
                <include name="*.jar" />
            </fileset>
        </copy>

	    <!-- Creation of the Jars Plugin -->
        <ant dir="ldapstudio-jars" inheritAll="no" />
        <!-- Copy of the Jars Plugin in the "plugins" folder of the RCP app -->
        <copy todir="${ldapstudio-complete.build}/plugins">
            <fileset dir="${basedir}/ldapstudio-jars/target">
                <include name="*.jar" />
            </fileset>
        </copy>

        <!-- Property for the features -->
		<property name="project.features" value="${ldapstudio-complete.build}/features" />

        <!-- Copy of the LDAP Studio RCP Feature in the "features" folder -->
		<property name="ldapstudio-rcp-feature.project" value="${basedir}/ldapstudio-rcp-feature" />
		<property name="ldapstudio-rcp-feature.name" value="org.apache.directory.ldapstudio.rcp.feature" />
		<property name="ldapstudio-rcp-feature.version" value="0.7.0" />
        <mkdir dir="${project.features}/${ldapstudio-rcp-feature.name}_${ldapstudio-rcp-feature.version}" />
		<copy todir="${project.features}/${ldapstudio-rcp-feature.name}_${ldapstudio-rcp-feature.version}">
			<fileset dir="${ldapstudio-rcp-feature.project}">
				<include name="feature.xml" />
				<include name="ldapstudio.png" />
				<include name="META-INF/**" />
			</fileset>
		</copy>
		
        <!-- Copy of the Schemas Editor Feature in the "features" folder -->
		<property name="ldapstudio-schemas-feature.project" value="${basedir}/ldapstudio-schemas-feature" />
		<property name="ldapstudio-schemas-feature.name" value="org.apache.directory.ldapstudio.schemas.feature" />
		<property name="ldapstudio-schemas-feature.version" value="0.7.0" />
		<mkdir dir="${project.features}/${ldapstudio-schemas-feature.name}_${ldapstudio-schemas-feature.version}" />
		<copy todir="${project.features}/${ldapstudio-schemas-feature.name}_${ldapstudio-schemas-feature.version}">
			<fileset dir="${ldapstudio-schemas-feature.project}">
				<include name="feature.xml" />
				<include name="ldapstudio.png" />
				<include name="META-INF/**" />
			</fileset>
		</copy>
		
	    <!-- Copy of the Browser Feature in the "features" folder -->
		<property name="ldapstudio-browser-feature.project" value="${basedir}/ldapstudio-browser-feature" />
		<property name="ldapstudio-browser-feature.name" value="org.apache.directory.ldapstudio.browser.feature" />
		<property name="ldapstudio-browser-feature.version" value="0.7.0" />
		<mkdir dir="${project.features}/${ldapstudio-browser-feature.name}_${ldapstudio-browser-feature.version}" />
		<copy todir="${project.features}/${ldapstudio-browser-feature.name}_${ldapstudio-browser-feature.version}">
			<fileset dir="${ldapstudio-browser-feature.project}">
				<include name="feature.xml" />
				<include name="ldapstudio.png" />
				<include name="META-INF/**" />
			</fileset>
		</copy>

        <!-- Setting Permissions -->
        <antcall target="setPermission_${ldapstudio-rcp.os.name}" />
        
        <!-- Special repackaging for Mac OS X -->
        <antcall target="repackage_MacOSX" />
    </target>
	
    <!-- ================================== -->
    <!--        Set Right Permissions       -->
    <!-- ================================== -->
    <target name="setPermission_macosx" description="Sets the right permissions on Mac OS X">
        <chmod file="${ldapstudio-complete.build}/LDAP Studio.app/Contents/MacOS/LDAPStudio" perm="755"/>
    </target>
    
    <target name="setPermission_linux" description="Sets the right permissions on Linux">
        <chmod file="${ldapstudio-complete.build}/LDAP Studio" perm="755"/>
    </target>

    <target name="setPermission_win32" description="Sets the right permissions on Windows">
        <chmod file="${ldapstudio-complete.build}/LDAP Studio.exe" perm="755" />
    </target>
    
    <!-- ================================== -->
    <!--         Repackage Mac OS X         -->
    <!-- ================================== -->
    <target name="repackage_MacOSX" description="Special repackage for Mac OS X" if="isTargetMacOSX">
        <property name="app.dir" location="${ldapstudio-complete.build}/LDAP Studio.app" />
        <property name="java.dir" location="${app.dir}/Contents/Resources/Java" />
        <mkdir dir="${java.dir}"/>
        <move todir="${java.dir}">
          <fileset dir="${ldapstudio-complete.build}">
               <exclude name="LDAP Studio.app/**"/>
          </fileset>
        </move>
    </target>

    <!-- ================================== -->
    <!--             USERGUIDES             -->
    <!-- ================================== -->
    <target name="userguides" description="Generates the user guides">
        <!-- Creation of the folders -->
        <mkdir dir="${ldapstudio-complete.userguides}" />

        <!-- Creation of the LDAP Studio RCP user guides -->
        <ant dir="ldapstudio-rcp-help" inheritAll="no" target="static-html" />
        <ant dir="ldapstudio-rcp-help" inheritAll="no" target="static-pdf" />
        <!-- Copy of the RCP user guides -->
        <mkdir dir="${ldapstudio-complete.userguides}/ldap_studio" />
        <copy todir="${ldapstudio-complete.userguides}/ldap_studio">
            <fileset dir="${basedir}/ldapstudio-rcp-help/target/html">
                <include name="**" />
            </fileset>
        </copy>
        <copy todir="${ldapstudio-complete.userguides}">
            <fileset dir="${basedir}/ldapstudio-rcp-help/target/pdf">
                <include name="**/*.pdf" />
            </fileset>
        </copy>

        <!-- Creation of the LDAP Studio Browser user guides -->
        <ant dir="ldapstudio-browser-help" inheritAll="no" target="static-html" />
        <ant dir="ldapstudio-browser-help" inheritAll="no" target="static-pdf" />
        <!-- Copy of the browser user guides -->
        <mkdir dir="${ldapstudio-complete.userguides}/ldap_browser" />
        <copy todir="${ldapstudio-complete.userguides}/ldap_browser">
            <fileset dir="${basedir}/ldapstudio-browser-help/target/html">
                <include name="**" />
            </fileset>
        </copy>
        <copy todir="${ldapstudio-complete.userguides}">
            <fileset dir="${basedir}/ldapstudio-browser-help/target/pdf">
                <include name="**/*.pdf" />
            </fileset>
        </copy>

        <!-- Creation of the LDAP Studio Schemas Editor user guides -->
        <ant dir="ldapstudio-schemas-help" inheritAll="no" target="static-html" />
        <ant dir="ldapstudio-schemas-help" inheritAll="no" target="static-pdf" />
        <!-- Copy of the schemas user guides -->
        <mkdir dir="${ldapstudio-complete.userguides}/schemas_editor" />
        <copy todir="${ldapstudio-complete.userguides}/schemas_editor">
            <fileset dir="${basedir}/ldapstudio-schemas-help/target/html">
                <include name="**" />
            </fileset>
        </copy>
        <copy todir="${ldapstudio-complete.userguides}">
            <fileset dir="${basedir}/ldapstudio-schemas-help/target/pdf">
                <include name="**/*.pdf" />
            </fileset>
        </copy>
    </target>

    <!-- ================================== -->
    <!--              JAVADOC               -->
    <!-- ================================== -->
    <target name="javadoc" description="Generate Javadoc files">
        <ant dir="ldapstudio-rcp" inheritAll="no" target="javadoc" />
        <ant dir="ldapstudio-schemas-plugin" inheritAll="no" target="javadoc" />
        <ant dir="ldapstudio-dsml-parser" inheritAll="no" target="javadoc" />
        <ant dir="ldapstudio-browser-core" inheritAll="no" target="javadoc" />
        <ant dir="ldapstudio-browser-ui" inheritAll="no" target="javadoc" />
        <ant dir="ldapstudio-aciitemeditor" inheritAll="no" target="javadoc" />
    </target>

    <!-- ================================== -->
    <!--              RESOLVE               -->
    <!-- ================================== -->
    <target name="resolve" description="Resolves the library dependencies using Ivy">
        <ant dir="ldapstudio-rcp" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-rcp-help" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-schemas-plugin" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-schemas-help" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-dsml-parser" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-browser-core" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-browser-ui" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-browser-help" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-aciitemeditor" inheritAll="no" target="resolve" />
        <ant dir="ldapstudio-jars" inheritAll="no" target="resolve" />
    </target>

    <!-- ================================== -->
    <!--               CLEAN                -->
    <!-- ================================== -->
    <target name="clean" description="Deletes any generated file (javadoc, classes, jars, distribution)">
        <ant dir="ldapstudio-rcp" inheritAll="no" target="clean"/>
        <ant dir="ldapstudio-rcp-feature" inheritAll="no" target="clean"/>
        <ant dir="ldapstudio-rcp-help" inheritAll="no" target="clean"/>
        <ant dir="ldapstudio-schemas-plugin" inheritAll="no" target="clean"/>
        <ant dir="ldapstudio-schemas-help" inheritAll="no" target="clean" />
        <ant dir="ldapstudio-schemas-feature" inheritAll="no" target="clean"/>
        <ant dir="ldapstudio-browser-core" inheritAll="no" target="clean" />
        <ant dir="ldapstudio-browser-ui" inheritAll="no" target="clean" />
        <ant dir="ldapstudio-browser-help" inheritAll="no" target="clean" />
        <ant dir="ldapstudio-browser-feature" inheritAll="no" target="clean"/>
        <ant dir="ldapstudio-jars" inheritAll="no" target="clean" />
        <ant dir="ldapstudio-updatesite" inheritAll="no" target="clean" />
        <delete dir="${ldapstudio-complete.output}" />
    </target>
</project>