Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
decbfa8
feat: Enable bzlmod and disable workspace
wojciechormaniec-da Jan 23, 2026
dba8f8e
feat: Add `rules_haskell` in version `1.0`
wojciechormaniec-da Jan 23, 2026
a938f2b
feat: Attach old scripts for `build_environment`, `os_info`, `scala_v…
wojciechormaniec-da Jan 23, 2026
5853e81
feat: Add `bazel_skylib` in version `1.9.0`
wojciechormaniec-da Jan 26, 2026
b5c1dee
feat: Add `rules_scala` in version `7.1.6`
wojciechormaniec-da Jan 26, 2026
2de7d6e
fix: Rename `io_bazel_rules_scala` to new name - `rules_scala`
wojciechormaniec-da Jan 26, 2026
fa2b1bc
fix: Correctly point to temporary file load for `build_environment`, …
wojciechormaniec-da Jan 26, 2026
2b11cb3
feat: Add `gazelle` in version `0.47.0`
wojciechormaniec-da Jan 26, 2026
be0281c
feat: Add `protobuf` in version `33.4`
wojciechormaniec-da Jan 26, 2026
457ce93
feat: Add `rules_go` in version `0.59.0`
wojciechormaniec-da Jan 26, 2026
44bc996
fix: Rename `io_bazel_rules_go` to new name - `rules_go`
wojciechormaniec-da Jan 26, 2026
f7cf0aa
fix: Rename `bazel_gazelle` to new name - `gazelle`
wojciechormaniec-da Jan 26, 2026
8c9db93
feat: Add `rules_sh` in version `0.5.0`
wojciechormaniec-da Jan 26, 2026
faa89ef
fix: Use new `rules_proto` (`protobuf`) library
wojciechormaniec-da Jan 26, 2026
656af05
feat: Add `buildifier_prebuilt` in version `8.2.1.1` and replace old …
wojciechormaniec-da Jan 26, 2026
dd87c26
query: Disable nodejs targets until full refactor to `rules_js`
wojciechormaniec-da Jan 26, 2026
ae22151
tmp: Add temporary stackage workaround
wojciechormaniec-da Jan 27, 2026
935d3ad
feat: Add `zlib` in version `1.3.1.bcr.8`
wojciechormaniec-da Jan 27, 2026
c02033f
feat: Add `rules_pkg` in version `1.2.0`
wojciechormaniec-da Jan 27, 2026
c2108c4
feat: Add `google_bazel_common` in version `0.0.1`
wojciechormaniec-da Jan 27, 2026
39cd37a
fix: Rename `com_github_google_bazel_common` to new name - `google_ba…
wojciechormaniec-da Jan 27, 2026
0af3d45
feat: Add `bazel_jar_jar` in version `0.1.14`
wojciechormaniec-da Jan 27, 2026
27ab549
feat: Add `rules_cc` in version `0.2.16`
wojciechormaniec-da Jan 27, 2026
00beaca
fix: Remove unused `load(...)`
wojciechormaniec-da Jan 27, 2026
9f3db30
fix: Rename `io_bazel_rules_scala` to new name - `rules_scala`
wojciechormaniec-da Jan 27, 2026
c97bae3
fix: Use `@protobuf` instead of `@rules_proto`
wojciechormaniec-da Jan 27, 2026
a90a1f2
tmp: Disable haskell temporarily
wojciechormaniec-da Jan 28, 2026
fe87b2e
tmp: Add empty implementation for new Haskell extension
wojciechormaniec-da Jan 29, 2026
e990e29
fix: Change name of `stack_snapshot.yaml` to `stackage_snapshot.yaml`…
wojciechormaniec-da Jan 29, 2026
47f5721
feat: Add working? Cabal instance
wojciechormaniec-da Jan 30, 2026
c1d04dc
feat: Add working? stackage repo
wojciechormaniec-da Jan 30, 2026
d71caf7
feat: Enable `lsp-types` in stackage (with custom patch)
wojciechormaniec-da Feb 18, 2026
e39f8e2
feat: Add support for new `daml_versions_repo`
wojciechormaniec-da Feb 18, 2026
cc34f5b
feat: Add `rules_java` in version `9.5.0`
wojciechormaniec-da Feb 18, 2026
6f12590
fix: Apply correct name for `daml_version_data` from `daml_version_repo`
wojciechormaniec-da Feb 18, 2026
9c90ca2
chore: Minor code cleanup
wojciechormaniec-da Feb 18, 2026
66eb7da
feat: Add gzip and tar from `dev_env`
wojciechormaniec-da Feb 18, 2026
c209917
feat: Add `patchelf` in version `0.18.0.bcr.1`
wojciechormaniec-da Feb 18, 2026
909b425
feat: Add `tar.bzl` in version `0.8.1` and `pigz` in version `2.8.bcr.1`
wojciechormaniec-da Feb 20, 2026
9aedd90
feat: Add first haskell packages
wojciechormaniec-da Feb 20, 2026
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
1 change: 0 additions & 1 deletion sdk/.bazeliskrc

