Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Bazel 1.1 #1142

Merged
merged 17 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ test:ci --test_output=errors

# Note [backward compatible options]

# XXX: --incompatible_use_python_toolchains needs a specific setup for
# each environment if python is provided by the system
# That's complicated to setup. Bazel is supposed to provide automatic
# detection utilities, see
# https://github.com/bazelbuild/bazel/issues/7899
# But it does not work on windows
# see: https://github.com/bazelbuild/bazel/issues/7844
# This is only used in rules_haskell tests, so user won't face this
# issue.
build --incompatible_use_python_toolchains=false

# test environment does not propagate locales by default
# some tests reads files written in UTF8, we need to propagate the correct
# environment variables, such as LOCALE_ARCHIVE
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/bazel-sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6564a9ccb2ab4e39696f20254f3c1a900992e849d1307d8abed708bf48acc4ee bazel
f54ab5f31b8d7c6a0ce9dee387af45b1d6577ff9625ef6c535896b59cdf8828a bazel
2 changes: 1 addition & 1 deletion .buildkite/bazel-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.28.0
1.1.0
2 changes: 0 additions & 2 deletions .buildkite/bindists-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ BAZEL_DIR="$(.buildkite/fetch-bazel-bindist)"
trap "rm -rf '$BAZEL_DIR'" EXIT
export PATH="$BAZEL_DIR:$PATH"
echo "common:ci --build_tag_filters -requires_lz4,-requires_proto,-requires_zlib,-requires_doctest,-requires_c2hs,-requires_threaded_rts,-dont_test_with_bindist" > .bazelrc.local
# XXX: See .bazelrc [backward compatible options] for the the rational behind this flag
echo "build --incompatible_use_python_toolchains=false" >> .bazelrc.local
# XXX: Remove once all rules using `use_default_shell_env = True` have been
# converted to using `rules_sh`'s POSIX toolchain.
echo "build:ci --experimental_strict_action_env" >> .bazelrc.local
Expand Down
5 changes: 2 additions & 3 deletions .netlify/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ mv WORKSPACE.tmp WORKSPACE
# generation either.
sed -i 's/vendored_node = "@nixpkgs_nodejs"/vendored_node = None/' WORKSPACE

# XXX: see .bazelrc note [backward compatible options] for rational behind
# the --incompatible_use_python_toolchains flag
bazel build --incompatible_use_python_toolchains=false //docs:api_html
# XXX: Remove --host_force_python=PY2 after updating to Stardoc 0.4.0
bazel build --host_force_python=PY2 //docs:api_html
unzip -d public bazel-bin/docs/api_html-skydoc.zip
cp start public
8 changes: 1 addition & 7 deletions .netlify/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

set -eux

# XXX: This should be bazel 0.27
# However, starting from bazel 0.27, they link with a more recent
# glibc, they are based on ubuntu 16.04 instead of 14.04.
# Apparently, netlify does not have the right glibc for now
# So, using bazel 0.26 is a temporary solution until netlify fix its
# environment.
V=0.26.0
V=1.1.0

curl -LO https://github.com/bazelbuild/bazel/releases/download/$V/bazel-$V-installer-linux-x86_64.sh
chmod +x bazel-$V-installer-linux-x86_64.sh
Expand Down
118 changes: 52 additions & 66 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ workspace(name = "rules_haskell")

# Subrepositories of rules_haskell

# various examples
local_repository(
name = "rules_haskell_examples",
path = "examples",
)

# code for the tutorial
local_repository(
name = "rules_haskell_tutorial",
path = "tutorial",
)

