From 3def0bd901d5174f432d846dea5c23308e5616fb Mon Sep 17 00:00:00 2001 From: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com> Date: Tue, 30 Apr 2019 13:44:11 +0200 Subject: [PATCH] Update rules_haskell - now generates Haskell version macros (#769) * Update rules_haskell: Generates version macros - rules_haskell now generates a version macros header file that is passed on to preprocessors such as c2hs or hsc2hs. - The haskell_import rule was also renamed to haskell_toolchain_library. * Drop unix-compat patch This was necessary to work around missing version macros. --- BAZEL-haskell.md | 6 +++--- WORKSPACE | 7 +------ bazel_tools/unix-compat.patch | 14 -------------- deps.bzl | 4 ++-- notices-gen/src/notices.hs | 2 +- 5 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 bazel_tools/unix-compat.patch diff --git a/BAZEL-haskell.md b/BAZEL-haskell.md index cce056ab38..f4b2642022 100644 --- a/BAZEL-haskell.md +++ b/BAZEL-haskell.md @@ -160,15 +160,15 @@ sets the default visibility property globally for our targets as `public`. This The `load` statments ``` load("@io_tweag_rules_haskell//haskell:haskell.bzl", - "haskell_toolchain", "haskell_import", "haskell_cc_import", + "haskell_toolchain", "haskell_toolchain_library", "haskell_cc_import", ) load("@io_tweag_rules_haskell//haskell:c2hs.bzl", "c2hs_toolchain", ) ``` -bring the macros `haskell_toolchain`, `haskell_import`, `haskell_cc_import` and `c2hs_toolchain` into scope from `rules_haskell`. +bring the macros `haskell_toolchain`, `haskell_toolchain_library`, `haskell_cc_import` and `c2hs_toolchain` into scope from `rules_haskell`. -`haskell_import`: +`haskell_toolchain_library`: - import a package that is prebuilt outside of Bazel `haskell_cc_import`: diff --git a/WORKSPACE b/WORKSPACE index 32ab76cf2b..8a3a759fbd 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -452,12 +452,7 @@ hazel_repositories( hazel_hackage("filepattern", "0.1.1", "f7fc5bdcfef0d43a793a3c64e7c0fd3b1d35eea97a37f0e69d6612ab255c9b4b") + hazel_hackage("terminal-progress-bar", "0.4.0.1", "c5a9720fcbcd9d83f9551e431ee3975c61d7da6432aa687aef0c0e04e59ae277") + hazel_hackage("rope-utf16-splay", "0.2.0.0", "83d1961bf55355da49a6b55d6f58d02483eff1f8e6df53f4dccdab1ac49e101d") + - hazel_hackage( - "unix-compat", - "0.5.1", - "a39d0c79dd906763770b80ba5b6c5cb710e954f894350e9917de0d73f3a19c52", - patches = ["@com_github_digital_asset_daml//bazel_tools:unix-compat.patch"], - ) + + hazel_hackage("unix-compat", "0.5.1", "a39d0c79dd906763770b80ba5b6c5cb710e954f894350e9917de0d73f3a19c52") + # This is a special version of Haskell LSP without GPL dependencies hazel_github( "haskell-lsp", diff --git a/bazel_tools/unix-compat.patch b/bazel_tools/unix-compat.patch deleted file mode 100644 index 9b42190e50..0000000000 --- a/bazel_tools/unix-compat.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- src/System/PosixCompat/Files.hsc 2018-08-23 02:44:16.000000000 +0200 -+++ src/System/PosixCompat/Files.hsc 2019-04-15 13:41:46.371761110 +0200 -@@ -392,11 +392,7 @@ - -- Renaming - - rename :: FilePath -> FilePath -> IO () --#if MIN_VERSION_Win32(2, 6, 0) - rename name1 name2 = moveFileEx name1 (Just name2) mOVEFILE_REPLACE_EXISTING --#else --rename name1 name2 = moveFileEx name1 name2 mOVEFILE_REPLACE_EXISTING --#endif - - -- ----------------------------------------------------------------------------- - -- chown() diff --git a/deps.bzl b/deps.bzl index b466c9b442..0c14937d7a 100644 --- a/deps.bzl +++ b/deps.bzl @@ -27,8 +27,8 @@ # be resolvable from external workspaces otherwise. rules_scala_version = "6f8ee3d951d2ac6154356314600f6edb4eb5df8b" -rules_haskell_version = "42f32a4017235b8c600a6cdd076232698285eef9" -rules_haskell_sha256 = "0ed1a2cecd85fb03720893c4a122f8a64eed9d87c173de7bdf2dd295ea1ccf98" +rules_haskell_version = "23eaaa8c85d908fb3ccc69b470d3730dcef165a0" +rules_haskell_sha256 = "9fab4f50a0ea0e02d98c918fdf0859cf0f6828b6dbf167c7acb1293cd2b37d65" rules_nixpkgs_version = "40b5a9f23abca57f364c93245c7451206ef1a855" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") diff --git a/notices-gen/src/notices.hs b/notices-gen/src/notices.hs index dd16ca87c5..416f2ee7ab 100644 --- a/notices-gen/src/notices.hs +++ b/notices-gen/src/notices.hs @@ -103,7 +103,7 @@ ppFullLicense libFullText = "\n\n" ++ replicate 80 '-' ++ "\n" ++ packageName l generateDepsFileFromBazel :: IO String generateDepsFileFromBazel = do - let cmd = "bazel query 'kind(\"(haskell_library|haskell_import)\",filter(\"^((?!da-hs-|:daml-|:daml_).)*$\", deps(//...)))' --output xml" + let cmd = "bazel query 'kind(\"(haskell_library|haskell_toolchain_library)\",filter(\"^((?!da-hs-|:daml-|:daml_).)*$\", deps(//...)))' --output xml" readCreateProcess (shell cmd) ""