Richard S. Hall | 6fe36b4 | 2009-07-13 13:25:46 +0000 | [diff] [blame] | 1 | <?xml version="1.0"?> |
| 2 | <!-- |
| 3 | Licensed to the Apache Software Foundation (ASF) under one |
| 4 | or more contributor license agreements. See the NOTICE file |
| 5 | distributed with this work for additional information |
| 6 | regarding copyright ownership. The ASF licenses this file |
| 7 | to you under the Apache License, Version 2.0 (the |
| 8 | "License"); you may not use this file except in compliance |
| 9 | with the License. You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, |
| 14 | software distributed under the License is distributed on an |
| 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | KIND, either express or implied. See the License for the |
| 17 | specific language governing permissions and limitations |
| 18 | under the License. |
| 19 | --> |
| 20 | <project name="sigil-builder" default="build"> |
| 21 | <property name="user.props" value="user.properties" /> |
| 22 | <property file="${user.props}"/> |
| 23 | <property file="project.properties"/> |
| 24 | <property file="download.properties"/> |
| 25 | |
| 26 | <property name="error.internal.target" value="Do not call this target directly"/> |
| 27 | |
| 28 | <property name="eclipse.sdk" value="${eclipse.install.dir}"/> |
| 29 | <property name="extras.sdk" value="build-libs/target-platform-extras"/> |
| 30 | |
| 31 | <condition property="isUnix"> |
| 32 | <os family="unix"/> |
| 33 | </condition> |
| 34 | |
| 35 | <!-- PUBLIC TARGETS --> |
| 36 | |
| 37 | <target name="build" |
| 38 | depends="clean-tmp, target-platform, pdebuild"/> |
| 39 | |
| 40 | <target name="clean-tmp"> |
| 41 | <delete dir="target/tmp" /> |
| 42 | </target> |
| 43 | |
| 44 | <target name="clean"> |
| 45 | <delete dir="target"/> |
| 46 | <delete dir="build-libs/classes"/> |
| 47 | </target> |
| 48 | |
| 49 | <!-- create target platform --> |
| 50 | <target name="target-platform" depends="rsync-platform, copy-platform"/> |
| 51 | |
| 52 | <target name="rsync-platform" if="isUnix"> |
| 53 | <mkdir dir="${target.platform}/eclipse" /> |
| 54 | <exec executable="rsync" append="true" |
| 55 | output="${target.platform}/rsync.log" > |
| 56 | <arg line="-av --delete ${eclipse.sdk}/ ${extras.sdk}/ ${target.platform}/eclipse" /> |
| 57 | </exec> |
| 58 | </target> |
| 59 | |
| 60 | <target name="copy-platform" unless="isUnix"> |
| 61 | <mkdir dir="${target.platform}/eclipse" /> |
| 62 | <copy todir="${target.platform}/eclipse"> |
| 63 | <fileset dir="${eclipse.sdk}"/> |
| 64 | <fileset dir="${extras.sdk}" /> |
| 65 | </copy> |
| 66 | </target> |
| 67 | |
| 68 | <target name="init"> |
| 69 | <mkdir dir="target"/> |
| 70 | <mkdir dir="target/features"/> |
| 71 | <mkdir dir="target/plugins"/> |
| 72 | </target> |
| 73 | |
| 74 | <target name="custom.tasks"> |
| 75 | <mkdir dir="build-libs/classes"/> |
| 76 | <javac srcdir="src" destdir="build-libs/classes" debug="on"> |
| 77 | <classpath> |
| 78 | <fileset dir="build-libs"> |
| 79 | <include name="osgi.core.jar"/> |
| 80 | </fileset> |
| 81 | </classpath> |
| 82 | </javac> |
David Morgan Spenser Savage | 9d4ffdd | 2009-07-14 16:00:10 +0000 | [diff] [blame] | 83 | <taskdef name="findbundle" classname="org.apache.felix.sigil.build.FindBundlesTask"> |
Richard S. Hall | 6fe36b4 | 2009-07-13 13:25:46 +0000 | [diff] [blame] | 84 | <classpath> |
| 85 | <pathelement location="build-libs/osgi.core.jar"/> |
| 86 | <pathelement location="build-libs/classes"/> |
| 87 | </classpath> |
| 88 | </taskdef> |
David Morgan Spenser Savage | 9d4ffdd | 2009-07-14 16:00:10 +0000 | [diff] [blame] | 89 | <taskdef name="siteInsertFeatures" classname="org.apache.felix.sigil.build.SiteInsertFeatures"> |
Richard S. Hall | 6fe36b4 | 2009-07-13 13:25:46 +0000 | [diff] [blame] | 90 | <classpath> |
| 91 | <pathelement location="build-libs/classes"/> |
| 92 | </classpath> |
| 93 | </taskdef> |
| 94 | </target> |
| 95 | |
| 96 | <target name="findbundles" depends="custom.tasks"> |
| 97 | <!-- Find the Equinox launcher JAR --> |
| 98 | <echo>${eclipse.install.dir}</echo> |
| 99 | <findbundle dir="${eclipse.install.dir}/plugins" symbolicname="org.eclipse.equinox.launcher" property="eclipse.launcher.version"/> |
| 100 | <property name="eclipse.launcher.jar" location="${eclipse.install.dir}/plugins/org.eclipse.equinox.launcher_${eclipse.launcher.version}.jar"/> |
| 101 | |
| 102 | <!-- Find the PDE Build scripts --> |
| 103 | <findbundle dir="${eclipse.install.dir}/plugins" symbolicname="org.eclipse.pde.build" property="eclipse.pdebuild.version"/> |
| 104 | <property name="eclipse.productBuild.xml" location="${eclipse.install.dir}/plugins/org.eclipse.pde.build_${eclipse.pdebuild.version}/scripts/productBuild/productBuild.xml"/> |
| 105 | <property name="eclipse.featureBuild.xml" location="${eclipse.install.dir}/plugins/org.eclipse.pde.build_${eclipse.pdebuild.version}/scripts/build.xml"/> |
| 106 | </target> |
| 107 | |
| 108 | <!-- Unused |
| 109 | <target name="download" depends="init"> |
| 110 | <mkdir dir="${target.platform}"/> |
| 111 | |
| 112 | <echo message="Downloading platform runtime"/> |
| 113 | <get dest="${target.platform}/platform-runtime.zip" |
| 114 | src="${download.base}/${download.dir}/${download.platform.runtime}" verbose="true"/> |
| 115 | |
| 116 | <echo message="Downloading RCP delta pack"/> |
| 117 | <get dest="${target.platform}/deltapack.zip" |
| 118 | src="${download.base}/${download.dir}/${download.deltapack}" verbose="true"/> |
| 119 | |
| 120 | <echo message="Downloading CVS client"/> |
| 121 | <get dest="${target.platform}/cvsclient.zip" |
| 122 | src="${download.base}/${download.dir}/${download.cvsclient}" verbose="true"/> |
| 123 | |
| 124 | <unzip src="${target.platform}/platform-runtime.zip" dest="${target.platform}" overwrite="true"/> |
| 125 | <unzip src="${target.platform}/deltapack.zip" dest="${target.platform}" overwrite="true"/> |
| 126 | <unzip src="${target.platform}/cvsclient.zip" dest="${target.platform}" overwrite="true"/> |
| 127 | </target> |
| 128 | --> |
| 129 | |
| 130 | <target name="copy.projects" depends="init"> |
| 131 | <foreach list="${plugins}" param="plugin.id" target="__copy.plugin"/> |
| 132 | <foreach list="${features}" param="feature.id" target="__copy.feature"/> |
| 133 | </target> |
| 134 | |
| 135 | <target name="copy.properties" depends="init"> |
| 136 | <copy file="builder/template.build.properties" tofile="builder/build.properties" overwrite="true"/> |
| 137 | <pathconvert property="basedir.unix" targetos="unix"> |
| 138 | <path location="${basedir}"/> |
| 139 | </pathconvert> |
| 140 | <replace file="builder/build.properties"> |
| 141 | <replacefilter token="@@WARNING_TEXT" value="Warning! This file is auto-generated. Changes will be overwritten!"/> |
| 142 | <replacefilter token="@@BUILD_PROJECT_DIR" value="${basedir.unix}"/> |
| 143 | <replacefilter token="@@TARGET_PLATFORM" value="${target.platform}"/> |
| 144 | </replace> |
| 145 | </target> |
| 146 | |
| 147 | <!-- Unused |
| 148 | <target name="copy.deps"> |
| 149 | <copy todir="${target.platform}/eclipse/plugins"> |
| 150 | <fileset dir="target-libs" includes="*.jar"/> |
| 151 | </copy> |
| 152 | </target> |
| 153 | --> |
| 154 | |
| 155 | <target name="pdebuild" depends="findbundles,copy.projects,copy.properties"> |
| 156 | <java jar="${eclipse.launcher.jar}" fork="true" failonerror="true"> |
| 157 | <sysproperty key="builder" path="${basedir}/builder"/> |
| 158 | <arg line="-application org.eclipse.ant.core.antRunner"/> |
| 159 | <arg line="-buildfile ${eclipse.featureBuild.xml}"/> |
| 160 | </java> |
| 161 | </target> |
| 162 | |
| 163 | <target name="new.updateSite"> |
| 164 | <copy file="site.xml" todir="${updateSiteDir}"/> |
| 165 | <antcall target="copy.updateSite" /> |
| 166 | </target> |
| 167 | |
| 168 | <target name="copy.updateSite" depends="custom.tasks"> |
| 169 | <copy todir="${updateSiteDir}"> |
| 170 | <fileset dir="target/tmp/eclipse" includes="**/*.jar"/> |
| 171 | </copy> |
| 172 | <property file="target/finalFeaturesVersions.properties" prefix="featureVersions"/> |
| 173 | <siteInsertFeatures sitexmlfile="${updateSiteDir}/site.xml" |
| 174 | features="${features}" |
| 175 | versionPropPrefix="featureVersions" |
| 176 | categoryPropPrefix="category"/> |
| 177 | </target> |
| 178 | |
| 179 | <!-- INTERNAL TARGETS --> |
| 180 | <target name="__copy.plugin"> |
| 181 | <fail unless="plugin.id" message="${error.internal.target}"/> |
| 182 | <echo message="Copying plugin ${plugin.id}"/> |
| 183 | <antcall target="__copy.artifact"> |
| 184 | <param name="artifact.id" value="${plugin.id}"/> |
| 185 | <param name="artifact.type" value="plugin"/> |
| 186 | </antcall> |
| 187 | </target> |
| 188 | |
| 189 | <target name="__copy.feature"> |
| 190 | <fail unless="feature.id" message="${error.internal.target}"/> |
| 191 | <antcall target="__copy.artifact"> |
| 192 | <param name="artifact.id" value="${feature.id}"/> |
| 193 | <param name="artifact.type" value="feature"/> |
| 194 | </antcall> |
| 195 | |
| 196 | <replace file="target/features/${feature.id}/feature.xml"> |
| 197 | <replacefilter token="http://replace.with.real.url" value="${updateUrl}"/> |
| 198 | </replace> |
| 199 | </target> |
| 200 | |
| 201 | <target name="__copy.artifact"> |
| 202 | <fail unless="artifact.id" message="${error.internal.target}"/> |
| 203 | <fail unless="artifact.type" message="${error.internal.target}"/> |
| 204 | |
| 205 | <echo message="Copying from ${source.dir}/${artifact.id} to target/${artifact.type}s"/> |
| 206 | <copy todir="target/${artifact.type}s"> |
| 207 | <fileset dir="${source.dir}"> |
| 208 | <exclude name="${artifact.id}/bin/**"/> |
| 209 | <exclude name="${artifact.id}/build/**"/> |
| 210 | <exclude name="${artifact.id}/**/*.class"/> |
| 211 | <include name="${artifact.id}/**"/> |
| 212 | </fileset> |
| 213 | </copy> |
| 214 | </target> |
| 215 | |
| 216 | <target name="__nodefault"> |
| 217 | <fail message="There is no default target"/> |
| 218 | </target> |
| 219 | |
| 220 | <!-- TASK DEFINITIONS --> |
| 221 | <taskdef resource="net/sf/antcontrib/antlib.xml"> |
| 222 | <classpath> |
| 223 | <pathelement location="build-libs/ant-contrib/ant-contrib-1.0b3.jar"/> |
| 224 | </classpath> |
| 225 | </taskdef> |
| 226 | |
| 227 | </project> |