Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions examples/no_prelude/go/.buckconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ name=BUILD

[repositories]
root = .
prelude = prelude
buck = no
fbcode = no
fbsource = no
ovr_config = no
toolchains = no
1 change: 1 addition & 0 deletions examples/no_prelude/go/prelude
12 changes: 6 additions & 6 deletions examples/no_prelude/go/rules.bzl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("//toolchain.bzl", "GoCompilerInfo")

def _go_binary_impl(ctx: "context") -> ["provider"]:
sources = ctx.attr.srcs
sources = ctx.attrs.srcs
out = ctx.actions.declare_output("main")

cmd = cmd_args([ctx.attr.toolchain[GoCompilerInfo].compiler_path, "build", "-o", out.as_output()] + sources)
cmd = cmd_args([ctx.attrs.toolchain[GoCompilerInfo].compiler_path, "build", "-o", out.as_output()] + sources)

ctx.actions.run(cmd, category = "compile")

Expand All @@ -14,10 +14,10 @@ def _go_binary_impl(ctx: "context") -> ["provider"]:
]

go_binary = rule(
implementation = _go_binary_impl,
impl = _go_binary_impl,
attrs = {
"deps": attr.list(attr.dep()),
"srcs": attr.list(attr.source()),
"toolchain": attr.dep(),
"deps": attrs.list(attrs.dep()),
"srcs": attrs.list(attrs.source()),
"toolchain": attrs.dep(),
},
)
12 changes: 6 additions & 6 deletions examples/no_prelude/go/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ GoCompilerInfo = provider(
)

def _go_toolchain_impl(ctx):
url = "https://go.dev/dl/go" + ctx.attr.version + "." + ctx.attr.platform + ".tar.gz"
url = "https://go.dev/dl/go" + ctx.attrs.version + "." + ctx.attrs.platform + ".tar.gz"

download = http_archive_impl(ctx, url, ctx.attr.sha1)
download = http_archive_impl(ctx, url, ctx.attrs.sha1)

compiler_dst = ctx.actions.declare_output("compiler")
compiler_src = cmd_args(download[0].default_outputs[0], format = "{}/go/bin/go")
Expand All @@ -15,11 +15,11 @@ def _go_toolchain_impl(ctx):
return download + [GoCompilerInfo(compiler_path = compiler_dst, GOROOT = "")]

go_toolchain = rule(
implementation = _go_toolchain_impl,
impl = _go_toolchain_impl,
attrs = {
"platform": attr.string(),
"sha1": attr.string(),
"version": attr.string(),
"platform": attrs.string(),
"sha1": attrs.string(),
"version": attrs.string(),
},
)

Expand Down
6 changes: 6 additions & 0 deletions examples/no_prelude/rust/.buckconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ name=BUILD

[repositories]
root = .
prelude = prelude
buck = no
fbcode = no
fbsource = no
ovr_config = no
toolchains = no
1 change: 1 addition & 0 deletions examples/no_prelude/rust/prelude
6 changes: 3 additions & 3 deletions examples/no_prelude/rust/rules.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def _rust_binary_impl(ctx):
file = ctx.attr.file
file = ctx.attrs.file
out = ctx.actions.declare_output("main")

cmd = cmd_args(["rustc", "--crate-type=bin", file, "-o", out.as_output()])
Expand All @@ -9,8 +9,8 @@ def _rust_binary_impl(ctx):
return [DefaultInfo(default_outputs = [out]), RunInfo(args = cmd_args([out]))]

rust_binary = rule(
implementation = _rust_binary_impl,
impl = _rust_binary_impl,
attrs = {
"file": attr.source(),
"file": attrs.source(),
},
)