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
8 changes: 7 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
build --host_javabase=@local_jdk//:jdk
build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host
build --compilation_mode opt
run --compilation_mode opt

build --java_runtime_version=11
build --java_language_version=11
build --tool_java_language_version=11
build --tool_java_runtime_version=11
build --experimental_strict_java_deps=off
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bazel complains otherwise that "//jvm-batching:jar" is missing from the direct dependencies of "//jvm-types:jar" even though the dependency is listed there.


#build --build_tag_filters=-only_with_ghc_9_0_1
#build --test_tag_filters=-only_with_ghc_9_0_1

Expand Down
25 changes: 13 additions & 12 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
exports_files(["nixpkgs.nix"])

# gazelle:exclude {benchmarks,examples,jvm-streaming,jvm-batching}
# gazelle:resolve gazelle_cabal jvm @openjdk//:lib

load(
"@bazel_gazelle//:def.bzl",
"DEFAULT_LANGUAGES",
"gazelle",
"gazelle_binary",
)
load(
"@rules_haskell//haskell:defs.bzl",
"ghc_plugin",
Expand All @@ -11,6 +12,11 @@ load(
"haskell_test",
)

exports_files(["nixpkgs.nix"])

# gazelle:exclude {benchmarks,examples,jvm-streaming,jvm-batching}
# gazelle:resolve gazelle_cabal jvm @openjdk//:lib

cc_library(
name = "bctable",
srcs = ["cbits/bctable.c"],
Expand All @@ -28,13 +34,6 @@ ghc_plugin(
deps = [":inline-java"],
)

load(
"@bazel_gazelle//:def.bzl",
"DEFAULT_LANGUAGES",
"gazelle",
"gazelle_binary",
)

gazelle(
name = "gazelle",
gazelle = ":gazelle_binary",
Expand Down Expand Up @@ -90,6 +89,8 @@ haskell_library(
# rule generated from inline-java.cabal by gazelle_cabal
haskell_test(
name = "spec",
# keep
timeout = "short",
srcs = [
"tests/Language/Java/Inline/SafeSpec.hs",
"tests/Language/Java/InlineSpec.hs",
Expand Down
110 changes: 55 additions & 55 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,56 @@ workspace(name = "io_tweag_inline_java")

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


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

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

load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_local_repository",
"nixpkgs_package",
"nixpkgs_python_configure",


http_archive(
name = "io_tweag_rules_nixpkgs",
sha256 = "30271f7bd380e4e20e4d7132c324946c4fdbc31ebe0bbb6638a0f61a37e74397",
strip_prefix = "rules_nixpkgs-0.13.0",
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.13.0/rules_nixpkgs-0.13.0.tar.gz"],
)

http_archive(
name = "rules_nixpkgs_core",
sha256 = "30271f7bd380e4e20e4d7132c324946c4fdbc31ebe0bbb6638a0f61a37e74397",
strip_prefix = "rules_nixpkgs-0.13.0/core",
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.13.0/rules_nixpkgs-0.13.0.tar.gz"],
)


http_archive(
name = "rules_nixpkgs_go",
sha256 = "30271f7bd380e4e20e4d7132c324946c4fdbc31ebe0bbb6638a0f61a37e74397",
strip_prefix = "rules_nixpkgs-0.13.0/toolchains/go",
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.13.0/rules_nixpkgs-0.13.0.tar.gz"],
)


load("@rules_nixpkgs_core//:nixpkgs.bzl", "nixpkgs_local_repository")

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

nixpkgs_python_configure(repository = "@nixpkgs")

nixpkgs_package(
name = "alex",
attribute_path = "haskellPackages.alex",
repository = "@nixpkgs",
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_package",
"nixpkgs_python_configure",
)

#nixpkgs_package(
# name = "stack_ignore_global_hints",
# attribute_path = "stack_ignore_global_hints",
# repository = "@nixpkgs",
#)
#
#load("//:config_settings/setup.bzl", "config_settings")
#config_settings(name = "config_settings")
#load("@config_settings//:info.bzl", "ghc_version")
nixpkgs_python_configure(repository = "@nixpkgs")

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

Expand Down Expand Up @@ -144,7 +155,7 @@ haskell_register_ghc_nixpkgs(
locale_archive = "@glibc_locales//:locale-archive",
repositories = {"nixpkgs": "@nixpkgs"},
version = "9.0.2",
compiler_flags = [
ghcopts = [
"-Werror",
"-Wall",
"-Wcompat",
Expand Down Expand Up @@ -256,49 +267,44 @@ maven_install(

# gazelle setup

http_archive(
name = "rules_nixpkgs_go",
sha256 = "30271f7bd380e4e20e4d7132c324946c4fdbc31ebe0bbb6638a0f61a37e74397",
strip_prefix = "rules_nixpkgs-0.13.0/toolchains/go",
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.13.0/rules_nixpkgs-0.13.0.tar.gz"],
)

http_archive(
name = "io_bazel_rules_go",
sha256 = "f2dcd210c7095febe54b804bb1cd3a58fe8435a909db2ec04e31542631cf715c",
sha256 = "130739704540caa14e77c54810b9f01d6d9ae897d53eedceb40fd6b75efc3c23",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.54.1/rules_go-v0.54.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.54.1/rules_go-v0.54.1.zip",
],
)

load("@rules_nixpkgs_go//:go.bzl", "nixpkgs_go_configure")

nixpkgs_go_configure(repository = "@nixpkgs")


http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
sha256 = "49b14c691ceec841f445f8642d28336e99457d1db162092fd5082351ea302f1d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.44.0/bazel-gazelle-v0.44.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.44.0/bazel-gazelle-v0.44.0.tar.gz",
],
)

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

############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
# The first declaration of an external repository "wins".
############################################################

load("@rules_nixpkgs_go//:go.bzl", "nixpkgs_go_configure")

nixpkgs_go_configure(
repository = "@nixpkgs",
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()


# go_repository added due to: https://github.com/bazelbuild/bazel-gazelle/issues/1217
go_repository(
name = "org_golang_x_xerrors",
importpath = "golang.org/x/xerrors",
sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
version = "v0.0.0-20200804184101-5ec99f83aff1",
)

gazelle_dependencies()


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

go_repository(
name = "org_golang_x_xerrors",
importpath = "golang.org/x/xerrors",
sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
version = "v0.0.0-20200804184101-5ec99f83aff1",
)
2 changes: 1 addition & 1 deletion benchmarks/wizzardo-http/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ haskell_binary(
name = "wizzardo-http-benchmark",
srcs = glob(['src/main/**/*.hs']),
extra_srcs = ["@openjdk//:rpath"],
compiler_flags = [
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-threaded",
"-rtsopts",
Expand Down
2 changes: 1 addition & 1 deletion examples/classpath/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ haskell_binary(
name = "classpath",
srcs = ['Main.hs'],
extra_srcs = ["@openjdk//:rpath"],
compiler_flags = [
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-threaded",
],
Expand Down
2 changes: 1 addition & 1 deletion examples/directory-server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ haskell_binary(
name = "directory-server",
srcs = glob(['src/**/*.hs']),
extra_srcs = ["@openjdk//:rpath"],
compiler_flags = [
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-threaded",
],
Expand Down
2 changes: 1 addition & 1 deletion examples/hello/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ haskell_binary(
name = "hello-java",
srcs = ['hello-java.hs'],
extra_srcs = ["@openjdk//:rpath"],
compiler_flags = [
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-threaded",
],
Expand Down
2 changes: 1 addition & 1 deletion jvm-batching/benchmarks/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ haskell_binary(
name = "bench",
srcs = glob(['**/*.hs']),
extra_srcs = ["@openjdk//:rpath"],
compiler_flags = [
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-threaded",
],
Expand Down
2 changes: 1 addition & 1 deletion jvm-batching/src/test/haskell/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ haskell_test(
name = "spec",
srcs = glob(["**/*.hs"]),
extra_srcs = ["@openjdk//:rpath"],
compiler_flags = [
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-DHSPEC_DISCOVER=$(location @hspec-discover//:bin)",
"-threaded",
Expand Down
2 changes: 1 addition & 1 deletion jvm-streaming/benchmarks/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ haskell_binary(
srcs = glob(['**/*.hs'], exclude = ["Main.hs"]),
main_file = "MainBazel.hs",
extra_srcs = ["@openjdk//:rpath"],
compiler_flags = [
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-threaded",
],
Expand Down
2 changes: 1 addition & 1 deletion jvm-streaming/src/test/haskell/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ haskell_test(
srcs = glob(["**/*.hs"], exclude = ["Main.hs"]),
main_file = "MainBazel.hs",
extra_srcs = ["@openjdk//:rpath"],
compiler_flags = [
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-DHSPEC_DISCOVER=$(location @hspec-discover//:bin)",
"-threaded",
Expand Down
4 changes: 2 additions & 2 deletions jvm-types/src/test/haskell/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ haskell_test(
name = "spec",
size = "small",
srcs = glob(["**/*.hs"]),
compiler_flags = [
extra_srcs = ["@openjdk//:rpath"],
ghcopts = [
"-optl-Wl,@$(location @openjdk//:rpath)",
"-DHSPEC_DISCOVER=$(location @hspec-discover//:bin)",
"-threaded",
],
extra_srcs = ["@openjdk//:rpath"],
plugins = ["//:inline-java-plugin"],
tools = ["@hspec-discover//:bin"],
deps = [
Expand Down
2 changes: 2 additions & 0 deletions jvm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ haskell_library(
# rule generated from jvm/jvm.cabal by gazelle_cabal
haskell_test(
name = "spec",
# keep
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment # keep is ambiguous; consider clarifying its intent or removing it if it’s no longer needed.

Copilot uses AI. Check for mistakes.
timeout = "short",
srcs = [
"tests/Language/JavaSpec.hs",
"tests/Main.hs",
Expand Down
9 changes: 3 additions & 6 deletions nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Trying to workaround
# https://github.com/NixOS/nixpkgs/issues/105573
#
# by going to a commit before the one introducing the regression.
args:
let pkgs = import (fetchTarball {
sha256 = "01j7nhxbb2kjw38yk4hkjkkbmz50g3br7fgvad6b1cjpdvfsllds";
url = "https://github.com/tweag/nixpkgs/archive/73ad5f9e147.tar.gz";}) args;
sha256 = "0dcslr2lwfaclfl4pmbwb3yw27bnvwlqiif394d3d66vyd163dvy";
url = "https://github.com/NixOS/nixpkgs/archive/3e3afe5174c561dee0df6f2c2b2236990146329f.tar.gz";
}) args;
stack_ignore_global_hints = pkgs.writeScriptBin "stack" ''
#!${pkgs.stdenv.shell}
# Skips the --global-hints parameter to stack. This is
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mkShell {
LANG="C.UTF-8";

buildInputs = [
bazel_4
bazel_6
git
gnused
nix
Expand Down
Loading