# hazel, a way to generate bazel libraries from [st/h]ackage
local_repository(
name = "ai_formation_hazel",
Expand Down Expand Up @@ -79,9 +67,9 @@ haskell_cabal_binary(
visibility = ["//visibility:public"],
)
""",
sha256 = "d10e4e43673bff435cf6256145f91fbb60dd37510320fcae56be18ac90af2fee",
strip_prefix = "proto-lens-protoc-0.4.0.1",
urls = ["http://hackage.haskell.org/package/proto-lens-protoc-0.4.0.1/proto-lens-protoc-0.4.0.1.tar.gz"],
sha256 = "161dcee2aed780f62c01522c86afce61721cf89c0143f157efefb1bd1fa1d164",
strip_prefix = "proto-lens-protoc-0.5.0.0",
urls = ["http://hackage.haskell.org/package/proto-lens-protoc-0.5.0.0/proto-lens-protoc-0.5.0.0.tar.gz"],
)

load("@rules_haskell//haskell:cabal.bzl", "stack_snapshot")
Expand All @@ -101,6 +89,7 @@ stack_snapshot(
"mtl",
"process",
"text",
"vector",
# For tests
"network",
"language-c",
Expand All @@ -110,12 +99,11 @@ stack_snapshot(
"hspec-core",
"lens-family-core",
"data-default-class",
"lens-labels",
"proto-lens",
"proto-lens-protoc",
"lens-family",
],
snapshot = "lts-13.15",
snapshot = "lts-14.4",
tools = [
"@alex",
"@happy",
Expand All @@ -135,26 +123,27 @@ load(
"nixpkgs_cc_configure",
"nixpkgs_local_repository",
"nixpkgs_package",
"nixpkgs_python_configure",
)

nixpkgs_package(
name = "ghc",
repository = "@nixpkgs",
repository = "@nixpkgs_default",
)

http_archive(
name = "com_google_protobuf",
sha256 = "03d2e5ef101aee4c2f6ddcf145d2a04926b9c19e7086944df3842b1b8502b783",
strip_prefix = "protobuf-3.8.0",
urls = ["https://github.com/google/protobuf/archive/v3.8.0.tar.gz"],
sha256 = "6adf73fd7f90409e479d6ac86529ade2d45f50494c5c10f539226693cb8fe4f7",
strip_prefix = "protobuf-3.10.1",
urls = ["https://github.com/google/protobuf/archive/v3.10.1.tar.gz"],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps() # configure and install zlib for protobuf

nixpkgs_local_repository(
name = "nixpkgs",
name = "nixpkgs_default",
nix_file = "//nixpkgs:default.nix",
)

Expand Down Expand Up @@ -193,7 +182,7 @@ haskell_register_ghc_nixpkgs(
haddock_flags = test_haddock_flags,
locale_archive = "@glibc_locales//:locale-archive",
repl_ghci_args = test_repl_ghci_args,
repository = "@nixpkgs",
repository = "@nixpkgs_default",
version = test_ghc_version,
)

Expand All @@ -211,20 +200,24 @@ register_toolchains(
"//tests:c2hs-toolchain",
"//tests:doctest-toolchain",
"//tests:protobuf-toolchain",
# XXX: see .bazelrc for discussion, the python toolchain
# work in postponed to future bazel version
# "//tests:python_toolchain",
)

nixpkgs_cc_configure(
nix_file = "//nixpkgs:cc-toolchain.nix",
repository = "@nixpkgs",
nix_file_deps = ["//nixpkgs:default.nix"],
repository = "@nixpkgs_default",
)

nixpkgs_python_configure(
# XXX: Remove python2_attribute_path after updating to Stardoc 0.4.0
python2_attribute_path = "python2",
repository = "@nixpkgs_default",
)

nixpkgs_package(
name = "nixpkgs_zlib",
attribute_path = "zlib",
repository = "@nixpkgs",
repository = "@nixpkgs_default",
)

nixpkgs_package(
Expand All @@ -239,43 +232,42 @@ cc_library(
includes = ["include"],
)
""",
repository = "@nixpkgs",
repository = "@nixpkgs_default",
)

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

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

#nixpkgs_package(
# name = "python3",
# attribute_path = "python3",
# repository = "@nixpkgs",
#)
nixpkgs_package(
name = "python3",
repository = "@nixpkgs_default",
)

nixpkgs_package(
name = "sphinx",
attribute_path = "python36Packages.sphinx",
repository = "@nixpkgs",
attribute_path = "python37Packages.sphinx",
repository = "@nixpkgs_default",
)

nixpkgs_package(
name = "graphviz",
attribute_path = "graphviz",
repository = "@nixpkgs",
repository = "@nixpkgs_default",
)

nixpkgs_package(
name = "zip",
attribute_path = "zip",
repository = "@nixpkgs",
repository = "@nixpkgs_default",
)

nixpkgs_package(
Expand All @@ -295,7 +287,7 @@ cc_library(
visibility = ["//visibility:public"],
)
""",
repository = "@nixpkgs",
repository = "@nixpkgs_default",
)

nixpkgs_package(
Expand All @@ -309,7 +301,7 @@ filegroup(
srcs = ["lib/locale/locale-archive"],
)
""",
repository = "@nixpkgs",
repository = "@nixpkgs_default",
)

http_archive(
Expand Down Expand Up @@ -347,13 +339,6 @@ local_repository(
path = "tests/c2hs/repo",
)

# python toolchain
nixpkgs_package(
name = "python3",
attribute_path = "python3",
repository = "@nixpkgs",
)

load(
"@rules_haskell//tests/external-haskell-repository:workspace_dummy.bzl",
"haskell_package_repository_dummy",
Expand Down Expand Up @@ -385,22 +370,20 @@ nixpkgs_package(
"sandbox",
"false",
],
repository = "@nixpkgs",
repository = "@nixpkgs_default",
)

http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "f79f605a920145216e64991d6eff4e23babc48810a9efd63a31744bb6637b01e",
strip_prefix = "rules_nodejs-b4dad57d2ecc63d74db1f5523593639a635e447d",
# Tip of https://github.com/bazelbuild/rules_nodejs/pull/471.
urls = ["https://github.com/mboes/rules_nodejs/archive/b4dad57d2ecc63d74db1f5523593639a635e447d.tar.gz"],
sha256 = "9901bc17138a79135048fb0c107ee7a56e91815ec6594c08cb9a17b80276d62b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.40.0/rules_nodejs-0.40.0.tar.gz"],
)

