Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
468 lines (420 sloc) 19.1 KB
<project name="Ceylon compiler" default="all" basedir=".">
<property file="build.properties"/>
<property name="name" value="Ceylon compiler"/>
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo"/>
<property name="ceylon.typechecker.dir" value="com/redhat/ceylon/typechecker/${module.com.redhat.ceylon.typechecker.version}"/>
<property name="ceylon.typechecker.jar" value="${ceylon.typechecker.dir}/com.redhat.ceylon.typechecker-${module.com.redhat.ceylon.typechecker.version}.jar"/>
<property name="ceylon.typechecker.lib" location="${ceylon.repo.dir}/${ceylon.typechecker.jar}"/>
<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}"/>
<!-- The Java source files for the compiler -->
<property name="javac.src" location="langtools/src/share/classes"/>
<property name="ceylonc.src" location="src"/>
<property name="test.src" location="test-src"/>
<property name="test.ceylond.src" location="test-ceylondoc-src"/>
<!-- Directories everything gets built into -->
<property name="build" location="build"/>
<property name="build.classes" location="${build}/classes"/>
<property name="build.ceylon.cars" location="${build}/ceylon-cars"/>
<property name="build.poms" location="${build}/poms"/>
<property name="build.bin" location="${build}/bin"/>
<property name="build.lib" location="${build}/lib"/>
<property name="build.api" location="${build}/api"/>
<property name="build.dist" location="${build}/dist"/>
<property name="test.reports" location="${build}/test-reports"/>
<property name="markdown.version" value="faf3bf83000"/>
<property name="markdown.lib" location="${base.path}/markdownj-core-${markdown.version}.jar"/>
<!-- Jarfiles everything ends up in -->
<property name="ceylon.compiler.dir" value="com/redhat/ceylon/compiler/java/${module.com.redhat.ceylon.compiler.version}"/>
<property name="ceylon.compiler.jar" value="${ceylon.compiler.dir}/com.redhat.ceylon.compiler.java-${module.com.redhat.ceylon.compiler.version}.jar"/>
<property name="ceylon.compiler.lib" location="${ceylon.repo.dir}/${ceylon.compiler.jar}"/>
<property name="ceylon.compiler.repo" value="${ceylon.repo.dir}/${ceylon.compiler.dir}"/>
<property name="ceylon.compiler.dist" value="${build.dist}/${ceylon.compiler.dir}"/>
<property name="ceylon.ant.dir" value="com/redhat/ceylon/ant/${module.com.redhat.ceylon.compiler.version}"/>
<property name="ceylon.ant.jar" value="${ceylon.ant.dir}/com.redhat.ceylon.ant-${module.com.redhat.ceylon.compiler.version}.jar"/>
<property name="ceylon.ant.lib" location="${ceylon.repo.dir}/${ceylon.ant.jar}"/>
<property name="ceylon.ant.repo" value="${ceylon.repo.dir}/${ceylon.ant.dir}"/>
<property name="ceylon.ant.dist" value="${build.dist}/${ceylon.ant.dir}"/>
<property name="ceylon-tests.dir" location="${build.ceylon.cars}/com/redhat/ceylon/compiler/java/test/ceylon/${module.com.redhat.ceylon.compiler.version}"/>
<property name="ceylon-tests.car" location="${ceylon-tests.dir}/com.redhat.ceylon.compiler.java.test.ceylon-${module.com.redhat.ceylon.compiler.version}.car"/>
<!-- The directory that parser tests live in, and
the directory test results get written into -->
<property name="parser.test.src" location="corpus/tests"/>
<property name="parser.test.dst" location="${build}/test/parser"/>
<path id="compiler.classpath">
<pathelement path="${ceylon.typechecker.lib}"/>
<pathelement path="${ceylon.language.lib}"/>
<pathelement path="${ceylon.module-resolver.lib}"/>
<pathelement path="${antlr.lib}"/>
<pathelement path="${markdown.lib}"/>
</path>
<path id="test.compile.classpath">
<path refid="compiler.classpath"/>
<pathelement path="${build.classes}"/>
<pathelement path="${junit.lib}"/>
</path>
<path id="test.run.classpath">
<path refid="compiler.classpath"/>
<pathelement path="${ceylon.compiler.lib}"/>
<pathelement path="${ceylon.language.lib}"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${build.classes}"/>
<pathelement path="${ceylon-tests.car}"/>
</path>
<path id="integrationtest.run.classpath">
<path refid="compiler.classpath"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${build.classes}"/>
<pathelement path="${ceylon.ant.lib}"/>
</path>
<path id="language.classpath">
<pathelement path="${language.jar}"/>
<pathelement path="${build.classes}"/>
</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">
<delete dir="${build}"/>
<delete dir="samples/helloworld/modules"/>
<delete dir="samples/no-module/modules"/>
</target>
<!-- Repository targets -->
<target name="init.repo"
description="Initialize the default local Ceylon module repository">
<mkdir dir="${ceylon.compiler.repo}"/>
</target>
<target name="clean.repo"
description="Clean default local Ceylon module repository">
<delete dir="${ceylon.compiler.repo}"/>
</target>
<target name="dist" depends="build"
description="Create Ceylon compiler distribution">
<zip destfile="${build.dist}/${ceylon.compiler.jar}">
<fileset dir="${build.classes}">
<exclude name="ceylon/**"/>
<exclude name="com/redhat/ceylon/compiler/java/test/**"/>
<exclude name="com/redhat/ceylon/ant/**"/>
</fileset>
<fileset dir="${javac.src}">
<include name="com/sun/tools/javac/resources/*.properties"/>
</fileset>
</zip>
<antcall target="sha1sum">
<param name="file" value="${build.dist}/${ceylon.compiler.jar}" />
</antcall>
<zip destfile="${build.dist}/${ceylon.ant.jar}">
<fileset dir="${build.classes}">
<include name="com/redhat/ceylon/ant/**"/>
</fileset>
<zipfileset src="${ceylon.typechecker.lib}"/>
<zipfileset src="${ceylon.module-resolver.lib}"/>
<zipfileset src="${antlr.lib}"/>
</zip>
<antcall target="sha1sum">
<param name="file" value="${build.dist}/${ceylon.ant.jar}" />
</antcall>
</target>
<target name="publish"
depends="dist,clean.repo,init.repo"
description="Publish Ceylon compiler module to default repo">
<copy todir="${ceylon.compiler.repo}">
<fileset dir="${ceylon.compiler.dist}"/>
</copy>
<copy todir="${ceylon.ant.repo}">
<fileset dir="${ceylon.ant.dist}"/>
</copy>
</target>
<target name="publish.maven" depends="publish"
description="install Ceylon compiler module to local maven repo"
unless="no-maven"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
<!-- need to install compiler and all its dependencies in a mvn repo
before we can use mvn to build the plugin -->
<!-- Also to work around MANTTASKS-170 we have to write out the poms
to disk, rather than using in-memory -->
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
<mkdir dir="${build.poms}"/>
<artifact:pom id="antlr.pom.tmp"
groupId="org.ceylon-lang"
artifactId="antlr-complete"
version="${antlr.version}">
</artifact:pom>
<artifact:writepom pomrefid="antlr.pom.tmp" file="${build.poms}/antlr.xml"/>
<artifact:pom id="antlr.pom" file="${build.poms}/antlr.xml"/>
<artifact:install pomrefid="antlr.pom"
file="${antlr.lib}" />
<artifact:pom id="typechecker.pom.tmp"
groupId="org.ceylon-lang"
artifactId="ceylon-spec"
version="${module.com.redhat.ceylon.typechecker.version}">
<dependency groupId="org.ceylon-lang"
artifactId="antlr-complete"
version="${antlr.version}"/>
</artifact:pom>
<artifact:writepom pomrefid="typechecker.pom.tmp" file="${build.poms}/typechecker.xml"/>
<artifact:pom id="typechecker.pom" file="${build.poms}/typechecker.xml"/>
<artifact:install pomrefid="typechecker.pom"
file="${ceylon.typechecker.lib}" />
<artifact:pom id="module-resolver.pom.tmp"
groupId="org.ceylon-lang"
artifactId="ceylon-module-resolver"
version="${module.com.redhat.ceylon.module-resolver.version}">
</artifact:pom>
<artifact:writepom pomrefid="module-resolver.pom.tmp" file="${build.poms}/module-resolver.xml"/>
<artifact:pom id="module-resolver.pom" file="${build.poms}/module-resolver.xml"/>
<artifact:install pomrefid="module-resolver.pom"
file="${ceylon.module-resolver.lib}" />
<artifact:pom id="language.pom.tmp"
groupId="org.ceylon-lang"
artifactId="ceylon.language"
version="${module.ceylon.language.version}">
</artifact:pom>
<artifact:writepom pomrefid="language.pom.tmp" file="${build.poms}/language.xml"/>
<artifact:pom id="language.pom" file="${build.poms}/language.xml"/>
<artifact:install pomrefid="language.pom"
file="${ceylon.language.lib}" />
<artifact:pom id="markdown.pom.tmp"
groupId="org.ceylon-lang"
artifactId="markdown"
version="${markdown.version}">
</artifact:pom>
<artifact:writepom pomrefid="markdown.pom.tmp" file="${build.poms}/markdown.xml"/>
<artifact:pom id="markdown.pom" file="${build.poms}/markdown.xml"/>
<artifact:install pomrefid="markdown.pom"
file="${markdown.lib}" />
<artifact:pom id="compiler.pom.tmp"
groupId="org.ceylon-lang"
artifactId="ceylon-compiler"
version="${module.com.redhat.ceylon.compiler.version}">
<dependency groupId="org.ceylon-lang"
artifactId="ceylon-spec"
version="${module.com.redhat.ceylon.typechecker.version}"/>
<dependency groupId="org.ceylon-lang"
artifactId="ceylon-module-resolver"
version="${module.com.redhat.ceylon.module-resolver.version}"/>
<dependency groupId="org.ceylon-lang"
artifactId="ceylon.language"
version="${module.ceylon.language.version}"/>
<dependency groupId="org.ceylon-lang"
artifactId="markdown"
version="${markdown.version}"/>
</artifact:pom>
<artifact:writepom pomrefid="compiler.pom.tmp" file="${build.poms}/compiler.xml"/>
<artifact:pom id="compiler.pom" file="${build.poms}/compiler.xml"/>
<artifact:install pomrefid="compiler.pom"
file="${build.lib}/compiler.jar" />
</target>
<!-- Rule to compile and test -->
<target name="all" depends="test"/>
<!-- Rule to build compiler classes from their Java sources -->
<target name="compiler.classes">
<mkdir dir="${build.classes}"/>
<javac
srcdir="${javac.src}:${ceylonc.src}"
destdir="${build.classes}"
debug="true"
encoding="UTF-8"
classpathref="compiler.classpath"
includeantruntime="true">
<include name="com/redhat/**"/>
<include name="com/sun/tools/javac/**"/>
<include name="com/sun/source/**"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${ceylonc.src}">
<include name="com/redhat/**/resources/**"/>
</fileset>
</copy>
</target>
<!-- Rule to build compiler test classes from their Java sources -->
<target name="test.classes" depends="compiler.classes">
<mkdir dir="${build.classes}"/>
<javac
srcdir="${test.src}"
destdir="${build.classes}"
debug="true"
encoding="UTF-8"
classpathref="test.compile.classpath"
includeantruntime="false">
<include name="com/redhat/ceylon/compiler/java/test/**"/>
<exclude name="com/redhat/ceylon/compiler/java/test/interop/mixed/**"/>
<include name="com/redhat/ceylon/itest/**"/>
</javac>
<javac
srcdir="${test.ceylond.src}"
destdir="${build.classes}"
debug="true"
encoding="UTF-8"
classpathref="test.compile.classpath"
includeantruntime="false">
<include name="com/redhat/ceylon/ceylondoc/test/**"/>
</javac>
</target>
<!-- Rule to build compiler jar -->
<target name="build" depends="compiler.classes">
<mkdir dir="${build.dist}"/>
<mkdir dir="${build.bin}"/>
<mkdir dir="${build.lib}"/>
<mkdir dir="${build.ceylon.cars}"/>
<jar destfile="${build.lib}/compiler.jar">
<fileset dir="${build.classes}">
<exclude name="ceylon/**"/>
<exclude name="com/redhat/ceylon/compiler/java/test/**"/>
<exclude name="com/redhat/ceylon/ant/**"/>
</fileset>
<fileset dir="${javac.src}">
<include name="com/sun/tools/javac/resources/*.properties"/>
</fileset>
</jar>
<jar destfile="${build.lib}/ant.jar">
<fileset dir="${build.classes}">
<include name="com/redhat/ceylon/ant/**"/>
</fileset>
</jar>
<filter token="VERSION" value="${module.com.redhat.ceylon.compiler.version}"/>
<copy todir="${build.bin}">
<fileset dir="${basedir}/bin">
<exclude name="*.in"/>
</fileset>
</copy>
<copy todir="${build.bin}" filtering="yes">
<fileset dir="${basedir}/bin">
<include name="*.in"/>
</fileset>
<globmapper from="*.in" to="*"/>
</copy>
<chmod perm="0755">
<fileset dir="${build.bin}">
<include name="ceylon"/>
<include name="ceylonc"/>
<include name="ceylond"/>
</fileset>
</chmod>
<copy todir="${build.lib}">
<fileset dir="${basedir}/lib">
<include name="antlr-*-complete.jar"/>
<include name="markdownj-*.jar"/>
</fileset>
</copy>
</target>
<target name="-test.cond">
<condition property="dont.test.ast">
<contains string="${dont.test}" substring="ast"/>
</condition>
<condition property="dont.test.runtime">
<contains string="${dont.test}" substring="runtime"/>
</condition>
<condition property="dont.test.ceylond">
<contains string="${dont.test}" substring="ceylond"/>
</condition>
</target>
<!-- Runs the JUnit tests -->
<target name="-test.prepare" depends="publish,test.classes,-test.cond">
<mkdir dir="${test.reports}"/>
<property name="bootclasspath" refid="test.run.classpath" />
</target>
<target name="test" depends="test.ast,test.runtime,test.ceylond"
description="Runs the tests and generates a test report. The dont.test system property can be used to select which tests to run">
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.reports}"/>
</junitreport>
</target>
<!-- Runs the JUnit tests which make assertions on the AST passed to javac -->
<target name="test.ast" depends="-test.prepare" unless="dont.test.ast">
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.run.classpath"/>
<jvmarg value="-Xbootclasspath/p:${bootclasspath}"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${test.src}">
<include name="com/redhat/ceylon/compiler/java/test/ConcurrentTestsNoRuntime.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- Runs the JUnit tests which execute generate ceylon classes -->
<target name="test.runtime" depends="-test.prepare" unless="dont.test.runtime">
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.run.classpath"/>
<jvmarg value="-Xbootclasspath/p:${bootclasspath}"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${test.src}">
<include name="com/redhat/ceylon/compiler/java/test/runtime/RuntimeSuite.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- Runs the JUnit tests for ceylond -->
<target name="test.ceylond" depends="-test.prepare" unless="dont.test.ceylond">
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.run.classpath"/>
<jvmarg value="-Xbootclasspath/p:${bootclasspath}"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${test.ceylond.src}">
<include name="com/redhat/ceylon/ceylondoc/test/**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="integration-test" depends="-test.prepare"
description="Runs integration tests (ant task tests, script tests etc)">
<junit printsummary="yes" haltonfailure="no">
<classpath refid="integrationtest.run.classpath"/>
<jvmarg value="-Dant.home=${ant.home}"/>
<jvmarg value="-Dbuild.bin=${build.bin}"/>
<jvmarg value="-Dbuild.dist=${build.dist}"/>
<jvmarg value="-Dceylon.ant.lib=${ceylon.ant.lib}"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${test.src}">
<include name="com/redhat/ceylon/itest/**/*Test.java"/>
<exclude name="com/redhat/ceylon/itest/**/AntBasedTest.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="ant-tasks" depends="publish">
<path id="ant-tasks">
<pathelement location="${ceylon.ant.lib}"/>
</path>
<taskdef name="ceylonc" classname="com.redhat.ceylon.ant.Ceylonc" classpathref="ant-tasks"/>
<taskdef name="ceylond" classname="com.redhat.ceylon.ant.Ceylond" classpathref="ant-tasks"/>
<taskdef name="ceylon" classname="com.redhat.ceylon.ant.Ceylon" classpathref="ant-tasks"/>
</target>
<path id="ceylon.tests.classpath">
<pathelement path="${junit.lib}"/>
</path>
<target name="api" depends="ant-tasks">
<ceylond
executable="${build.bin}/ceylond"
src="../ceylon.language/src"
out="${build.api}"
includeSourceCode="true">
<module name="ceylon.language"/>
</ceylond>
</target>
</project>
Something went wrong with that request. Please try again.