aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 11:06:46 +01:00
parent df99318392
commit 86e7c72e5f
10383 changed files with 749164 additions and 749170 deletions

View File

@@ -0,0 +1,73 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//:defs.bzl", "codex_rust_crate")
load("//bazel/rules:runtime_package.bzl", "release_binary")
codex_rust_crate(
name = "bwrap",
# Bazel wires vendored bubblewrap + libcap via :bwrap-ffi below and sets
# bwrap_available explicitly, so we skip Cargo's build.rs in Bazel builds.
build_script_enabled = False,
crate_name = "codex_bwrap",
deps_extra = select({
"@platforms//os:linux": [":bwrap-ffi"],
"//conditions:default": [],
}),
rustc_flags_extra = select({
"@platforms//os:linux": [
"--cfg=bwrap_available",
# TODO(anp) Extract bwrap symbols before stripping.
"-Cstrip=symbols",
],
"//conditions:default": [],
}),
)
release_binary(
binary = ":bwrap",
target_compatible_with = ["@platforms//os:linux"],
)
genrule(
name = "bwrap-sha256-env",
srcs = [":bwrap"],
outs = ["bwrap.sha256.env"],
cmd = " && ".join([
'$(execpath @bazel_tools//tools/build_defs/hash:sha256) $(execpath :bwrap) "$@"',
'digest=$$(<"$@")',
'printf "AKODE_BWRAP_SHA256=%s\\n" "$$digest" > "$@"',
]),
target_compatible_with = ["@platforms//os:linux"],
tools = ["@bazel_tools//tools/build_defs/hash:sha256"],
visibility = ["//akode-rs/linux-sandbox:__pkg__"],
)
config_setting(
name = "optimized",
values = {"compilation_mode": "opt"},
)
cc_library(
name = "bwrap-ffi",
srcs = ["//akode-rs/vendor:bubblewrap_c_sources"],
hdrs = [
"config.h",
"//akode-rs/vendor:bubblewrap_headers",
],
copts = [
"-D_GNU_SOURCE",
"-Dmain=bwrap_main",
] + select({
# Cargo cc-rs uses release OPT_LEVEL=3 and DEBUG=true, without
# the C toolchain's default NDEBUG; retain native symbols for packaging.
":optimized": [
"-O3",
"-g",
"-UNDEBUG",
],
"//conditions:default": [],
}),
includes = ["."],
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:private"],
deps = ["@libcap"],
)