From a5b222ad92a0da9c200d031b12d885b2d1ee0c51 Mon Sep 17 00:00:00 2001 From: Samuel Littley Date: Fri, 20 Jun 2025 16:37:41 +0100 Subject: [PATCH 1/3] Make sure debug tools/data get queued to be built --- src/BUILD.plz | 1 + src/core/state.go | 3 +++ src/please.go | 1 + src/plz/plz.go | 21 +++++++++++++++++++++ 4 files changed, 26 insertions(+) diff --git a/src/BUILD.plz b/src/BUILD.plz index bedc510018..5bf660c421 100644 --- a/src/BUILD.plz +++ b/src/BUILD.plz @@ -28,6 +28,7 @@ go_binary( "//src/help", "//src/metrics", "//src/output", + "//src/parse", "//src/plz", "//src/plzinit", "//src/process", diff --git a/src/core/state.go b/src/core/state.go index 3dc8dcd207..790165c2bc 100644 --- a/src/core/state.go +++ b/src/core/state.go @@ -237,6 +237,9 @@ type BuildState struct { // EnableBreakpoints enablese the breakpoint() build-in, and drops Please into an interactive debugger when // they're encountered. EnableBreakpoints bool + // NeedDebugDeps is true if we're doing a `plz debug` and we need to build the debug tools and + // data + NeedDebugDeps bool // initOnce is used to control loading the subrepo .plzconfig initOnce *sync.Once diff --git a/src/please.go b/src/please.go index 1d6b1bd1d5..1f0a35f0af 100644 --- a/src/please.go +++ b/src/please.go @@ -1153,6 +1153,7 @@ func Please(targets []core.BuildLabel, config *core.Configuration, shouldBuild, state.ShowAllOutput = opts.OutputFlags.ShowAllOutput state.ParsePackageOnly = opts.ParsePackageOnly state.EnableBreakpoints = opts.BehaviorFlags.Debug + state.NeedDebugDeps = debug // What outputs get downloaded in remote execution. if debug { diff --git a/src/plz/plz.go b/src/plz/plz.go index 088f4e5e02..7c893a8165 100644 --- a/src/plz/plz.go +++ b/src/plz/plz.go @@ -157,6 +157,12 @@ func findOriginalTasks(state *core.BuildState, preTargets, targets []core.BuildL } findOriginalTaskSet(state, targets, true, arch) log.Debug("Original target scan complete") + if state.NeedDebugDeps { + if len(targets) != 1 { + log.Fatalf("expected exactly 1 target in debug mode; got %d", len(targets)) + } + queueTargetsForDebug(state, targets[0]) + } state.TaskDone() // initial target adding counts as one. } @@ -166,6 +172,21 @@ func findOriginalTaskSet(state *core.BuildState, targets []core.BuildLabel, addT } } +func queueTargetsForDebug(state *core.BuildState, target core.BuildLabel) { + parse.Parse(state, target, core.OriginalTarget, core.ParseModeNormal) + t := state.Graph.TargetOrDie(target) + for _, tool := range t.AllDebugTools() { + if l, ok := tool.Label(); ok { + state.AddOriginalTarget(l, false) + } + } + for _, data := range t.AllDebugData() { + if l, ok := data.Label(); ok { + state.AddOriginalTarget(l, false) + } + } +} + func stripHostRepoName(config *core.Configuration, label core.BuildLabel) core.BuildLabel { if label.Subrepo == "" { return label From f8bc71237b36ba0f3ea48351df78ad3b4e51499c Mon Sep 17 00:00:00 2001 From: Samuel Littley Date: Fri, 20 Jun 2025 16:44:28 +0100 Subject: [PATCH 2/3] Update version & changelog --- ChangeLog | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 705f9ed9bf..08c1d7d73d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 17.18.0 +--------------- + * Make sure debug tools/data get queued to be built (#3373) + Version 17.17.0 --------------- * Make export work when it hits something in the repository root (#3364) diff --git a/VERSION b/VERSION index 12d3ea1c8e..7d4794d4f9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -17.17.0 +17.18.0 From e96eb94f2479bd83e4f76bc1f260640fee591cdd Mon Sep 17 00:00:00 2001 From: Samuel Littley Date: Mon, 23 Jun 2025 09:49:42 +0100 Subject: [PATCH 3/3] Update changelog with other commits --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 08c1d7d73d..8f586a046d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ Version 17.18.0 --------------- * Make sure debug tools/data get queued to be built (#3373) + * Implement reverse parameter for `sorted` built-in function (#3372) + * Implement key parameter for `sorted` built-in function (#3371) + * Add `//` operator (#3370) + * fix(query.deps): memoize provided labels rather than declared targets (#3369) Version 17.17.0 ---------------