Skip to content

Commit

Permalink
feat: Uncomment rustBuildHook in Setup.lhs for autobuilding
Browse files Browse the repository at this point in the history
  • Loading branch information
wwared committed Sep 11, 2024
1 parent ed6f130 commit 729fed5
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions Setup.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ should be removed before `cargo-cabal` stable release.
> defaultMainWithHooks
> simpleUserHooks
> { confHook = rustConfHook
> -- , buildHook = rustBuildHook
> , buildHook = rustBuildHook
> }

This hook could be remove if at some point, likely if this issue is resolved
Expand Down Expand Up @@ -59,21 +59,21 @@ https://github.com/haskell/cabal/issues/2641
It would be nice to remove this hook ot some point, e.g., if this RFC is merged
in Cabal https://github.com/haskell/cabal/issues/7906

% rustBuildHook ::
% PD.PackageDescription ->
% LocalBuildInfo ->
% UserHooks ->
% BuildFlags ->
% IO ()
% rustBuildHook description localBuildInfo hooks flags = do
% putStrLn "******************************************************************"
% putStrLn "Call `cargo build --release` to build a dependency written in Rust"
% -- FIXME: add `--target $TARGET` flag to support cross-compiling to $TARGET
% rawSystemExit (fromFlag $ buildVerbosity flags) "cargo" ["build","--release"]
% putStrLn "... `rustc` compilation seems to succeed 🦀! Back to Cabal build:"
% putStrLn "******************************************************************"
% putStrLn "Back to Cabal build"
% buildHook simpleUserHooks description localBuildInfo hooks flags
> rustBuildHook ::
> PD.PackageDescription ->
> LocalBuildInfo ->
> UserHooks ->
> BuildFlags ->
> IO ()
> rustBuildHook description localBuildInfo hooks flags = do
> putStrLn "******************************************************************"
> putStrLn "Call `cargo build --release` to build a dependency written in Rust"
> -- FIXME: add `--target $TARGET` flag to support cross-compiling to $TARGET
> rawSystemExit (fromFlag $ buildVerbosity flags) "cargo" ["build","--release"]
> putStrLn "... `rustc` compilation seems to succeed 🦀! Back to Cabal build:"
> putStrLn "******************************************************************"
> putStrLn "Back to Cabal build"
> buildHook simpleUserHooks description localBuildInfo hooks flags

This handy automation (particularly useful when you want to quickly prototype
without having to spawn manually `cargo` commands) is disabled by default.
Expand Down

0 comments on commit 729fed5

Please sign in to comment.