cabal/README.md
At the top level we have a cabal.project file that defines project
configuration settings that stay the same, regardless of whether we're doing
local development, building on CI, etc.
Additionally in this directory we have various cabal.project.local files that
add or override settings depending on context:
ci-*.project.local - these are used when building in CI (see .buildkite/)dev-sh.project.local - this is used to configure the environment we expect in
scripts/dev.sh, and is where we put good local development defaultsdev-sh-optimized.project.local - above, but building with optimizations,
suitable for prod-like performance testingdev-sh-prof-*.project.local - Various profiling modes (see below)Because we can only gives us --project-file to select configuration, we need
each of these local overrides to have a symlink back to the top-level
cabal.project. So e.g. if you wanted to build with CI settings locally you
would do:
$ cabal build --project-file=cabal/ci.project exe:graphql-engine
Likewise for the freeze file symlinks.
In cabal-install 3.8 we can have imports, which we also use.
Here's a helper for making new configurations:
function hasura_new_sub_config () {
cd "$(git rev-parse --show-toplevel)/cabal"
ln -s ../cabal.project.freeze "$1.project.freeze"
ln -s ../cabal.project "$1.project"
touch "$1.project.local"
echo "continue editing: $1.project.local"
cd - &>/dev/null
}
See the graphql-engine --prof-* flags in dev.sh for the happy path to use these modes.
+RTS -hi(info map) Heap ProfilesEvery distinct constructure allocation site is instrumented with source code information
See: dev-sh-prof-heap-infomap.project.local
A set of client and server libraries for snapshotting and arbitrarily analyzing the Haskell heap
Generates a report for all allocations even those that are very short-lived; quasi- time profiling
See: dev-sh-prof-ticky.project.local
-fprof-late time profilingNOT YET IMPLEMENTED
Time profiling that instruments code after all significant optimizations have been performed, so it doesn't distort the profile (on 9.4+ only, but plug-in available)
See: dev-sh-prof-time.project.local