Skip to content

Commit

Permalink
Merge pull request #5538 from systeminit/deno/cache_marker
Browse files Browse the repository at this point in the history
fix: ensure deno_cache rules are run under buck2 build
  • Loading branch information
sprutton1 authored Feb 25, 2025
2 parents 099cb8c + e4ee72c commit 1aa68ac
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 212 deletions.
22 changes: 12 additions & 10 deletions bin/lang-js/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,22 @@ alias(
)

deno_cache(
name = "cache"
name = "cache",
srcs = glob(["src/**/*.ts"])
)

# this builds bundle.ts so it can be used at runtime by function execution
deno_run(
name = "build",
main = "src/build.ts",
out = "src/bundle.ts",
srcs = glob([
"src/**/build.ts",
]) + [
srcs = [
":cache",
"//:deno_workspace"
],
] +
glob([
"src/**/build.ts",
]),
permissions = [
"allow-all",
],
Expand All @@ -47,13 +49,13 @@ deno_compile(
name = "bin",
main = "src/index.ts",
out = "lang-js",
srcs = glob([
srcs = [
":build",
] +
glob([
"src/**/*.ts",
"src/**/*.js",
]) + [
":build",
"//:deno_workspace"
],
]),
permissions = [
"allow-all",
],
Expand Down
204 changes: 3 additions & 201 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion prelude-si/deno.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ load(
def deno_cache_impl(ctx: AnalysisContext) -> list[Provider]:
"""Implementation of the deno_cache rule."""
deno_toolchain = ctx.attrs._deno_toolchain[DenoToolchainInfo]
out = ctx.actions.declare_output("deno_cache_marker")


cmd = cmd_args(
ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter,
deno_toolchain.deno_cache[DefaultInfo].default_outputs[0],
)
cmd.add("--marker", out.as_output())

for src in ctx.attrs.srcs:
cmd.add("--input", src)

ctx.actions.run(cmd, category = "deno", identifier = "deno_cache")

return [
DefaultInfo(),
DefaultInfo(default_output = out),
RunInfo(args = cmd),
]

Expand Down
Loading

0 comments on commit 1aa68ac

Please sign in to comment.