Skip to content

Commit

Permalink
Update load-plugin
Browse files Browse the repository at this point in the history
Use `if-absent` so that we don't load the plugins and apply
transformations to the build if this is not necessary.
  • Loading branch information
Duhemm committed Apr 12, 2018
1 parent 920fb74 commit 6fd30e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vscode-dotty/package.json
Expand Up @@ -51,7 +51,7 @@
"vscode:prepublish": "npm install && ./node_modules/.bin/tsc -p ./",
"compile": "./node_modules/.bin/tsc -p ./",
"test": "node ./node_modules/vscode/bin/test",
"postinstall": "node ./node_modules/vscode/bin/install && curl -L -o out/coursier https://github.com/coursier/coursier/raw/v1.0.0/coursier && curl -L -o out/load-plugin.jar https://github.com/scalacenter/load-plugin/releases/download/v0.1.0/load-plugin_2.12-0.1.0.jar"
"postinstall": "node ./node_modules/vscode/bin/install && curl -L -o out/coursier https://github.com/coursier/coursier/raw/v1.0.0/coursier && curl -L -o out/load-plugin.jar https://oss.sonatype.org/content/repositories/releases/ch/epfl/scala/load-plugin_2.12/0.1.0+2-496ac670/load-plugin_2.12-0.1.0+2-496ac670.jar"
},
"extensionDependencies": [
"daltonjorge.scala"
Expand Down
14 changes: 10 additions & 4 deletions vscode-dotty/src/extension.ts
Expand Up @@ -94,15 +94,21 @@ function configureIDE() {
title: 'Configuring IDE...'
}, (progress) => {

const applyLoadPlugin = "apply -cp " + loadPluginPath + " ch.epfl.scala.loadplugin.LoadPlugin"
const ifAbsentCommands = [
"if-absent dotty.tools.sbtplugin.DottyPlugin",
"\"set every scalaVersion := \\\"0.8.0-bin-SNAPSHOT\\\"\"",
"\"load-plugin ch.epfl.lamp:sbt-dotty:0.2.0-SNAPSHOT dotty.tools.sbtplugin.DottyPlugin\"",
"\"load-plugin ch.epfl.lamp:sbt-dotty:0.2.0-SNAPSHOT dotty.tools.sbtplugin.DottyIDEPlugin\""
].join(" ")

const sbtPromise =
cpp.spawn("java", [
"-jar", coursierPath,
"launch",
"org.scala-sbt:sbt-launch:1.1.2", "--",
"apply -cp " + loadPluginPath + " ch.epfl.scala.loadplugin.LoadPlugin",
"set every scalaVersion := \"0.8.0-bin-SNAPSHOT\"",
"load-plugin ch.epfl.lamp:sbt-dotty:0.2.0-SNAPSHOT dotty.tools.sbtplugin.DottyPlugin",
"load-plugin ch.epfl.lamp:sbt-dotty:0.2.0-SNAPSHOT dotty.tools.sbtplugin.DottyIDEPlugin",
applyLoadPlugin,
ifAbsentCommands,
"configureIDE"
])
const sbtProc = sbtPromise.childProcess
Expand Down

0 comments on commit 6fd30e8

Please sign in to comment.