blob: 4161e540bb0d8baad50e96aed56c1076633d076a [file] [log] [blame]
<?xml version="1.0"?>
<!--
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="sigil-builder" default="build">
<property name="user.props" value="user.properties" />
<property file="${user.props}"/>
<property file="project.properties"/>
<property file="download.properties"/>
<property name="error.internal.target" value="Do not call this target directly"/>
<property name="eclipse.sdk" value="${eclipse.install.dir}"/>
<property name="extras.sdk" value="build-libs/target-platform-extras"/>
<condition property="isUnix">
<os family="unix"/>
</condition>
<!-- PUBLIC TARGETS -->
<target name="build"
depends="clean-tmp, target-platform, pdebuild"/>
<target name="clean-tmp">
<delete dir="target/tmp" />
</target>
<target name="clean">
<delete dir="target"/>
<delete dir="build-libs/classes"/>
</target>
<!-- create target platform -->
<target name="target-platform" depends="rsync-platform, copy-platform"/>
<target name="rsync-platform" if="isUnix">
<mkdir dir="${target.platform}/eclipse" />
<exec executable="rsync" append="true"
output="${target.platform}/rsync.log" >
<arg line="-av --delete ${eclipse.sdk}/ ${extras.sdk}/ ${target.platform}/eclipse" />
</exec>
</target>
<target name="copy-platform" unless="isUnix">
<mkdir dir="${target.platform}/eclipse" />
<copy todir="${target.platform}/eclipse">
<fileset dir="${eclipse.sdk}"/>
<fileset dir="${extras.sdk}" />
</copy>
</target>
<target name="init">
<mkdir dir="target"/>
<mkdir dir="target/features"/>
<mkdir dir="target/plugins"/>
</target>
<target name="custom.tasks">
<mkdir dir="build-libs/classes"/>
<javac srcdir="src" destdir="build-libs/classes" debug="on">
<classpath>
<fileset dir="build-libs">
<include name="osgi.core.jar"/>
</fileset>
</classpath>
</javac>
<taskdef name="findbundle" classname="org.cauldron.sigil.build.FindBundlesTask">
<classpath>
<pathelement location="build-libs/osgi.core.jar"/>
<pathelement location="build-libs/classes"/>
</classpath>
</taskdef>
<taskdef name="siteInsertFeatures" classname="org.cauldron.sigil.build.SiteInsertFeatures">
<classpath>
<pathelement location="build-libs/classes"/>
</classpath>
</taskdef>
</target>
<target name="findbundles" depends="custom.tasks">
<!-- Find the Equinox launcher JAR -->
<echo>${eclipse.install.dir}</echo>
<findbundle dir="${eclipse.install.dir}/plugins" symbolicname="org.eclipse.equinox.launcher" property="eclipse.launcher.version"/>
<property name="eclipse.launcher.jar" location="${eclipse.install.dir}/plugins/org.eclipse.equinox.launcher_${eclipse.launcher.version}.jar"/>
<!-- Find the PDE Build scripts -->
<findbundle dir="${eclipse.install.dir}/plugins" symbolicname="org.eclipse.pde.build" property="eclipse.pdebuild.version"/>
<property name="eclipse.productBuild.xml" location="${eclipse.install.dir}/plugins/org.eclipse.pde.build_${eclipse.pdebuild.version}/scripts/productBuild/productBuild.xml"/>
<property name="eclipse.featureBuild.xml" location="${eclipse.install.dir}/plugins/org.eclipse.pde.build_${eclipse.pdebuild.version}/scripts/build.xml"/>
</target>
<!-- Unused
<target name="download" depends="init">
<mkdir dir="${target.platform}"/>
<echo message="Downloading platform runtime"/>
<get dest="${target.platform}/platform-runtime.zip"
src="${download.base}/${download.dir}/${download.platform.runtime}" verbose="true"/>
<echo message="Downloading RCP delta pack"/>
<get dest="${target.platform}/deltapack.zip"
src="${download.base}/${download.dir}/${download.deltapack}" verbose="true"/>
<echo message="Downloading CVS client"/>
<get dest="${target.platform}/cvsclient.zip"
src="${download.base}/${download.dir}/${download.cvsclient}" verbose="true"/>
<unzip src="${target.platform}/platform-runtime.zip" dest="${target.platform}" overwrite="true"/>
<unzip src="${target.platform}/deltapack.zip" dest="${target.platform}" overwrite="true"/>
<unzip src="${target.platform}/cvsclient.zip" dest="${target.platform}" overwrite="true"/>
</target>
-->
<target name="copy.projects" depends="init">
<foreach list="${plugins}" param="plugin.id" target="__copy.plugin"/>
<foreach list="${features}" param="feature.id" target="__copy.feature"/>
</target>
<target name="copy.properties" depends="init">
<copy file="builder/template.build.properties" tofile="builder/build.properties" overwrite="true"/>
<pathconvert property="basedir.unix" targetos="unix">
<path location="${basedir}"/>
</pathconvert>
<replace file="builder/build.properties">
<replacefilter token="@@WARNING_TEXT" value="Warning! This file is auto-generated. Changes will be overwritten!"/>
<replacefilter token="@@BUILD_PROJECT_DIR" value="${basedir.unix}"/>
<replacefilter token="@@TARGET_PLATFORM" value="${target.platform}"/>
</replace>
</target>
<!-- Unused
<target name="copy.deps">
<copy todir="${target.platform}/eclipse/plugins">
<fileset dir="target-libs" includes="*.jar"/>
</copy>
</target>
-->
<target name="pdebuild" depends="findbundles,copy.projects,copy.properties">
<java jar="${eclipse.launcher.jar}" fork="true" failonerror="true">
<sysproperty key="builder" path="${basedir}/builder"/>
<arg line="-application org.eclipse.ant.core.antRunner"/>
<arg line="-buildfile ${eclipse.featureBuild.xml}"/>
</java>
</target>
<target name="new.updateSite">
<copy file="site.xml" todir="${updateSiteDir}"/>
<antcall target="copy.updateSite" />
</target>
<target name="copy.updateSite" depends="custom.tasks">
<copy todir="${updateSiteDir}">
<fileset dir="target/tmp/eclipse" includes="**/*.jar"/>
</copy>
<property file="target/finalFeaturesVersions.properties" prefix="featureVersions"/>
<siteInsertFeatures sitexmlfile="${updateSiteDir}/site.xml"
features="${features}"
versionPropPrefix="featureVersions"
categoryPropPrefix="category"/>
</target>
<!-- INTERNAL TARGETS -->
<target name="__copy.plugin">
<fail unless="plugin.id" message="${error.internal.target}"/>
<echo message="Copying plugin ${plugin.id}"/>
<antcall target="__copy.artifact">
<param name="artifact.id" value="${plugin.id}"/>
<param name="artifact.type" value="plugin"/>
</antcall>
</target>
<target name="__copy.feature">
<fail unless="feature.id" message="${error.internal.target}"/>
<antcall target="__copy.artifact">
<param name="artifact.id" value="${feature.id}"/>
<param name="artifact.type" value="feature"/>
</antcall>
<replace file="target/features/${feature.id}/feature.xml">
<replacefilter token="http://replace.with.real.url" value="${updateUrl}"/>
</replace>
</target>
<target name="__copy.artifact">
<fail unless="artifact.id" message="${error.internal.target}"/>
<fail unless="artifact.type" message="${error.internal.target}"/>
<echo message="Copying from ${source.dir}/${artifact.id} to target/${artifact.type}s"/>
<copy todir="target/${artifact.type}s">
<fileset dir="${source.dir}">
<exclude name="${artifact.id}/bin/**"/>
<exclude name="${artifact.id}/build/**"/>
<exclude name="${artifact.id}/**/*.class"/>
<include name="${artifact.id}/**"/>
</fileset>
</copy>
</target>
<target name="__nodefault">
<fail message="There is no default target"/>
</target>
<!-- TASK DEFINITIONS -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="build-libs/ant-contrib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
</project>