summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/binary-repo-lib.sh234
-rwxr-xr-xtools/codegen8
-rwxr-xr-xtools/codegen-anyvals5
-rwxr-xr-xtools/deploy-local-maven-snapshot11
-rwxr-xr-xtools/get-scala-commit-date17
-rw-r--r--tools/get-scala-commit-date.bat9
-rwxr-xr-xtools/get-scala-commit-sha18
-rw-r--r--tools/get-scala-commit-sha.bat9
-rwxr-xr-xtools/new-starr6
-rwxr-xr-xtools/partest-ack131
-rwxr-xr-xtools/partest-paths27
-rw-r--r--tools/push.jar.desired.sha11
-rwxr-xr-xtools/rm-orphan-checkfiles4
-rwxr-xr-xtools/scaladoc-diff4
-rwxr-xr-xtools/stability-test.sh29
15 files changed, 4 insertions, 509 deletions
diff --git a/tools/binary-repo-lib.sh b/tools/binary-repo-lib.sh
deleted file mode 100755
index 278804e30e..0000000000
--- a/tools/binary-repo-lib.sh
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/usr/bin/env bash
-#
-# Library to push and pull binary artifacts from a remote repository using CURL.
-
-remote_urlget="https://dl.bintray.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap"
-remote_urlpush="https://dl.bintray.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap"
-libraryJar="$(pwd)/lib/scala-library.jar"
-desired_ext=".desired.sha1"
-push_jar="$(pwd)/tools/push.jar"
-
-if [[ "$OSTYPE" == *Cygwin* || "$OSTYPE" == *cygwin* ]]; then push_jar="$(cygpath -m "$push_jar")"; fi
-# Cache dir has .sbt in it to line up with SBT build.
-SCALA_BUILD_REPOS_HOME=${SCALA_BUILD_REPOS_HOME:=$HOME}
-cache_dir="${SCALA_BUILD_REPOS_HOME}/.sbt/cache/scala"
-
-# Checks whether or not curl is installed and issues a warning on failure.
-checkCurl() {
- if ! which curl >/dev/null; then
- cat <<EOM
-No means of downloading or uploading binary artifacts found.
-
-Please install curl for your OS. e.g.
-* sudo apt-get install curl
-* brew install curl
-EOM
- fi
-}
-
-# Executes the `curl` command to publish artifacts into a maven/ivy repository.
-# Arugment 1 - The location to publish the file.
-# Argument 2 - The file to publish.
-# Argument 3 - The user to publish as.
-# Argument 4 - The password for the user.
-curlUpload() {
- checkCurl
- local remote_location=$1
- local data=$2
- local user=$3
- local password=$4
- local url="${remote_urlpush}/${remote_location}"
- java -jar $push_jar "$data" "$url" "$user" "$password"
- if (( $? != 0 )); then
- echo "Error uploading $data to $url"
- echo "$url"
- exit 1
- fi
-}
-
-# Executes the `curl` command to download a file.
-# Argument 1 - The location to store the file.
-# Argument 2 - The URL to download.
-curlDownload() {
- checkCurl
- local jar=$1
- local url=$2
- if [[ "$OSTYPE" == *Cygwin* || "$OSTYPE" == *cygwin* ]]; then
- jar=$(cygpath -m $1)
- fi
- http_code=$(curl --write-out '%{http_code}' --silent --fail -L --output "$jar" "$url")
- if (( $? != 0 )); then
- echo "Error downloading $jar: response code: $http_code"
- echo "$url"
- exit 1
- fi
-}
-
-# Pushes a local JAR file to the remote repository and updates the .desired.sha1 file.
-# Argument 1 - The JAR file to update.
-# Argument 2 - The root directory of the project.
-# Argument 3 - The user to use when publishing artifacts.
-# Argument 4 - The password to use when publishing artifacts.
-pushJarFile() {
- local jar=$1
- local basedir=$2
- local user=$3
- local pw=$4
- local jar_dir=$(dirname $jar)
- local jar_name=${jar#$jar_dir/}
- pushd $jar_dir >/dev/null
- local version=$(makeJarSha $jar_name)
- local remote_uri=${version}${jar#$basedir}
- echo " Pushing to ${remote_urlpush}/${remote_uri} ..."
- echo " $curl"
- curlUpload $remote_uri $jar_name $user $pw
- echo " Making new sha1 file ...."
- echo "$version ?$jar_name" > "${jar_name}${desired_ext}"
- popd >/dev/null
- # TODO - Git remove jar and git add jar.desired.sha1
- # rm $jar
-}
-
-makeJarSha() {
- local jar=$1
- if which sha1sum 2>/dev/null >/dev/null; then
- shastring=$(sha1sum "$jar")
- echo "$shastring" | sed 's/ .*//'
- elif which shasum 2>/dev/null >/dev/null; then
- shastring=$(shasum "$jar")
- echo "$shastring" | sed 's/ .*//'
- else
- shastring=$(openssl sha1 "$jar")
- echo "$shastring" | sed 's/^.*= //'
- fi
-}
-
-getJarSha() {
- local jar=$1
- if [[ ! -f "$jar" ]]; then
- echo ""
- else
- echo $(makeJarSha $jar)
- fi
-}
-
-# Tests whether or not the .desired.sha1 hash matches a given file.
-# Arugment 1 - The jar file to test validity.
-# Returns: Empty string on failure, "OK" on success.
-isJarFileValid() {
- local jar=$1
- if [[ ! -f "$jar" ]]; then
- echo ""
- else
- local jar_dir=$(dirname $jar)
- local jar_name=${jar#$jar_dir/}
- pushd $jar_dir >/dev/null
- local valid=$(shasum -p --check ${jar_name}${desired_ext} 2>/dev/null)
- echo "${valid#$jar_name: }"
- popd >/dev/null
- fi
-}
-
-# Pushes any jar file in the local repository for which the corresponding SHA1 hash is invalid or nonexistent.
-# Argument 1 - The base directory of the project.
-# Argument 2 - The user to use when pushing artifacts.
-# Argument 3 - The password to use when pushing artifacts.
-pushJarFiles() {
- local basedir=$1
- local user=$2
- local password=$3
- # TODO - ignore target/ and build/
- local jarFiles="$(find ${basedir}/lib -name "*.jar") $(find ${basedir}/test/files -name "*.jar") $(find ${basedir}/tools -name "*.jar")"
- local changed="no"
- for jar in $jarFiles; do
- local valid=$(isJarFileValid $jar)
- if [[ "$valid" != "OK" ]]; then
- echo "$jar has changed, pushing changes...."
- changed="yes"
- pushJarFile $jar $basedir $user $password
- fi
- done
- if test "$changed" == "no"; then
- echo "No jars have been changed."
- else
- echo "Binary changes have been pushed. You may now submit the new *${desired_ext} files to git."
- fi
-}
-
-
-checkJarSha() {
- local jar=$1
- local sha=$2
- local testsha=$(getJarSha "$jar")
- if test "$sha" == "$testsha"; then
- echo "OK"
- fi
-}
-
-makeCacheLocation() {
- local uri=$1
- local sha=$2
- local cache_loc="$cache_dir/$uri"
- local cdir=$(dirname $cache_loc)
- if [[ ! -d "$cdir" ]]; then
- mkdir -p "$cdir"
- fi
- echo "$cache_loc"
-}
-
-# Pulls a single binary artifact from a remote repository.
-# Argument 1 - The uri to the file that should be downloaded.
-# Argument 2 - SHA of the file...
-# Returns: Cache location.
-pullJarFileToCache() {
- local uri=$1
- local sha=$2
- local cache_loc="$(makeCacheLocation $uri)"
- # TODO - Check SHA of local cache is accurate.
- if test -f "$cache_loc" && test "$(checkJarSha "$cache_loc" "$sha")" != "OK"; then
- echo "Found bad cached file: $cache_loc"
- rm -f "$cache_loc"
- fi
- if [[ ! -f "$cache_loc" ]]; then
- # Note: After we follow up with JFrog, we should check the more stable raw file server first
- # before hitting the more flaky artifactory.
- curlDownload $cache_loc ${remote_urlget}/${uri}
- if test "$(checkJarSha "$cache_loc" "$sha")" != "OK"; then
- echo "Trouble downloading $uri. Please try pull-binary-libs again when your internet connection is stable."
- exit 2
- fi
- fi
-}
-
-# Pulls a single binary artifact from a remote repository.
-# Argument 1 - The jar file that needs to be downloaded.
-# Argument 2 - The root directory of the project.
-pullJarFile() {
- local jar=$1
- local basedir=$2
- local sha1=$(cat ${jar}${desired_ext})
- local jar_dir=$(dirname $jar)
- local jar_name=${jar#$jar_dir/}
- local version=${sha1%% *}
- local remote_uri=${version}/${jar#$basedir/}
- echo "Resolving [${remote_uri}]"
- pullJarFileToCache $remote_uri $version
- local cached_file=$(makeCacheLocation $remote_uri)
- cp $cached_file $jar
-}
-
-# Pulls binary artifacts from the remote repository.
-# Argument 1 - The directory to search for *.desired.sha1 files that need to be retrieved.
-pullJarFiles() {
- local basedir=$1
- local desiredFiles="$(find ${basedir}/lib -name *${desired_ext}) $(find ${basedir}/test/files -name *${desired_ext}) $(find ${basedir}/tools -name *${desired_ext})"
- for sha in $desiredFiles; do
- jar=${sha%$desired_ext}
- local valid=$(isJarFileValid $jar)
- if [[ "$valid" != "OK" ]]; then
- pullJarFile $jar $basedir
- fi
- done
-}
-
-
diff --git a/tools/codegen b/tools/codegen
deleted file mode 100755
index 35c93fba16..0000000000
--- a/tools/codegen
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-
-THISDIR=`dirname $0`
-SCALALIB=$THISDIR/../src/library/scala
-BINDIR=$THISDIR/../build/quick/bin
-
-$BINDIR/scala scala.tools.cmd.gen.Codegen "$@"
diff --git a/tools/codegen-anyvals b/tools/codegen-anyvals
deleted file mode 100755
index 27d1c40134..0000000000
--- a/tools/codegen-anyvals
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-#
-
-THISDIR=`dirname $0`
-$THISDIR/codegen --anyvals --out $THISDIR/../src/library/scala
diff --git a/tools/deploy-local-maven-snapshot b/tools/deploy-local-maven-snapshot
deleted file mode 100755
index 30f78cb110..0000000000
--- a/tools/deploy-local-maven-snapshot
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/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/get-scala-commit-date b/tools/get-scala-commit-date
deleted file mode 100755
index b2e4e10770..0000000000
--- a/tools/get-scala-commit-date
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env bash
-#
-# Usage: get-scala-commit-date [dir]
-# Figures out current commit date of a git clone.
-# If no dir is given, current working dir is used.
-#
-# Example build version string:
-# 20120312
-#
-
-[[ $# -eq 0 ]] || cd "$1"
-
-lastcommitdate=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 1)
-lastcommithours=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 2)
-
-# 20120324
-echo "${lastcommitdate//-/}-${lastcommithours//:/}"
diff --git a/tools/get-scala-commit-date.bat b/tools/get-scala-commit-date.bat
deleted file mode 100644
index 735a80b927..0000000000
--- a/tools/get-scala-commit-date.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@echo off
-for %%X in (bash.exe) do (set FOUND=%%~$PATH:X)
-if defined FOUND (
- bash "%~dp0\get-scala-commit-date" 2>NUL
-) else (
- rem echo this script does not work with cmd.exe. please, install bash
- echo unknown
- exit 1
-)
diff --git a/tools/get-scala-commit-sha b/tools/get-scala-commit-sha
deleted file mode 100755
index eab90a4215..0000000000
--- a/tools/get-scala-commit-sha
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-#
-# Usage: get-scala-commit-sha [dir]
-# Figures out current commit sha of a git clone.
-# If no dir is given, current working dir is used.
-#
-# Example build version string:
-# 6f1c486d0ba
-#
-
-[[ $# -eq 0 ]] || cd "$1"
-
-# printf %016s is not portable for 0-padding, has to be a digit.
-# so we're stuck disassembling it.
-hash=$(git log -1 --format="%H" HEAD)
-hash=${hash#g}
-hash=${hash:0:10}
-echo "$hash"
diff --git a/tools/get-scala-commit-sha.bat b/tools/get-scala-commit-sha.bat
deleted file mode 100644
index 6559a19120..0000000000
--- a/tools/get-scala-commit-sha.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@echo off
-for %%X in (bash.exe) do (set FOUND=%%~$PATH:X)
-if defined FOUND (
- bash "%~dp0\get-scala-commit-sha" 2>NUL
-) else (
- rem echo this script does not work with cmd.exe. please, install bash
- echo unknown
- exit 1
-)
diff --git a/tools/new-starr b/tools/new-starr
deleted file mode 100755
index 5f00cc758e..0000000000
--- a/tools/new-starr
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-ant -Dscalac.args.optimise="-optimise" locker.done
-cp -R src/starr/* src/
-ant build-opt
-ant starr.done
diff --git a/tools/partest-ack b/tools/partest-ack
deleted file mode 100755
index ab722e3b1c..0000000000
--- a/tools/partest-ack
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/usr/bin/env bash
-#
-# wrapper around partest for fine-grained test selection via ack
-
-declare quiet failed update partest_debug
-declare cotouched since sortCommand
-declare -a ack_args partest_args scalac_args
-declare -r standard_ack_args="--noenv -s --java --scala --type-add=scala:ext:flags,check --files-with-matches"
-
-partest_args=( --show-diff )
-bindir="$(cd "$(dirname "$0")" && pwd)"
-base="$bindir/.."
-cd "$base" || { echo "Could not change to base directory $base" && exit 1; }
-filesdir="test/files"
-sortCommand="sort -u"
-partestPaths="$bindir/partest-paths"
-
-[[ -x "$partestPaths" ]] || { echo "Cannot find partest-paths in $partestPaths" && exit 1; }
-
-[[ $# -gt 0 ]] || {
- cat <<EOM
-Usage: $0 <regex> [-dfquvp] [ack options]
-
- -f pass --failed to partest
- -q pass --terse to partest
- -u pass --update-check to partest
- -p <path> select tests appearing in commits where <path> was also modified
- -s <time> select tests touched since <time> (git format, e.g. 1.month.ago)
- -r run tests in random order
-
-Given a regular expression (and optionally, any arguments accepted by ack)
-runs all the tests for which any associated file matches the regex. Associated
-files include .check and .flags files. Tests in directories will match if any
-file matches. A file can match the regex by its contents or by its name.
-
-You must have ack version 2.12+ installed: http://beyondgrep.com/ack-2.12-single-file
-
-Examples:
-
- > tools/partest-ack 'case (class|object) Baz'
- % testsWithMatchingPaths ... 0
- % testsWithMatchingCode ... 3
- # 3 tests to run.
-
- > tools/partest-ack -s 12.hours.ago
- % testsTouchedSinceGitTime ... 33
- # 33 tests to run.
-
- > tools/partest-ack -p src/library/scala/Enumeration.scala
- % testsModifiedInSameCommit ... 80
- # 80 tests to run.
-
- > tools/partest-ack -f
- % tests-which-failed ... 42
- # 42 tests to run.
-
- > tools/partest-ack "kinds of the type arguments"
- % testsWithMatchingPaths ... 0
- % testsWithMatchingCode ... 6
- # 6 tests to run.
-EOM
-
- exit 0
-}
-
-while getopts :fuvdrp:s: opt; do
- case $opt in
- f) failed=true && partest_args+=" --failed" ;;
- p) cotouched="$cotouched $OPTARG" ;;
- r) sortCommand="randomSort" ;;
- s) since="$OPTARG" ;;
- q) partest_args+=" --terse" ;;
- u) partest_args+=" --update-check" ;;
- v) partest_args+=" --verbose" ;;
- :) echo "Option -$OPTARG requires an argument." >&2 ;;
- *) ack_args+="-$OPTARG" ;; # don't drop unknown args, assume they're for ack
- esac
-done
-
-shift $((OPTIND-1))
-ack_args=( "${ack_args[@]}" "$@" )
-
-# These methods all just create paths which may or may not be tests
-# all are filtered through partest-paths which limits the output to actual tests
-regexPathTests () { find "$filesdir" | ack --noenv "$@"; }
-failedTests () { for p in $(find "$filesdir" -name '*.log'); do p1=${p%.log} && p2=${p1%-*} && echo "$p2"; done; }
-sinceTests() { git log --since="$@" --name-only --pretty="format:" -- "$filesdir"; }
-regexCodeTests () { ack $standard_ack_args "$@" -- "$filesdir"; }
-sameCommitTests() { for rev in $(git rev-list HEAD -- "$@"); do git --no-pager show --pretty="format:" --name-only "$rev" -- "$filesdir"; done; }
-
-countStdout () {
- local -i count=0
- while read line; do
- printf "$line\n" && count+=1
- done
-
- printf >&2 " $count\n"
-}
-
-randomSort () {
- sort -u | while read line; do echo "$RANDOM $line"; done | sort | sed -E 's/^[0-9]+ //'
-}
-
-testRun () {
- local description="$1" && shift
- printf >&2 "%% tests %-25s ... " "$description"
- "$@" | "$partestPaths" | countStdout | egrep -v '^[ ]*$'
-}
-
-allMatches() {
- [[ -n $ack_args ]] && testRun "with matching paths" regexPathTests "${ack_args[@]}"
- [[ -n $ack_args ]] && testRun "with matching code" regexCodeTests "${ack_args[@]}"
- [[ -n $cotouched ]] && testRun "modified in same commit" sameCommitTests $cotouched
- [[ -n $since ]] && testRun "modified since time" sinceTests "$since"
- [[ -n $failed ]] && testRun "failed on last run" failedTests
-}
-
-paths=$(allMatches | $sortCommand)
-
-[[ -z $paths ]] && [[ -z $failed ]] && echo >&2 "No matching tests." && exit 0;
-
-count=$(echo $(echo "$paths" | wc -w))
-[[ "$count" -eq 0 ]] && echo >&2 "No tests to run." && exit 0;
-
-# Output a command line which will re-run these same tests.
-echo "# $count tests to run."
-printf "%-52s %s\n" "$base/test/partest ${partest_args[*]}" "\\"
-for path in $paths; do printf " %-50s %s\n" "$path" "\\"; done
-echo ""
-
-test/partest ${partest_args[*]} $paths
diff --git a/tools/partest-paths b/tools/partest-paths
deleted file mode 100755
index 6ce403a04e..0000000000
--- a/tools/partest-paths
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-#
-# Given a list of files on stdin, translates them into a set
-# of tests covering those files. That means paths which aren't
-# part of a test are dropped and the rest are rewritten to the
-# primary test path, with duplicates dropped.
-
-cd "$(dirname "$0")/.."
-
-# We have to enumerate good test dirs since partest chokes and fails
-# on continuations, bench, etc. tests
-pathRegex="test/files/(pos|neg|jvm|run|scalap|presentation)/[^/.]+([.]scala)?\$"
-
-# Echo the argument only if it matches our idea of a test and exists.
-isPath () { [[ "$1" =~ $pathRegex ]] && [[ -e "$1" ]]; }
-
-# Filter stdin down to actual test paths.
-asTestPaths() {
- while read -r p; do
- # Matched file at the standard test depth
- p1="${p%.*}" && isPath "$p1.scala" && echo "$p1.scala" && continue
- # Or, matched file may be in a test subdirectory, so strip the last path segment and check
- p2="${p1%/*}" && isPath "$p2" && echo "$p2" && continue
- done
-}
-
-asTestPaths | sort -u
diff --git a/tools/push.jar.desired.sha1 b/tools/push.jar.desired.sha1
deleted file mode 100644
index 63e6a47372..0000000000
--- a/tools/push.jar.desired.sha1
+++ /dev/null
@@ -1 +0,0 @@
-a1883f4304d5aa65e1f6ee6aad5900c62dd81079 ?push.jar
diff --git a/tools/rm-orphan-checkfiles b/tools/rm-orphan-checkfiles
index ca0a3f2938..5bf95dda0a 100755
--- a/tools/rm-orphan-checkfiles
+++ b/tools/rm-orphan-checkfiles
@@ -6,13 +6,13 @@
shopt -s nullglob
echo "Scanning for orphan check files..."
-for f in $(ls -1d test/{files,pending,disabled}/{jvm,neg,pos,run}/*.check); do
+for f in $(ls -1d test/files/{jvm,neg,pos,run}/*.check); do
base=${f%%.check}
[[ -d $base ]] || [[ -f $base.scala ]] || git rm -f $f
done
echo "Scanning for orphan flags files..."
-for f in $(ls -1d test/{files,pending,disabled}/{jvm,neg,pos,run}/*.flags); do
+for f in $(ls -1d test/files/{jvm,neg,pos,run}/*.flags); do
base=${f%%.flags}
[[ -d $base ]] || [[ -f $base.scala ]] || git rm -f $f
done
diff --git a/tools/scaladoc-diff b/tools/scaladoc-diff
index df0d1f3335..1003b3dc02 100755
--- a/tools/scaladoc-diff
+++ b/tools/scaladoc-diff
@@ -49,7 +49,7 @@ if [ ! -f "build/scaladoc-output-$oldsha.txt" ]
then
echo "making scaladoc for parent commit ($oldsha)"
git checkout -q $oldsha
- ant docs.lib -Dscaladoc.raw.output='yes' > build/scaladoc-output-$oldsha.txt
+ sbt 'set scalacOptions in Compile in doc in library += "-raw-output"' library/doc > build/scaladoc-output-$oldsha.txt
rm -rf build/scaladoc-${oldsha}
mv build/scaladoc build/scaladoc-${oldsha}
git checkout -q $sha
@@ -57,7 +57,7 @@ fi
# create scaladoc for current commit
echo "making scaladoc for current commit ($sha)"
-ant docs.lib -Dscaladoc.raw.output='yes' > build/scaladoc-output-$sha.txt
+sbt 'set scalacOptions in Compile in doc in library += "-raw-output"' library/doc > build/scaladoc-output-$sha.txt
rm -rf build/scaladoc-${sha}
mv build/scaladoc build/scaladoc-${sha}
diff --git a/tools/stability-test.sh b/tools/stability-test.sh
deleted file mode 100755
index f017ac0842..0000000000
--- a/tools/stability-test.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-#
-
-declare failed
-
-echo "Comparing build/quick/classes and build/strap/classes"
-for dir in library reflect compiler; do
- # feel free to replace by a more elegant approach -- don't know how
- if diff -rw -x '*.css' \
- -x '*.custom' \
- -x '*.gif' \
- -x '*.js' \
- -x '*.layout' \
- -x '*.png' \
- -x '*.properties' \
- -x '*.tmpl' \
- -x '*.tooltip' \
- -x '*.txt' \
- -x '*.xml' \
- build/{quick,strap}/classes/$dir
- then
- classes=$(find build/quick/classes/$dir -name '*.class' | wc -l)
- printf "%8s: %5d classfiles verified identical\n" $dir $classes
- else
- failed=true
- fi
-done
-
-[[ -z $failed ]] || exit 127