diff options
author | Spandan Das <spandandas@google.com> | 2023-06-14 21:55:21 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-06-14 21:55:21 +0000 |
commit | 711a453236752a1786e93fbde5929b92008fc7ff (patch) | |
tree | d9fac15bb5a835ae6ba757dc5eaf6ef597ea44cf /go/private/rules/info.bzl | |
parent | 9803cf8403d7105bddc1d5304d6e694b781a6605 (diff) | |
parent | 49dcd021242b91376524f85bfec457f8e81051e4 (diff) | |
download | bazelbuild-rules_go-711a453236752a1786e93fbde5929b92008fc7ff.tar.gz |
Merge remote-tracking branch 'aosp/upstream-master' into merge_rules_go am: 49dcd02124platform-tools-34.0.5platform-tools-34.0.4
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353
Change-Id: I9f9788cf0500a3062862c617370cef7b915bbbc1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'go/private/rules/info.bzl')
-rw-r--r-- | go/private/rules/info.bzl | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/go/private/rules/info.bzl b/go/private/rules/info.bzl new file mode 100644 index 00000000..28cd1ba0 --- /dev/null +++ b/go/private/rules/info.bzl @@ -0,0 +1,60 @@ +# Copyright 2014 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load( + "//go/private:context.bzl", + "go_context", +) +load( + "//go/private:go_toolchain.bzl", + "GO_TOOLCHAIN", +) + +def _go_info_impl(ctx): + go = go_context(ctx) + report = go.declare_file(go, ext = ".txt") + args = go.builder_args(go) + args.add("-out", report) + go.actions.run( + inputs = go.sdk_files, + outputs = [report], + mnemonic = "GoInfo", + executable = ctx.executable._go_info, + arguments = [args], + ) + return [DefaultInfo( + files = depset([report]), + runfiles = ctx.runfiles([report]), + )] + +_go_info = rule( + implementation = _go_info_impl, + attrs = { + "_go_info": attr.label( + executable = True, + cfg = "exec", + default = "//go/tools/builders:info", + ), + "_go_context_data": attr.label( + default = "//:go_context_data", + ), + }, + toolchains = [GO_TOOLCHAIN], +) + +def go_info(): + _go_info( + name = "go_info", + visibility = ["//visibility:public"], + ) |