From c732f3e9859a328953bfffb4946cfb3c9029b683 Mon Sep 17 00:00:00 2001 From: mpociecha Date: Tue, 11 Nov 2014 10:41:00 +0100 Subject: Let users specify a different location for build repos than user home This change is helpful e.g. when setting up CI for Scala and it's important which directories are used by a build. By default it uses .m2, .pax and .sbt/cache from user home (in general $HOME). Sometimes it's not possible to use this location and also changing a value of $HOME is not an option. The required location should be specified both for ant's build.xml and used scripts. In the first case specifying -Duser.home is all, what we need. But we can't just set _JAVA_OPTIONS as then partest tests fail due to the unexpected output (an additional 'Picked up java options (...)' messages). We can set ANT_OPTS instead of this. The only problem was that OSGi JUnit tests (only they) were using $HOME anyway. I forced them to use -Duser.home by propagating this option in build.xml. binary-repo-lib.sh is changed to use a special env variable or $HOME, when this variable is not set. Then we can do: export SCALA_BUILD_REPOS_HOME= export ANT_OPTS="$ANT_OPTS -Duser.home=$SCALA_BUILD_REPOS_HOME" ant dist and it will create all directories .m2, .pax and .sbt/cache in a specified $SCALA_BUILD_REPOS_HOME directory. Note: maven's settings.xml should be located in this used $SCALA_BUILD_REPOS_HOME/.m2 and point to the repository like /.m2/repository --- tools/binary-repo-lib.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/binary-repo-lib.sh b/tools/binary-repo-lib.sh index 654ba21547..437c0a0c08 100755 --- a/tools/binary-repo-lib.sh +++ b/tools/binary-repo-lib.sh @@ -2,15 +2,16 @@ # # Library to push and pull binary artifacts from a remote repository using CURL. - remote_urlget="http://repo.typesafe.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap" remote_urlpush="http://private-repo.typesafe.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. -cache_dir="${HOME}/.sbt/cache/scala" +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() { -- cgit v1.2.3