Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run rust-project develop: error: Unconfigured target label(s)/node(s) was passed into analysis #786

Open
Lev1ty opened this issue Sep 25, 2024 · 2 comments

Comments

@Lev1ty
Copy link
Contributor

Lev1ty commented Sep 25, 2024

Errored after updating buck2 prelude submodule. Blame points to

facebook/buck2-prelude@e50861f

$ buck2 run buck2//integrations/rust-project develop --prefer-rustup-managed-toolchain -p //rust/lmd:main
...
2024-09-25T05:13:24.810318Z ERROR rust_project: error=failed to deserialize command output error.sources=[command `env -u RUST_BACKTRACE -u RUST_LIB_BACKTRACE "buck2" "--isolation-dir" ".rust-analyzer" "bxl" "--oncall" "rust_devx" "-c=client.id=rust-project" "-c=xplat.available_platforms=CXX,FBCODE" "-c=rust.rust_project_build=true" "prelude//rust/rust-analyzer/resolve_deps.bxl:resolve_targets" "--" "--exclude_workspaces" "false" "--targets" "root//rust/lmd:demogen" "root//rust/lmd:main" "root//rust/lmd:provider" "root//rust/lmd:resource" "root//rust/lmd:router"` (exit code: exit status: 2)
stderr:
[2024-09-25T01:13:24.808-04:00] Build ID: 70777fd6-39d1-4d0e-83db-ffddaeffd941
Command failed:
Traceback (most recent call last):
  File <builtin>, in <module>
  * third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl:232, in resolve_targets_impl
      resolved_deps = cquery_deps(ctx, expanded_targets, workspaces)
  * third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl:119, in cquery_deps
      analysis_set = ctx.analysis(top_targets)
error: Unconfigured target label(s)/node(s) was passed into analysis. Targets passed into analysis should be configured.
   --> third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl:119:20
    |
119 |     analysis_set = ctx.analysis(top_targets)
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^
    |

BXL FAILED
, no file path in output] source=command `env -u RUST_BACKTRACE -u RUST_LIB_BACKTRACE "buck2" "--isolation-dir" ".rust-analyzer" "bxl" "--oncall" "rust_devx" "-c=client.id=rust-project" "-c=xplat.available_platforms=CXX,FBCODE" "-c=rust.rust_project_build=true" "prelude//rust/rust-analyzer/resolve_deps.bxl:resolve_targets" "--" "--exclude_workspaces" "false" "--targets" "root//rust/lmd:demogen" "root//rust/lmd:main" "root//rust/lmd:provider" "root//rust/lmd:resource" "root//rust/lmd:router"` (exit code: exit status: 2)
stderr:
[2024-09-25T01:13:24.808-04:00] Build ID: 70777fd6-39d1-4d0e-83db-ffddaeffd941
Command failed:
Traceback (most recent call last):
  File <builtin>, in <module>
  * third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl:232, in resolve_targets_impl
      resolved_deps = cquery_deps(ctx, expanded_targets, workspaces)
  * third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl:119, in cquery_deps
      analysis_set = ctx.analysis(top_targets)
error: Unconfigured target label(s)/node(s) was passed into analysis. Targets passed into analysis should be configured.
   --> third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl:119:20
    |
119 |     analysis_set = ctx.analysis(top_targets)
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^
    |

BXL FAILED
 source.sources=[no file path in output] kind="error"
@Lev1ty
Copy link
Contributor Author

Lev1ty commented Sep 27, 2024

bad commit facebook/buck2-prelude@5196cbf

good commit (one before bad commit) facebook/buck2-prelude@ff8d00e

@capickett
Copy link
Contributor

Hey @Lev1ty - apologies for the breakage. I'm looking into your issue now but I am not able to successfully create a repro.

Still, I have an idea to try. Can you please try applying the following diff to third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl and seeing if the problem persists?

diff --git a/third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl b/third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl
--- a/third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl
+++ b/third-party/buck2-prelude/rust/rust-analyzer/resolve_deps.bxl
@@ -115,7 +115,8 @@
         top_targets: list[TargetLabel],
         workspaces: list[TargetLabel]) -> dict[TargetLabel, TargetInfo]:
     targets = set([])
-    analysis_set = ctx.analysis(top_targets)
+    target_universe = ctx.target_universe(top_targets).target_set()
+    analysis_set = ctx.analysis(target_universe)
     for _target, analysis in analysis_set.items():
         info = analysis.providers().get(RustAnalyzerInfo)
         if info:
@@ -194,7 +195,7 @@
 
                     possible_workspaces.setdefault(workspace.raw_target(), []).append(label)
 
-    workspace_analysis = ctx.analysis(possible_workspaces.keys())
+    workspace_analysis = ctx.analysis(ctx.target_universe(possible_workspaces.keys()).target_set())
 
     active_workspaces = {}
     for workspace_label, analysis in workspace_analysis.items():

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants