Permalink
Fetching contributors…
Cannot retrieve contributors at this time
233 lines (204 sloc) 8.47 KB
<?xml version="1.0"?>
<project name="ioke" default="build" basedir=".">
<description>
ioke is a next generation language, based on Io, Self, Smalltalk, Ruby and Lisp
</description>
<property name="src.raw.dir" value="src"/>
<property name="src.dir" value="src/ikc/main"/>
<property name="lib.dir" value="lib"/>
<property name="lib.build.dir" value="${lib.dir}/build"/>
<property name="bin.dir" value="bin"/>
<property name="release.dir" value="rels"/>
<property name="build.dir" value="build"/>
<property name="build.filtered.dir" value="${build.dir}/filtered"/>
<property name="test.results.dir" value="${build.dir}/test-results"/>
<script language="C#" prefix="version">
<code>
<![CDATA[
[Function("extract-property")]
public static string ExtractProperty(string name, string from) {
try {
string outp = System.IO.File.ReadAllText(from);
string[] pieces = outp.Split('\n');
foreach(string s in pieces) {
string[] keyAndValue = s.Split('=');
if(keyAndValue[0].Equals(name))
return keyAndValue[1];
}
return null;
} catch(System.Exception) { return null; }
}
]]>
</code>
</script>
<property name="VERSION_NAME" value="${version::extract-property('VERSION_NAME', 'version.properties')}" />
<property name="VERSION_NUMBER" value="${version::extract-property('VERSION_NUMBER', 'version.properties')}" />
<property name="VERSION_ADDITION" value="${version::extract-property('VERSION_ADDITION', 'version.properties')}" />
<if test="${environment::variable-exists('BUILD_RELEASE_VERSION')}">
<property name="VERSION_ADDITION" value="" />
</if>
<if test="${environment::variable-exists('ADD_SNAPSHOT_VERSION')}">
<property name="VERSION_ADDITION" value="-p${environment::get-variable('GO_PIPELINE_COUNTER')}" />
</if>
<target name="prepare" description="Creates the directories needed for building">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.filtered.dir}"/>
<mkdir dir="${release.dir}"/>
</target>
<target name="generate_filters" depends="prepare" description="Generates source files">
<exec program="ruby" failonerror="false">
<arg value="generate_filter_data.rb"/>
</exec>
</target>
<target name="generate_version_data" depends="generate_filters" description="Generates version data">
<echo file="${build.filtered.dir}/Ioke.Lang.version.properties">ioke.build.version=${VERSION_NAME}
ioke.build.runtimeVersion=${VERSION_NUMBER}${VERSION_ADDITION}
ioke.build.versionString=Ioke ${VERSION_NAME} ikc ${VERSION_NUMBER}${VERSION_ADDITION}
ioke.build.date=${version::extract-property('DATE', 'version_data.properties')}
ioke.build.commit=${version::extract-property('COMMIT', 'version_data.properties')}
</echo>
</target>
<target name="compile" depends="generate_version_data" description="Compile the source files for the project.">
<csc target="library" output="${bin.dir}/Ioke.Math.dll" debug="true">
<sources>
<include name="${src.dir}/Ioke.Math/**/*.cs" />
</sources>
</csc>
<csc target="library" output="${bin.dir}/Ioke.Lang.dll" debug="true">
<sources>
<include name="${src.dir}/getline.cs" />
<include name="${src.dir}/Ioke.Lang/**/*.cs" />
<exclude name="${src.dir}/Ioke.Lang/Main.cs"/>
<exclude name="${src.dir}/Ioke.Lang/ISpecMain.cs"/>
<exclude name="${src.dir}/Ioke.Lang/DokgenMain.cs"/>
</sources>
<references basedir="${bin.dir}">
<include name="Ioke.Math.dll" />
<include name="NRegex.dll" />
</references>
<resources basedir="${src.raw.dir}" dynamicprefix="true">
<include name="builtin/**/*.ik" />
</resources>
<resources basedir="${src.raw.dir}/ikc" dynamicprefix="true">
<include name="builtin/**/*.ik" />
</resources>
<resources basedir="${build.filtered.dir}" dynamicprefix="true">
<include name="*.properties" />
</resources>
</csc>
<csc target="exe" output="${bin.dir}/ioke.exe" debug="true">
<sources>
<include name="${src.dir}/Ioke.Lang/Main.cs"/>
</sources>
<references basedir="${bin.dir}">
<include name="Ioke.Lang.dll" />
</references>
</csc>
<csc target="exe" output="${bin.dir}/ispec.exe" debug="true">
<sources>
<include name="${src.dir}/Ioke.Lang/ISpecMain.cs"/>
</sources>
<references basedir="${bin.dir}">
<include name="ioke.exe" />
</references>
</csc>
<csc target="exe" output="${bin.dir}/dokgen.exe" debug="true">
<sources>
<include name="${src.dir}/Ioke.Lang/DokgenMain.cs"/>
</sources>
<references basedir="${bin.dir}">
<include name="ioke.exe" />
</references>
</csc>
</target>
<target name="compile-version" depends="generate_version_data" description="Compiles a version DLL">
<al output="${bin.dir}/Ioke.Lang.Version.dll" target="lib">
<sources basedir="${build.filtered.dir}" defaultexcludes="true">
<include name="*.properties" />
</sources>
</al>
</target>
<target name="add-new-version-file" depends="compile-version" description="Adds a version DLL to the original DLL">
<move file="${bin.dir}/Ioke.Lang.dll" tofile="${bin.dir}/Ioke.Lang.Org.dll"/>
<exec managed="true" program="bin/ILRepack.exe">
<arg line="/out:${bin.dir}/Ioke.Lang.dll ${bin.dir}/Ioke.Lang.Org.dll ${bin.dir}/Ioke.Lang.Version.dll"/>
</exec>
<delete file="${bin.dir}/Ioke.Lang.Org.dll"/>
</target>
<target name="test" depends="compile" description="Runs all ISpec tests">
<exec managed="true" program="bin/ispec.exe">
<arg line="test -fs"/>
</exec>
</target>
<target name="ci-test" description="Runs all ISpec tests">
<exec managed="true" program="bin/ispec.exe">
<arg line="test -fx to: ${test.results.dir}"/>
</exec>
</target>
<target name="build" depends="test" description="Builds everything">
</target>
<target name="dist-bin">
<tar destfile="${release.dir}/ioke-${VERSION_NAME}-ikc-${VERSION_NUMBER}${VERSION_ADDITION}.tar.gz" compression="GZip">
<fileset filemode="755" basedir="." prefix="ioke">
<include name="bin/*.dll"/>
<include name="bin/*.exe"/>
<include name="bin/ispec"/>
<include name="bin/dokgen"/>
<exclude name="bin/Ioke.Lang.Org.dll"/>
<exclude name="bin/Ioke.Lang.Version.dll"/>
<exclude name="bin/ILRepack.exe"/>
</fileset>
<fileset basedir="." prefix="ioke">
<include name="lib/ioke/**"/>
<include name="dok/**"/>
<include name="share/**"/>
<include name="COPYING"/>
<include name="LICENSE"/>
<include name="LICENSE.kawa"/>
<include name="LICENSE.icu4j"/>
<include name="README"/>
</fileset>
</tar>
<zip zipfile="${release.dir}/ioke-${VERSION_NAME}-ikc-${VERSION_NUMBER}${VERSION_ADDITION}.zip">
<fileset basedir="." prefix="ioke">
<include name="bin/*.dll"/>
<include name="bin/*.exe"/>
<include name="bin/ispec"/>
<include name="bin/dokgen"/>
<exclude name="bin/Ioke.Lang.Org.dll"/>
<exclude name="bin/Ioke.Lang.Version.dll"/>
<exclude name="bin/ILRepack.exe"/>
</fileset>
<fileset basedir="." prefix="ioke">
<include name="lib/ioke/**"/>
<include name="dok/**"/>
<include name="share/**"/>
<include name="COPYING"/>
<include name="LICENSE"/>
<include name="LICENSE.kawa"/>
<include name="LICENSE.icu4j"/>
<include name="README"/>
</fileset>
</zip>
</target>
<target name="dist" depends="build, dist-bin"/>
<target name="dist-notest" depends="compile, dist-bin"/>
<target name="ci-dist" depends="prepare, dist-bin"/>
<target name="ci-clean-dist">
<delete dir="${release.dir}"/>
</target>
<target name="clean" description="clean almost everything">
<delete file="${bin.dir}/ioke.dll"/>
<delete file="${bin.dir}/ioke.dll.mdb"/>
<delete file="${bin.dir}/ioke.exe"/>
<delete file="${bin.dir}/ioke.exe.mdb"/>
<delete file="${bin.dir}/ispec.exe"/>
<delete file="${bin.dir}/ispec.exe.mdb"/>
<delete file="${bin.dir}/dokgen.exe"/>
<delete file="${bin.dir}/dokgen.exe.mdb"/>
<delete file="${bin.dir}/Ioke.Lang.dll"/>
<delete file="${bin.dir}/Ioke.Lang.dll.mdb"/>
<delete file="${bin.dir}/Ioke.Math.dll"/>
<delete file="${bin.dir}/Ioke.Math.dll.mdb"/>
</target>
</project>