Skip to content

Commit

Permalink
Merge branch 'master' into cg/use_write_bazelrc
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jan 4, 2024
2 parents 282f324 + 300963d commit eaba9ce
Show file tree
Hide file tree
Showing 41 changed files with 203 additions and 349 deletions.
File renamed without changes.
1 change: 0 additions & 1 deletion .ci/bazel-6.4.0-darwin-x86_64.sha256

This file was deleted.

1 change: 0 additions & 1 deletion .ci/bazel-6.4.0-linux-x86_64.sha256

This file was deleted.

1 change: 0 additions & 1 deletion .ci/bazel-6.4.0-windows-x86_64.exe.sha256

This file was deleted.

14 changes: 0 additions & 14 deletions .ci/check-bazel-version

This file was deleted.

30 changes: 0 additions & 30 deletions .ci/fetch-bazel-bindist

This file was deleted.

25 changes: 0 additions & 25 deletions .ci/update-bazel-version

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/patch-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ jobs:
with:
path: ~/repo-cache
key: repo-cache-${{ runner.os }}-bindist-${{ env.cache-version }}
- name: Install Bazel
shell: bash
run: |
BAZEL_DIR="$(.ci/fetch-bazel-bindist)"
mv $BAZEL_DIR $HOME/bazel
- name: Configure
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
Expand Down
34 changes: 11 additions & 23 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,12 @@ jobs:
EOF
cp .bazelrc.local rules_haskell_nix
cp .bazelrc.local rules_haskell_tests
- name: Check Bazel version
uses: tweag/run-nix-shell@v0
with:
options: ${{ env.NIX_SHELL_ARGS }}
run: .ci/check-bazel-version
- name: Build & test - rules_haskell
if: matrix.module == 'rules_haskell'
uses: tweag/run-nix-shell@v0
with:
options: ${{ env.NIX_SHELL_ARGS }}
run: |
set -euo pipefail
bazel test //...
bazel build //docs:api_html
bazel build //docs:guide_html
Expand All @@ -119,23 +113,23 @@ jobs:
uses: tweag/run-nix-shell@v0
with:
options: ${{ env.NIX_SHELL_ARGS }}
run: |
set -euo pipefail
cd rules_haskell_nix
bazel test //...
working-directory: rules_haskell_nix
run: bazel test //...
- name: Build & test - rules_haskell_tests
if: matrix.module == 'rules_haskell_tests'
uses: tweag/run-nix-shell@v0
with:
options: ${{ env.NIX_SHELL_ARGS }}
working-directory: rules_haskell_tests
run: |
set -euo pipefail
cd rules_haskell_tests
# XXX run start script `--with-bzlmod=true` when supported
if ! ${{ matrix.bzlmod }}; then
./tests/run-start-script.sh --use-nix --with-bzlmod=${{ matrix.bzlmod }}
fi
bazel build //tests:run-tests
# Shutdown Bazel to free up memory
# https://github.com/tweag/rules_haskell/issues/2089.
bazel shutdown
./bazel-ci-bin/tests/run-tests
bazel coverage //...
Expand Down Expand Up @@ -179,12 +173,6 @@ jobs:
with:
path: ~/repo-cache
key: repo-cache-${{ runner.os }}-bindist-${{ env.cache-version }}
- name: Install Bazel
shell: bash
run: |
BAZEL_DIR="$(.ci/fetch-bazel-bindist)"
mv $BAZEL_DIR $HOME/bazel
echo "$HOME/bazel" >> "$GITHUB_PATH"
- uses: tweag/configure-bazel-remote-cache-auth@v0
with:
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
Expand Down Expand Up @@ -229,7 +217,7 @@ jobs:
shell: bash
run: |
# Quote the package specifier so that it works on Windows
bazel test "//..."
bazelisk test "//..."
- name: Build & test - rules_haskell_tests
if: matrix.module == 'rules_haskell_tests'
Expand All @@ -238,11 +226,11 @@ jobs:
cd rules_haskell_tests
./tests/run-start-script.sh --use-bindists --with-bzlmod=${{ matrix.bzlmod }}
# Quote the package specifier so that it works on Windows
bazel test "//..."
bazelisk test "//..."
# Test stack_snapshot pinning
# NOTE keep in sync with tests/RunTests.hs
bazel run @stackage-pinning-test-unpinned//:pin
bazel build @stackage-pinning-test//:hspec
bazelisk run @stackage-pinning-test-unpinned//:pin
bazelisk build @stackage-pinning-test//:hspec
- name: Collect Logs
id: collect_logs
Expand All @@ -255,7 +243,7 @@ jobs:
else
dir=.
fi
base=$( cd "$dir" ; bazel info output_base )
base=$( cd "$dir" ; bazelisk info output_base )
find "$base" -mindepth 1 -maxdepth 1 -name "java*.log.*" -print0 | xargs -0rI % cp % logs/
- name: Upload Logs
Expand Down
19 changes: 1 addition & 18 deletions .netlify/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,7 @@

set -eux

export PATH="$HOME/bin:$PATH"

# XXX We don't want to be using the Nixpkgs CC toolchain, because
# Nixpkgs is not available. But currently we can only override the
# autoconfigured CC toolchain, not have several (which we would then
# select via --extra_toolchains). So here's a gross hack that simply
# patches out the nixpkgs_cc_configure() line.
#
# See https://github.com/bazelbuild/bazel/issues/6696.
awk '
BEGIN {del=0}
/^nixpkgs_cc_configure\(/ {del=1}
del==0 {print}
/\)/ {del=0}' WORKSPACE > WORKSPACE.tmp
# Note: awk -i inplace not available
mv WORKSPACE.tmp WORKSPACE

