Skip to content

Commit b2d487a

Browse files
Merge pull request #202 from tweag/fd/bazel6
Update build configuration to bazel 6
2 parents 4055ed9 + f5ec9f0 commit b2d487a

File tree

15 files changed

+91
-85
lines changed

15 files changed

+91
-85
lines changed

.bazelrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
build --host_javabase=@local_jdk//:jdk
21
build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host
32
build --compilation_mode opt
43
run --compilation_mode opt
4+
5+
build --java_runtime_version=11
6+
build --java_language_version=11
7+
build --tool_java_language_version=11
8+
build --tool_java_runtime_version=11
9+
build --experimental_strict_java_deps=off
10+
511
#build --build_tag_filters=-only_with_ghc_9_0_1
612
#build --test_tag_filters=-only_with_ghc_9_0_1
713

BUILD.bazel

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
exports_files(["nixpkgs.nix"])
2-
3-
# gazelle:exclude {benchmarks,examples,jvm-streaming,jvm-batching}
4-
# gazelle:resolve gazelle_cabal jvm @openjdk//:lib
5-
1+
load(
2+
"@bazel_gazelle//:def.bzl",
3+
"DEFAULT_LANGUAGES",
4+
"gazelle",
5+
"gazelle_binary",
6+
)
67
load(
78
"@rules_haskell//haskell:defs.bzl",
89
"ghc_plugin",
@@ -11,6 +12,11 @@ load(
1112
"haskell_test",
1213
)
1314

15+
exports_files(["nixpkgs.nix"])
16+
17+
# gazelle:exclude {benchmarks,examples,jvm-streaming,jvm-batching}
18+
# gazelle:resolve gazelle_cabal jvm @openjdk//:lib
19+
1420
cc_library(
1521
name = "bctable",
1622
srcs = ["cbits/bctable.c"],
@@ -28,13 +34,6 @@ ghc_plugin(
2834
deps = [":inline-java"],
2935
)
3036

31-
load(
32-
"@bazel_gazelle//:def.bzl",
33-
"DEFAULT_LANGUAGES",
34-
"gazelle",
35-
"gazelle_binary",
36-
)
37-
3837
gazelle(
3938
name = "gazelle",
4039
gazelle = ":gazelle_binary",
@@ -90,6 +89,8 @@ haskell_library(
9089
# rule generated from inline-java.cabal by gazelle_cabal
9190
haskell_test(
9291
name = "spec",
92+
# keep
93+
timeout = "short",
9394
srcs = [
9495
"tests/Language/Java/Inline/SafeSpec.hs",
9596
"tests/Language/Java/InlineSpec.hs",

WORKSPACE

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,56 @@ workspace(name = "io_tweag_inline_java")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5+
56
http_archive(
67
name = "rules_haskell",
7-
sha256 = "2b36e26fde296dc9fbaeed087c898fdce23af0247592e897c317d19345b0e259",
8-
strip_prefix = "rules_haskell-7a7f8545789dc4f3bc0780d5725e1337bb494ea6",
9-
urls = ["https://github.com/tweag/rules_haskell/archive/7a7f8545789dc4f3bc0780d5725e1337bb494ea6.zip"],
8+
sha256 = "4cae22bc84f327bf3cb7605021c3663160ff6bc8a0b7b6266062366bcbd19e79",
9+
strip_prefix = "rules_haskell-1.0",
10+
urls = ["https://github.com/tweag/rules_haskell/releases/download/v1.0/rules_haskell-1.0.tar.gz"],
1011
)
1112

1213
load("@rules_haskell//haskell:repositories.bzl", "rules_haskell_dependencies")
1314
rules_haskell_dependencies()
1415

15-
load(
16-
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
17-
"nixpkgs_local_repository",
18-
"nixpkgs_package",
19-
"nixpkgs_python_configure",
16+
17+
18+
http_archive(
19+
name = "io_tweag_rules_nixpkgs",
20+
sha256 = "30271f7bd380e4e20e4d7132c324946c4fdbc31ebe0bbb6638a0f61a37e74397",
21+
strip_prefix = "rules_nixpkgs-0.13.0",
22+
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.13.0/rules_nixpkgs-0.13.0.tar.gz"],
23+
)
24+
25+
http_archive(
26+
name = "rules_nixpkgs_core",
27+
sha256 = "30271f7bd380e4e20e4d7132c324946c4fdbc31ebe0bbb6638a0f61a37e74397",
28+
strip_prefix = "rules_nixpkgs-0.13.0/core",
29+
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.13.0/rules_nixpkgs-0.13.0.tar.gz"],
2030
)
2131

32+
33+
http_archive(
34+
name = "rules_nixpkgs_go",
35+
sha256 = "30271f7bd380e4e20e4d7132c324946c4fdbc31ebe0bbb6638a0f61a37e74397",
36+
strip_prefix = "rules_nixpkgs-0.13.0/toolchains/go",
37+
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.13.0/rules_nixpkgs-0.13.0.tar.gz"],
38+
)
39+
40+
41+
load("@rules_nixpkgs_core//:nixpkgs.bzl", "nixpkgs_local_repository")
42+
2243
nixpkgs_local_repository(
2344
name = "nixpkgs",
2445
nix_file = "//:nixpkgs.nix",
2546
)
2647

27-
nixpkgs_python_configure(repository = "@nixpkgs")
28-
29-
nixpkgs_package(
30-
name = "alex",
31-
attribute_path = "haskellPackages.alex",
32-
repository = "@nixpkgs",
48+
load(
49+
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
50+
"nixpkgs_package",
51+
"nixpkgs_python_configure",
3352
)
3453

35-
#nixpkgs_package(
36-
# name = "stack_ignore_global_hints",
37-
# attribute_path = "stack_ignore_global_hints",
38-
# repository = "@nixpkgs",
39-
#)
40-
#
41-
#load("//:config_settings/setup.bzl", "config_settings")
42-
#config_settings(name = "config_settings")
43-
#load("@config_settings//:info.bzl", "ghc_version")
54+
nixpkgs_python_configure(repository = "@nixpkgs")
4455

4556
load("@rules_haskell//haskell:cabal.bzl", "stack_snapshot")
4657

@@ -144,7 +155,7 @@ haskell_register_ghc_nixpkgs(
144155
locale_archive = "@glibc_locales//:locale-archive",
145156
repositories = {"nixpkgs": "@nixpkgs"},
146157
version = "9.0.2",
147-
compiler_flags = [
158+
ghcopts = [
148159
"-Werror",
149160
"-Wall",
150161
"-Wcompat",
@@ -256,49 +267,44 @@ maven_install(
256267

257268
# gazelle setup
258269

259-
http_archive(
260-
name = "rules_nixpkgs_go",
261-
sha256 = "30271f7bd380e4e20e4d7132c324946c4fdbc31ebe0bbb6638a0f61a37e74397",
262-
strip_prefix = "rules_nixpkgs-0.13.0/toolchains/go",
263-
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.13.0/rules_nixpkgs-0.13.0.tar.gz"],
264-
)
265-
266270
http_archive(
267271
name = "io_bazel_rules_go",
268-
sha256 = "f2dcd210c7095febe54b804bb1cd3a58fe8435a909db2ec04e31542631cf715c",
272+
sha256 = "130739704540caa14e77c54810b9f01d6d9ae897d53eedceb40fd6b75efc3c23",
269273
urls = [
270-
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
271-
"https://github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
274+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.54.1/rules_go-v0.54.1.zip",
275+
"https://github.com/bazelbuild/rules_go/releases/download/v0.54.1/rules_go-v0.54.1.zip",
272276
],
273277
)
274278

279+
load("@rules_nixpkgs_go//:go.bzl", "nixpkgs_go_configure")
280+
281+
nixpkgs_go_configure(repository = "@nixpkgs")
282+
283+
275284
http_archive(
276285
name = "bazel_gazelle",
277-
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
286+
sha256 = "49b14c691ceec841f445f8642d28336e99457d1db162092fd5082351ea302f1d",
278287
urls = [
279-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
280-
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
288+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.44.0/bazel-gazelle-v0.44.0.tar.gz",
289+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.44.0/bazel-gazelle-v0.44.0.tar.gz",
281290
],
282291
)
283292

284293
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
285294

286-
############################################################
287-
# Define your own dependencies here using go_repository.
288-
# Else, dependencies declared by rules_go/gazelle will be used.
289-
# The first declaration of an external repository "wins".
290-
############################################################
291-
292-
load("@rules_nixpkgs_go//:go.bzl", "nixpkgs_go_configure")
293-
294-
nixpkgs_go_configure(
295-
repository = "@nixpkgs",
296-
)
297-
298295
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
299296

300297
go_rules_dependencies()
301298

299+
300+
# go_repository added due to: https://github.com/bazelbuild/bazel-gazelle/issues/1217
301+
go_repository(
302+
name = "org_golang_x_xerrors",
303+
importpath = "golang.org/x/xerrors",
304+
sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
305+
version = "v0.0.0-20200804184101-5ec99f83aff1",
306+
)
307+
302308
gazelle_dependencies()
303309

304310

@@ -313,9 +319,3 @@ load("@rules_haskell//haskell:cabal.bzl", "stack_snapshot")
313319
load("@io_tweag_gazelle_cabal//:defs.bzl", "gazelle_cabal_dependencies")
314320
gazelle_cabal_dependencies()
315321

316-
go_repository(
317-
name = "org_golang_x_xerrors",
318-
importpath = "golang.org/x/xerrors",
319-
sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
320-
version = "v0.0.0-20200804184101-5ec99f83aff1",
321-
)

benchmarks/wizzardo-http/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ haskell_binary(
2828
name = "wizzardo-http-benchmark",
2929
srcs = glob(['src/main/**/*.hs']),
3030
extra_srcs = ["@openjdk//:rpath"],
31-
compiler_flags = [
31+
ghcopts = [
3232
"-optl-Wl,@$(location @openjdk//:rpath)",
3333
"-threaded",
3434
"-rtsopts",

examples/classpath/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ haskell_binary(
1818
name = "classpath",
1919
srcs = ['Main.hs'],
2020
extra_srcs = ["@openjdk//:rpath"],
21-
compiler_flags = [
21+
ghcopts = [
2222
"-optl-Wl,@$(location @openjdk//:rpath)",
2323
"-threaded",
2424
],

examples/directory-server/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ haskell_binary(
77
name = "directory-server",
88
srcs = glob(['src/**/*.hs']),
99
extra_srcs = ["@openjdk//:rpath"],
10-
compiler_flags = [
10+
ghcopts = [
1111
"-optl-Wl,@$(location @openjdk//:rpath)",
1212
"-threaded",
1313
],

examples/hello/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ haskell_binary(
77
name = "hello-java",
88
srcs = ['hello-java.hs'],
99
extra_srcs = ["@openjdk//:rpath"],
10-
compiler_flags = [
10+
ghcopts = [
1111
"-optl-Wl,@$(location @openjdk//:rpath)",
1212
"-threaded",
1313
],

jvm-batching/benchmarks/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ haskell_binary(
77
name = "bench",
88
srcs = glob(['**/*.hs']),
99
extra_srcs = ["@openjdk//:rpath"],
10-
compiler_flags = [
10+
ghcopts = [
1111
"-optl-Wl,@$(location @openjdk//:rpath)",
1212
"-threaded",
1313
],

jvm-batching/src/test/haskell/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ haskell_test(
77
name = "spec",
88
srcs = glob(["**/*.hs"]),
99
extra_srcs = ["@openjdk//:rpath"],
10-
compiler_flags = [
10+
ghcopts = [
1111
"-optl-Wl,@$(location @openjdk//:rpath)",
1212
"-DHSPEC_DISCOVER=$(location @hspec-discover//:bin)",
1313
"-threaded",

jvm-streaming/benchmarks/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ haskell_binary(
88
srcs = glob(['**/*.hs'], exclude = ["Main.hs"]),
99
main_file = "MainBazel.hs",
1010
extra_srcs = ["@openjdk//:rpath"],
11-
compiler_flags = [
11+
ghcopts = [
1212
"-optl-Wl,@$(location @openjdk//:rpath)",
1313
"-threaded",
1414
],

0 commit comments

Comments
 (0)