From dea04a72d8d6d0b5a2b78e978433d305921c2cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Mon, 24 May 2021 00:11:58 +0300 Subject: [PATCH] temp repro --- BUILD | 14 +++++++++++++- rules.bzl | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 24e8c0a..4a9aec7 100644 --- a/BUILD +++ b/BUILD @@ -1,6 +1,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") -load("//src/undocker:rules.bzl", "rootfs") +load("//src/undocker:rules.bzl", "rootfs", "temp") load( "@io_bazel_rules_docker//container:container.bzl", "container_bundle", @@ -34,3 +34,15 @@ rootfs( #src = "@alpine//image:image", src = ":alpine-container-plus", ) + +filegroup( + name = "maingo", + srcs = ["main.go"], + visibility = ["//visibility:public"], +) + +temp( + name = "temp", + data = ":maingo", + out = "maingo.txt", +) diff --git a/rules.bzl b/rules.bzl index 2406fc3..2a4b76b 100644 --- a/rules.bzl +++ b/rules.bzl @@ -33,3 +33,19 @@ rootfs = rule( ), }, ) + +def _temp_impl(ctx): + for f in ctx.files.data: + print(f.path) + ctx.actions.run_shell( + outputs = [ctx.outputs.out], + command = "find $@", + ) + +temp = rule( + implementation = _temp_impl, + attrs = { + "data": attr.label(mandatory = True, allow_single_file = True), + "out": attr.output(mandatory = True) + }, +)