diff options
-rwxr-xr-x | ant-build-nsc.sh | 37 | ||||
-rwxr-xr-x | ant-common.sh | 19 | ||||
-rwxr-xr-x | ant-test-nsc.sh | 38 | ||||
-rw-r--r-- | build-nsc.xml | 79 | ||||
-rw-r--r-- | test-nsc.xml | 98 |
5 files changed, 135 insertions, 136 deletions
diff --git a/ant-build-nsc.sh b/ant-build-nsc.sh index f95e8a1493..86e2c245d2 100755 --- a/ant-build-nsc.sh +++ b/ant-build-nsc.sh @@ -7,38 +7,25 @@ . ant-common.sh ############################################################################## -# jars for `scalac' task MUST EXIST - -if ! addJar $fjbg_jar fjbg_jar; then exit -1; fi -if ! addJar $scala_jar scala_jar; then - $ECHO "try: make jar target=LIBRARY" && exit -1; -fi -if ! addJar $tools_jar tools_jar; then - $ECHO "try: make jar target=TOOLS" && exit -1; -fi - -############################################################################## -# jars for `pico' task MUST EXIST including the `-scala-hacks' enabled +# ant build -if ! addJar $jaco_jar jaco_jar; then exit -1; fi +ANT_CONFIG_BUILDFILE=build-nsc.xml +ANT_BUILDFILE=concrete-$ANT_CONFIG_BUILDFILE +ANT_EXCLUDEFILE=developer/${USER}/build-nsc-excludes.xml -############################################################################## -# ant build +if [ -f "$ANT_EXCLUDEFILE" ]; then + $SED -e "s#userExcludes\ \"\"#userExcludes\ SYSTEM\ \"$ANT_EXCLUDEFILE\"#" \ + < $ANT_CONFIG_BUILDFILE > $ANT_BUILDFILE; + else + $CP $ANT_CONFIG_BUILDFILE $ANT_BUILDFILE; +fi -ANT_CONFIGFILE=build-nsc.xml -ANT_BUILDFILE=concrete-$ANT_CONFIGFILE -ANT_EXCLFILE=developer/${USER}/build-nsc-excludes.xml +CLASSPATH=$nsc_fjbg_jar:$nsc_scala_jar:$nsc_tools_jar:$nsc_jaco_jar # for debugging your classpath #echo CLASSPATH=$CLASSPATH -if [ -f "$ANT_EXCLFILE" ]; then - $SED -e "s#userExcludes\ \"\"#userExcludes\ SYSTEM\ \"$ANT_EXCLFILE\"#" \ - < $ANT_CONFIGFILE > $ANT_BUILDFILE; - else - $CP $ANT_CONFIGFILE $ANT_BUILDFILE; -fi -CLASSPATH="$CLASSPATH" $ANT_CMD -f "$ANT_BUILDFILE" $* +CLASSPATH="$CLASSPATH" $ANT_CMD -Dplatform=unix -f "$ANT_BUILDFILE" $* $RM "$ANT_BUILDFILE" ############################################################################## diff --git a/ant-common.sh b/ant-common.sh index 631134580b..df29b1865b 100755 --- a/ant-common.sh +++ b/ant-common.sh @@ -13,7 +13,6 @@ export ANT_OPTS='-Xmx256M' ############################################################################## # Shell commands -AWK=awk CP=cp ECHO=echo RM='rm -f' @@ -22,23 +21,7 @@ SED=sed ############################################################################## # set user environment -$AWK '/^$/ {next;} /^#/ {next;} {print "export " $1 $2 $3}' \ - build-nsc.properties > env.sh - +$ANT_CMD -Dplatform=unix -q -f setenv-nsc.xml . env.sh -# ------- don't change these, change build-nsc.properties instead - -function addJar() { # string -> void - local jarfile="$1"; shift 1; - local jarname="$1"; - if [ -f $jarfile ]; then - CLASSPATH=$jarfile:$CLASSPATH; - return 0; - else - $ECHO you supplied $jarfile for $jarname, but it does not exists; - return -1; - fi -} - ############################################################################## diff --git a/ant-test-nsc.sh b/ant-test-nsc.sh index 0483f601d3..2f0d927842 100755 --- a/ant-test-nsc.sh +++ b/ant-test-nsc.sh @@ -7,41 +7,25 @@ . ant-common.sh ############################################################################## -# jar with fjbg, scala runtime - -if ! addJar $fjbg_jar fjbg_jar; then exit -1; fi -if ! addJar $tools_jar tools_jar; then exit -1; fi -if ! addJar $scala_jar scala_jar; then - $ECHO "try: make jar target=LIBRARY" && exit -1; -fi +# ant build -############################################################################## -# jars for `nsc' task (once its compiled) +ANT_CONFIG_BUILDFILE=test-nsc.xml +ANT_BUILDFILE=concrete-$ANT_CONFIG_BUILDFILE +ANT_EXCUDELFILE=developer/${USER}/test-nsc-excludes.xml -if ! addJar $nsc4ant_jar nsc4ant_jar; then - $ECHO "try 'sh ant-build-nsc.sh build.nsc4'" && exit -1; -fi -if ! addJar $nsc_jar nsc_jar; then - $ECHO "try 'sh ant-build-nsc.sh'" && exit -1; +if [ -f "$ANT_EXCLUDEFILE" ]; then + $SED -e "s#userExcludes\ \"\"#userExcludes\ SYSTEM\ \"$ANT_EXCLUDEFILE\"#" \ + < $ANT_CONFIG_BUILDFILE > $ANT_BUILDFILE; + else + $CP $ANT_CONFIG_BUILDFILE $ANT_BUILDFILE; fi -############################################################################## -# ant build - -ANT_CONFIGFILE=test-nsc.xml -ANT_BUILDFILE=concrete-$ANT_CONFIGFILE -ANT_EXCLFILE=developer/${USER}/test-nsc-excludes.xml +CLASSPATH=$nsc_fjbg_jar:$nsc_scala_jar:$nsc_tools_jar:$nsc_nsc_jar:$nsc_nsc4ant_jar # for debugging your classpath #echo CLASSPATH=$CLASSPATH -if [ -f "$ANT_EXCLFILE" ]; then - $SED -e "s#userExcludes\ \"\"#userExcludes\ SYSTEM\ \"$ANT_EXCLFILE\"#" \ - < $ANT_CONFIGFILE > $ANT_BUILDFILE; - else - $CP $ANT_CONFIGFILE $ANT_BUILDFILE; -fi -CLASSPATH="$CLASSPATH" $ANT_CMD -f "$ANT_BUILDFILE" $* +CLASSPATH="$CLASSPATH" $ANT_CMD -Dplatform=unix -f "$ANT_BUILDFILE" $* $RM "$ANT_BUILDFILE" ############################################################################## diff --git a/build-nsc.xml b/build-nsc.xml index 3bd5eedca0..ca9326c7b5 100644 --- a/build-nsc.xml +++ b/build-nsc.xml @@ -2,7 +2,6 @@ <!DOCTYPE project [ <!ENTITY userExcludes ""> ]> - <project name="scala.nsc" default="build.nsc"> <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -32,23 +31,45 @@ <!-- %%% properties and taskdefs %%%--> - <property file="build-nsc.properties"/> - - <!-- taskdefs to call compilers --> - - <taskdef name="scalac" classname="scala.tools.scala4ant.ScalacTask$class"/> + <property file="build-nsc.properties.${platform}" prefix="nsc." /> + + <target name="check.env"> + <fail> + <condition><not><available file="${nsc.fjbg_jar}" /></not></condition> + Missing library file ${nsc.fjbg_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + <fail> + <condition><not><available file="${nsc.scala_jar}" /></not></condition> + Missing library file ${nsc.scala_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + <fail> + <condition><not><available file="${nsc.tools_jar}" /></not></condition> + Missing library file ${nsc.tools_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + <fail> + <condition><not><available file="${nsc.jaco_jar}" /></not></condition> + Missing library file ${nsc.jaco_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + </target> - <available classname="scala.tools.scala4ant.NscTask$class" - property="nsc4ant.present"/> + <target name="init" depends="check.env"> + <mkdir dir="${nsc.tools_util_runtime_dir}" /> + <mkdir dir="${nsc.jars_dir}" /> + <mkdir dir="${nsc.nsc_dir}" /> + <mkdir dir="${nsc.nsc4ant_dir}" /> + </target> <!-- taskdef for nsc comes later, because has to be compiled before --> - <target name="build.nsc"> - <mkdir dir="${tools_util_runtime_dir}"/> - + <target name="build.nsc" depends="init"> + <taskdef name="scalac" classname="scala.tools.scala4ant.ScalacTask$class"/> <taskdef name="pico" classname="jaco.pizza.AntTask"/> - <pico srcdir="sources" destdir="${tools_util_runtime_dir}" source="1.4" scalaHack="true"> + <pico srcdir="sources" destdir="${nsc.tools_util_runtime_dir}" source="1.4" scalaHack="true"> <include name="scala/*.java"/> <include name="scala/runtime/*.java"/> <include name="scala/runtime/**/*.java"/> @@ -61,46 +82,44 @@ <!-- we do *not* want the ScalaObject.class file, because in nsc's eyes ScalaObject is a scala file. --> - <delete file="${tools_util_runtime_dir}/scala/ScalaObject.class"/> - <delete file="${tools_util_runtime_dir}/scala/Array.class"/> + <delete file="${nsc.tools_util_runtime_dir}/scala/ScalaObject.class"/> + <delete file="${nsc.tools_util_runtime_dir}/scala/Array.class"/> - <mkdir dir="${jars_dir}"/> - <jar destfile="${jars_dir}/nsrt.jar" basedir="${tools_util_runtime_dir}"/> + <jar destfile="${nsc.nsrt_jar}" basedir="${nsc.tools_util_runtime_dir}"/> - <mkdir dir="${nsc_dir}"/> - <scalac srcdir="sources" destdir="${nsc_dir}" - classpath="${tools_util_runtime_dir}" sourcePath="sources" force="true"> + <scalac srcdir="sources" destdir="${nsc.nsc_dir}" + classpath="${nsc.tools_util_runtime_dir}" sourcePath="sources" force="true"> <!-- force = "true" always recompiles all source files, because scalac does not always go find the latest source file (*3) --> <include name="scala/tools/nsc/**/*.scala"/> - &userExcludes; + </scalac> - <mkdir dir="${jars_dir}"/> - <jar destfile="${jars_dir}/nsc.jar" basedir="${nsc_dir}"/> + <jar destfile="${nsc.nsc_jar}" basedir="${nsc.nsc_dir}"/> </target> - <target name="clean"> - <delete dir="${tools_util_runtime_dir}"/> - <delete dir="${nsc_dir}"/> + <delete dir="${nsc.tools_util_runtime_dir}" /> + <delete dir="${nsc.jars_dir}" /> + <delete dir="${nsc.nsc_dir}" /> + <delete dir="${nsc.nsc4ant_dir}" /> </target> <!-- builds NscTask for use in this ant file --> - <target name="build.nsc4ant"> + <target name="build.nsc4ant" depends="init"> + <taskdef name="scalac" classname="scala.tools.scala4ant.ScalacTask$class"/> - <mkdir dir="${nsc4ant_dir}"/> - <scalac srcdir="sources" destdir="${nsc4ant_dir}/" sourcePath="sources" - classpath="${ant_jar}:${nsc_dir}:${tools_util_runtime_dir}:${scala_jar}" > + <scalac srcdir="sources" destdir="${nsc.nsc4ant_dir}/" sourcePath="sources" + classpath="${nsc.ant_jar}:${nsc.nsc_dir}:${nsc.tools_util_runtime_dir}:${nsc.scala_jar}" > <include name="scala/tools/scala4ant/NscAdaptor.scala"/> <include name="scala/tools/scala4ant/NscTask.scala"/> </scalac> - <jar destfile="${jars_dir}/nsc4ant.jar" basedir="${nsc4ant_dir}"/> + <jar destfile="${nsc.nsc4ant_jar}" basedir="${nsc.nsc4ant_dir}"/> </target> <!-- diff --git a/test-nsc.xml b/test-nsc.xml index 2f23e15df5..221040353b 100644 --- a/test-nsc.xml +++ b/test-nsc.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE project [ <!ENTITY userExcludes ""> ]> @@ -19,47 +20,64 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> - <!-- %%% properties and taskdefs %%%--> + <property file="build-nsc.properties.${platform}" prefix="nsc." /> - <property file="build-nsc.properties"/> + <property file="developer/${user.name}/custom.properties" /> - <!-- taskdefs to call compilers --> - - <taskdef name="nsc" classname="scala.tools.scala4ant.NscTask$class"/> - - <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - test test nsc compiler - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> - - <property file="developer/${user.name}/custom.properties"/> + <target name="init.args" if="nscArgs"> + <property name="moreNscArgs" value="${nscArgs}" /> + </target> - <target name="init.args" if="nscArgs"> - <property name="moreNscArgs" value="${nscArgs}"/> - </target> + <target name="init.noargs"> + <property name="moreNscArgs" value="" /> + </target> - <target name="init.noargs"> - <property name="moreNscArgs" value=""/> - </target> + <target name="init" depends="init.args, init.noargs"> + <echo> Hi, I am your helpful test script. Passing options to nsc?</echo> + <echo> Either, add a line to developer/${user.name}/custom.properties</echo> + <echo> nscArgs = -check:term;-debug </echo> + <echo> or set a property nscArgs on the cmd line</echo> + <echo> sh ant-test-nsc.sh -DnscArgs="-check:term;-debug" </echo> + <echo/> + <echo> Note the hyphens, the quotes on the cmd line, no spaces between options, the ';' separator</echo> + </target> + + <target name="check.env"> + <fail> + <condition><not><available file="${nsc.fjbg_jar}" /></not></condition> + Missing library file ${nsc.fjbg_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + <fail> + <condition><not><available file="${nsc.scala_jar}" /></not></condition> + Missing library file ${nsc.scala_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + <fail> + <condition><not><available file="${nsc.tools_jar}" /></not></condition> + Missing library file ${nsc.tools_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + <fail> + <condition><not><available file="${nsc.nsc_jar}" /></not></condition> + Missing library file ${nsc.nsc_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + <fail> + <condition><not><available file="${nsc.nsc4ant_jar}" /></not></condition> + Missing library file ${nsc.nsc4ant_jar}. + Check your property file build-nsc.properties.${platform}. + </fail> + </target> - <target name="init" depends="init.args, init.noargs"> - <echo> Hi, I am your helpful test script. Passing options to nsc?</echo> - <echo> Either, add a line to developer/${user.name}/custom.properties</echo> - <echo> nscArgs = -check:term;-debug </echo> - <echo> or set a property nscArgs on the cmd line</echo> - <echo> sh ant-test-nsc.sh -DnscArgs="-check:term;-debug" </echo> - <echo/> - <echo> Note the hyphens, the quotes on the cmd line, no spaces between options, the ';' separator</echo> - </target> + <target name="test" depends="init,check.env"> + <mkdir dir="${nsc.nsc_output_dir}" /> - <target name="test" depends="init"> + <taskdef name="nsc" classname="scala.tools.scala4ant.NscTask$class" /> - <mkdir dir="${nsc_output_dir}"/> - <echo>==== running nsc on predef and runtime</echo> - <nsc srcdir="sources" destdir="${nsc_output_dir}" - classpath="sources:newsources:${nsrt_jar}" + <nsc srcdir="sources" destdir="${nsc.nsc_output_dir}" + classpath="sources:newsources:${nsc.nsrt_jar}" nscArgs="-nopredefs;${moreNscArgs}"> <include name="scala/Predef.scala"/> @@ -67,8 +85,8 @@ </nsc> <echo>===== running nsc on the rest</echo> - <nsc srcdir="sources" destdir="${nsc_output_dir}" - classpath="sources:newsources:${nsrt_jar}:${nsc_output_dir}" + <nsc srcdir="sources" destdir="${nsc.nsc_output_dir}" + classpath="sources:newsources:${nsc.nsrt_jar}:${nsc.nsc_output_dir}" nscArgs="${moreNscArgs}" force="true"> <include name="scala/**/*.scala"/> @@ -81,8 +99,16 @@ &userExcludes; </nsc> - <jar destfile="${jars_dir}/nsrt.jar" basedir="${nsc_output_dir}" update="true"/> + <!-- couldn't get parameter "update" to work on Windows (mics) --> + <jar destfile="${nsc.nsrt_jar}"> + <fileset dir="${nsc.tools_util_runtime_dir}" /> + <fileset dir="${nsc.nsc_output_dir}" /> + </jar> + + </target> + <target name="clean"> + <delete dir="${nsc.nsc_output_dir}" /> </target> </project> |