mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-11 10:46:25 +03:00
server: Clean up Cabal project files
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4105 GitOrigin-RevId: 423eecf04061ca8d5ee036a84ee6792036a149e4
This commit is contained in:
parent
250bf6a691
commit
6720aef26f
@ -14,7 +14,9 @@ SERVER_DIR="$ROOT/../../server"
|
||||
|
||||
cd $SERVER_DIR
|
||||
set -x
|
||||
cabal new-build --project-file=cabal.project.dev-sh exe:graphql-engine
|
||||
cabal new-build \
|
||||
--project-file=cabal/dev-sh.project \
|
||||
exe:graphql-engine
|
||||
export SERVER_BINARY="$(cabal new-exec --verbose=0 which graphql-engine)"
|
||||
echo "server binary: $SERVER_BINARY"
|
||||
cd -
|
||||
|
@ -1,15 +1,17 @@
|
||||
-- Global project configuration.
|
||||
--
|
||||
-- This file can be overridden with cabal.project.local (see e.g. cabal.project.dev)
|
||||
-- This file can be overridden with cabal.project.local (see e.g. cabal/dev.project)
|
||||
--
|
||||
-- If you need to switch between several local configurations you can also create a
|
||||
-- symbolic link to this file in the project root directory; e.g.:
|
||||
-- $ ln -s cabal.project myconfig.project
|
||||
-- $ ln -s cabal.project.freeze myconfig.project.freeze
|
||||
--
|
||||
-- If you need to switch between several local configurations you can also
|
||||
-- create a symlink to this file with a different name, e.g.:
|
||||
-- $ ln -s cabal.project cabal.project.myconfig
|
||||
-- $ ln -s cabal.project.freeze cabal.project.myconfig.freeze
|
||||
-- ...and then create a new set of overrides in:
|
||||
-- cabal.project.myconfig.local
|
||||
-- myconfig.project.local
|
||||
--
|
||||
-- ...and then invoke cabal with
|
||||
-- $ cabal new-build --project-file=cabal.project.myconfig
|
||||
-- $ cabal new-build --project-file=myconfig.project
|
||||
--
|
||||
-- See: https://www.haskell.org/cabal/users-guide/nix-local-build.html#configuring-builds-with-cabal-project
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
cabal.project
|
@ -1 +0,0 @@
|
||||
cabal.project
|
@ -1 +0,0 @@
|
||||
cabal.project.freeze
|
@ -1 +0,0 @@
|
||||
cabal.project.freeze
|
@ -1 +0,0 @@
|
||||
cabal.project
|
@ -1 +0,0 @@
|
||||
cabal.project.freeze
|
1
cabal/ci-haddock.project
Symbolic link
1
cabal/ci-haddock.project
Symbolic link
@ -0,0 +1 @@
|
||||
../cabal.project
|
1
cabal/ci-haddock.project.freeze
Symbolic link
1
cabal/ci-haddock.project.freeze
Symbolic link
@ -0,0 +1 @@
|
||||
../cabal.project.freeze
|
@ -4,7 +4,7 @@
|
||||
-- Instead we make this a parallel job, but use a configuration with optimizations
|
||||
-- off so the haskell build will be relatively fast.
|
||||
|
||||
-- NOTE!: we want to make sure this matches cabal.project.ci.local, so we can re-use the
|
||||
-- NOTE!: we want to make sure this matches `ci.project.local`, so we can re-use the
|
||||
-- cached library dependencies and don't accidentally rebuild:
|
||||
package *
|
||||
ghc-options:
|
1
cabal/ci.project
Symbolic link
1
cabal/ci.project
Symbolic link
@ -0,0 +1 @@
|
||||
../cabal.project
|
1
cabal/ci.project.freeze
Symbolic link
1
cabal/ci.project.freeze
Symbolic link
@ -0,0 +1 @@
|
||||
../cabal.project.freeze
|
1
cabal/dev-sh.project
Symbolic link
1
cabal/dev-sh.project
Symbolic link
@ -0,0 +1 @@
|
||||
../cabal.project
|
1
cabal/dev-sh.project.freeze
Symbolic link
1
cabal/dev-sh.project.freeze
Symbolic link
@ -0,0 +1 @@
|
||||
../cabal.project.freeze
|
@ -1,5 +1,5 @@
|
||||
-- This is the local cabal configuration file used by the 'scripts/dev.sh'
|
||||
-- development script, which uses `... --project-file=cabal.project.dev-sh`
|
||||
-- This is the local cabal configuration file used by the `scripts/dev.sh`
|
||||
-- development script, which uses `... --project-file=cabal/dev-sh.project`
|
||||
-- which in turn consults this file.
|
||||
--
|
||||
-- You can temporarily override values here rather than modifying 'dev.sh'
|
@ -1,10 +1,11 @@
|
||||
-- A project configuration for general-purpose development: this builds documentation for
|
||||
-- dependencies and disables optimizations for graphql-engine to improve compilation times.
|
||||
--
|
||||
-- To enable this, you can do:
|
||||
-- $ ln -s cabal.project.dev cabal.project.local
|
||||
-- Or, if you want to customize the configuration:
|
||||
-- $ cp cabal.project.dev cabal.project.local
|
||||
-- From the project root, this configuration can be linked directly:
|
||||
-- $ ln -s cabal/dev.project cabal.project.local
|
||||
--
|
||||
-- ...or, it can be copied if you would like to customize any settings:
|
||||
-- $ cp cabal/cabal.project.dev cabal.project.local
|
||||
|
||||
with-compiler: ghc-8.10.7
|
||||
|
@ -10,8 +10,8 @@ shopt -s globstar
|
||||
# document describing how to do various dev tasks (or worse yet, not writing
|
||||
# one), make it runnable
|
||||
#
|
||||
# This makes use of 'cabal.project.dev-sh*' files when building. See
|
||||
# 'cabal.project.dev-sh.local'.
|
||||
# This makes use of 'cabal/dev-sh.project' files when building.
|
||||
# See 'cabal/dev-sh.project.local' for details.
|
||||
#
|
||||
# The configuration for the containers of each backend is stored in
|
||||
# separate files, see files in 'scripts/containers'
|
||||
@ -279,8 +279,10 @@ if [ "$MODE" = "graphql-engine" ]; then
|
||||
echo
|
||||
# Generate coverage, which can be useful for debugging or understanding
|
||||
if command -v hpc >/dev/null && command -v jq >/dev/null ; then
|
||||
# Get the appropriate mix dir (the newest one). This way this hopefully
|
||||
# works when cabal.project.dev-sh.local is edited to turn on optimizations.
|
||||
# Get the appropriate mix dir (the newest one); this way this hopefully
|
||||
# works when 'cabal/dev-sh.project.local' is edited to turn on
|
||||
# optimizations.
|
||||
#
|
||||
# See also: https://hackage.haskell.org/package/cabal-plan
|
||||
distdir=$(cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[] | select(."id" == "graphql-engine-1.0.0-inplace")? | ."dist-dir"')
|
||||
hpcdir="$distdir/hpc/dyn/mix/graphql-engine-1.0.0"
|
||||
@ -321,17 +323,17 @@ if [ "$MODE" = "graphql-engine" ]; then
|
||||
echo_pretty " $ $0 postgres"
|
||||
echo_pretty ""
|
||||
|
||||
RUN_INVOCATION=(cabal new-run --project-file=cabal.project.dev-sh --RTS --
|
||||
RUN_INVOCATION=(cabal new-run --project-file=cabal/dev-sh.project --RTS --
|
||||
exe:graphql-engine +RTS -N -T -s -RTS serve
|
||||
--enable-console --console-assets-dir "$PROJECT_ROOT/console/static/dist"
|
||||
)
|
||||
|
||||
echo_pretty 'About to do:'
|
||||
echo_pretty ' $ cabal new-build --project-file=cabal.project.dev-sh exe:graphql-engine'
|
||||
echo_pretty ' $ cabal new-build --project-file=cabal/dev-sh.project exe:graphql-engine'
|
||||
echo_pretty " $ ${RUN_INVOCATION[*]}"
|
||||
echo_pretty ''
|
||||
|
||||
cabal new-build --project-file=cabal.project.dev-sh exe:graphql-engine
|
||||
cabal new-build --project-file=cabal/dev-sh.project exe:graphql-engine
|
||||
|
||||
# We assume a PG is *already running*, and therefore bypass the
|
||||
# cleanup mechanism previously set.
|
||||
@ -477,8 +479,11 @@ elif [ "$MODE" = "test" ]; then
|
||||
# Formerly this was a `cabal build` but mixing cabal build and cabal run
|
||||
# seems to conflict now, causing re-linking, haddock runs, etc. Instead do a
|
||||
# `graphql-engine version` to trigger build
|
||||
cabal new-run --project-file=cabal.project.dev-sh -- exe:graphql-engine \
|
||||
--metadata-database-url="$PG_DB_URL" version
|
||||
cabal run \
|
||||
--project-file=cabal/dev-sh.project \
|
||||
-- exe:graphql-engine \
|
||||
--metadata-database-url="$PG_DB_URL" \
|
||||
version
|
||||
start_dbs
|
||||
fi
|
||||
|
||||
@ -492,7 +497,10 @@ elif [ "$MODE" = "test" ]; then
|
||||
echo "${UNIT_TEST_ARGS[@]}"
|
||||
HASURA_GRAPHQL_DATABASE_URL="$PG_DB_URL" \
|
||||
HASURA_MSSQL_CONN_STR="$MSSQL_CONN_STR" \
|
||||
cabal new-run --project-file=cabal.project.dev-sh test:graphql-engine-tests -- "${UNIT_TEST_ARGS[@]}"
|
||||
cabal run \
|
||||
--project-file=cabal/dev-sh.project \
|
||||
test:graphql-engine-tests \
|
||||
-- "${UNIT_TEST_ARGS[@]}"
|
||||
fi
|
||||
|
||||
if [ "$RUN_HLINT" = true ]; then
|
||||
@ -517,11 +525,13 @@ elif [ "$MODE" = "test" ]; then
|
||||
|
||||
# Using --metadata-database-url flag to test multiple backends
|
||||
# HASURA_GRAPHQL_PG_SOURCE_URL_* For a couple multi-source pytests:
|
||||
cabal new-run --project-file=cabal.project.dev-sh -- exe:graphql-engine \
|
||||
--metadata-database-url="$PG_DB_URL" serve \
|
||||
--stringify-numeric-types \
|
||||
--enable-console \
|
||||
--console-assets-dir ../console/static/dist \
|
||||
cabal new-run \
|
||||
--project-file=cabal/dev-sh.project \
|
||||
-- exe:graphql-engine \
|
||||
--metadata-database-url="$PG_DB_URL" serve \
|
||||
--stringify-numeric-types \
|
||||
--enable-console \
|
||||
--console-assets-dir ../console/static/dist \
|
||||
&> "$GRAPHQL_ENGINE_TEST_LOG" & GRAPHQL_ENGINE_PID=$!
|
||||
|
||||
echo -n "Waiting for graphql-engine"
|
||||
|
3
server/.gitignore
vendored
3
server/.gitignore
vendored
@ -20,7 +20,8 @@ Pipfile.lock
|
||||
cabal.sandbox.config
|
||||
cabal.config
|
||||
# Configurable for local dev/experimentation:
|
||||
cabal.project.local*
|
||||
cabal.project.local
|
||||
cabal/*.local
|
||||
*.prof*
|
||||
*.aux
|
||||
*.hp
|
||||
|
@ -51,7 +51,7 @@
|
||||
(cd tests-py/remote_schemas/nodejs && npm ci)
|
||||
```
|
||||
|
||||
5. Add the C dependencies in the `cabal.project.dev-sh.local` and `cabal.project.local` files (according to where the dependencies were installed by homebrew):
|
||||
5. Add the C dependencies in the `cabal/dev-sh.project.local` and `cabal.project.local` files (according to where the dependencies were installed by homebrew):
|
||||
|
||||
```sh
|
||||
package mysql
|
||||
@ -87,10 +87,10 @@
|
||||
/opt/homebrew/opt/openssl/lib
|
||||
```
|
||||
|
||||
Note: If you don't have special requirements of a `cabal.project.local` you can just add a symbolic link to `cabal.project.dev-sh.local`:
|
||||
Note: If you have not added any local project overrides in `cabal.project.local` you can just add a symbolic link to `cabal/dev-sh.project.local`:
|
||||
|
||||
```sh
|
||||
ln -s cabal.project.dev-sh.local cabal.project.local
|
||||
ln -s cabal/dev-sh.project.local cabal.project.local
|
||||
```
|
||||
|
||||
|
||||
|
@ -45,13 +45,13 @@ After making your changes
|
||||
|
||||
...and the server:
|
||||
|
||||
$ ln -s cabal.project.dev cabal.project.local
|
||||
$ ln -s cabal/dev.project cabal.project.local
|
||||
$ cabal new-update
|
||||
$ cabal new-build graphql-engine
|
||||
|
||||
To set up the project configuration to coincide with the testing scripts below, thus avoiding recompilation when testing locally, rather use `cabal.project.dev-sh.local` instead of `cabal.project.dev`:
|
||||
To set up the project configuration to coincide with the testing scripts below, thus avoiding recompilation when testing locally, rather use `cabal/dev-sh.project.local` instead of `cabal/dev.project`:
|
||||
|
||||
$ ln -s cabal.project.dev-sh.local cabal.project.local
|
||||
$ ln -s cabal/dev-sh.project.local cabal.project.local
|
||||
|
||||
### IDE Support
|
||||
|
||||
|
@ -38,8 +38,9 @@ flag profiling
|
||||
|
||||
-- A single flag to enable all optimization-related settings at once, for all
|
||||
-- hasura code.
|
||||
-- We share this flag name across our .cabal projects so we can switch it on or
|
||||
-- off for all of them at the top level of our cabal.project(.*) files
|
||||
--
|
||||
-- We share this flag name across our Haskell projects so we can switch it on or
|
||||
-- off for all of them at in our Cabal project files.
|
||||
flag optimize-hasura
|
||||
description: Compile hasura code with appropriate optimizations
|
||||
default: True
|
||||
|
Loading…
Reference in New Issue
Block a user