Skip to content

Commit

Permalink
Move ghc-lib{,-parser} to bazel-haskell-deps (#11775)
Browse files Browse the repository at this point in the history
* Move ghc-lib{,-parser} to bazel-haskell-deps

changelog_begin
changelog_end

* Always show changes to bazel-haskell-deps.bzl
  • Loading branch information
akrmn authored Nov 30, 2021
1 parent 9350632 commit 683ab87
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 28 deletions.
52 changes: 50 additions & 2 deletions bazel-haskell-deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ load("@os_info//:os_info.bzl", "is_linux", "is_windows")
load("@dadew//:dadew.bzl", "dadew_tool_home")
load("@rules_haskell//haskell:cabal.bzl", "stack_snapshot")

GHC_LIB_REV = "ded0a9e82e5d4bdf47e568ee83f26959"
GHC_LIB_SHA256 = "cee47f49c8f26feba53d3d90bc6d306f9a832b199096e06c3cadc1b021792269"
GHC_LIB_VERSION = "8.8.1"
GHC_LIB_PARSER_REV = "ded0a9e82e5d4bdf47e568ee83f26959"
GHC_LIB_PARSER_SHA256 = "869452c0158186928eb20540818eec69d6d76c1f7cf8a96de98be4150bebdd66"
GHC_LIB_PARSER_VERSION = "8.8.1"
GHCIDE_REV = "e04b5386b3741b839eb5c3d2a2586fd2aa97229c"
GHCIDE_SHA256 = "1d27926e0ad3c2a9536f23b454875a385ecc766ae68ce48a0ec88d0867884b46"
JS_JQUERY_VERSION = "3.3.1"
Expand Down Expand Up @@ -120,6 +126,48 @@ haskell_library(
urls = ["https://github.com/digital-asset/daml-ghcide/archive/%s.tar.gz" % GHCIDE_REV],
)

http_archive(
name = "ghc_lib",
build_file_content = """
load("@rules_haskell//haskell:cabal.bzl", "haskell_cabal_library")
load("@stackage//:packages.bzl", "packages")
haskell_cabal_library(
name = "ghc-lib",
version = packages["ghc-lib"].version,
srcs = glob(["**"]),
haddock = False,
flags = packages["ghc-lib"].flags,
deps = packages["ghc-lib"].deps,
visibility = ["//visibility:public"],
tools = packages["ghc-lib"].tools,
)
""",
sha256 = GHC_LIB_SHA256,
strip_prefix = "ghc-lib-%s" % GHC_LIB_VERSION,
urls = ["https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-%s.tar.gz" % GHC_LIB_REV],
)

http_archive(
name = "ghc_lib_parser",
build_file_content = """
load("@rules_haskell//haskell:cabal.bzl", "haskell_cabal_library")
load("@stackage//:packages.bzl", "packages")
haskell_cabal_library(
name = "ghc-lib-parser",
version = packages["ghc-lib-parser"].version,
srcs = glob(["**"]),
haddock = False,
flags = packages["ghc-lib-parser"].flags,
deps = packages["ghc-lib-parser"].deps,
visibility = ["//visibility:public"],
tools = packages["ghc-lib-parser"].tools,
)
""",
sha256 = GHC_LIB_PARSER_SHA256,
strip_prefix = "ghc-lib-parser-%s" % GHC_LIB_PARSER_VERSION,
urls = ["https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-%s.tar.gz" % GHC_LIB_PARSER_REV],
)

cbit_dep = ":fat_cbits" if is_windows else ":needed-cbits-clib" if is_linux else ":cbits"
grpc_dep = "@com_github_grpc_grpc//:grpc" if is_windows else "@grpc_nix//:grpc_lib"

Expand Down Expand Up @@ -490,8 +538,6 @@ exports_files(["stack.exe"], visibility = ["//visibility:public"])
"filelock",
"filepath",
"filepattern",
"ghc-lib",
"ghc-lib-parser",
"ghc-lib-parser-ex",
"gitrev",
"hashable",
Expand Down Expand Up @@ -590,6 +636,8 @@ exports_files(["stack.exe"], visibility = ["//visibility:public"])
stack = "@stack_windows//:stack.exe" if is_windows else None,
vendored_packages = {
"ghcide": "@ghcide_ghc_lib//:ghcide",
"ghc-lib": "@ghc_lib//:ghc-lib",
"ghc-lib-parser": "@ghc_lib_parser//:ghc-lib-parser",
"grpc-haskell-core": "@grpc_haskell_core//:grpc-haskell-core",
"grpc-haskell": "@grpc_haskell//:grpc-haskell",
"js-dgtable": "@js_dgtable//:js-dgtable",
Expand Down
31 changes: 23 additions & 8 deletions ci/da-ghc-lib/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
name: ubuntu_20_04
demands: assignment -equals default
variables:
ghc-lib-sha: '42e5c306dcfbc84b83336fdd531023e93bfcc5b2'
ghc-lib-sha: '362d4f38a7ac10521393de9b7ad942a77a2605be'
base-sha: '9c787d4d24f2b515934c8503ee2bbd7cfac4da20'
patches: '65f50a6f72097324de23d6168e3cb9efe734c181 833ca63be2ab14871874ccb6974921e8952802e9'
flavor: 'ghc-8.8.1'
patches: '8d26bb64b7ea02d2a54f22cc3296b7245458821f 833ca63be2ab14871874ccb6974921e8952802e9'
flavor: 'da-ghc-8.8.1'
steps:
- checkout: self
- bash: |
Expand All @@ -26,7 +26,19 @@ jobs:
LIB_STATUS="$(curl -Is "$URL_BASE/$LIB" | head -1 | awk '{print $2}')"
PARSER_STATUS="$(curl -Is "$URL_BASE/$PARSER" | head -1 | awk '{print $2}')"
if [ "200" = "$LIB_STATUS" ] && [ "200" = "$PARSER_STATUS" ]; then
curl -s "$URL_BASE/$LIB" --output lib.tar.gz
curl -s "$URL_BASE/$PARSER" --output parser.tar.gz
echo "Both artifacts exist; no need to run."
echo "Check the following lines of bazel-haskell-deps.bzl:"
echo "GHC_LIB_REV = \"$CACHE_KEY\""
echo "GHC_LIB_SHA256 = \"$(sha256sum lib.tar.gz | awk '{print $1}')\""
echo "GHC_LIB_VERSION = \"8.8.1\""
echo "GHC_LIB_PARSER_REV = \"$CACHE_KEY\""
echo "GHC_LIB_PARSER_SHA256 = \"$(sha256sum parser.tar.gz | awk '{print $1}')\""
echo "GHC_LIB_PARSER_VERSION = \"8.8.1\""
rm -f lib.tar.gz parser.tar.gz
exit 0
fi
Expand All @@ -53,6 +65,7 @@ jobs:
--merge-base-sha=$(base-sha) \
$(for p in $(patches); do echo -n "--patch $p "; done) \
--gen-flavor=$(flavor) \
--version-suffix= \
| tee log"
export NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/cc855b133100a956d4587079e27c5704cbc8342b.tar.gz
# We need GHC 8.10.4 for running ghc-lib-gen and GHC 8.6.5 to build GHC.
Expand All @@ -70,10 +83,12 @@ jobs:
gcloud auth activate-service-account --key-file=$GCS_KEY
BOTO_CONFIG=/dev/null gsutil cp -n "ghc-lib-${VERSION}.tar.gz" "gs://daml-binaries/$LIB"
BOTO_CONFIG=/dev/null gsutil cp -n "ghc-lib-parser-${VERSION}.tar.gz" "gs://daml-binaries/$PARSER"
echo "Please add(/replace) the following lines to stack-snapshot.yaml:"
echo " - archive: $URL_BASE/$LIB"
echo " sha256: \"$(sha256sum ghc-lib-${VERSION}.tar.gz | awk '{print $1}')\""
echo " - archive: $URL_BASE/$PARSER"
echo " sha256: \"$(sha256sum ghc-lib-parser-${VERSION}.tar.gz | awk '{print $1}')\""
echo "Please add(/replace) the following lines to bazel-haskell-deps.bzl:"
echo "GHC_LIB_REV = \"$CACHE_KEY\""
echo "GHC_LIB_SHA256 = \"$(sha256sum ghc-lib-${VERSION}.tar.gz | awk '{print $1}')\""
echo "GHC_LIB_VERSION = \"8.8.1\""
echo "GHC_LIB_PARSER_REV = \"$CACHE_KEY\""
echo "GHC_LIB_PARSER_SHA256 = \"$(sha256sum ghc-lib-parser-${VERSION}.tar.gz | awk '{print $1}')\""
echo "GHC_LIB_PARSER_VERSION = \"8.8.1\""
env:
GOOGLE_APPLICATION_CREDENTIALS_CONTENT: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)
4 changes: 0 additions & 4 deletions stack-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

resolver: lts-18.0
packages:
- archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-37eea5cf5534b712317d827ad081ca28.tar.gz
sha256: "719ff9dddcf74522a58edfed306f83303947f7bebb6453f55221203ff2692679"
- archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-37eea5cf5534b712317d827ad081ca28.tar.gz
sha256: "6361ac8a39088aa53478d5a6c878801e334e4c55309dc85360bdc6b2e5000335"
- github: digital-asset/hlint
commit: "c8246c1feb932858ff2b5d7e9e900068a974bf57"
sha256: "3da24baf789c5f00211a92e24153e6b88102befaa946ada1f707935554500fe2"
Expand Down
Loading

0 comments on commit 683ab87

Please sign in to comment.