Skip to content

Commit

Permalink
Avoid repository rule restarts in go_sdk (bazelbuild#3478)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh authored and jacqueline.lee committed Jul 19, 2023
1 parent dde7fe5 commit 7cc768c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion go/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ go_host_sdk_rule = repository_rule(
"experiments": attr.string_list(
doc = "Go experiments to enable via GOEXPERIMENT",
),
"_sdk_build_file": attr.label(
default = Label("//go/private:BUILD.sdk.bazel"),
),
},
)

Expand Down Expand Up @@ -139,6 +142,9 @@ go_download_sdk_rule = repository_rule(
"urls": attr.string_list(default = ["https://dl.google.com/go/{}"]),
"version": attr.string(),
"strip_prefix": attr.string(default = "go"),
"_sdk_build_file": attr.label(
default = Label("//go/private:BUILD.sdk.bazel"),
),
},
)

Expand Down Expand Up @@ -321,6 +327,9 @@ _go_local_sdk = repository_rule(
"experiments": attr.string_list(
doc = "Go experiments to enable via GOEXPERIMENT",
),
"_sdk_build_file": attr.label(
default = Label("//go/private:BUILD.sdk.bazel"),
),
},
)

Expand Down Expand Up @@ -371,6 +380,9 @@ _go_wrap_sdk = repository_rule(
"experiments": attr.string_list(
doc = "Go experiments to enable via GOEXPERIMENT",
),
"_sdk_build_file": attr.label(
default = Label("//go/private:BUILD.sdk.bazel"),
),
},
)

Expand Down Expand Up @@ -437,7 +449,7 @@ def _sdk_build_file(ctx, platform, version, experiments):

ctx.template(
"BUILD.bazel",
Label("//go/private:BUILD.sdk.bazel"),
ctx.path(ctx.attr._sdk_build_file),
executable = False,
substitutions = {
"{goos}": goos,
Expand Down

0 comments on commit 7cc768c

Please sign in to comment.