diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-05-17 17:01:20 +0200 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-17 11:16:39 -0700 |
commit | b7c352a57f65458c66c78a368f75aaaa4a08e443 (patch) | |
tree | 4b2b7fcea439948c5de65b05a392091a66eea0a4 /tools | |
parent | 4f8c306aca703c63282295c9f74f0cb35f9f85d4 (diff) | |
parent | be405eed9bef9736f0142d6ddf53b6bf8af08696 (diff) | |
download | scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.tar.gz scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.tar.bz2 scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.zip |
Merge v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master
================================================================
Merge commit 'v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master
Conflicts:
src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
src/reflect/scala/reflect/runtime/JavaMirrors.scala
================================================================
Merge -s ours 4e64a27 ([nomaster commit range])
================================================================
Merge commit '0ae7e55' into merge/v2.10.1-326-g4f8c306-to-master
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Macros.scala
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/binary-repo-lib.sh | 2 | ||||
-rwxr-xr-x | tools/buildcp | 2 | ||||
-rwxr-xr-x | tools/make-release-notes | 49 | ||||
-rw-r--r-- | tools/make-release-notes.scala | 129 | ||||
-rwxr-xr-x | tools/partest-ack | 141 | ||||
-rwxr-xr-x | tools/strapcp | 3 |
6 files changed, 273 insertions, 53 deletions
diff --git a/tools/binary-repo-lib.sh b/tools/binary-repo-lib.sh index 4fe6dd67a0..704bf4944d 100755 --- a/tools/binary-repo-lib.sh +++ b/tools/binary-repo-lib.sh @@ -208,7 +208,7 @@ pullJarFile() { local sha1=$(cat ${jar}${desired_ext}) local jar_dir=$(dirname $jar) local jar_name=${jar#$jar_dir/} - local version=${sha1% ?$jar_name} + local version=${sha1%% *} local remote_uri=${version}/${jar#$basedir/} echo "Resolving [${remote_uri}]" pullJarFileToCache $remote_uri $version diff --git a/tools/buildcp b/tools/buildcp index 766ab81f90..3ae70e10a3 100755 --- a/tools/buildcp +++ b/tools/buildcp @@ -8,4 +8,4 @@ lib=$($dir/abspath $dir/../lib) build=$($dir/abspath $dir/../build) cp=$($dir/cpof $build/$1/classes):$build/asm/classes -echo $cp:$lib/fjbg.jar:$lib/msil.jar:$lib/forkjoin.jar:$lib/jline.jar:$lib/extra/'*' +echo $cp:$lib/forkjoin.jar:$lib/jline.jar:$lib/extra/'*' diff --git a/tools/make-release-notes b/tools/make-release-notes deleted file mode 100755 index dcd206f7fc..0000000000 --- a/tools/make-release-notes +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -# This tool is used to build a *scaffold* of a release note that you can fill in details with before posting to the list. -# It aims to provide *all* the information you need, and probably need to prune it before releasing. -# Author: jsuereth - -fixMessages() { - local tag1="$1" - local tag2="$2" - git log $tag1..$tag2 "--format=format: * %h - %s" --no-merges --grep "SI-" -} - -allcommitMessages() { - local tag1="$1" - local tag2="$2" - git log $tag1..$tag2 "--format=format: * %h - %s" --no-merges -} - -authors() { - local tag1="$1" - local tag2="$2" - git log $tag1..$tag2 --format=format:%an --no-merges | sort | uniq -c | sort -rh -} - - -message() { - local tag1="$1" - local tag2="$2" - - echo "A new release of Scala is available! Please point your build tools at ${tag2#v}" - echo - echo "Here's a list of the issues that have been fixed since ${tag1#v}: " - fixMessages "$tag1" "$tag2" - echo - echo - echo "Special thanks to all the contributions!" - echo "------- --------------------------------" - authors "$tag1" "$tag2" - echo "------- --------------------------------" - echo - echo - echo "Here's a complete list of changes:" - allcommitMessages "$tag1" "$tag2" -} - - -message "$1" "$2" - - diff --git a/tools/make-release-notes.scala b/tools/make-release-notes.scala new file mode 100644 index 0000000000..3e5b60d223 --- /dev/null +++ b/tools/make-release-notes.scala @@ -0,0 +1,129 @@ +#!/bin/sh +exec scala -feature $0 $@ +!# + +import sys.process._ + +val tag1 = "v2.10.0-M4" +val tag2 = "v2.10.0-M5" + +// Git commit parsing magikz + +case class Commit(sha: String, author: String, header: String, body: String) { + override def toString = " * " + sha + " (" + author + ") " + header + " - " + body.take(5) + " ..." +} + +val gitFormat = "--format=format:*-*%h``%aN``%s``%b" + +def processGitCommits(input: String): IndexedSeq[Commit] = + ((input split "[\\r\\n]*\\*\\-\\*").view map (_ split "``") collect { + case Array(sha, author, hdr, msg) => Commit(sha, author, hdr, msg) + }).toVector + +val commits = + processGitCommits(Process(Seq("git", "log", tag1+".."+tag2,"--format=format:*-*%h``%aN``%s``%b","--no-merges")).!!) + +val authors: Seq[(String, Int)] = { + val grouped: Vector[(String,Int)] = (commits groupBy (_.author)).map { case (a,c) => a -> c.length }{collection.breakOut} + (grouped sortBy (_._2)).reverse +} + +def hasFixins(msg: String): Boolean = ( + (msg contains "SI-") /*&& ((msg.toLowerCase contains "fix") || (msg.toLowerCase contains "close"))*/ +) + +val fixCommits = + for { + commit <- commits + searchString = commit.body + commit.header + if hasFixins(searchString) + } yield commit + + +val siPattern = java.util.regex.Pattern.compile("(SI-[0-9]+)") + +def fixLinks(commit: Commit): String = { + val searchString = commit.body + commit.header + val m = siPattern matcher searchString + val issues = new collection.mutable.ArrayBuffer[String] + while(m.find()) { + issues += (m group 1) + } + issues map (si => """<a href="https://issues.scala-lang.org/browse/%s">%s</a>""" format (si, si)) mkString ", " +} + + +// HTML Generation for Toni + +def commitShaLink(sha: String) = + """<a href="https://github.com/scala/scala/commit/%s">%s</a>""" format (sha,sha) + +def printBlankLine(): Unit = println("<p> </p>") +def printHeader4(msg: String): Unit = println("<h4>%s</h4>" format (msg)) + +def printCommiterList(): Unit = { + printBlankLine() + printHeader4("Special thanks to all the contribtuors!") + println("""<table border="0" cellspacing="0" cellpadding="1"> + <thead><tr><th>#</th><th align="left">Author</th></tr></thead> + <tbody>""") + for((author, count) <- authors) + println("""<tr><td align="right">%d </td><td>%s</td></tr>""" format (count, author)) + println("""</tbody> +</table>""") +} + +def printCommitList(): Unit = { + printBlankLine() + printHeader4("Complete commit list!") + println("""<table border="0" cellspacing="0" cellpadding="1"> + <thead><tr><th>sha</th><th align="left">Title</th></tr></thead> + <tbody>""") + for(commit <- commits) { + println("<tr>") + println("""<td align="right">%s </td><td>%s</td>""" format (commitShaLink(commit.sha), commit.header)) + /*print("<td>") + (commit.body split "[\\r\\n]") foreach { line => + print(line) + print("<br/>") + } + print("</td>")*/ + println("""</tr>""") + } + println("""</tbody> +</table>""") +} + +def issueFixPrinter(): Unit = { + printBlankLine() + printHeader4("Here's a list of isssues that have been fixed since %s" format (tag1)) + println("""<table border="0" cellspacing="0" cellpading="1"> + <thead><tr><th>Issue(s)</th><th>Commit</th><th>Message</th></tr></thead> + <tbody>""") + for(commit <- fixCommits) { + println("""<tr><td>%s </td><td>%s </td><td>%s</td></tr>""" format(fixLinks(commit), commitShaLink(commit.sha), commit.header)) + } + println("""</tbody> +</table>""") + printBlankLine() +} + +def printHTML(): Unit = { + println("""<html> + <head> + <title>%s - Release notes</title> + </head> + <body> + <h3>A new release of Scala is available! Please point your build tools at %s</h3> + <p>:: INSERT HAND GENERATED NOTES HERE ::</p> +""" format(tag2, tag2 drop 1)) + issueFixPrinter() + printCommiterList() + printCommitList() + println("""</body></html>""") +} + +printHTML() + + + diff --git a/tools/partest-ack b/tools/partest-ack new file mode 100755 index 0000000000..f7d5063292 --- /dev/null +++ b/tools/partest-ack @@ -0,0 +1,141 @@ +#!/usr/bin/env bash +# +# wrapper around partest for fine-grained test selection via ack + +declare quiet failed update partest_debug file_regex partest_args ack_args cotouched + +[[ $# -gt 0 ]] || { + cat <<EOM +Usage: $0 <regex> [-dfquvp] [ack options] + + -d pass --debug to partest + -f pass --failed to partest + -q DON'T pass --show-log and --show-diff to partest + -u pass --update-check to partest + -v pass --verbose to partest + -p <path> select tests appearing in commits where <path> was also modified + +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 installed: http://betterthangrep.com/ack-standalone + +Examples: + + > tools/partest-ack monad + % tests-with-matching-paths ... 2 + % tests-with-matching-code ... 2 + # 4 tests to run. + + > tools/partest-ack -p src/library/scala/Enumeration.scala + % tests-modified-in-same-commit ... 84 + # 84 tests to run. + + > tools/partest-ack -f + % tests-which-failed ... 42 + # 42 tests to run. +EOM + + exit 0 +} + +# 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 :fuvdp: opt; do + case $opt in + d) partest_debug=true && partest_args="$partest_args --debug" ;; + f) failed=true && partest_args="$partest_args --failed" ;; + p) cotouched="$cotouched $OPTARG" ;; + q) quiet=true ;; + u) partest_args="$partest_args --update-check" ;; + v) partest_args="$partest_args --verbose" ;; + :) 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 + +shift $((OPTIND-1)) +file_regex="$1" +ack_args="$*" + +tests () { + find test/files -mindepth 2 -maxdepth 2 -name '*.scala' -o -type d +} + +pathsToTests () { + for path in $(perl -pe 's#^(test/files/[^/]+/[^/.]+).*$#$1#'); do + if [[ -d "$path" ]]; then + echo "$path" + elif [[ -f "$path.scala" ]]; then + echo "$path.scala" + fi + done | sort -u +} + +tests-with-matching-paths() { + local re="$1" + for p in $(find test/files -type f); do + [[ $p =~ $re ]] && echo "$p" + done +} + +tests-which-failed () { + for f in $(find test/files -name '*.log'); do + echo ${f%-*} + done +} + +tests-modified-in-same-commit() { + [[ $# -gt 0 ]] && \ + for rev in $(git rev-list HEAD -- "$@"); do + git --no-pager show --pretty="format:" --name-only "$rev" -- test/files + done +} + +tests-with-matching-code() { + ack --noenv --text --files-with-matches "$@" -- test/files +} + +countStdout () { + local -i count=0 + while read line; do + printf "$line\n" + count+=1 + done + + printf >&2 " $count\n" +} + +testRun () { + printf >&2 "%% %-30s ... " "$1" + "$@" | pathsToTests | countStdout +} + +allMatches() { + [[ -n $file_regex ]] && testRun tests-with-matching-paths $file_regex + [[ -n $cotouched ]] && testRun tests-modified-in-same-commit $cotouched + [[ -n $ack_args ]] && testRun tests-with-matching-code $ack_args + [[ -n $failed ]] && testRun tests-which-failed +} + +paths=$(allMatches | sort -u) +[[ -n $quiet ]] || partest_args="--show-diff --show-log $partest_args" + +if [[ -z $paths ]] && [[ -z $failed ]]; then + echo >&2 "No matching tests." +else + count=$(echo $(echo "$paths" | wc -w)) + + # Output a command line which will re-run these same tests. + echo "# $count tests to run." + printf "%-52s %s\n" "test/partest $partest_args" "\\" + for path in $paths; do + printf " %-50s %s\n" "$path" "\\" + done + echo ' ""' + + test/partest $partest_args $paths +fi diff --git a/tools/strapcp b/tools/strapcp index 6a46b4e1c8..6a4044ae24 100755 --- a/tools/strapcp +++ b/tools/strapcp @@ -6,7 +6,6 @@ strap="$dir/../build/strap/classes" [[ -d $strap ]] || { echo "Error: no directory at $strap"; exit 1; } cp=$($dir/cpof $strap) -fjbg=$($dir/abspath $dir/../lib/fjbg.jar) asm=$($dir/abspath $dir/../build/asm/classes) -echo $cp:$fjbg:$asm +echo $cp:$asm |