enso/project/LauncherShimsForTest.scala
Radosław Waśko a2a1aefc14
Check cargo return value to ensure issues are reported back to SBT (#5588)
Before, any failures of the Rust-side of the parser build would be swallowed by sbt, for example if I add gibberish to the Rust code I will get:
<img width="474" alt="image" src="https://user-images.githubusercontent.com/1436948/217374050-fd9ddaca-136c-459e-932e-c4b9e630d610.png">

This is problematic, because when users are compiling in SBT they may get confusing errors about Java files not being found whereas the true cause is hard to track down because it is somewhere deep in the logs. We've run into this silent failure when setting up SBT builds together with @GregoryTravis today.

I suggest to change it so that once cargo fails, the build is failed with a helpful message - this way it will be easier to track down the issues.

With these changes we get:
<img width="802" alt="image" src="https://user-images.githubusercontent.com/1436948/217374531-707ae348-4c55-4d62-9a86-93850ad8086b.png">
2023-02-08 10:46:40 +00:00

18 lines
375 B
Scala

import sbt.Keys._
import sbt._
object LauncherShimsForTest {
/** Creates a task that compiles the launcher shims which are used for some of
* the launcher tests.
*/
def prepare(): Def.Initialize[Task[Unit]] =
Def.task {
val log = state.value.log
Cargo.run(
Seq("build", "-p", "launcher-shims"),
log = log
)
}
}