forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tool for compiling ghcide from a local copy (digital-asset#16860)
* Add tool for compiling ghcide from a local copy * Allow custom output path, so different repos can use different files
- Loading branch information
Showing
2 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/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 |