This file was deleted.

3 changes: 2 additions & 1 deletion sdk/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
common --noenable_bzlmod
common --enable_bzlmod
common --noenable_workspace

# Bazel distributed cache, can be temporarily disabled by passing the following
# flag: --noremote_accept_cached
Expand Down
1 change: 1 addition & 0 deletions sdk/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.2.1
5 changes: 5 additions & 0 deletions sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# This should be later on unignored, for now it will just make a mess
# in commit history
# Refer to: https://bazel.build/external/lockfile#best-practices
MODULE.bazel.lock

# private configuration
.envrc.private

Expand Down
39 changes: 17 additions & 22 deletions sdk/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -166,42 +166,37 @@ exports_files([
])

# Buildifier.

load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")

buildifier_excluded_patterns = [
"./3rdparty/haskell/c2hs-package.bzl",
"./3rdparty/haskell/network-package.bzl",
"**/node_modules/*",
]

# Run this to check if BUILD files are well-formatted.
buildifier(
alias(
name = "buildifier",
exclude_patterns = buildifier_excluded_patterns,
mode = "check",
actual = "@buildifier_prebuilt//:buildifier",
)

# Run this to fix the errors in BUILD files.
buildifier(
alias(
name = "buildifier-fix",
exclude_patterns = buildifier_excluded_patterns,
mode = "fix",
verbose = True,
actual = "@buildifier_prebuilt//:buildifier.fix",
)

# TODO: Enable it later with buildifier prebuilt: `bazel run @buildifier_prebuilt//:buildifier -- "$@"`
# Run by the git pre-commit hook
genrule(
name = "buildifier-pre-commit",
outs = ["buildifier-hook"],
cmd = """cat <<'EOF' > "$@"
# !/usr/bin/env bash
exec "$(execpath @com_github_bazelbuild_buildtools//buildifier)" "$$@"
EOF
""",
executable = True,
tools = ["@com_github_bazelbuild_buildtools//buildifier"],
)
# genrule(
# name = "buildifier-pre-commit",
# outs = ["buildifier-hook"],
# cmd = """cat <<'EOF' > "$@"
# # !/usr/bin/env bash
# exec "$(execpath @com_github_bazelbuild_buildtools//buildifier)" "$$@"
# EOF
# """,
# executable = True,
# tools = ["@com_github_bazelbuild_buildtools//buildifier"],
# )

# Default target for da-ghci, da-ghcid.
da_haskell_repl(
Expand Down Expand Up @@ -231,7 +226,7 @@ da_haskell_repl(
],
)

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

gazelle(
name = "gazelle-update-repos",
Expand Down
89 changes: 89 additions & 0 deletions sdk/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
bazel_dep(name = "bazel_jar_jar", version = "0.1.14")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.1")
bazel_dep(name = "gazelle", version = "0.47.0")
bazel_dep(name = "google_bazel_common", version = "0.0.1")
bazel_dep(name = "protobuf", version = "33.4")
bazel_dep(name = "rules_cc", version = "0.2.16")
bazel_dep(name = "rules_go", version = "0.59.0")
bazel_dep(name = "rules_haskell", version = "1.0")
bazel_dep(name = "rules_java", version = "9.5.0")
bazel_dep(name = "rules_pkg", version = "1.2.0")
bazel_dep(name = "rules_scala", version = "7.1.6")
bazel_dep(name = "rules_sh", version = "0.5.0")
bazel_dep(name = "zlib", version = "1.3.1.bcr.8")

bazel_dep(name = "patchelf", version = "0.18.0.bcr.1")
bazel_dep(name = "tar.bzl", version = "0.8.1")
bazel_dep(name = "pigz", version = "2.8.bcr.1")

haskell = use_extension("@rules_haskell//extensions:haskell.bzl", "haskell")
haskell.toolchain(version = "9.12.3")
use_repo(haskell, "ghc_toolchains")

haskell_non_module_deps = use_extension("//bazel_tools/MODULE_MIGRATION:haskell_non_module_deps_extension.bzl", "haskell_non_module_deps_extension")
use_repo(haskell_non_module_deps, "Cabal", "lsp-types")

stack_snapshot = use_extension(
"@rules_haskell//extensions:stack_snapshot.bzl",
"stack_snapshot",
)
use_repo(stack_snapshot, "stackage")

stack_snapshot.snapshot(local_snapshot = "//:stackage_snapshot.yaml")
# stack_snapshot.package(name = "lsp-types")
[
stack_snapshot.package(
name = pkg,
setup_deps = ["@Cabal//:Cabal"],
)
for pkg in [
"aeson",
"aeson-pretty",
"ansi-terminal",
"async",
"base",
"binary",
"blaze-html",
"bytestring",
"conduit",
"containers",
"deepseq",
"directory",
"extra",
"filepath",
"hashable",
"http-client",
"http-conduit",
"http-types",
"lens",
"lsp-test",
"lsp-types",
"monad-loops",
"network",
"optparse-applicative",
"parser-combinators",
"pretty",
"process",
"safe",
"safe-exceptions",
"split",
"tar-conduit",
"tasty",
"tasty-hunit",
"tasty-quickcheck",
"text",
"time",
"typed-process",
"unix-compat",
"unordered-containers",
"vector",
"unix",
]
]

module_temporary_extension = use_extension("//bazel_tools/MODULE_MIGRATION:module_temporary_extension.bzl", "temporary_extension")
use_repo(module_temporary_extension, "build_environment", "daml_versions_data", "os_info", "scala_version")

# packaging_extension = use_extension("//bazel_tools/MODULE_MIGRATION:packaging_extension.bzl", "packaging_extension")
# use_repo(packaging_extension, "tar_dev_env", "gzip_dev_env")
2 changes: 1 addition & 1 deletion sdk/bazel-haskell-deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ exports_files(["stack.exe"], visibility = ["//visibility:public"])
},
),
haddock = False,
local_snapshot = "//:stack-snapshot.yaml",
local_snapshot = "//:stackage_snapshot.yaml",
stack_snapshot_json =
"//:stackage_snapshot_windows.json" if is_windows else "//:stackage_snapshot.json",
packages = [
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
load("@rules_haskell//haskell:cabal.bzl", "haskell_cabal_library")

haskell_cabal_library(
name = "Cabal",
srcs = glob(["Cabal/**"]),
verbose = False,
version = "3.8.1.0",
visibility = ["//visibility:public"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
load("@rules_haskell//haskell:cabal.bzl", "haskell_cabal_library")
load("@stackage//:packages.bzl", "packages")

haskell_cabal_library(
name = "lsp-types",
version = packages["lsp-types"].version,
srcs = glob(["**"]),
deps = packages["lsp-types"].deps,
haddock = False,
visibility = ["//visibility:public"],
)
25 changes: 25 additions & 0 deletions sdk/bazel_tools/MODULE_MIGRATION/haskell_extension.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def _get_lsp_types(module_ctx):
LSP_TYPES_VERSION = "1.4.0.0"
LSP_TYPES_SHA256 = "7ae8a3bad0e91d4a2af9b93e3ad207e3f4c3dace40d420e0592f6323ac93fb67"

print(packages)

http_archive(
name = "lsp-types",
build_file = ":haskell/haskell_lsp_types.BUILD.bzl",
patch_args = ["-p1"],
patches = [
"//bazel_tools:lsp-types-normalisation.patch",
"//bazel_tools:lsp-types-expose-other-modules.patch",
],
sha256 = LSP_TYPES_SHA256,
strip_prefix = "lsp-types-{}".format(LSP_TYPES_VERSION),
urls = ["http://hackage.haskell.org/package/lsp-types-{version}/lsp-types-{version}.tar.gz".format(version = LSP_TYPES_VERSION)],
)

def _impl(module_ctx):
_get_lsp_types(module_ctx)

haskell_extension = module_extension(implementation = _impl)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def _get_cabal():
http_archive(
name = "Cabal",
build_file = ":haskell/haskell_cabal.BUILD.bzl",
sha256 = "b697b558558f351d2704e520e7dcb1f300cd77fea5677d4b2ee71d0b965a4fe9",
strip_prefix = "cabal-ghc-9.4-paths-module-relocatable",
urls = ["https://github.com/tweag/cabal/archive/refs/heads/ghc-9.4-paths-module-relocatable.zip"],
)

def _get_lsp_types():
LSP_TYPES_VERSION = "1.4.0.0"
LSP_TYPES_SHA256 = "7ae8a3bad0e91d4a2af9b93e3ad207e3f4c3dace40d420e0592f6323ac93fb67"

http_archive(
name = "lsp-types",
build_file = ":haskell/haskell_lsp_types.BUILD.bzl",
patch_args = ["-p1"],
patches = [
"//bazel_tools:lsp-types-normalisation.patch",
"//bazel_tools:lsp-types-expose-other-modules.patch",
],
sha256 = LSP_TYPES_SHA256,
strip_prefix = "lsp-types-{}".format(LSP_TYPES_VERSION),
urls = ["http://hackage.haskell.org/package/lsp-types-{version}/lsp-types-{version}.tar.gz".format(version = LSP_TYPES_VERSION)],
)

def _impl(module_ctx):
_get_cabal()
_get_lsp_types()

haskell_non_module_deps_extension = module_extension(implementation = _impl)
17 changes: 17 additions & 0 deletions sdk/bazel_tools/MODULE_MIGRATION/module_temporary_extension.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
load("//bazel_tools:build_environment.bzl", "build_environment")
load("//bazel_tools:os_info.bzl", "os_info")
load("//bazel_tools:scala_version.bzl", "scala_version_configure")
load("//daml-lf:json_repo.bzl", "daml_versions_repo")

def _temporary_extension_impl(module_ctx):
scala_version_configure(name = "scala_version")
os_info(name = "os_info")
build_environment(name = "build_environment")
daml_versions_repo(
name = "daml_versions_data",
json_file = "//daml-lf:daml-lf-versions.json",
)

temporary_extension = module_extension(
implementation = _temporary_extension_impl,
)
30 changes: 30 additions & 0 deletions sdk/bazel_tools/MODULE_MIGRATION/packaging_extension.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
load("//bazel_tools/dev_env_tool:dev_env_tool.bzl", "dev_env_tool")

def _impl(module_ctx):
"""
Note:
This should be later migrated to use bazel defined toolset, not
one from dev_env
"""
dev_env_tool(
name = "tar_dev_env",
nix_include = ["bin/tar"],
nix_label = "@tar_nix",
nix_paths = ["bin/tar"],
tools = ["tar"],
win_include = ["usr/bin/tar.exe"],
win_paths = ["usr/bin/tar.exe"],
win_tool = "msys2",
)
dev_env_tool(
name = "gzip_dev_env",
nix_include = ["bin/gzip"],
nix_label = "@gzip_nix",
nix_paths = ["bin/gzip"],
tools = ["gzip"],
win_include = ["usr/bin/gzip.exe"],
win_paths = ["usr/bin/gzip.exe"],
win_tool = "msys2",
)

packaging_extension = module_extension(implementation = _impl)
Loading
Loading