@@ -930,22 +930,10 @@ object Build {
930
930
compile in Compile := {
931
931
val coursier = baseDirectory.value / " out/coursier"
932
932
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)
942
935
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 )
949
937
950
938
// Currently, vscode-dotty depends on daltonjorge.scala for syntax highlighting,
951
939
// this is not automatically installed when starting the extension in development mode
@@ -955,33 +943,15 @@ object Build {
955
943
sbt.inc.Analysis .Empty
956
944
},
957
945
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)
965
947
966
948
baseDirectory.value / s " dotty- ${version.value}.vsix "
967
949
},
968
950
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)
976
952
},
977
953
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)
985
955
},
986
956
run := Def .inputTask {
987
957
val inputArgs = spaceDelimited(" <arg>" ).parsed
0 commit comments