Skip to content

Commit

Permalink
Merge pull request #887 from tweag/stack_install
Browse files Browse the repository at this point in the history
Add stack_install
  • Loading branch information
mboes authored May 24, 2019
2 parents 607494e + f04cd5f commit 647ddc8
Show file tree
Hide file tree
Showing 15 changed files with 317 additions and 159 deletions.
99 changes: 57 additions & 42 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@ load("@os_info//:os_info.bzl", "is_linux", "is_windows")
# bazel dependencies
haskell_repositories()

load("@io_tweag_rules_haskell//haskell:cabal.bzl", "stack_install")

stack_install(
name = "stackage",
packages = [
# Core libraries
"array",
"base",
"directory",
"filepath",
"process",
# For tests
"streaming",
"void",
"hspec",
"hspec-core",
"lens-family-core",
"data-default-class",
"lens-labels",
"proto-lens",
"lens-family",
],
snapshot = "lts-13.15",
deps = ["@zlib.dev//:zlib"],
)

rules_nixpkgs_version = "0.5.2"

rules_nixpkgs_version_is_hash = False
Expand All @@ -52,29 +78,10 @@ load(
"nixpkgs_local_repository",
"nixpkgs_package",
)
load(
"@io_tweag_rules_haskell//haskell:nixpkgs.bzl",
"haskell_nixpkgs_package",
"haskell_nixpkgs_packageset",
)
load(
"@io_tweag_rules_haskell//tests/external-haskell-repository:workspace_dummy.bzl",
"haskell_package_repository_dummy",
)
load(
"@io_tweag_rules_haskell//:constants.bzl",
"test_ghc_version",
)

haskell_nixpkgs_package(
nixpkgs_package(
name = "ghc",
attribute_path = "haskellPackages.ghc",
nix_file = "//tests:ghc.nix",
nix_file_deps = ["//nixpkgs:default.nix"],
# rules_nixpkgs assumes we want to read from `<nixpkgs>` implicitly
# if `repository` is not set, but our nix_file uses `./nixpkgs/`.
# TODO(Profpatsch)
repositories = {"nixpkgs": "//nixpkgs:NOTUSED"},
repository = "@nixpkgs",
)

http_archive(
Expand Down Expand Up @@ -109,18 +116,22 @@ test_repl_ghci_args = [
"-XOverloadedStrings",
]

load(
"@io_tweag_rules_haskell//:constants.bzl",
"test_ghc_version",
)
load(
"@io_tweag_rules_haskell//haskell:nixpkgs.bzl",
"haskell_register_ghc_nixpkgs",
)

haskell_register_ghc_nixpkgs(
attribute_path = "ghc",
compiler_flags = test_compiler_flags,
haddock_flags = test_haddock_flags,
locale_archive = "@glibc_locales//:locale-archive",
nix_file = "//tests:ghc.nix",
nix_file_deps = ["//nixpkgs:default.nix"],
repl_ghci_args = test_repl_ghci_args,
repositories = {"nixpkgs": "@nixpkgs"},
version = test_ghc_version,
)

Expand Down Expand Up @@ -159,12 +170,29 @@ cc_library(
name = "zlib",
linkstatic = 1,
srcs = [":lib"],
testonly = 1,
)
""",
repository = "@nixpkgs",
)

nixpkgs_package(
name = "c2hs",
attribute_path = "haskellPackages.c2hs",
repository = "@nixpkgs",
)

nixpkgs_package(
name = "doctest",
attribute_path = "haskellPackages.doctest",
repository = "@nixpkgs",
)

nixpkgs_package(
name = "proto-lens-protoc",
attribute_path = "haskellPackages.proto-lens-protoc",
repository = "@nixpkgs",
)

nixpkgs_package(
name = "sphinx",
attribute_path = "python36Packages.sphinx",
Expand All @@ -191,14 +219,12 @@ package(default_visibility = ["//visibility:public"])
filegroup (
name = "include",
srcs = glob(["include/*.h"]),
testonly = 1,
)
cc_library(
name = "zlib",
deps = ["@zlib//:zlib"],
hdrs = [":include"],
testonly = 1,
strip_include_prefix = "include",
)
""",
Expand All @@ -219,22 +245,6 @@ filegroup(
repository = "@nixpkgs",
)

haskell_nixpkgs_packageset(
name = "hackage-packages",
base_attribute_path = "haskellPackages",
nix_file = "//tests:ghc.nix",
nix_file_deps = ["//tests/haddock:libC.nix"],
nixopts = [
"-j",
"1",
],
repositories = {"nixpkgs": "@nixpkgs"},
)

load("@hackage-packages//:packages.bzl", "import_packages")

import_packages(name = "hackage")

load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")

jvm_maven_import_external(
Expand All @@ -251,6 +261,11 @@ local_repository(
path = "tests/c2hs/repo",
)

load(
"@io_tweag_rules_haskell//tests/external-haskell-repository:workspace_dummy.bzl",
"haskell_package_repository_dummy",
)

# dummy repo for the external haskell repo test (hazel)
haskell_package_repository_dummy(
name = "haskell_package_repository_dummy",
Expand Down
2 changes: 1 addition & 1 deletion constants.bzl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
test_ghc_version = "8.6.4"
test_ghc_version = "8.6.5"
11 changes: 11 additions & 0 deletions haskell/assets/ghc_8_6_5_win_base.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- lib/package.conf.d/base-4.12.0.0.conf 2019-03-20 12:24:30.857292020 +0100
+++ lib/package.conf.d/base-4.12.0.0.conf 2019-03-20 12:24:44.637400564 +0100
@@ -79,7 +79,7 @@
data-dir: $topdir\x86_64-windows-ghc-8.6.5\base-4.12.0.0
hs-libraries: HSbase-4.12.0.0
extra-libraries:
- wsock32 user32 shell32 msvcrt mingw32 mingwex
+ wsock32 user32 shell32 msvcrt mingw32 mingwex shlwapi
include-dirs: $topdir\base-4.12.0.0\include
includes:
HsBase.h
Loading

0 comments on commit 647ddc8

Please sign in to comment.