Fixup the bazel build when used without bzlmod

As currently we do not use bzlmod when building on Windows
This commit is contained in:
Philip Kuryloski 2022-06-15 09:52:08 +02:00
parent 295f6e2afb
commit 2fd155e55d
8 changed files with 47 additions and 18 deletions

View File

@ -1,5 +1,8 @@
filegroup(
name = "bin_dir",
srcs = glob(["bin/**/*", "libexec/**/*"]),
srcs = glob([
"bin/**/*",
"libexec/**/*",
]),
visibility = ["//visibility:public"],
)

View File

@ -1,8 +1,8 @@
load("@rules_erlang//:erlang_app.bzl", "erlang_app")
erlang_app(
app_name = "inet_tcp_proxy_dist",
app_version = "0.1.0",
app_description = "Erlang distribution proxy to simulate network failures",
app_module = "inet_tcp_proxy_dist_app",
app_name = "inet_tcp_proxy_dist",
app_version = "0.1.0",
)

10
BUILD.jose Normal file
View File

@ -0,0 +1,10 @@
load("@rules_erlang//:erlang_app.bzl", "erlang_app")
erlang_app(
app_name = "jose",
erlc_opts = [
"+deterministic",
"+debug_info",
],
stamp = 0,
)

View File

@ -1,14 +1,17 @@
load("@rules_erlang//:app_file.bzl", "app_file")
load("@rules_erlang//:erlang_app_info.bzl", "erlang_app_info")
load("@rules_erlang//:erlang_app.bzl", "DEFAULT_ERLC_OPTS")
load("@rules_erlang//:erlc.bzl", "erlc")
load("@rules_erlang//:erlang_bytecode.bzl", "erlang_bytecode")
erlc(
erlang_bytecode(
name = "beam_files",
hdrs = glob(["include/**/*.hrl", "src/**/*.hrl"]),
srcs = glob(["src/**/*.erl"]),
erlc_opts = DEFAULT_ERLC_OPTS,
hdrs = glob([
"include/**/*.hrl",
"src/**/*.hrl",
]),
dest = "ebin",
erlc_opts = DEFAULT_ERLC_OPTS,
)
genrule(
@ -27,9 +30,12 @@ app_file(
erlang_app_info(
name = "erlang_app",
app_name = "ranch",
app = ":app_file",
hdrs = glob(["include/**/*.hrl"]),
beam = [":beam_files", ":appup"],
app = ":app_file",
app_name = "ranch",
beam = [
":beam_files",
":appup",
],
visibility = ["//visibility:public"],
)

View File

@ -1,9 +1,9 @@
load("@rules_erlang//:erlang_app.bzl", "erlang_app")
erlang_app(
app_name = "trust_store_http",
app_description = "Trust store HTTP server",
app_module = "trust_store_http_app",
app_name = "trust_store_http",
app_version = "1.0.0",
extra_apps = [
"ssl",

View File

@ -137,14 +137,13 @@ erlang_package.hex_package(
erlang_package.git_package(
repository = "rabbitmq/osiris",
branch = "main",
patch_cmds = ["""
VERSION=$(git rev-parse HEAD)
patch_cmds = ["""VERSION=$(git rev-parse HEAD)
echo "Injecting ${VERSION} into Makefile..."
sed -i"_orig" -E '/PROJECT_VERSION/ s/[0-9]+\\.[0-9]+\\.[0-9]+/'${VERSION}'/' Makefile
echo "Injecting ${VERSION} into BUILD.bazel..."
sed -i"_orig" -E '/VERSION/ s/[0-9]+\\.[0-9]+\\.[0-9]+/'${VERSION}'/' BUILD.bazel
sed -i"_orig2" -E 's/ct_sharded\\.bzl/ct.bzl/' BUILD.bazel
""",
"""sed -i"_orig2" -E 's/ct_sharded\\.bzl/ct.bzl/' BUILD.bazel
"""],
)

View File

@ -32,7 +32,7 @@ def elixir_toolchain_external():
elixir_constraint,
],
toolchain = ":elixir_external",
toolchain_type = Label("@rabbitmq-server//bazel/elixir:toolchain_type"),
toolchain_type = Label("//bazel/elixir:toolchain_type"),
visibility = ["//visibility:public"],
)
@ -69,7 +69,7 @@ def elixir_toolchain_from_http_archive(
elixir_constraint,
],
toolchain = ":elixir{}".format(name_suffix),
toolchain_type = Label("@rabbitmq-server//bazel/elixir:toolchain_type"),
toolchain_type = Label("//bazel/elixir:toolchain_type"),
visibility = ["//visibility:public"],
)
@ -78,7 +78,7 @@ def elixir_toolchain_from_github_release(
version = None,
sha256 = None):
[major, minor, patch] = version.split(".")
elixir_constraint = Label("@rabbitmq-server//bazel/platforms:elixir_{}_{}".format(major, minor))
elixir_constraint = Label("//bazel/platforms:elixir_{}_{}".format(major, minor))
url = "https://github.com/elixir-lang/elixir/archive/refs/tags/v{}.tar.gz".format(version)
elixir_toolchain_from_http_archive(
name_suffix = name_suffix,

View File

@ -131,6 +131,7 @@ erlang_app(
ref = "2b1d66b5f4fbe33cb198149a8cb23895a2c877ea",
version = "2b1d66b5f4fbe33cb198149a8cb23895a2c877ea",
sha256 = "7816f39d00655f2605cfac180755e97e268dba86c2f71037998ff63792ca727b",
build_file = rabbitmq_workspace + "//:BUILD.jose",
)
hex_pm_erlang_app(
@ -154,6 +155,16 @@ erlang_app(
name = "osiris",
branch = "main",
remote = "https://github.com/rabbitmq/osiris.git",
patch_cmds = [
"""VERSION=$(git rev-parse HEAD)
echo "Injecting ${VERSION} into Makefile..."
sed -i"_orig" -E '/PROJECT_VERSION/ s/[0-9]+\\.[0-9]+\\.[0-9]+/'${VERSION}'/' Makefile
echo "Injecting ${VERSION} into BUILD.bazel..."
sed -i"_orig" -E '/VERSION/ s/[0-9]+\\.[0-9]+\\.[0-9]+/'${VERSION}'/' BUILD.bazel
""",
"""sed -i"_orig2" -E 's/ct_sharded\\.bzl/ct.bzl/' BUILD.bazel
""",
],
)
hex_pm_erlang_app(