diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/binary-repo-lib.sh | 42 | ||||
-rwxr-xr-x | tools/epfl-publish | 22 | ||||
-rwxr-xr-x | tools/get-scala-revision | 52 | ||||
-rw-r--r-- | tools/get-scala-revision.bat | 2 | ||||
-rwxr-xr-x | tools/locker_scala | 8 | ||||
-rwxr-xr-x | tools/locker_scalac | 8 | ||||
-rwxr-xr-x | tools/quick_scala | 6 | ||||
-rwxr-xr-x | tools/quick_scalac | 6 | ||||
-rwxr-xr-x | tools/starr_scala | 6 | ||||
-rwxr-xr-x | tools/starr_scalac | 6 |
10 files changed, 104 insertions, 54 deletions
diff --git a/tools/binary-repo-lib.sh b/tools/binary-repo-lib.sh index 79a37dd7df..4c5497e803 100755 --- a/tools/binary-repo-lib.sh +++ b/tools/binary-repo-lib.sh @@ -7,6 +7,9 @@ remote_urlbase="http://typesafe.artifactoryonline.com/typesafe/scala-sha-bootstr 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. +cache_dir="${HOME}/.sbt/cache/scala" # Checks whether or not curl is installed and issues a warning on failure. checkCurl() { @@ -48,7 +51,7 @@ curlDownload() { checkCurl local jar=$1 local url=$2 - if [[ "$OSTYPE" == *Cygwin* ]]; then + if [[ "$OSTYPE" == *Cygwin* || "$OSTYPE" == *cygwin* ]]; then jar=$(cygpath -m $1) fi http_code=$(curl --write-out '%{http_code}' --silent --fail --output "$jar" "$url") @@ -77,7 +80,7 @@ pushJarFile() { local remote_uri=${version}${jar#$basedir} echo " Pushing to ${remote_urlbase}/${remote_uri} ..." echo " $curl" - local curl=$(curlUpload $remote_uri $jar_name $user $pw) + curlUpload $remote_uri $jar_name $user $pw echo " Making new sha1 file ...." echo "$jar_sha1" > "${jar_name}${desired_ext}" popd >/dev/null @@ -112,14 +115,39 @@ pushJarFiles() { local password=$3 # TODO - ignore target/ and build/ local jarFiles="$(find ${basedir}/lib -name "*.jar") $(find ${basedir}/test/files -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 - echo "Binary changes have been pushed. You may now submit the new *${desired_ext} files to git." + 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 +} + +# 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=$cache_dir/$uri + local cdir=$(dirname $cache_loc) + if [[ ! -d $cdir ]]; then + mkdir -p $cdir + fi + # TODO - Check SHA of local cache is accurate. + if [[ ! -f $cache_loc ]]; then + curlDownload $cache_loc ${remote_urlbase}/${uri} + fi + echo "$cache_loc" } # Pulls a single binary artifact from a remote repository. @@ -133,20 +161,20 @@ pullJarFile() { local jar_name=${jar#$jar_dir/} local version=${sha1% ?$jar_name} local remote_uri=${version}/${jar#$basedir/} - echo "Downloading from ${remote_urlbase}/${remote_uri}" - curlDownload $jar ${remote_urlbase}/${remote_uri} + echo "Resolving [${remote_uri}]" + local cached_file=$(pullJarFileToCache $remote_uri $version) + 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})" + 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 - echo "Obtaining [$jar] from binary repository..." pullJarFile $jar $basedir fi done diff --git a/tools/epfl-publish b/tools/epfl-publish index e9cd97b3d2..de5e17b13f 100755 --- a/tools/epfl-publish +++ b/tools/epfl-publish @@ -1,7 +1,6 @@ #!/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 ]] || { @@ -20,31 +19,14 @@ version="$1" 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" + # only publish scaladoc nightly for trunk + [[ $version == "master" ]] && 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/get-scala-revision b/tools/get-scala-revision index b27b6ddc82..4d97ec58ad 100755 --- a/tools/get-scala-revision +++ b/tools/get-scala-revision @@ -2,23 +2,43 @@ # # Usage: get-scala-revision [dir] # Figures out current scala revision of a git clone. -# # If no dir is given, current working dir is used. +# +# Example build version string: +# v2.10.0-M1-0098-g6f1c486d0b-2012-02-01 +# + +[[ $# -eq 0 ]] || cd "$1" + +ensure_tag () { + sha=$1 + rev=$2 + + [[ -n $(git tag -l $rev) ]] || { + git tag -a -m "generated by get-scala-revision" $rev $sha + } +} + +# Ensure some baseline tags are present so if this repository's +# tags are screwed up or stale, we should still have a reference +# point for a build string. +ensure_tag 58cb15c40d v2.10.0-M1 +ensure_tag 29f3eace1e v2.9.1 +ensure_tag b0d78f6b9c v2.8.2 + +# the closest tag, obtained separately because we have to +# reconstruct the string around the padded distance. +tag=$(git describe --tags --match 'v2*' --abbrev=0) -# not like releases come out so often that we are duty-bound -# to recalculate this every time. -# git merge-base v2.8.2 v2.9.1 master -devbase="df13e31bbb" +# printf %016s is not portable for 0-padding, has to be a digit. +# so we're stuck disassembling it. +described=$(git describe --tags --match 'v2*' --abbrev=10) +suffix="${described##${tag}-}" +counter=$(echo $suffix | cut -d - -f 1) +hash=$(echo $suffix | cut -d - -f 2) -# reimplementing git describe hopefully in a way which works -# without any particular tags, branches, or recent versions of git. -# this is supposed to generate -# dev-NNNN-g<sha> -# where NNNN is the number of commits since devbase, which -# is the merge-base of the most recent release and master. -# Presently hardcoded to reduce uncertainty, v2.8.2/v2.9.1/master. -commits=$(git --no-pager log --pretty=oneline $devbase..HEAD | wc -l) -sha=$(git rev-list -n 1 HEAD) -datestr=$(date "+%Y-%m-%d") +# remove any alphabetic characters before the version number +tag=$(echo $tag | sed "s/\([a-z_A-Z]*\)\(.*\)/\2/") -printf "rdev-%s-%s-g%s\n" $commits $datestr ${sha:0:7} +# 2.10.0-M1-0098-g6f1c486d0b-2012-02-01 +printf "%s-%04d-%s-%s\n" "$tag" "$counter" "$hash" $(date "+%Y-%m-%d") diff --git a/tools/get-scala-revision.bat b/tools/get-scala-revision.bat index f4dc24b71f..48c7cbd94f 100644 --- a/tools/get-scala-revision.bat +++ b/tools/get-scala-revision.bat @@ -15,7 +15,7 @@ if "%*"=="" ( cd %_DIR% if exist .git\NUL ( - git describe HEAD --abbrev=7 --match dev + git describe --abbrev=10 --always --tags ) :end diff --git a/tools/locker_scala b/tools/locker_scala index 4434c94bf3..02d2efcdd8 100755 --- a/tools/locker_scala +++ b/tools/locker_scala @@ -1,8 +1,6 @@ -#!/bin/bash +#!/bin/sh # -THISDIR=`dirname $0` -CP=`$THISDIR/lockercp` -CLASS="scala.tools.nsc.MainGenericRunner" +CP=$($(dirname $BASH_SOURCE)/lockercp) -java -classpath "$CP" $CLASS -usejavacp "$@" +java $JAVA_OPTS -classpath "$CP" scala.tools.nsc.MainGenericRunner -usejavacp "$@" diff --git a/tools/locker_scalac b/tools/locker_scalac index 2ad153e929..c4b28b7bc0 100755 --- a/tools/locker_scalac +++ b/tools/locker_scalac @@ -1,8 +1,6 @@ -#!/bin/bash +#!/bin/sh # -THISDIR=`dirname $0` -CP=`$THISDIR/lockercp` -CLASS="scala.tools.nsc.Main" +CP=$($(dirname $BASH_SOURCE)/lockercp) -java -classpath "$CP" $CLASS -usejavacp "$@" +java $JAVA_OPTS -classpath "$CP" scala.tools.nsc.Main -usejavacp "$@" diff --git a/tools/quick_scala b/tools/quick_scala new file mode 100755 index 0000000000..16938ddba4 --- /dev/null +++ b/tools/quick_scala @@ -0,0 +1,6 @@ +#!/bin/sh +# + +CP=$($(dirname $BASH_SOURCE)/quickcp) + +java $JAVA_OPTS -classpath "$CP" scala.tools.nsc.MainGenericRunner -usejavacp "$@" diff --git a/tools/quick_scalac b/tools/quick_scalac new file mode 100755 index 0000000000..1b9a036c18 --- /dev/null +++ b/tools/quick_scalac @@ -0,0 +1,6 @@ +#!/bin/sh +# + +CP=$($(dirname $BASH_SOURCE)/quickcp) + +java $JAVA_OPTS -classpath "$CP" scala.tools.nsc.Main -usejavacp "$@" diff --git a/tools/starr_scala b/tools/starr_scala new file mode 100755 index 0000000000..9b0fb60cf7 --- /dev/null +++ b/tools/starr_scala @@ -0,0 +1,6 @@ +#!/bin/sh +# + +CP=$($(dirname $BASH_SOURCE)/starrcp) + +java $JAVA_OPTS -classpath "$CP" scala.tools.nsc.MainGenericRunner -usejavacp "$@" diff --git a/tools/starr_scalac b/tools/starr_scalac new file mode 100755 index 0000000000..972eeaff2b --- /dev/null +++ b/tools/starr_scalac @@ -0,0 +1,6 @@ +#!/bin/sh +# + +CP=$($(dirname $BASH_SOURCE)/starrcp) + +java $JAVA_OPTS -classpath "$CP" scala.tools.nsc.Main -usejavacp "$@" |