diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala index 753192abae..2c66c95d93 100644 --- a/project/AkkaBuild.scala +++ b/project/AkkaBuild.scala @@ -701,10 +701,22 @@ object AkkaBuild extends Build { (if (useOnlyTestTags.isEmpty) Seq.empty else Seq("-n", if (multiNodeEnabled) useOnlyTestTags.mkString("\"", " ", "\"") else useOnlyTestTags.mkString(" "))) } + val (mavenLocalResolver, mavenLocalResolverSettings) = + System.getProperty("akka.build.M2Dir") match { + case null => (Resolver.mavenLocal, Seq.empty) + case path => + // Maven resolver settings + val resolver = Resolver.file("user-publish-m2-local", new File(path)) + (resolver, Seq( + otherResolvers := resolver:: publishTo.value.toList, + publishM2Configuration := Classpaths.publishConfig(packagedArtifacts.value, None, resolverName = resolver.name, checksums = checksums.in(publishM2).value, logging = ivyLoggingLevel.value) + )) + } + lazy val resolverSettings = { // should we be allowed to use artifacts published to the local maven repository if(System.getProperty("akka.build.useLocalMavenResolver", "false").toBoolean) - Seq(resolvers += Resolver.mavenLocal) + Seq(resolvers += mavenLocalResolver) else Seq.empty } ++ { // should we be allowed to use artifacts from sonatype snapshots @@ -773,16 +785,7 @@ object AkkaBuild extends Build { // don't save test output to a file testListeners in (Test, test) := Seq(TestLogger(streams.value.log, {_ => streams.value.log }, logBuffered.value)) - ) ++ (System.getProperty("akka.build.M2Dir") match { - case null => Seq.empty - case path => - // Maven resolver settings - Seq( - otherResolvers := - Resolver.file("user-publish-m2-local", new File(path)) :: publishTo.value.toList, - publishM2Configuration := Classpaths.publishConfig(packagedArtifacts.value, None, resolverName = "user-publish-m2-local", checksums = checksums.in(publishM2).value, logging = ivyLoggingLevel.value) - ) - }) + ) ++ mavenLocalResolverSettings val validatePullRequest = TaskKey[Unit]("validate-pull-request", "Additional tasks for pull request validation") diff --git a/scripts/build/extra-build-steps.sh b/scripts/build/extra-build-steps.sh new file mode 100755 index 0000000000..161c7fab58 --- /dev/null +++ b/scripts/build/extra-build-steps.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +# defaults +declare -r default_java_home="/usr/local/share/java/jdk6" +declare -r default_java8_home="/usr/local/share/java/jdk8" + +# get the source location for this script; handles symlinks +function get_script_path { + local source="${BASH_SOURCE[0]}" + while [ -h "${source}" ] ; do + source="$(readlink "${source}")"; + done + echo ${source} +} + +# path, name, and dir for this script +declare -r script_path=$(get_script_path) +declare -r script_name=$(basename "${script_path}") +declare -r script_dir="$(cd -P "$(dirname "${script_path}")" && pwd)" + +# print usage info +function usage { + cat <&2 +} + +# fail the script with an error message +function fail { + echoerr "$@" + exit 1 +} + +# try to run a command or otherwise fail with a message +function try { + "${@:1:$#-1}" || fail "${@:$#}" +} + +# try to run a command or otherwise fail +function check { + type -P "$@" &> /dev/null || fail "command not found: $@" +} + +# initialize variables with defaults and override from environment +declare java_home="$default_java_home" +if [ $AKKA_BUILD_JAVA_HOME ]; then + java_home="$AKKA_BUILD_JAVA_HOME" +fi + +declare java8_home="$default_java8_home" +if [ $AKKA_BUILD_JAVA8_HOME ]; then + java8_home="$AKKA_BUILD_JAVA8_HOME" +fi + +# process options and set flags +while true; do + case "$1" in + -h | --help ) usage; exit 1 ;; + --java_home ) java_home=$2; shift 2 ;; + --java8_home ) java8_home=$2; shift 2 ;; + * ) break ;; + esac +done + +declare -r java_path="$java_home/bin/java" +declare -r java8_path="$java8_home/bin/java" + +# check that java paths work +check "$java_path" +check "$java8_path" + +# check for a mvn command +check mvn + +# now do some work +tmp="$script_dir/../../akka-samples/akka-sample-java8" +try cd "$tmp" "can't step into project directory: $tmp" +export JAVA_HOME="$java8_home" +try mvn clean test "mvn execution in akka-sample-java8 failed"