Skip to content
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
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ test --test_env=LANG=C.UTF-8 --test_env=LOCALE_ARCHIVE

# Platform / Toolchain Selection
# ------------------------------
build:linux-nixpkgs --config=nixpkgs
build:macos-nixpkgs --config=nixpkgs
build:nixpkgs --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host
# Use this configuration when targeting Windows. Eventually this will
# no longer be required:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ jobs:
nix_path: nixpkgs=./nixpkgs/default.nix
- name: Configure
run: |
[[ ${{ matrix.os }} == macos ]] && EXTRA_CONFIG=--config=macos-nixpkgs
case ${{ matrix.os }} in
macos) BUILD_CONFIG=macos-nixpkgs;;
ubuntu) BUILD_CONFIG=linux-nixpkgs;;
esac
cat >.bazelrc.local <<EOF
common --config=ci
build --config=nixpkgs $EXTRA_CONFIG
build --config=$BUILD_CONFIG
EOF
- name: Check Bazel version
run: |
Expand Down
7 changes: 4 additions & 3 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
pull_request_rules:
- name: automatic merge
conditions:
- 'status-success~=Build & Test - macOS \(Nixpkgs\).*'
- 'status-success~=Build & Test - macOS \(bindist\).*'
- "status-success~=buildkite/rules-haskell(|/pr)"
- 'status-success~=Build & Test - Nixpkgs \(ubuntu\).*'
- 'status-success~=Build & Test - Nixpkgs \(macos\).*'
- 'status-success~=Build & Test - bindist \(ubuntu\).*'
- 'status-success~=Build & Test - bindist \(macos\).*'
- "status-success=tweag.rules_haskell"
- "status-success=deploy/netlify"
- "#approved-reviews-by>=1"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Haskell rules for [Bazel][bazel]

![Continuous integration](https://github.com/tweag/rules_haskell/workflows/Continuous%20integration/badge.svg)
[![Continuous integration](https://github.com/tweag/rules_haskell/workflows/Continuous%20integration/badge.svg)](https://github.com/tweag/rules_haskell/actions?query=branch%3Amaster)
[![Build Status](https://dev.azure.com/tweag/rules_haskell/_apis/build/status/tweag.rules_haskell?branchName=master)](https://dev.azure.com/tweag/rules_haskell/_build/latest?definitionId=1?branchName=master)

Bazel automates building and testing software. It scales to very large
Expand Down Expand Up @@ -254,26 +254,26 @@ This chooses the `cc_toolchain` bundled with GHC.
### Configuring your platform

`rules_haskell` can be built and tested on Linux, MacOS, and Windows. Depending
on the platform GHC can be provisioned using Nixpkgs or by downloading a binary
on the platform GHC can be provisioned using nixpkgs or by downloading a binary
distribution. In case of nixpkgs other toolchains (C compiler, Python, shell
tools) will also be provided by nixpkgs, in case of bindist they will be taken
from the environment (`$PATH`). The following `--config` options select the
corresponding combination of operating system and GHC distribution:

| | Linux | MacOS | Windows |
| ------------------- | --------------- | --------------- | ----------------- |
| Nixpkgs | (unneeded) | `macos-nixpkgs` | (unsupported) |
| Binary distribution | `linux-bindist` | `macos-bindist` | `windows-bindist` |
| nixpkgs | `linux-nixpkgs` | `macos-nixpkgs` | |
| binary distribution | `linux-bindist` | `macos-bindist` | `windows-bindist` |

Hint: You can use Bazel's `--announce_rc` flag to see what options are being
used for a command in a specific configuration. E.g.
```
$ bazel build //tests:run-tests --config linux-bindist --nobuild --announce_rc
$ bazel build //tests:run-tests --config linux-nixpkgs --nobuild --announce_rc
```

Hint: To avoid repetition you can add your configuration to `.bazelrc.local`.
```
echo "build --config=linux-bindist" >>.bazelrc.local
echo "build --config=linux-nixpkgs" >>.bazelrc.local
```

### Saving common command-line flags to a file
Expand Down
5 changes: 5 additions & 0 deletions tests/haddock_protobuf/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ load("//haskell:protobuf.bzl", "haskell_proto_library")
proto_library(
name = "hello_world_proto",
srcs = ["hello_world.proto"],
tags = ["requires_proto"],
)

haskell_proto_library(
name = "hello_world_haskell_proto",
tags = ["requires_proto"],
deps = [
":hello_world_proto",
],
Expand All @@ -21,6 +23,7 @@ haskell_proto_library(
haskell_library(
name = "hello_world_haskell",
srcs = ["HelloWorld.hs"], # Just imports the proto and does something trivial
tags = ["requires_proto"],
deps = [
":hello_world_haskell_proto",
"@stackage//:base",
Expand All @@ -30,6 +33,7 @@ haskell_library(
# Haddocks version A: depend on just the haskell_library
haskell_doc(
name = "haddocks_a",
tags = ["requires_proto"],
deps = [
":hello_world_haskell",
],
Expand All @@ -38,6 +42,7 @@ haskell_doc(
# Haddocks version B: depend on both haskell_library and haskell_proto_library
haskell_doc(
name = "haddocks_b",
tags = ["requires_proto"],
deps = [
":hello_world_haskell",
":hello_world_haskell_proto",
Expand Down
6 changes: 3 additions & 3 deletions tests/haskell_proto_simple/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ load(
proto_library(
name = "foo",
srcs = ["foo.proto"],
tags = ["requires_proto"],
deps = ["@com_google_protobuf//:descriptor_proto"],
)

haskell_proto_library(
name = "foo_haskell",
tags = ["requires_proto"],
deps = [
":foo",
],
Expand All @@ -25,9 +27,7 @@ haskell_proto_library(
haskell_library(
name = "hs-lib",
srcs = ["Bar.hs"],
tags = [
"requires_proto",
],
tags = ["requires_proto"],
visibility = ["//visibility:public"],
deps = [
":foo_haskell",
Expand Down