Skip to content

Commit 22a6ea9

Browse files
authored
Create PowerShell Script for Windows users
1 parent 50f5772 commit 22a6ea9

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

jupyter-scala.ps1

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
$VERSION="0.4.2"
2+
$AMMONIUM_VERSION="0.8.3-1"
3+
$SCALA_VERSION="2.11.11" # Set to 2.12.2 for Scala 2.12
4+
5+
$TYPELEVEL_SCALA=$false # If true, set SCALA_VERSION above to a both ammonium + TLS available version (e.g. 2.11.8)
6+
7+
$EXTRA_OPTS=@()
8+
9+
function Make-Temp
10+
{
11+
$find_temp=$false
12+
$random=Get-Random
13+
$result="$env:TEMP\$random"
14+
while(!($find_temp)) {
15+
$result="$env:TEMP\$random"
16+
if(Test-Path $result) {
17+
$random=Get-Random
18+
} else {
19+
$find_temp=$true
20+
}
21+
}
22+
$result
23+
}
24+
25+
$COURSIER_JAR=Make-Temp
26+
27+
echo "Getting coursier launcher..."
28+
(New-Object Net.WebClient).DownloadFile('https://git.io/vgvpD', $COURSIER_JAR)
29+
echo "Done"
30+
31+
if($TYPELEVEL_SCALA) {
32+
$EXTRA_OPTS += @(
33+
"-E", "org.scala-lang:scala-compiler",
34+
"-E", "org.scala-lang:scala-library",
35+
"-E", "org.scala-lang:scala-reflect",
36+
"-I", "ammonite:org.typelevel:scala-compiler:$SCALA_VERSION",
37+
"-I", "ammonite:org.typelevel:scala-library:$SCALA_VERSION",
38+
"-I", "ammonite:org.typelevel:scala-reflect:$SCALA_VERSION"
39+
)
40+
}
41+
42+
& "java" -noverify -jar $COURSIER_JAR launch `
43+
-r sonatype:releases -r sonatype:snapshots `
44+
-i ammonite `
45+
-I "ammonite:org.jupyter-scala:ammonite-runtime_$SCALA_VERSION`:$AMMONIUM_VERSION" `
46+
-I "ammonite:org.jupyter-scala:scala-api_$SCALA_VERSION`:$VERSION" `
47+
$EXTRA_OPTS `
48+
"org.jupyter-scala:scala-cli_$SCALA_VERSION`:$VERSION" `
49+
-- `
50+
--id scala `
51+
--name "Scala" `
52+
$args
53+
54+
rm $COURSIER_JAR

0 commit comments

Comments
 (0)