summarylogtreecommitdiffstats
path: root/0001-copy-buildozer-target-output.patch
blob: 4c07899476a81889e3c7b9082019a9e167abc363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff -urN --color a/buildozer/BUILD.bazel b/buildozer/BUILD.bazel
--- a/buildozer/BUILD.bazel	2021-04-29 10:35:23.356798746 -0600
+++ b/buildozer/BUILD.bazel	2021-04-29 10:35:18.426801616 -0600
@@ -1,4 +1,5 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("@bazel_skylib//rules:copy_file.bzl", "copy_file")

 go_library(
     name = "go_default_library",
@@ -47,7 +48,7 @@
 )

 go_binary(
-    name = "buildozer-linux",
+    name = "real_buildozer-linux",
     out = "buildozer-linux_amd64",
     embed = [":go_default_library"],
     goarch = "amd64",
@@ -56,6 +57,15 @@
     visibility = ["//visibility:public"],
 )

+# rules_go doesn't give a predeclared output file due to starlark transitions,
+# so we have to copy the output file from the go_binary rule in order to
+# programmatically determine the output path.
+copy_file(
+    name = "buildozer-linux",
+    src = ":real_buildozer-linux",
+    out = "buildozer-linux_amd64",
+)
+
 go_binary(
     name = "buildozer-windows",
     out = "buildozer-windows_amd64.exe",