Skip to content

Commit

Permalink
[antlir/metalos][oss] fix some third party deps builds
Browse files Browse the repository at this point in the history
Summary: Title

Test Plan:
```name="Third-party deps of bootloader build"
❯ buck build --keep-going //metalos/bootloader:metalos-bootloader
Action failed: metalos//metalos/lib/tracing:metalos_tracing (rustc rlib)
Local command returned non-zero exit code 1
Reproduce locally: `env -- 'BUCK_SCRATCH_PATH=buck-out/v2/tmp/metalos/e85947776b662505/rustc/rlib' /usr/bin/env 'PYTHONP ...<omitted>... 03749/metalos/lib/tracing/__metalos_tracing__/rlib-static-static-link/metalos_tracing-link-diag.args (run `buck2 log what-failed` to get the full command)`
stdout:
stderr:
error: external crate `fbinit` unused in `metalos_tracing`: remove the dependency or add `use fbinit as _;`
  |
  = note: requested on the command line with `-F unused-crate-dependencies`

error: aborting due to 1 previous error

Action failed: metalos//metalos/lib/tracing:metalos_tracing (rustc metadata [static])
Local command returned non-zero exit code 1
Reproduce locally: `env -- 'BUCK_SCRATCH_PATH=buck-out/v2/tmp/metalos/e85947776b662505/rustc/_buck_749b01f6d1bd8e8c' /us ...<omitted>... tracing/__metalos_tracing__/rlib-static-static-metadata-full/metalos_tracing-metadata-full-diag.args (run `buck2 log what-failed` to get the full command)`
stdout:
stderr:
error: external crate `fbinit` unused in `metalos_tracing`: remove the dependency or add `use fbinit as _;`
  |
  = note: requested on the command line with `-F unused-crate-dependencies`

error: aborting due to 1 previous error

Build ID: 4bdfc708-d862-427e-b07e-87e3205a72cf
Network: Up: 0B  Down: 0B
Jobs completed: 5290. Time elapsed: 29.0s.
Cache hits: 0%. Commands: 1282 (cached: 0, remote: 0, local: 1282)
BUILD FAILED
Failed to build 'metalos//metalos/lib/tracing:metalos_tracing (prelude//platforms:default#904931f735703749)'
```

Differential Revision: D59928725
  • Loading branch information
vmagro authored and facebook-github-bot committed Jul 19, 2024
1 parent e0b8144 commit 0f8649c
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 155 deletions.
13 changes: 10 additions & 3 deletions antlir/bzl/build_defs_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,26 @@ def _third_party_library(project, rule = None, platform = None):
if not rule:
rule = project

# TODO: third party deps should be consumable from the cell which is calling
# this function so that deps aren't pinned to whatever ships in antlir, but
# while metalos has deps on some antlir rust targets, we can't do this (or
# we get mismatched type errors with duplicate crates)
cell = "antlir"

if platform == "python" or platform == "pypi":
if not rule == project:
fail("python dependencies must omit rule or be identical to project")
return "antlir//third-party/python:" + project

return cell + "//third-party/python:" + project

if platform == "rust":
if not rule == project:
fail("rust dependencies must omit rule or be identical to project")

return "antlir//third-party/rust:" + project
return cell + "//third-party/rust:" + project

if platform == "antlir":
return "//third-party/antlir/{project}:{rule}".format(
return cell + "//third-party/antlir/{project}:{rule}".format(
project = project,
rule = rule,
)
Expand Down
Loading

0 comments on commit 0f8649c

Please sign in to comment.