bazel build //docs:api_html
npx @bazel/bazelisk build //docs:api_html
mkdir -p public
unzip -d public bazel-bin/docs/api_html-stardoc.zip
cp start public
4 changes: 0 additions & 4 deletions .netlify/install.sh

This file was deleted.

1 change: 0 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ exports_files(["start"])
exports_files(
[
".netlify/build.sh",
".netlify/install.sh",
"serve-docs.sh",
],
visibility = ["//tests/shellcheck:__pkg__"],
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,30 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/).

## Unreleased
## [0.18] 2023-12-21

[0.18]: https://github.com/tweag/rules_haskell/compare/v0.17...v0.18

### Highlights

* Support for GHC 9.6.x (See https://github.com/tweag/rules_haskell/pull/1921 and https://github.com/tweag/rules_haskell/issues/1986)

### Changed

* Use GHC 9.2.8 by default (See https://github.com/tweag/rules_haskell/pull/1994)
* Use Bazel 6.4.0 by default (See https://github.com/tweag/rules_haskell/pull/2063)
* `start` script supports bzlmod with bindists (See https://github.com/tweag/rules_haskell/pull/2046)
* Support Python Windows App aliases (See https://github.com/tweag/rules_haskell/pull/2060)

### Fixed

* Error using `snapshot` tag from stack_snapshot module extension (See https://github.com/tweag/rules_haskell/issues/2001)
* Build gi-gtk from stackage (See https://github.com/tweag/rules_haskell/issues/1752)
* X is not a toolchain library (See https://github.com/tweag/rules_haskell/issues/1920)

### Removed

* GHC versions < 8.10 are no longer supported (see https://github.com/tweag/rules_haskell/issues/2093)
* remove `compiler_flags` option which was deprecated since 0.14 from macros and rules
* remove `<name>-repl` aliases for repl targets introduced in 0.7
* remove deprecated nixpkgs platform aliases introduced in 0.13
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "rules_haskell",
version = "0.17",
version = "0.18",
)

bazel_dep(
Expand Down
6 changes: 3 additions & 3 deletions docs/haskell-use-cases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ rules_haskell. To use a released version, do the following::

http_archive(
name = "rules_haskell",
sha256 = "298f6f0db23391274b4eca215daa01797d05699469048ef94540d5829b466377",
strip_prefix = "rules_haskell-0.17",
url = "https://github.com/tweag/rules_haskell/archive/refs/tags/v0.17.tar.gz",
sha256 = "d1f0e1bd4f1d5e248b2882bfdc7c31a146112f9d85b9d2f0ef77e78d02ecba45",
strip_prefix = "rules_haskell-0.18",
url = "https://github.com/tweag/rules_haskell/releases/download/v0.18/rules_haskell-0.18.tar.gz",
)

Picking a compiler
Expand Down
4 changes: 2 additions & 2 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ bazel_dep(
)
bazel_dep(
name = "rules_haskell_nix",
version = "0.17",
version = "0.18",
)
bazel_dep(
name = "rules_haskell",
version = "0.17",
version = "0.18",
)

# TODO
Expand Down
11 changes: 0 additions & 11 deletions haskell/assets/ghc_8_6_5_win_base.patch

This file was deleted.

11 changes: 0 additions & 11 deletions haskell/assets/ghc_8_8_4_win_base.patch

This file was deleted.

22 changes: 6 additions & 16 deletions haskell/ghc_bindist.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ load(
"resolve_labels",
)
load("//haskell:ghc.bzl", "DEFAULT_GHC_VERSION")
load(":private/bazel_platforms.bzl", "bazel_platforms")

_GHC_DEFAULT_VERSION = DEFAULT_GHC_VERSION

Expand Down Expand Up @@ -459,15 +460,6 @@ def ghc_bindist(
toolchain_name = "{}-toolchain".format(name)

patches = None
if target == "windows_amd64":
# Older GHC versions on Windows contain a bug:
# https://gitlab.haskell.org/ghc/ghc/issues/16466
# We work around this by patching the base configuration.
patches = {
"8.6.5": ["@rules_haskell//haskell:assets/ghc_8_6_5_win_base.patch"],
"8.8.4": ["@rules_haskell//haskell:assets/ghc_8_8_4_win_base.patch"],
}.get(version)

if target == "darwin_amd64":
patches = {
# Patch for https://gitlab.haskell.org/ghc/ghc/-/issues/19963
Expand Down Expand Up @@ -567,7 +559,7 @@ def haskell_register_ghc_bindists(
configure_python3_toolchain(name = LOCAL_PYTHON_REPO_NAME, register = register)

def _configure_python3_toolchain_impl(repository_ctx):
cpu = get_cpu_value(repository_ctx)
os_cpu = get_cpu_value(repository_ctx)
python3_path = find_python(repository_ctx)
if check_bazel_version("4.2.0")[0]:
stub_shebang = """stub_shebang = "#!{python3_path}",""".format(
Expand Down Expand Up @@ -595,20 +587,18 @@ toolchain(
toolchain = ":py_runtime_pair",
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
exec_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//cpu:{cpu}",
"@platforms//os:{os}",
],
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//cpu:{cpu}",
"@platforms//os:{os}",
],
)
""".format(
python3 = python3_path,
os = {
"darwin": "osx",
"x64_windows": "windows",
}.get(cpu, "linux"),
os = bazel_platforms.get_os(os_cpu),
cpu = bazel_platforms.get_cpu(os_cpu),
stub_shebang = stub_shebang,
))

Expand Down
Loading

0 comments on commit eaba9ce

Please sign in to comment.