Skip to content

Commit be56859

Browse files
committed
Refactor bazelrc files
Various modules will need to reference the local registry with different relative paths.
1 parent 51e35d5 commit be56859

11 files changed

+149
-131
lines changed

.bazelrc

+2-130
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,2 @@
1-
# See https://docs.bazel.build/versions/master/user-manual.html#bazelrc.
2-
3-
# Global Configuration
4-
# --------------------
5-
6-
# Force TLS 1.2. With TLS 1.3, we run into the following error on Darwin.
7-
# > No subject alternative DNS name matching github-releases.githubusercontent.com found.
8-
# It looks like this is a result of SNI being broken on TLS 1.3 which results
9-
# in us getting a certificate for githubassets.com instead.
10-
#
11-
# Taken from https://github.com/digital-asset/daml/pull/8697.
12-
startup --host_jvm_args=-Djdk.tls.client.protocols=TLSv1.2
13-
14-
common --incompatible_require_linker_input_cc_api
15-
16-
common --incompatible_disallow_empty_glob=true
17-
18-
# test environment does not propagate locales by default some tests reads files
19-
# written in UTF8, we need to propagate the correct environment variables, such
20-
# as LOCALE_ARCHIVE We also need to setup an utf8 locale
21-
test --test_env=LANG=C.UTF-8 --test_env=LOCALE_ARCHIVE
22-
23-
# Platform / Toolchain Selection
24-
# ------------------------------
25-
build:linux-nixpkgs --config=nixpkgs
26-
build:macos-nixpkgs --config=nixpkgs
27-
build:nixpkgs --host_platform=@rules_nixpkgs_core//platforms:host
28-
29-
# Build and Test Filters
30-
# ----------------------
31-
# Note tag filters do not compose. If you wish to augment these filters on the
32-
# command-line you have to repeat the full list.
33-
build:linux-bindist --build_tag_filters -requires_nix,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
34-
build:linux-bindist --test_tag_filters -requires_nix,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
35-
36-
build:macos-nixpkgs --build_tag_filters -dont_test_on_darwin
37-
build:macos-nixpkgs --test_tag_filters -dont_test_on_darwin
38-
39-
build:macos-bindist --build_tag_filters -requires_nix,-dont_test_on_darwin,-dont_test_on_darwin_with_bindist,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
40-
build:macos-bindist --test_tag_filters -requires_nix,-dont_test_on_darwin,-dont_test_on_darwin_with_bindist,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
41-
42-
build:windows-bindist --build_tag_filters -requires_nix,-dont_test_on_windows,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
43-
build:windows-bindist --test_tag_filters -requires_nix,-dont_test_on_windows,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
44-
45-
# CI Configuration
46-
# ----------------
47-
common:ci --config=ci-common
48-
build:ci --config=remote-cache
49-
50-
common:ci-common --color=no
51-
52-
build:ci-common --loading_phase_threads=1
53-
build:ci-common --verbose_failures
54-
# Make sure we don't rely on the names of convenience symlinks because those
55-
# can be changed by user.
56-
build:ci-common --symlink_prefix=bazel-ci-
57-
build:ci-common --repository_cache=~/repo-cache/
58-
build:ci-common --experimental_repository_cache_hardlinks
59-
60-
# Use a remote cache during CI
61-
build:ci-common --bes_results_url=https://app.buildbuddy.io/invocation/
62-
build:ci-common --bes_backend=grpcs://remote.buildbuddy.io
63-
build:ci-windows-bindist --bes_upload_mode=wait_for_upload_complete --bes_timeout=60s
64-
build:remote-cache --remote_cache=grpcs://remote.buildbuddy.io
65-
build:ci-common --remote_timeout=3600
66-
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
67-
# See https://github.com/tweag/rules_haskell/issues/1498.
68-
build:ci-common --keep_backend_build_event_connections_alive=false
69-
70-
test:ci-common --test_output=errors
71-
72-
build:ci-linux-bindist --config=linux-bindist
73-
build:ci-linux-nixpkgs --config=linux-nixpkgs
74-
build:ci-macos-bindist --config=macos-bindist
75-
build:ci-macos-nixpkgs --config=macos-nixpkgs
76-
build:ci-windows-bindist --config=windows-bindist
77-
build:ci-windows-bindist-rules-haskell --config=ci-windows-bindist
78-
build:ci-windows-bindist-rules-haskell-tests --config=ci-windows-bindist
79-
80-
# Windows is prone to leaking absolute paths into the remote cache which can
81-
# poison the cache, so we do not share the cache between different modules.
82-
# Increment these numbers to use a fresh cache.
83-
# Errors of the following form might indicate such an issue:
84-
#
85-
# ERROR: D:/a/rules_haskell/rules_haskell/tests/runfiles/BUILD.bazel:20:10: Compiling tests/runfiles/main.cc failed: undeclared inclusion(s) in rule '//tests/runfiles:cc-runner':
86-
# this rule is missing dependency declarations for the following files included by 'tests/runfiles/main.cc':
87-
# '.../execroot/rules_haskell/external/rules_haskell_ghc_windows_amd64/mingw/include/c++/9.2.0/cstdlib'
88-
# '.../execroot/rules_haskell/external/rules_haskell_ghc_windows_amd64/mingw/include/c++/9.2.0/x86_64-w64-mingw32/bits/c++config.h'
89-
build:ci-windows-bindist-rules-haskell --remote_default_exec_properties=cache-silo-key=windows-rules-haskell-v0
90-
build:ci-windows-bindist-rules-haskell-tests --remote_default_exec_properties=cache-silo-key=windows-rules-haskell-tests-v0
91-
92-
# XXX: @com_google_protobuf sets `use_default_shell_env = True`, so we enable
93-
# strict action env to avoid changes in `PATH` invalidating the cache.
94-
build:linux-bindist --experimental_strict_action_env
95-
build:macos-bindist --experimental_strict_action_env
96-
build:windows-bindist --experimental_strict_action_env
97-
98-
# Note [backward compatible options]
99-
build:linux-bindist --incompatible_enable_cc_toolchain_resolution
100-
build:macos-bindist --incompatible_enable_cc_toolchain_resolution
101-
build:linux-nixpkgs --incompatible_enable_cc_toolchain_resolution
102-
build:macos-nixpkgs --incompatible_enable_cc_toolchain_resolution
103-
build:windows-bindist --incompatible_enable_cc_toolchain_resolution
104-
105-
# Blocked by https://github.com/bazelbuild/bazel/issues/11704
106-
#build:ci --incompatible_load_cc_rules_from_bzl
107-
108-
# This flag will become the default in a later version of bazel
109-
# See https://github.com/bazelbuild/bazel/issues/8922
110-
build:ci --incompatible_load_proto_rules_from_bzl
111-
112-
# This flag will become the default in bazel 6
113-
# https://github.com/tweag/rules_haskell/issues/1657
114-
build: --incompatible_override_toolchain_transition
115-
116-
# This flag will become the default in bazel 7
117-
# https://github.com/bazelbuild/bazel/issues/17032
118-
build --incompatible_disable_starlark_host_transitions
119-
120-
coverage --build_tag_filters "coverage-compatible" --test_tag_filters "coverage-compatible" --test_output=all
121-
122-
# To update these lines, execute
123-
# `bazel run @contrib_rules_bazel_integration_test//tools:update_deleted_packages`
124-
build --deleted_packages=examples,examples/arm,examples/cat_hs,examples/cat_hs/exec/cat_hs,examples/cat_hs/lib/args,examples/cat_hs/lib/cat,examples/primitive,examples/rts,examples/transformers,examples/vector,tests/c2hs/repo,tests/haskell_module/repl/haskell_module_repl_cross_library_deps_test/package-a,tests/haskell_module/repl/haskell_module_repl_cross_library_deps_test/package-b,tests/haskell_module/repl/haskell_module_repl_test,tests/library-external-workspace/repo,tests/repl-targets/hs_bin_repl_test,tests/repl-targets/hs_lib_repl_test,tests/stack-snapshot-deps/hs_override_stack_test,tutorial,tutorial/lib,tutorial/main,tutorial/tools/build_rules
125-
query --deleted_packages=examples,examples/arm,examples/cat_hs,examples/cat_hs/exec/cat_hs,examples/cat_hs/lib/args,examples/cat_hs/lib/cat,examples/primitive,examples/rts,examples/transformers,examples/vector,tests/c2hs/repo,tests/haskell_module/repl/haskell_module_repl_cross_library_deps_test/package-a,tests/haskell_module/repl/haskell_module_repl_cross_library_deps_test/package-b,tests/haskell_module/repl/haskell_module_repl_test,tests/library-external-workspace/repo,tests/repl-targets/hs_bin_repl_test,tests/repl-targets/hs_lib_repl_test,tests/stack-snapshot-deps/hs_override_stack_test,tutorial,tutorial/lib,tutorial/main,tutorial/tools/build_rules
126-
127-
128-
# User Configuration
129-
# ------------------
130-
try-import %workspace%/.bazelrc.local
1+
import %workspace%/.bazelrc.common
2+
import %workspace%/.bazelrc.bzlmod

