diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/abspath | 9 | ||||
-rwxr-xr-x | tools/binary-repo-lib.sh | 4 | ||||
-rwxr-xr-x | tools/codegen | 8 | ||||
-rwxr-xr-x | tools/codegen-anyvals | 5 | ||||
-rwxr-xr-x | tools/cpof | 30 | ||||
-rwxr-xr-x | tools/deploy-local-maven-snapshot | 11 | ||||
-rwxr-xr-x | tools/diffPickled | 51 | ||||
-rwxr-xr-x | tools/epfl-build | 28 | ||||
-rwxr-xr-x | tools/epfl-publish | 50 | ||||
-rwxr-xr-x | tools/flag-usages.sh | 67 | ||||
-rw-r--r-- | tools/get-scala-revision.bat | 22 | ||||
-rwxr-xr-x | tools/locker_scala | 8 | ||||
-rwxr-xr-x | tools/locker_scalac | 8 | ||||
-rwxr-xr-x | tools/lockercp | 10 | ||||
-rwxr-xr-x | tools/packcp | 5 | ||||
-rwxr-xr-x | tools/pathResolver | 11 | ||||
-rwxr-xr-x | tools/profile_scala | 17 | ||||
-rwxr-xr-x | tools/profile_scalac | 25 | ||||
-rwxr-xr-x | tools/proxy-report | 4 | ||||
-rwxr-xr-x | tools/quickcp | 10 | ||||
-rwxr-xr-x | tools/remotetest | 230 | ||||
-rwxr-xr-x | tools/scalawhich | 4 | ||||
-rwxr-xr-x | tools/scmp | 4 | ||||
-rwxr-xr-x | tools/showPickled | 32 | ||||
-rwxr-xr-x | tools/starrcp | 5 | ||||
-rwxr-xr-x | tools/strapcp | 8 | ||||
-rwxr-xr-x | tools/test-renamer | 82 | ||||
-rwxr-xr-x | tools/tokens | 4 | ||||
-rwxr-xr-x | tools/truncate | 7 | ||||
-rwxr-xr-x | tools/updatescalacheck | 130 |
30 files changed, 887 insertions, 2 deletions
diff --git a/tools/abspath b/tools/abspath new file mode 100755 index 0000000000..a2d1410b9b --- /dev/null +++ b/tools/abspath @@ -0,0 +1,9 @@ +#!/bin/sh +# +# print the absolute path of each argument + +for relpath in $* ; do + D=`dirname "$relpath"` + B=`basename "$relpath"` + echo "`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B" +done
\ No newline at end of file diff --git a/tools/binary-repo-lib.sh b/tools/binary-repo-lib.sh index 1f4733ff3b..79a37dd7df 100755 --- a/tools/binary-repo-lib.sh +++ b/tools/binary-repo-lib.sh @@ -111,7 +111,7 @@ pushJarFiles() { local user=$2 local password=$3 # TODO - ignore target/ and build/ - local jarFiles=$(find ${basedir} -name "*.jar") + local jarFiles="$(find ${basedir}/lib -name "*.jar") $(find ${basedir}/test/files -name "*.jar")" for jar in $jarFiles; do local valid=$(isJarFileValid $jar) if [[ "$valid" != "OK" ]]; then @@ -141,7 +141,7 @@ pullJarFile() { # Argument 1 - The directory to search for *.desired.sha1 files that need to be retrieved. pullJarFiles() { local basedir=$1 - local desiredFiles=$(find ${basedir} -name "*${desired_ext}") + local desiredFiles="$(find ${basedir}/lib -name *${desired_ext}) $(find ${basedir}/test/files -name *${desired_ext})" for sha in $desiredFiles; do jar=${sha%$desired_ext} local valid=$(isJarFileValid $jar) diff --git a/tools/codegen b/tools/codegen new file mode 100755 index 0000000000..734235aef8 --- /dev/null +++ b/tools/codegen @@ -0,0 +1,8 @@ +#!/bin/sh +# + +THISDIR=`dirname $0` +SCALALIB=$THISDIR/../src/library/scala +BINDIR=$THISDIR/../build/pack/bin + +$BINDIR/scala scala.tools.cmd.gen.Codegen "$@" diff --git a/tools/codegen-anyvals b/tools/codegen-anyvals new file mode 100755 index 0000000000..27d1c40134 --- /dev/null +++ b/tools/codegen-anyvals @@ -0,0 +1,5 @@ +#!/bin/bash +# + +THISDIR=`dirname $0` +$THISDIR/codegen --anyvals --out $THISDIR/../src/library/scala diff --git a/tools/cpof b/tools/cpof new file mode 100755 index 0000000000..ab5a42b4fb --- /dev/null +++ b/tools/cpof @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Creates a classpath out of the contents of each directory +# given as an argument. + +if [ $# == 0 ] ; then + echo "Usage: $0 [dir1 dir2 ...]" + exit 1 +fi + +THISDIR=`dirname $0` +ABSCMD="${THISDIR}/abspath" +CPRES="" + +for dir in $* ; do + absdir=`${ABSCMD} $dir` + LS=`ls -1 ${absdir}` + + for x in $LS ; do + ABS=`${ABSCMD} "${absdir}/${x}"` + CPRES="${CPRES}:${ABS}" + done +done + +# shaving the : off the beginning. Applause to /bin/sh for +# keeping us humble about how far we've come. +LEN=$(( ${#CPRES} - 1 )) +result=${CPRES:1:${LEN}} + +echo $result diff --git a/tools/deploy-local-maven-snapshot b/tools/deploy-local-maven-snapshot new file mode 100755 index 0000000000..30f78cb110 --- /dev/null +++ b/tools/deploy-local-maven-snapshot @@ -0,0 +1,11 @@ +#!/bin/bash +# +# Install the -SNAPSHOT artifacts in the local maven cache. + +set -e + +cd $(dirname $0)/.. + +ant fastdist distpack +cd dists/maven/latest +ant deploy.snapshot.local diff --git a/tools/diffPickled b/tools/diffPickled new file mode 100755 index 0000000000..b4a345dc7d --- /dev/null +++ b/tools/diffPickled @@ -0,0 +1,51 @@ +#!/bin/sh +# +# Shows the difference in pickler output between two variations on a class. +# +# If quick and strap are built normally you can run +# +# diffPickled foo.bar.Baz +# +# to see any differences between them in that class. + +USAGE="Usage: $0 classpath1 classpath2 class" +TOOLSDIR=`dirname $0` +BUILDDIR="${TOOLSDIR}/../build" +QUICKDIR="${BUILDDIR}/quick" +STRAPDIR="${BUILDDIR}/strap" + +CP1="" +CP2="" +CLASS="" + +if [ $# == 1 ] ; then + if [ -e ${QUICKDIR} ] && [ -e ${STRAPDIR} ] ; then + CP1=`${TOOLSDIR}/quickcp` + CP2=`${TOOLSDIR}/strapcp` + CLASS=$1 + else + echo $USAGE + echo "(If only one argument is given, $QUICKDIR and $STRAPDIR must exist.)" + exit 1 + fi +elif [ $# == 3 ] ; then + CP1=$1 + CP2=$2 + CLASS=$3 +else + echo $USAGE + exit 1 +fi + +TMPDIR="/tmp/scala_pickle_diff${RANDOM}" + +if mkdir -m 0700 "$TMPDIR" 2>/dev/null ; then + ${TOOLSDIR}/showPickled -cp $CP1 $CLASS > "${TMPDIR}/out1.txt" + ${TOOLSDIR}/showPickled -cp $CP2 $CLASS > "${TMPDIR}/out2.txt" + diff "${TMPDIR}/out1.txt" "${TMPDIR}/out2.txt" + rm -rf ${TMPDIR} +else + echo "Failed to create temporary directory ${TMPDIR}." + exit 1 +fi + diff --git a/tools/epfl-build b/tools/epfl-build new file mode 100755 index 0000000000..dd66307de3 --- /dev/null +++ b/tools/epfl-build @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# builds nightlies + +[[ $# -gt 0 ]] || { + cat <<EOM +Usage: $0 <version> [opt opt ...] + + Everything after the version is supplied to scalac and partest. + Example: $0 -Xcheckinit -Ycheck:all + +Environment variables: + extra_ant_targets Additional ant targets to run after nightly + +EOM + exit 0 +} + +# version isn't actually used at present. +scalaVersion="$1" && shift +scalaArgs="-Dscalac.args=\"$@\" -Dpartest.scalac_opts=\"$@\"" + +ant all.clean && ./pull-binary-libs.sh + +ant $scalaArgs build-opt && +ant $scalaArgs nightly && +for target in $extra_ant_targets; do ant $target ; done +# [[ -n "$BUILD_DOCSCOMP" ]] && ant docscomp diff --git a/tools/epfl-publish b/tools/epfl-publish new file mode 100755 index 0000000000..e9cd97b3d2 --- /dev/null +++ b/tools/epfl-publish @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# +# publishes nightly build if $publish_to is set in environment. +# alternate maven settings.xml file given in $maven_settings. +# + +[[ $# -eq 1 ]] || { + cat <<EOM +Usage: $0 <scala version> + +Environment variables: + publish_to rsync destination +EOM + exit 0 +} +version="$1" + +[[ -d dists/archives ]] || { + echo "Can't find build, has it completed? No directory at dists/archives" + exit 1 +} + +# should not be hardcoded +# adds -Dsettings.file= if fixed path is present +mavenSettingsOption () { + hardcoded_path="/home/linuxsoft/apps/hudson-maven-settings/settings.xml" + + # environment variable + if [[ -n $maven_settings ]]; then + echo -Dsettings.file="$maven_settings" + elif [[ -f $hardcoded_path ]]; then + echo -Dsettings.file="$hardcoded_path" + fi +} + +mavenSettings=${maven_settings:-findMavenSettings} + +if [[ -z $publish_to ]]; then + echo "Nothing to publish." +else + echo "Publishing nightly build to $publish_to" + # Archive Scala nightly distribution + rsync -az dists/archives/ "$publish_to/distributions" + # don't publish docs in 2.8.x + [[ $version == "2.8.x" ]] || rsync -az build/scaladoc/ "$publish_to/docs" + # sbaz + [[ -d dists/sbaz ]] && rsync -az dists/sbaz/ "$publish_to/sbaz" + # Deploy the maven artifacts on scala-tools.org + ( cd dists/maven/latest && ant deploy.snapshot $(mavenSettingsOption) ) +fi diff --git a/tools/flag-usages.sh b/tools/flag-usages.sh new file mode 100755 index 0000000000..82696bd1da --- /dev/null +++ b/tools/flag-usages.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# +# find-flag-usages +# Paul Phillips <paulp@typesafe.com> +# +# Looks through the scala source tree for direct references to flag names. + +set -e # Good idea in almost all scripts: causes script to exit on any error. + +# Would be better not to hardcode this. +flags='\b(ABSOVERRIDE|ABSTRACT|ACCESSOR|BRIDGE|BYNAMEPARAM|CAPTURED|CASE|CASEACCESSOR|CONTRAVARIANT|COVARIANT|DEFAULTINIT|DEFAULTPARAM|DEFERRED|EXISTENTIAL|EXPANDEDNAME|FINAL|IMPLCLASS|IMPLICIT|INCONSTRUCTOR|INTERFACE|JAVA|LABEL|LAZY|LIFTED|LOCAL|LOCKED|METHOD|MIXEDIN|MODULE|MODULEVAR|MUTABLE|OVERLOADED|OVERRIDE|PACKAGE|PARAM|PARAMACCESSOR|PRESUPER|PRIVATE|PROTECTED|SEALED|SPECIALIZED|STABLE|STATIC|SUPERACCESSOR|SYNTHETIC|TRAIT|TRIEDCOOKING|VARARGS|VBRIDGE)\b' + +# $() runs a command in a subshell. This is calculating the root of the +# repository by looking relative to the location of the script. +rootdir=$(cd $(dirname $0) ; pwd)/.. + +# A bash function. Can be used like a command. +usage () { + # A here string. Allows for blocks of text without lots of quoting. + # Variable interpolation still takes place, e.g. $(basename $0). + cat <<EOM +Usage: $(basename $0) [-achs] + -a show all flag usages + -c count flag usages per file + -h show this message + -s count total flag usages +EOM +} + +# Checking for no arguments or missing requirements. +if [[ $# -eq 0 ]]; then + usage + exit 1 +elif [[ ! $(which ack) ]]; then # no ack + echo "Error: cannot find required program ack." + exit 1 +fi + +# Using pushd/popd for directory changes is a way to make moving +# the current directory around somewhat more composable. +pushd "$rootdir" >/dev/null + +# The leading : in :achs suppresses some errors. Each letter is a valid +# option. If an option takes an argument, a colon follows it, e.g. +# it would be :ach:s if -h took an argument. +while getopts :achs opt; do + case $opt in + a) ack "$flags" src ;; + c) ack --files-with-matches -c "$flags" src ;; + h) usage ;; + s) ack --no-filename -o "$flags" src | sort | uniq -c | sort -gr ;; + :) echo "Option -$OPTARG requires an argument." >&2 ;; # this case is called for a missing option argument + *) echo "Unrecognized argument $OPTARG" ;; # this is the catch-all implying an unknown option + esac +done + +# This removes all the options from $@, as getopts doesn't touch it. +# After this, "$@" contains the non-option arguments. +shift $((OPTIND-1)) + +# In this program we don't expect any. +if [[ $# -ne 0 ]]; then + echo "This program does not take arguments." +fi + +popd >/dev/null +exit 0 diff --git a/tools/get-scala-revision.bat b/tools/get-scala-revision.bat new file mode 100644 index 0000000000..f4dc24b71f --- /dev/null +++ b/tools/get-scala-revision.bat @@ -0,0 +1,22 @@ +@echo off +rem +rem Usage: get-scala-revison.bat [dir] +rem Figures out current scala revision of a git clone. +rem +rem If no dir is given, current working dir is used. + +@setlocal +set _DIR= +if "%*"=="" ( + for /f "delims=;" %%i in ('cd') do set "_DIR=%%i" +) else ( + set "_DIR=%~1" +) +cd %_DIR% + +if exist .git\NUL ( + git describe HEAD --abbrev=7 --match dev +) + +:end +@endlocal diff --git a/tools/locker_scala b/tools/locker_scala new file mode 100755 index 0000000000..4434c94bf3 --- /dev/null +++ b/tools/locker_scala @@ -0,0 +1,8 @@ +#!/bin/bash +# + +THISDIR=`dirname $0` +CP=`$THISDIR/lockercp` +CLASS="scala.tools.nsc.MainGenericRunner" + +java -classpath "$CP" $CLASS -usejavacp "$@" diff --git a/tools/locker_scalac b/tools/locker_scalac new file mode 100755 index 0000000000..2ad153e929 --- /dev/null +++ b/tools/locker_scalac @@ -0,0 +1,8 @@ +#!/bin/bash +# + +THISDIR=`dirname $0` +CP=`$THISDIR/lockercp` +CLASS="scala.tools.nsc.Main" + +java -classpath "$CP" $CLASS -usejavacp "$@" diff --git a/tools/lockercp b/tools/lockercp new file mode 100755 index 0000000000..3e8799596f --- /dev/null +++ b/tools/lockercp @@ -0,0 +1,10 @@ +#!/bin/sh +# + +THISDIR=`dirname $0` +ABS=${THISDIR}/abspath +LIBDIR=`$ABS $THISDIR/../lib` + +cp=`${THISDIR}/cpof ${THISDIR}/../build/locker/classes` + +echo ${cp}:$LIBDIR/fjbg.jar:$LIBDIR/msil.jar:$LIBDIR/forkjoin.jar:$LIBDIR/jline.jar:$LIBDIR/extra/'*' diff --git a/tools/packcp b/tools/packcp new file mode 100755 index 0000000000..42bce9e266 --- /dev/null +++ b/tools/packcp @@ -0,0 +1,5 @@ +#!/bin/sh +# + +THISDIR=`dirname $0` +${THISDIR}/cpof ${THISDIR}/../build/pack/lib diff --git a/tools/pathResolver b/tools/pathResolver new file mode 100755 index 0000000000..efff45ea62 --- /dev/null +++ b/tools/pathResolver @@ -0,0 +1,11 @@ +#!/bin/sh +# + +WHICH=`which scala` +BASE=`dirname $WHICH` +LIBDIR=$BASE/../lib + +echo Using ${WHICH}. +echo + +java -cp "${LIBDIR}/*" scala.tools.util.PathResolver $* diff --git a/tools/profile_scala b/tools/profile_scala new file mode 100755 index 0000000000..037fc327bd --- /dev/null +++ b/tools/profile_scala @@ -0,0 +1,17 @@ +#!/bin/bash +# + +# Uses quick by default +CLASSPATH=`tools/quickcp` + +AGENT=${YOURKIT_PATH:-/Applications/YourKit.app/bin/mac/libyjpagent.jnilib} + +java $JAVA_OPTS \ + -classpath $CLASSPATH \ + -agentpath:$AGENT=$YNP_STARTUP_OPTIONS \ + scala.tools.nsc.MainGenericRunner -usejavacp \ + -i <(cat <<EOF +lazy val profiler = new scala.tools.util.YourkitProfiling { } +import profiler._ +EOF +) "$@" diff --git a/tools/profile_scalac b/tools/profile_scalac new file mode 100755 index 0000000000..f29b5b6fa4 --- /dev/null +++ b/tools/profile_scalac @@ -0,0 +1,25 @@ +#!/bin/bash +# +# To influence behavior, you can set: +# +# YOURKIT_PATH +# YOURKIT_PROFILE_PHASES +# YNP_STARTUP_OPTIONS +# + +# Start cpu sampling immediately +DEFAULT_OPTS="sampling,onexit=snapshot" + +# Uses quick by default +CLASSPATH=`tools/quickcp` + +AGENT=${YOURKIT_PATH:-/Applications/YourKit.app/bin/mac/libyjpagent.jnilib} +OPTS=${YNP_STARTUP_OPTIONS:-$DEFAULT_OPTS} +PHASES=${YOURKIT_PROFILE_PHASES:-all} + +java $JAVA_OPTS \ + -classpath $CLASSPATH \ + -agentpath:$AGENT=$OPTS \ + scala.tools.nsc.Main -usejavacp \ + -Yprofile:$PHASES \ + "$@" diff --git a/tools/proxy-report b/tools/proxy-report new file mode 100755 index 0000000000..589803d6ea --- /dev/null +++ b/tools/proxy-report @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# + +$(dirname $BASH_SOURCE)/../build/pack/bin/scala scala.tools.nsc.util.ProxyReportRunner "$@"
\ No newline at end of file diff --git a/tools/quickcp b/tools/quickcp new file mode 100755 index 0000000000..dd5251d30f --- /dev/null +++ b/tools/quickcp @@ -0,0 +1,10 @@ +#!/bin/sh +# + +THISDIR=`dirname $0` +ABS=${THISDIR}/abspath +LIBDIR=`$ABS $THISDIR/../lib` + +cp=`${THISDIR}/cpof ${THISDIR}/../build/quick/classes` + +echo ${cp}:$LIBDIR/fjbg.jar:$LIBDIR/msil.jar:$LIBDIR/forkjoin.jar:$LIBDIR/jline.jar:$LIBDIR/extra/'*' diff --git a/tools/remotetest b/tools/remotetest new file mode 100755 index 0000000000..fb89794c30 --- /dev/null +++ b/tools/remotetest @@ -0,0 +1,230 @@ + + +# +# Remote build&test script. +# Author: Aleksandar Prokopec +# + + +SCRIPTNAME="..:: RemoteTest ::.." +DESC="This script pushes the current git repo to a remote bare repo. \ +It then checks out the source tree in a workspace repo and starts the\ + build and all the tests. It can also initialize the remote bare repo\ + and the workspace repo. It assumes that the current repo refspec has\ + been set for the remote bare repository - .git/config of the current\ + repo must have a remote called <server> and the corresponding master\ + branch. Git should, naturally, be installed on both systems.\ + " +USAGE=" Usage: remotetest (--help|--init|--all|--incr|--clear) <user> <server> <bare-repo-path> <workspace-repo-path> [logfile]" + + + +function title() +{ + echo + echo $SCRIPTNAME + echo +} + +function usage() +{ + title + echo $DESC + echo + echo $USAGE +} + + +function error() +{ + echo $1 + echo "Failed." + exit 1 +} + +function success() +{ + echo "Success!" + exit 0 +} + +function instruct() +{ + usage + error +} + +function help() +{ + usage + echo + echo "Make sure you have git installed on both your computer and the server, as well as java and ant." + echo "Add your ssh key to the list of authorized keys on the server (see .ssh dir in your home). This is not required, but makes life easier, as you will have to answer fewer passwords." + echo "To initialize the remote repositories on a server 'server.url.com', see the following example:" + echo + echo "> tools/remotetest --init jack server.url.com ~jack/git-repos-dir/scala ~jack/tmp-build-dir/scala" + echo + echo "If you decide you no longer want this remote repository to be tracked (this also tries to delete remote repos on the server):" + echo + echo "> tools/remotetest --clear jack server.url.com ~jack/git-repos-dir/scala ~jack/tmp-build-dir/scala" + echo + echo "Once the initialization is successful, simply run: " + echo + echo "> tools/remotetest --all jack server.url.com ~jack/git-repos-dir/scala ~jack/tmp-build-dir/scala" + echo + echo "Optionally, build and test results will be saved into the logfile on the server (an additional, last argument). Be aware that problems arise should you push an ammended commit over a previously pushed commit - this has nothing to do with this script per se." + echo + echo " Example workflow:" + echo + echo " ------------------- " + echo " | | " + echo " V | " + echo " init ---> [ all | incr ] ---> clear " + echo + echo "Complete argument list:" + echo " --help prints this help" + echo " --init initializes remote repos" + echo " --clear deletes remote repos and removes the remote repo reference from local git repo" + echo " --all pushes the newest version, checks it out at the server, cleans all, builds and tests" + echo " --incr incremental does the same as --all, but does not clean the directory before testing" +} + + +if [ $# -lt 1 ] +then + instruct +fi + + + +if [ $# -lt 5 ] +then + if [[ $1 = "--help" ]] + then + help + success + else + instruct + fi +fi + +COMMAND=$1 +USER=$2 +LOCATION=$3 +BAREREPO=$4 +WORKREPO=$5 +LOGFILE=$6 + + +if [[ $COMMAND = "--help" ]] +then + help + success +fi + + + + +# +# Init +# + + +if [[ $COMMAND = "--init" ]] +then + echo "Initializing." + + # init bare repo + ssh $USER@$LOCATION "mkdir $BAREREPO" + ssh $USER@$LOCATION "cd $BAREREPO; git init; git config --bool core.bare true" + if [ $? -ne 0 ] + then + error "Could not initialize bare repo." + fi + + # add remote bare repo + git remote add $LOCATION $USER@$LOCATION:$BAREREPO + + # push to bare repo + git push $LOCATION master + if [ $? -ne 0 ] + then + error "Could not push to bare repo." + fi + + # init and checkout work repo + ssh $USER@$LOCATION "git clone $BAREREPO $WORKREPO" + if [ $? -ne 0 ] + then + error "Could not init working repo." + fi + + success +fi + + + + +# +# Clear. +# + + +if [[ $COMMAND = "--clear" ]] +then + echo "Clearing remote and deleting remote repos." + git remote rm $LOCATION + ssh $USER@$LOCATION "rm -rf $BAREREPO" + ssh $USER@$LOCATION "cd $WORKREPO; ant all.clean; rm -rf $WORKREPO" + + echo "Removed remote repo $LOCATION." + success +fi + + + + +# +# Test. +# + + +if [[ $COMMAND = "--all" || $COMMAND = "--incr" ]] +then + # proceed + echo "Starting remote build and testing." +else + error "Unrecognized command $COMMAND." +fi + +# if it's not the init operation, proceed normally +# push to remote bare repo +git push $LOCATION master +if [ $? -ne 0 ] +then + error "Could not push to bare repo - push from local machine failed." +fi + +# remotely checkout the repo +ssh $USER@$LOCATION "cd $WORKREPO; git pull origin master" +if [ $? -ne 0 ] +then + error "Could not remotely pull from bare repo to work repo." +fi + +# clean the build dir if not incremental +if [[ $COMMAND = "--all" ]] +then + ssh $USER@$LOCATION "cd $WORKREPO; ant all.clean" +fi + +# run the build and tests +SET_ANT_OPTS='export ANT_OPTS="-XX:MaxPermSize=192M -Xmx1536m"; echo $ANT_OPTS' +echo "Set ant options command: $SET_ANT_OPTS" +ssh $USER@$LOCATION "cd $WORKREPO; $SET_ANT_OPTS; ant nightly | tee -a $LOGFILE" + +success + + + + diff --git a/tools/scalawhich b/tools/scalawhich new file mode 100755 index 0000000000..6a4b1788a8 --- /dev/null +++ b/tools/scalawhich @@ -0,0 +1,4 @@ +#!/bin/sh +# + +scala scala.tools.util.Which $* diff --git a/tools/scmp b/tools/scmp new file mode 100755 index 0000000000..f6acea5ab1 --- /dev/null +++ b/tools/scmp @@ -0,0 +1,4 @@ +#!/bin/sh +# + +scala scala.tools.cmd.program.Scmp "$@" diff --git a/tools/showPickled b/tools/showPickled new file mode 100755 index 0000000000..27421c3ae5 --- /dev/null +++ b/tools/showPickled @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Shows the pickled scala data in a classfile. + +if [ $# == 0 ] ; then + echo "Usage: $0 [--bare] [-cp classpath] <class*>" + exit 1 +fi + +TOOLSDIR=`dirname $0` +CPOF="$TOOLSDIR/cpof" + +PACK="$TOOLSDIR/../build/pack/lib" +QUICK="$TOOLSDIR/../build/quick/classes" +STARR="$TOOLSDIR/../lib" +CP="" + +if [ -f "${PACK}/scala-library.jar" ] ; then + CP=`${TOOLSDIR}/packcp` +elif [ -d "${QUICK}/library" ] ; then + CP=`${TOOLSDIR}/quickcp` +else + CP=`${TOOLSDIR}/starrcp` +fi + +if [ "$1" == "-cp" ] ; then + shift + CP="${1}:${CP}" + shift +fi + +java -cp "$CP" scala.tools.nsc.util.ShowPickled $* diff --git a/tools/starrcp b/tools/starrcp new file mode 100755 index 0000000000..6add5665b5 --- /dev/null +++ b/tools/starrcp @@ -0,0 +1,5 @@ +#!/bin/sh +# + +THISDIR=`dirname $0` +${THISDIR}/cpof ${THISDIR}/../lib
\ No newline at end of file diff --git a/tools/strapcp b/tools/strapcp new file mode 100755 index 0000000000..61e4a61b2c --- /dev/null +++ b/tools/strapcp @@ -0,0 +1,8 @@ +#!/bin/sh +# + +THISDIR=`dirname $0` +cp=`${THISDIR}/cpof ${THISDIR}/../build/strap/classes` +fjbg=`${THISDIR}/abspath ${THISDIR}/../lib/fjbg.jar` + +echo ${cp}:${fjbg} diff --git a/tools/test-renamer b/tools/test-renamer new file mode 100755 index 0000000000..5a7fc3d78c --- /dev/null +++ b/tools/test-renamer @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +# +# Despite its shameful hackiness, checked in for posterity. +# It'll live on forever in the git history; then I can remove it. + +# set -e +shopt -s nullglob + +cd $(dirname $0)/../test + +rename_pattern='^.*/bug[0-9]+.*?(\.scala)?$' + +targets () +{ + ls -d pending/*/* disabled/*/* | egrep "$rename_pattern" +} + +showRun () +{ + echo "$@" + "$@" +} + +for path in $(targets); do + if [[ -f "$path" ]]; then + # echo "$path" + dir=$(dirname "$path") + file=$(basename "$path") + base=${file%%.scala} + num=${base##bug} + + (cd "$dir" && + for file in ${base}.*; do + ext=${file##*.} + newname="t${num}.${ext}" + + if [[ -e "$newname" ]]; then + echo "Hey, $newname already exists." + else + showRun perl -pi -e "'s/bug$num\b/t$num/g;'" "$file" + showRun mv "$file" "$newname" + fi + done + ) + fi + + if [[ -d "$path" ]]; then + dir=$(dirname "$path") + file=$(basename "$path") + base="$file" + num=${base##bug} + + (cd "$dir" && + for file in $file ${file}.*; do + ext=${file##*.} + if [[ "$ext" != "$file" ]]; then + newname="t${num}.${ext}" + else + newname="t${num}" + for file0 in ${file}/*; do + showRun perl -pi -e "'s/bug$num\b/t$num/g;'" "$file0" + done + fi + + if [[ -e "$newname" ]]; then + echo "Hey, $newname already exists." + else + if [[ -f "$file" ]]; then + showRun perl -pi -e "'s/bug$num\b/t$num/g;'" "$file" + fi + showRun mv "$file" "$newname" + fi + done + ) + + fi + +done +# +# for d in files/*/*; do +# [[ -d "$d" ]] && do_dir "$d" +# done diff --git a/tools/tokens b/tools/tokens new file mode 100755 index 0000000000..b910fb29cc --- /dev/null +++ b/tools/tokens @@ -0,0 +1,4 @@ +#!/bin/sh +# + +scala scala.tools.cmd.program.Tokens "$@" diff --git a/tools/truncate b/tools/truncate new file mode 100755 index 0000000000..b7f410e25d --- /dev/null +++ b/tools/truncate @@ -0,0 +1,7 @@ +#!/bin/bash + +find . -type f -not -path "*.svn*" -name "*.scala" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; +find . -type f -not -path "*.svn*" -name "*.java" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; +find . -type f -not -path "*.svn*" -name "*.cs" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; +find . -type f -not -path "*.svn*" -name "*.js" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; +find . -type f -not -path "*.svn*" -name "*.scala.disabled" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; diff --git a/tools/updatescalacheck b/tools/updatescalacheck new file mode 100755 index 0000000000..c4b80dd963 --- /dev/null +++ b/tools/updatescalacheck @@ -0,0 +1,130 @@ +# +# +# ScalaCheck update script. +# +# + + +# vars +TMPFILE=`mktemp` +SCALACHECK_REL_DIR=src/scalacheck +DESC="Updates ScalaCheck sources from ScalaCheck nightly branch." +WARN="Make sure your repository checkout is clean. Will remove and delete existing ScalaCheck source in <path-to-scala-repo>/$SCALACHECK_REL_DIR!" +USAGE=" Usage: updatescalacheck <path-to-scala-repo>" + + +# functions +function error() { + rm $TMPFILE + exit 1 +} + +function success() { + rm $TMPFILE + exit 0 +} + + + +# check num args +if [ $# -ne 1 ] +then + echo $DESC + echo $WARN + echo "Must provide path to scala repo checkout dir." + echo $USAGE + error +fi + +if [[ $1 = "--help" ]] +then + echo $DESC + echo $WARN + echo $USAGE + error +fi + +if [ ! -d $1 ] +then + echo "The folder $1 does not exist." + error +fi + +# go to scala dir +SCALA_DIR=$1 +cd $SCALA_DIR + +# +# check if checkout is svn and up to date +# otherwise check if its git and up to date +# +if [ -d .svn ] || [ -d _svn ] +then + # + # svn repo - check if clean + # + svn status > $TMPFILE + if [ $? -ne 0 ] + then + echo "Detected .svn dir, but svn status returns an error. Check if this is really an .svn repo." + error + fi + echo "svn status output: " + cat $TMPFILE + echo "grep found: " + cat $TMPFILE | grep "^\(?\|A\|D\|M\|C\|!\|~\)" + GREPRETCODE=$? + echo "grep return code: $GREPRETCODE" + if [ $GREPRETCODE -eq 0 ] + then + echo "Working directory does not seem to be clean. Do a clean checkout and try again." + error + fi + echo "Checkout appears to be clean." +elif [ -d .git ] +then + # + # git repo - check if clean + # + git status --porcelain > $TMPFILE + if [ $? -ne 0 ] + then + echo "Detected .git dir, but git status returns an error. Check if this is really a .git repo." + error + fi + echo "git status output: " + cat $TMPFILE + echo "grep found: " + cat $TMPFILE | grep "^\(A\|M\|D\|R\|C\|U\)" + GREPRETCODE=$? + echo "grep return code: $GREPRETCODE" + if [ $GREPRETCODE -eq 0 ] + then + echo "Working directory does not seem to be clean. Do a clean checkout and try again." + error + fi + echo "Checkout appears to be clean." +else + # no repo detected + echo "The directory $SCALA_DIR does not seem to be a repository." + error +fi + +# check if ScalaCheck source dir exists +if [ ! -d $SCALACHECK_REL_DIR ] +then + echo "ScalaCheck source dir does not seem to exist in: $SCALA_DIR/$SCALACHECK_REL_DIR" + echo "Please create one and try again." + error +fi + +# go to ScalaCheck source dir +cd $SCALACHECK_DIR + +# update sources +svn export --force https://scalacheck.googlecode.com/svn/branches/scalanightly/src/main/scala . + +# remove unneeded class +rm org/scalacheck/ScalaCheckFramework.scala + +success |