http_archive(
name = "io_bazel_rules_sass",
sha256 = "1e135452dc627f52eab39a50f4d5b8d13e8ed66cba2e6da56ac4cbdbd776536c",
strip_prefix = "rules_sass-1.15.2",
urls = ["https://github.com/bazelbuild/rules_sass/archive/1.15.2.tar.gz"],
sha256 = "d5e0c0d16fb52f3dcce5bd7830d92d4813eb01bac0211119e74ec9e65eaf3b86",
strip_prefix = "rules_sass-1.23.3",
urls = ["https://github.com/bazelbuild/rules_sass/archive/1.23.3.tar.gz"],
)

load("@io_bazel_rules_sass//:package.bzl", "rules_sass_dependencies")
Expand All @@ -419,9 +402,10 @@ node_repositories(

http_archive(
name = "io_bazel_skydoc",
sha256 = "c2d66a0cc7e25d857e480409a8004fdf09072a1bd564d6824441ab2f96448eea",
strip_prefix = "skydoc-0.3.0",
urls = ["https://github.com/bazelbuild/skydoc/archive/0.3.0.tar.gz"],
sha256 = "0f77e715e6cf683548a0af9ab84909e57a8f4609de1e847920444d0434259eb4",
# XXX: Update to 0.4.0 and Stardoc, the Skydoc API has been deprecated.
strip_prefix = "stardoc-0.3.0",
urls = ["https://github.com/bazelbuild/stardoc/archive/0.3.0.tar.gz"],
)

load("@io_bazel_skydoc//:setup.bzl", "skydoc_repositories")
Expand All @@ -432,16 +416,18 @@ skydoc_repositories()

http_archive(
name = "io_bazel_rules_go",
sha256 = "1ad10f384053ae50c050fdec7d595d12427c82c0a27c58f8554deb4437216892",
strip_prefix = "rules_go-0.18.7",
urls = ["https://github.com/bazelbuild/rules_go/archive/0.18.7.tar.gz"],
sha256 = "b9aa86ec08a292b97ec4591cf578e020b35f98e12173bbd4a921f84f583aebd9",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.20.2/rules_go-v0.20.2.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.20.2/rules_go-v0.20.2.tar.gz",
],
)

http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = "5ec71602e9b458b01717fab1d37492154c1c12ea83f881c745dbd88e9b2098d8",
strip_prefix = "buildtools-0.28.0",
urls = ["https://github.com/bazelbuild/buildtools/archive/0.28.0.tar.gz"],
sha256 = "f3ef44916e6be705ae862c0520bac6834dd2ff1d4ac7e5abc61fe9f12ce7a865",
strip_prefix = "buildtools-0.29.0",
urls = ["https://github.com/bazelbuild/buildtools/archive/0.29.0.tar.gz"],
)

# A repository that generates the Go SDK imports, see ./tools/go_sdk/README
Expand Down
11 changes: 10 additions & 1 deletion examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ load("@rules_haskell//haskell:repositories.bzl", "rules_haskell_toolchains")

rules_haskell_toolchains(version = "8.6.5")

load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_cc_configure")
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_cc_configure",
"nixpkgs_python_configure",
)

nixpkgs_cc_configure(
nix_file = "@rules_haskell//nixpkgs:cc-toolchain.nix",
nix_file_deps = ["@rules_haskell//nixpkgs:default.nix"],
repository = "@rules_haskell//nixpkgs:default.nix",
)

nixpkgs_python_configure(
repository = "@rules_haskell//nixpkgs:default.nix",
)

Expand Down
4 changes: 2 additions & 2 deletions haskell/platforms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ load(":list.bzl", "declare_config_settings")

declare_config_settings()

constraint_value(
alias(
name = "nixpkgs",
constraint_setting = "@bazel_tools//tools/cpp:cc_compiler",
actual = "@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs",
visibility = ["//visibility:public"],
)

Expand Down
1 change: 0 additions & 1 deletion haskell/protobuf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ def haskell_proto_toolchain(
"containers",
"data-default-class",
"lens-family",
"lens-labels",
"proto-lens",
"text",
],
Expand Down
6 changes: 3 additions & 3 deletions haskell/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def rules_haskell_dependencies():
if "io_tweag_rules_nixpkgs" not in excludes:
http_archive(
name = "io_tweag_rules_nixpkgs",
sha256 = "5a384daa57b49abf9f0b672852f1a66a3c52aecf9d4d2ac64f6de0fd307690c8",
strip_prefix = "rules_nixpkgs-0.5.2",
urls = ["https://github.com/tweag/rules_nixpkgs/archive/v0.5.2.tar.gz"],
sha256 = "f5af641e16fcff5b24f1a9ba5d93cab5ad26500271df59ede344f1a56fc3b17d",
strip_prefix = "rules_nixpkgs-0.6.0",
urls = ["https://github.com/tweag/rules_nixpkgs/archive/v0.6.0.tar.gz"],
)

def haskell_repositories():
Expand Down
Loading