mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
server: drop dependency on ghc-heap-view again for profiling builds (close #2554)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2557 GitOrigin-RevId: e392651861140bfefc65ce387d5cfbd6d3211f66
This commit is contained in:
parent
cfc4481bc2
commit
3c3c048bb9
server
@ -292,6 +292,15 @@ This naming convention enables easier test filtering with [pytest command line f
|
||||
|
||||
The backend-specific and common test suites are disjoint; for example, run `pytest --integration -k "Common or MySQL" --backend mysql` to run all MySQL tests.
|
||||
|
||||
#### Building with profiling
|
||||
|
||||
To build with profiling support, you need to both enable profiling via `cabal`
|
||||
and set the `profiling` flag. E.g.
|
||||
|
||||
```
|
||||
cabal build exe:graphql-engine -f profiling --enable-profiling
|
||||
```
|
||||
|
||||
### Create Pull Request
|
||||
|
||||
- Make sure your commit messages meet the [guidelines](../CONTRIBUTING.md).
|
||||
|
@ -118,7 +118,6 @@ library
|
||||
, either
|
||||
, exceptions
|
||||
, fast-logger
|
||||
, ghc-heap-view
|
||||
, hashable
|
||||
, hashable-time
|
||||
, http-client-tls
|
||||
@ -290,6 +289,10 @@ library
|
||||
, mysql
|
||||
, mysql-simple
|
||||
|
||||
if !flag(profiling)
|
||||
-- ghc-heap-view can't be built with profiling
|
||||
build-depends: ghc-heap-view
|
||||
|
||||
exposed-modules: Control.Arrow.Extended
|
||||
, Control.Arrow.Trans
|
||||
, Control.Concurrent.Extended
|
||||
|
@ -3,6 +3,29 @@
|
||||
-- | GHC.AssertNF.CPP localizes our use of CPP around calls
|
||||
-- to 'assertNFHere', primarily to give tooling (e.g. ormolu)
|
||||
-- an easier time.
|
||||
--
|
||||
-- We disable the 'assertNF'-related code because it is provided
|
||||
-- by the package ghc-heap-view, which can't be built using profiling.
|
||||
|
||||
#ifdef PROFILING
|
||||
|
||||
module GHC.AssertNF.CPP
|
||||
( assertNFHere,
|
||||
disableAssertNF,
|
||||
)
|
||||
where
|
||||
|
||||
import Hasura.Prelude
|
||||
import Language.Haskell.TH
|
||||
|
||||
assertNFHere :: Q Exp
|
||||
assertNFHere = [| const (return ()) |]
|
||||
|
||||
disableAssertNF :: IO ()
|
||||
disableAssertNF = return ()
|
||||
|
||||
#else
|
||||
|
||||
module GHC.AssertNF.CPP
|
||||
( assertNFHere,
|
||||
disableAssertNF,
|
||||
@ -13,14 +36,9 @@ where
|
||||
import GHC.AssertNF qualified
|
||||
import Hasura.Prelude
|
||||
import Language.Haskell.TH
|
||||
#ifndef PROFILING
|
||||
import Text.Printf (printf)
|
||||
#endif
|
||||
|
||||
assertNFHere :: Q Exp
|
||||
#ifdef PROFILING
|
||||
assertNFHere = [| const (return ()) |]
|
||||
#else
|
||||
-- This is a copy of 'GHC.AssertNF.assertNFHere'. We can't easily
|
||||
-- use the original because that relies on an import of "GHC.AssertNF".
|
||||
-- Instead, we rewrite it to use the re-exported 'assertNFNamed'.
|
||||
@ -32,11 +50,8 @@ assertNFHere = do
|
||||
formatLoc loc = let file = loc_filename loc
|
||||
(line, col) = loc_start loc
|
||||
in printf "parameter at %s:%d:%d" file line col
|
||||
#endif
|
||||
|
||||
disableAssertNF :: IO ()
|
||||
#ifdef PROFILING
|
||||
disableAssertNF = return ()
|
||||
#else
|
||||
disableAssertNF = GHC.AssertNF.disableAssertNF
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user