Last active
March 30, 2017 07:58
-
-
Save paulp/7e65b83691e917d823b023185f226a9c to your computer and use it in GitHub Desktop.
sbt from zero to shell in 39s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash -x | |
# | |
# Invoke sbt starting with no local jars, using coursier. | |
shopt -s globstar | |
set -euo pipefail | |
cpof() { | |
find "$@" -iname '*.jar' -o -iname '*.zip' | paste -sd: - | |
} | |
mmkdir() { | |
[[ -d "$1" ]] || mkdir -p "$1" | |
} | |
SBTVERSION="0.13.13" | |
SCALAVERSION="2.10.6" | |
CACHE="./.coursier" | |
BOOT="./.boot" | |
SBTJAR="./sbt" | |
SCALALIB="$BOOT/scala-$SCALAVERSION/lib" | |
COURSIER_CACHE=$CACHE coursier fetch -r typesafe:ivy-releases -r sonatype:releases org.scala-sbt:sbt:$SBTVERSION | |
mmkdir $SBTJAR | |
cp $CACHE/**/interface*.jar "interface-$SBTVERSION.jar" | |
cp $CACHE/**/compiler-interface*.jar "compiler-interface-$SBTVERSION-sources.jar" | |
mmkdir $SCALALIB | |
cp $CACHE/**/scala-lang/scala-*/**/scala-compiler-*.jar $SCALALIB/scala-compiler.jar | |
cp $CACHE/**/scala-lang/scala-*/**/scala-reflect-*.jar $SCALALIB/scala-reflect.jar | |
cp $CACHE/**/scala-lang/scala-*/**/scala-library-*.jar $SCALALIB/scala-library.jar | |
cp $CACHE/**/jansi-*.jar $SCALALIB/jansi.jar | |
cp $CACHE/**/jline-*.jar $SCALALIB/jline.jar | |
java -Dsbt.boot.directory="$BOOT" -Dsbt.global.base="$CACHE" -cp $(cpof .coursier):$SCALALIB:. sbt.Main "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% time echo about | ./bin/make-sbt.sh | |
Downloading https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.13/sbt-0.13.13.pom.sha1 | |
Downloading https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.13/sbt-0.13.13.pom | |
... | |
> about | |
[info] This is sbt 0.13.13 | |
[info] The current project is {file:/r/ivy-vs-coursier/}ivy-vs-coursier 0.1-SNAPSHOT | |
[info] The current project is built against Scala 2.10.6 | |
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, | |
sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.Giter8TemplatePlugin | |
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.6 | |
> 39.095 real, 17.280 user, 2.029 sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% time echo about | sbtx -no-share | |
Getting org.scala-sbt sbt 0.13.13 ... | |
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.13/jars/sbt.jar ... | |
[SUCCESSFUL ] org.scala-sbt#sbt;0.13.13!sbt.jar (2215ms) | |
... | |
> about | |
[info] This is sbt 0.13.13 | |
[info] The current project is {file:/private/tmp/sbtbare/}sbtbare 0.1-SNAPSHOT | |
[info] The current project is built against Scala 2.10.6 | |
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, | |
sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.Giter8TemplatePlugin | |
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.6 | |
> 204.582 real, 24.446 user, 2.159 sys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment