Allow applying patches before BUILD file generation
This adds support for patching Go dependencies before BUILD file generation and
also plumbs that support into fietsje. No actual prepatching is done in this revision.
Test Plan: This has been used successfully in code built on top of it.
X-Origin-Diff: phab/D612
GitOrigin-RevId: 7013e5f98feb57ac64ff3dc79d1a9bb94e4152a8
diff --git a/build/fietsje/render.go b/build/fietsje/render.go
index bc5d732..16fd089 100644
--- a/build/fietsje/render.go
+++ b/build/fietsje/render.go
@@ -69,6 +69,15 @@
fmt.Fprintf(w, " %q,\n", "//third_party/go/patches:"+patch)
}
fmt.Fprintf(w, " ],\n")
+ }
+ if d.prePatches != nil {
+ fmt.Fprintf(w, " pre_patches = [\n")
+ for _, patch := range d.prePatches {
+ fmt.Fprintf(w, " %q,\n", "//third_party/go/patches:"+patch)
+ }
+ fmt.Fprintf(w, " ],\n")
+ }
+ if d.patches != nil || d.prePatches != nil {
fmt.Fprintf(w, " patch_args = [%q],\n", "-p1")
}
if d.buildExtraArgs != nil {