mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
224a6b1747
* Add tool for compiling ghcide from a local copy * Allow custom output path, so different repos can use different files
40 lines
1011 B
Bash
Executable File
40 lines
1011 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Get input directory, output file
|
|
target=${1:-daml-ghcide}
|
|
out=${2:-out.tar.gz}
|
|
target=$(realpath $target)
|
|
out=$(realpath ${out%.tar.gz}.tar.gz)
|
|
|
|
# Check target exists
|
|
if [[ ! -e "$target" ]]; then
|
|
echo "Local GHCIDE location '$target' does not exist"
|
|
exit 1
|
|
fi
|
|
if [[ ! -d "$target" ]]; then
|
|
echo "Local GHCIDE location '$target' is not a directory"
|
|
exit 1
|
|
fi
|
|
|
|
# Check that correct output path is set in bazel-haskell-deps.bzl
|
|
if [[ ! -e ./bazel-haskell-deps.bzl ]]; then
|
|
echo "Cannot find bazel-haskell-deps.bzl"
|
|
exit 1
|
|
fi
|
|
|
|
if ! grep -E "^GHCIDE_LOCAL_PATH *= *\"$out\"$" >/dev/null ./bazel-haskell-deps.bzl; then
|
|
echo "Cannot find a correct definition of GHCIDE_LOCAL_PATH"
|
|
echo "Make sure to redefine GHCIDE_LOCAL_PATH = \"$out\" in ./bazel-haskell-deps.bzl"
|
|
exit 1
|
|
fi
|
|
|
|
# Make new out
|
|
if [[ -e "$out" ]]; then rm "$out"; fi
|
|
cd "$target"
|
|
tar czf "$out" .
|
|
|
|
# Synchronize new result
|
|
bazel sync --only=ghcide_ghc_lib
|
|
bazel build @ghcide_ghc_lib//:ghcide
|