.bazelrc.bzlmod

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
common:bzlmod --experimental_enable_bzlmod
2+
common:bzlmod --registry=file:%workspace%/registry --registry=https://bcr.bazel.build

.bazelrc.common

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# See https://docs.bazel.build/versions/master/user-manual.html#bazelrc.
2+
3+
# Global Configuration
4+
# --------------------
5+
6+
# Force TLS 1.2. With TLS 1.3, we run into the following error on Darwin.
7+
# > No subject alternative DNS name matching github-releases.githubusercontent.com found.
8+
# It looks like this is a result of SNI being broken on TLS 1.3 which results
9+
# in us getting a certificate for githubassets.com instead.
10+
#
11+
# Taken from https://github.com/digital-asset/daml/pull/8697.
12+
startup --host_jvm_args=-Djdk.tls.client.protocols=TLSv1.2
13+
14+
common --incompatible_require_linker_input_cc_api
15+
16+
common --incompatible_disallow_empty_glob=true
17+
18+
# test environment does not propagate locales by default some tests reads files
19+
# written in UTF8, we need to propagate the correct environment variables, such
20+
# as LOCALE_ARCHIVE We also need to setup an utf8 locale
21+
test --test_env=LANG=C.UTF-8 --test_env=LOCALE_ARCHIVE
22+
23+
# Platform / Toolchain Selection
24+
# ------------------------------
25+
build:linux-nixpkgs --config=nixpkgs
26+
build:macos-nixpkgs --config=nixpkgs
27+
build:nixpkgs --host_platform=@rules_nixpkgs_core//platforms:host
28+
29+
# Build and Test Filters
30+
# ----------------------
31+
# Note tag filters do not compose. If you wish to augment these filters on the
32+
# command-line you have to repeat the full list.
33+
build:linux-bindist --build_tag_filters -requires_nix,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
34+
build:linux-bindist --test_tag_filters -requires_nix,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
35+
36+
build:macos-nixpkgs --build_tag_filters -dont_test_on_darwin
37+
build:macos-nixpkgs --test_tag_filters -dont_test_on_darwin
38+
39+
build:macos-bindist --build_tag_filters -requires_nix,-dont_test_on_darwin,-dont_test_on_darwin_with_bindist,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
40+
build:macos-bindist --test_tag_filters -requires_nix,-dont_test_on_darwin,-dont_test_on_darwin_with_bindist,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
41+
42+
build:windows-bindist --build_tag_filters -requires_nix,-dont_test_on_windows,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
43+
build:windows-bindist --test_tag_filters -requires_nix,-dont_test_on_windows,-requires_lz4,-requires_shellcheck,-requires_threaded_rts,-dont_test_with_bindist
44+
45+
# CI Configuration
46+
# ----------------
47+
common:ci --config=ci-common
48+
build:ci --config=remote-cache
49+
50+
common:ci-common --color=no
51+
52+
build:ci-common --loading_phase_threads=1
53+
build:ci-common --verbose_failures
54+
# Make sure we don't rely on the names of convenience symlinks because those
55+
# can be changed by user.
56+
build:ci-common --symlink_prefix=bazel-ci-
57+
build:ci-common --repository_cache=~/repo-cache/
58+
build:ci-common --experimental_repository_cache_hardlinks
59+
60+
# Use a remote cache during CI
61+
build:ci-common --bes_results_url=https://app.buildbuddy.io/invocation/
62+
build:ci-common --bes_backend=grpcs://remote.buildbuddy.io
63+
build:ci-windows-bindist --bes_upload_mode=wait_for_upload_complete --bes_timeout=60s
64+
build:remote-cache --remote_cache=grpcs://remote.buildbuddy.io
65+
build:ci-common --remote_timeout=3600
66+
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
67+
# See https://github.com/tweag/rules_haskell/issues/1498.
68+
build:ci-common --keep_backend_build_event_connections_alive=false
69+
70+
test:ci-common --test_output=errors
71+
72+
build:ci-linux-bindist --config=linux-bindist
73+
build:ci-linux-nixpkgs --config=linux-nixpkgs
74+
build:ci-macos-bindist --config=macos-bindist
75+
build:ci-macos-nixpkgs --config=macos-nixpkgs
76+
build:ci-windows-bindist --config=windows-bindist
77+
build:ci-windows-bindist-rules-haskell --config=ci-windows-bindist
78+
build:ci-windows-bindist-rules-haskell-tests --config=ci-windows-bindist
79+
80+
# Windows is prone to leaking absolute paths into the remote cache which can
81+
# poison the cache, so we do not share the cache between different modules.
82+
# Increment these numbers to use a fresh cache.
83+
# Errors of the following form might indicate such an issue:
84+
#
85+
# ERROR: D:/a/rules_haskell/rules_haskell/tests/runfiles/BUILD.bazel:20:10: Compiling tests/runfiles/main.cc failed: undeclared inclusion(s) in rule '//tests/runfiles:cc-runner':
86+
# this rule is missing dependency declarations for the following files included by 'tests/runfiles/main.cc':
87+
# '.../execroot/rules_haskell/external/rules_haskell_ghc_windows_amd64/mingw/include/c++/9.2.0/cstdlib'
88+
# '.../execroot/rules_haskell/external/rules_haskell_ghc_windows_amd64/mingw/include/c++/9.2.0/x86_64-w64-mingw32/bits/c++config.h'
89+
build:ci-windows-bindist-rules-haskell --remote_default_exec_properties=cache-silo-key=windows-rules-haskell-v0
90+
build:ci-windows-bindist-rules-haskell-tests --remote_default_exec_properties=cache-silo-key=windows-rules-haskell-tests-v0
91+
92+
# XXX: @com_google_protobuf sets `use_default_shell_env = True`, so we enable
93+
# strict action env to avoid changes in `PATH` invalidating the cache.
94+
build:linux-bindist --experimental_strict_action_env
95+
build:macos-bindist --experimental_strict_action_env
96+
build:windows-bindist --experimental_strict_action_env
97+
98+
# Note [backward compatible options]
99+
build:linux-bindist --incompatible_enable_cc_toolchain_resolution
100+
build:macos-bindist --incompatible_enable_cc_toolchain_resolution
101+
build:linux-nixpkgs --incompatible_enable_cc_toolchain_resolution
102+
build:macos-nixpkgs --incompatible_enable_cc_toolchain_resolution
103+
build:windows-bindist --incompatible_enable_cc_toolchain_resolution
104+
105+
# Blocked by https://github.com/bazelbuild/bazel/issues/11704
106+
#build:ci --incompatible_load_cc_rules_from_bzl
107+
108+
# This flag will become the default in a later version of bazel
109+
# See https://github.com/bazelbuild/bazel/issues/8922
110+
build:ci --incompatible_load_proto_rules_from_bzl
111+
112+
# This flag will become the default in bazel 6
113+
# https://github.com/tweag/rules_haskell/issues/1657
114+
build: --incompatible_override_toolchain_transition
115+
116+
coverage --build_tag_filters "coverage-compatible" --test_tag_filters "coverage-compatible" --test_output=all
117+
118+
# To update these lines, execute
119+
# `bazel run @contrib_rules_bazel_integration_test//tools:update_deleted_packages`
120+
build --deleted_packages=examples,examples/arm,examples/cat_hs,examples/cat_hs/exec/cat_hs,examples/cat_hs/lib/args,examples/cat_hs/lib/cat,examples/primitive,examples/rts,examples/transformers,examples/vector,tests/c2hs/repo,tests/haskell_module/repl/haskell_module_repl_cross_library_deps_test/package-a,tests/haskell_module/repl/haskell_module_repl_cross_library_deps_test/package-b,tests/haskell_module/repl/haskell_module_repl_test,tests/library-external-workspace/repo,tests/repl-targets/hs_bin_repl_test,tests/repl-targets/hs_lib_repl_test,tests/stack-snapshot-deps/hs_override_stack_test,tutorial,tutorial/lib,tutorial/main,tutorial/tools/build_rules
121+
query --deleted_packages=examples,examples/arm,examples/cat_hs,examples/cat_hs/exec/cat_hs,examples/cat_hs/lib/args,examples/cat_hs/lib/cat,examples/primitive,examples/rts,examples/transformers,examples/vector,tests/c2hs/repo,tests/haskell_module/repl/haskell_module_repl_cross_library_deps_test/package-a,tests/haskell_module/repl/haskell_module_repl_cross_library_deps_test/package-b,tests/haskell_module/repl/haskell_module_repl_test,tests/library-external-workspace/repo,tests/repl-targets/hs_bin_repl_test,tests/repl-targets/hs_lib_repl_test,tests/stack-snapshot-deps/hs_override_stack_test,tutorial,tutorial/lib,tutorial/main,tutorial/tools/build_rules
122+
123+
# Needed to build @rules_jvm_external//private/tools/java/com/github/bazelbuild/rules_jvm_external/zip (used by //tests/java_classpath)
124+
build:macos-nixpkgs --tool_java_language_version=11
125+
126+
# This flag will become the default in bazel 7
127+
# https://github.com/bazelbuild/bazel/issues/17032
128+
build --incompatible_disable_starlark_host_transitions
129+
130+
# User Configuration
131+
# ------------------
132+
try-import %workspace%/.bazelrc.local

examples/.bazelrc.bzlmod

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
common:bzlmod --experimental_enable_bzlmod
2+
common:bzlmod --registry=file://%workspace%/../registry --registry=https://bcr.bazel.build

examples/.bazelrc.common

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.bazelrc.common

examples/arm/.bazelrc.bzlmod

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
common:bzlmod --experimental_enable_bzlmod
2+
common:bzlmod --registry=file://%workspace%/../../registry --registry=https://bcr.bazel.build

examples/arm/.bazelrc.common

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.bazelrc.common

rules_haskell_tests/.bazelrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
import %workspace%/../.bazelrc
1+
import %workspace%/../.bazelrc.common
2+
import %workspace%/.bazelrc.bzlmod

rules_haskell_tests/.bazelrc.bzlmod

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
common:bzlmod --experimental_enable_bzlmod
2+
common:bzlmod --registry=file:%workspace%/../registry --registry=https://bcr.bazel.build

tutorial/.bazelrc.bzlmod

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
common:bzlmod --experimental_enable_bzlmod
2+
common:bzlmod --registry=file://%workspace%/../registry --registry=https://bcr.bazel.build

tutorial/.bazelrc.common

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.bazelrc.common

0 commit comments

Comments
 (0)