Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
206 lines (181 sloc) 8.73 KB
<!--
~ Copyright 2011 Red Hat inc. and third party contributors as noted
~ by the author tags.
~ Licensed 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="Ceylon runtime module" default="dist" basedir=".">
<property file="build.properties"/>
<!-- Local repository -->
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo"/>
<property name="ceylon.language.dir" value="ceylon/language/${module.ceylon.language.version}"/>
<property name="ceylon.language.car"
value="${ceylon.language.dir}/ceylon.language-${module.ceylon.language.version}.car"/>
<property name="ceylon.language.lib" location="${ceylon.repo.dir}/${ceylon.language.car}"/>
<property name="ceylon.module-resolver.dir"
value="com/redhat/ceylon/module-resolver/${module.com.redhat.ceylon.module-resolver.version}"/>
<property name="ceylon.module-resolver.jar"
value="${ceylon.module-resolver.dir}/com.redhat.ceylon.module-resolver-${module.com.redhat.ceylon.module-resolver.version}.jar"/>
<property name="ceylon.module-resolver.lib" location="${ceylon.repo.dir}/${ceylon.module-resolver.jar}"/>
<!-- Set build directories for all formats. -->
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.dist" location="${build.dir}/dist"/>
<property name="build.dist.lib" location="${build.dist}/lib"/>
<property name="build.dist.repo" location="${build.dist}/runtime-repo"/>
<property name="build.lib" location="${build.dir}/lib"/>
<property name="build.bootstrap" location="${build.dir}/test"/>
<property name="build.test" location="${build.dir}/test"/>
<property name="test.reports" location="${build.dir}/test-reports"/>
<property name="dist.dir" value="${basedir}/dist"/>
<!-- The Java source files for the runtime -->
<property name="runtime-api.src" location="${basedir}/api/src/main/java"/>
<property name="runtime-impl.src" location="${basedir}/impl/src/main/java"/>
<property name="runtime-spi.src" location="${basedir}/spi/src/main/java"/>
<!-- jar generated -->
<property name="bootstrap.jar" value="ceylon-runtime-bootstrap.jar"/>
<property name="bootstrap.lib" location="${build.lib}/${bootstrap.jar}"/>
<property name="runtime.lib" location="${build.lib}/runtime.jar"/>
<property name="runtime-test.src" location="${basedir}/testsuite/src/test/java"/>
<tstamp/>
<!-- ceylon.runtime -->
<property name="module.runtime.dir" value="ceylon/runtime"/>
<property name="module.runtime.name" value="ceylon.runtime"/>
<!-- module archives -->
<property name="ceylon.runtime.dir" value="runtime-repo/${module.runtime.dir}/main"/>
<property name="ceylon.runtime.jar" value="${ceylon.runtime.dir}/${module.runtime.name}.jar"/>
<property name="ceylon.runtime.dist" value="${build.dist}/${ceylon.runtime.dir}"/>
<path id="compiler.classpath">
<pathelement path="${ceylon.language.lib}"/>
<pathelement path="${ceylon.module-resolver.lib}"/>
<pathelement path="${jboss-modules.lib}"/>
</path>
<path id="test.build.classpath">
<path refid="compiler.classpath"/>
<pathelement path="${build.classes}"/>
<pathelement path="${shrinkwrap-api.lib}"/>
<pathelement path="${junit.lib}"/>
</path>
<path id="test.run.classpath">
<path refid="test.build.classpath"/>
<pathelement path="${build.test}"/>
<pathelement path="${shrinkwrap-impl-base.lib}"/>
<pathelement path="${shrinkwrap-spi.lib}"/>
</path>
<!-- ################################################################## -->
<!-- constant to declare a file binary for checksumsum -->
<property name="checksum.binary-prefix" value=" *"/>
<!-- Helper target, used to create a sha1 checksum file -->
<!-- Requires 'file' as a parameter. -->
<target name="sha1sum">
<fail unless="file"/>
<fail if="filename"/>
<fail if="value"/>
<basename file="${file}" property="filename"/>
<checksum file="${file}" property="value" algorithm="sha1"/>
<echo file="${file}.sha1" message="${value}"/>
</target>
<!-- Rule to clean everything up -->
<target name="clean" description="Clean up everything">
<delete dir="${build.dir}"/>
</target>
<target name="dist"
depends="build"
description="Create Ceylon runtime distribution">
<!-- Setup the basic structure of the dist folder by copying the template folder -->
<copy todir="${build.dist}">
<fileset dir="${dist.dir}"/>
</copy>
<!-- Copy the libraries -->
<copy file="${bootstrap.lib}" tofile="${build.dist.lib}/${bootstrap.jar}"/>
<copy file="${jboss-modules.lib}" tofile="${build.dist.lib}/${jboss-modules.jar}"/>
<!-- Copy the Ceylon runtime dependencies -->
<copy file="${jboss-modules.lib}" tofile="${build.dist.repo}/${jboss-modules.dir}/main/${jboss-modules.jar}"/>
<copy file="${ceylon.language.lib}" tofile="${build.dist.repo}/${ceylon.language.car}"/>
<copy file="${ceylon.module-resolver.lib}" tofile="${build.dist.repo}/${ceylon.module-resolver.jar}"/>
<copy file="${runtime.lib}" tofile="${build.dist}/${ceylon.runtime.jar}"/>
</target>
<!-- Tasks related to building the runtime -->
<!-- Rule to build runtime classes from their Java sources -->
<target name="runtime.classes">
<mkdir dir="${build.classes}"/>
<javac debug="true"
srcdir="${runtime-spi.src}"
destdir="${build.classes}"
classpathref="compiler.classpath"
includeantruntime="false"/>
<javac debug="true"
srcdir="${runtime-api.src}"
destdir="${build.classes}"
classpathref="compiler.classpath"
includeantruntime="false"/>
<javac debug="true"
srcdir="${runtime-impl.src}"
destdir="${build.classes}"
classpathref="compiler.classpath"
includeantruntime="false"/>
</target>
<!-- Rule to build runtime jar -->
<target name="runtime.jar" depends="runtime.classes">
<mkdir dir="${build.lib}"/>
<jar destfile="${runtime.lib}">
<fileset dir="${build.classes}">
</fileset>
</jar>
</target>
<!-- Tasks related to building the runtime -->
<!-- Rule to build runtime classes from their Java sources -->
<target name="bootstrap.classes">
<mkdir dir="${build.bootstrap}"/>
<javac debug="true"
srcdir="${runtime-spi.src}"
destdir="${build.bootstrap}"
classpathref="compiler.classpath"
includeantruntime="false"/>
</target>
<!-- Rule to build runtime jar -->
<target name="bootstrap.jar" depends="bootstrap.classes">
<mkdir dir="${build.lib}"/>
<jar destfile="${bootstrap.lib}">
<fileset dir="${build.bootstrap}">
</fileset>
</jar>
</target>
<!-- Rule to compile and test -->
<target name="build" depends="runtime.jar,bootstrap.jar"/>
<target name="compile.tests" depends="build">
<mkdir dir="${build.test}"/>
<javac debug="true"
srcdir="${runtime-test.src}"
destdir="${build.test}"
classpathref="test.build.classpath"
includeantruntime="false"/>
</target>
<target name="test" depends="compile.tests" description="Runs the JUnit tests">
<mkdir dir="${test.reports}"/>
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.run.classpath"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${runtime-test.src}">
<include name="**/*TestCase.java"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.reports}"/>
</junitreport>
</target>
</project>