@@ -930,22 +930,10 @@ object Build {
930930 compile in Compile := {
931931 val coursier = baseDirectory.value / " out/coursier"
932932 val packageJson = baseDirectory.value / " package.json"
933- if (! coursier.exists || packageJson.lastModified > coursier.lastModified) {
934- val exitCode = new java.lang.ProcessBuilder (" npm" , " run" , " update-all" )
935- .directory(baseDirectory.value)
936- .inheritIO()
937- .start()
938- .waitFor()
939- if (exitCode != 0 )
940- throw new MessageOnlyException (" 'npm run update-all' in vscode-dotty failed" )
941- }
933+ if (! coursier.exists || packageJson.lastModified > coursier.lastModified)
934+ runProcess(Seq (" npm" , " run" , " update-all" ), wait = true , directory = baseDirectory.value)
942935 val tsc = baseDirectory.value / " node_modules" / " .bin" / " tsc"
943- val exitCodeTsc = new java.lang.ProcessBuilder (tsc.getAbsolutePath, " --pretty" , " --project" , baseDirectory.value.getAbsolutePath)
944- .inheritIO()
945- .start()
946- .waitFor()
947- if (exitCodeTsc != 0 )
948- throw new MessageOnlyException (" tsc in vscode-dotty failed" )
936+ runProcess(Seq (tsc.getAbsolutePath, " --pretty" , " --project" , baseDirectory.value.getAbsolutePath), wait = true )
949937
950938 // Currently, vscode-dotty depends on daltonjorge.scala for syntax highlighting,
951939 // this is not automatically installed when starting the extension in development mode
@@ -955,33 +943,15 @@ object Build {
955943 sbt.inc.Analysis .Empty
956944 },
957945 sbt.Keys .`package`:= {
958- val exitCode = new java.lang.ProcessBuilder (" vsce" , " package" )
959- .directory(baseDirectory.value)
960- .inheritIO()
961- .start()
962- .waitFor()
963- if (exitCode != 0 )
964- throw new MessageOnlyException (" vsce package failed" )
946+ runProcess(Seq (" vsce" , " package" ), wait = true , directory = baseDirectory.value)
965947
966948 baseDirectory.value / s " dotty- ${version.value}.vsix "
967949 },
968950 unpublish := {
969- val exitCode = new java.lang.ProcessBuilder (" vsce" , " unpublish" )
970- .directory(baseDirectory.value)
971- .inheritIO()
972- .start()
973- .waitFor()
974- if (exitCode != 0 )
975- throw new MessageOnlyException (" vsce unpublish failed" )
951+ runProcess(Seq (" vsce" , " unpublish" ), wait = true , directory = baseDirectory.value)
976952 },
977953 publish := {
978- val exitCode = new java.lang.ProcessBuilder (" vsce" , " publish" )
979- .directory(baseDirectory.value)
980- .inheritIO()
981- .start()
982- .waitFor()
983- if (exitCode != 0 )
984- throw new MessageOnlyException (" vsce publish failed" )
954+ runProcess(Seq (" vsce" , " publish" ), wait = true , directory = baseDirectory.value)
985955 },
986956 run := Def .inputTask {
987957 val inputArgs = spaceDelimited(" <arg>" ).parsed
0 commit comments