diff --git a/.bazelrc b/.bazelrc index 0a7ebfcd..99a93368 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 + #build --build_tag_filters=-only_with_ghc_9_0_1 #build --test_tag_filters=-only_with_ghc_9_0_1 diff --git a/BUILD.bazel b/BUILD.bazel index 11c324dc..14869f9f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -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", @@ -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"], @@ -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", @@ -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", diff --git a/WORKSPACE b/WORKSPACE index f8eb868a..fd4efc8c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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") @@ -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", @@ -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() @@ -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", -) diff --git a/benchmarks/wizzardo-http/BUILD.bazel b/benchmarks/wizzardo-http/BUILD.bazel index 0412450f..65a66b7e 100644 --- a/benchmarks/wizzardo-http/BUILD.bazel +++ b/benchmarks/wizzardo-http/BUILD.bazel @@ -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", diff --git a/examples/classpath/BUILD.bazel b/examples/classpath/BUILD.bazel index f583d25d..4d03c7a2 100644 --- a/examples/classpath/BUILD.bazel +++ b/examples/classpath/BUILD.bazel @@ -18,7 +18,7 @@ haskell_binary( name = "classpath", srcs = ['Main.hs'], extra_srcs = ["@openjdk//:rpath"], - compiler_flags = [ + ghcopts = [ "-optl-Wl,@$(location @openjdk//:rpath)", "-threaded", ], diff --git a/examples/directory-server/BUILD.bazel b/examples/directory-server/BUILD.bazel index 4462b0a8..72bd72ad 100644 --- a/examples/directory-server/BUILD.bazel +++ b/examples/directory-server/BUILD.bazel @@ -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", ], diff --git a/examples/hello/BUILD.bazel b/examples/hello/BUILD.bazel index a68aa23b..654d876c 100644 --- a/examples/hello/BUILD.bazel +++ b/examples/hello/BUILD.bazel @@ -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", ], diff --git a/jvm-batching/benchmarks/BUILD.bazel b/jvm-batching/benchmarks/BUILD.bazel index 4b4532c7..479cd9b8 100644 --- a/jvm-batching/benchmarks/BUILD.bazel +++ b/jvm-batching/benchmarks/BUILD.bazel @@ -7,7 +7,7 @@ haskell_binary( name = "bench", srcs = glob(['**/*.hs']), extra_srcs = ["@openjdk//:rpath"], - compiler_flags = [ + ghcopts = [ "-optl-Wl,@$(location @openjdk//:rpath)", "-threaded", ], diff --git a/jvm-batching/src/test/haskell/BUILD.bazel b/jvm-batching/src/test/haskell/BUILD.bazel index a827be0d..c66fd0ce 100644 --- a/jvm-batching/src/test/haskell/BUILD.bazel +++ b/jvm-batching/src/test/haskell/BUILD.bazel @@ -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", diff --git a/jvm-streaming/benchmarks/BUILD.bazel b/jvm-streaming/benchmarks/BUILD.bazel index bcc08ead..65212d3f 100644 --- a/jvm-streaming/benchmarks/BUILD.bazel +++ b/jvm-streaming/benchmarks/BUILD.bazel @@ -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", ], diff --git a/jvm-streaming/src/test/haskell/BUILD.bazel b/jvm-streaming/src/test/haskell/BUILD.bazel index 8b945c99..d92f704a 100644 --- a/jvm-streaming/src/test/haskell/BUILD.bazel +++ b/jvm-streaming/src/test/haskell/BUILD.bazel @@ -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", diff --git a/jvm-types/src/test/haskell/BUILD.bazel b/jvm-types/src/test/haskell/BUILD.bazel index ceb9c385..f4d7fe89 100644 --- a/jvm-types/src/test/haskell/BUILD.bazel +++ b/jvm-types/src/test/haskell/BUILD.bazel @@ -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 = [ diff --git a/jvm/BUILD.bazel b/jvm/BUILD.bazel index 9e90d944..f5a08fec 100644 --- a/jvm/BUILD.bazel +++ b/jvm/BUILD.bazel @@ -36,6 +36,8 @@ haskell_library( # rule generated from jvm/jvm.cabal by gazelle_cabal haskell_test( name = "spec", + # keep + timeout = "short", srcs = [ "tests/Language/JavaSpec.hs", "tests/Main.hs", diff --git a/nixpkgs.nix b/nixpkgs.nix index de81a1fc..55470ff4 100644 --- a/nixpkgs.nix +++ b/nixpkgs.nix @@ -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 diff --git a/shell.nix b/shell.nix index f8f7c551..5ea1d9a0 100644 --- a/shell.nix +++ b/shell.nix @@ -13,7 +13,7 @@ mkShell { LANG="C.UTF-8"; buildInputs = [ - bazel_4 + bazel_6 git gnused nix