Commit Graph

28 Commits

Author SHA1 Message Date
Miroslav Hruz 4cc14020fb aya-build: honor RUSTC_BOOTSTRAP
Use `RUSTC_BOOTSTRAP` when deciding whether to pass `-Zbuild-std=core`.

This keeps eBPF builds working in environments without rustup where a
stable toolchain is used with bootstrap enabled to allow unstable
features. It also preserves `-1` as an explicit opt-out and accepts
crate-scoped bootstrap values.
2026-03-09 11:04:17 -07:00
Tamir Duberstein 2f8759cc62 Dial the lints to 100 2026-01-29 10:02:48 -05:00
famfo dc12998268 aya-build: try to build when rustup is not found
In some environments, rustup is not availible but cargo and its targets
are. This changes aya-build to try to continue building if rustup is not
found, even with stable Rust. A warning will now be issued if rustup is
not found but the build will proceed regardless. Add a dependency on
`rustc_version` and condition `-Z build-std=core` on the toolchain being
nightly to allow custom toolchains with prebuilt ebpf sysroots.

Fixes: #1329
2026-01-26 10:38:15 -05:00
Tamir Duberstein e746618143 enable unused_qualifications lint 2026-01-23 11:03:26 -05:00
vad 388d1f9694 aya-build: Allow to opt out
Allow to opt out from cargo-in-cargo by setting `AYA_BUILD_SKIP`
environment variable to `1` or `true`. That makes it easier for people
using custom toolchains not managed by rustup (e.g. package
maintainers).

Fixes: #1329
2026-01-20 17:17:23 +00:00
Tamir Duberstein 5c0ebe8684 aya-build: Avoid OUT_DIR collisions
When the eBPF package name matches a bin target name, aya-build used
OUT_DIR/<package-name> as Cargo's --target-dir and then tried to copy
the built binary to OUT_DIR/<bin-name>. This makes the destination a
directory and fails with EISDIR.

Put the cargo --target-dir under a dedicated subdirectory inside OUT_DIR
to keep build artifacts separate from copied outputs.

Fixes https://github.com/aya-rs/aya/issues/1432.
2025-12-29 06:55:35 -05:00
Tamir Duberstein d238b2ea6f Release crates
- aya v0.13.2
- aya-build v0.1.3
- aya-ebpf v0.1.2
- aya-ebpf-bindings v0.1.2
- aya-ebpf-cty v0.2.3
- aya-ebpf-macros v0.1.2
- aya-log v0.2.2
- aya-log-common v0.1.16
- aya-log-ebpf v0.1.2
- aya-log-ebpf-macros v0.1.1
- aya-log-parser v0.1.14
- aya-obj v0.2.2

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
2025-11-17 14:51:14 -05:00
Tim W 17573e0e47 aya-build: plumb features of ebpf crates
This allows callers to select features of the ebpf crate.
2025-11-03 18:43:45 -05:00
Tamir Duberstein 948b8553ee aya-build: guess bpf_target_arch from HOST
Remove the use of `CARGO_CFG_TARGET_ARCH` in ebpf crate build scripts,
moving it back only to `aya_build::build_ebpf` where it refers to the
userspace crate's target. In the ebpf crates restore the use of `HOST`
as the default compilation target when neither `--cfg bpf_target_arch`
nor `AYA_BPF_TARGET_ARCH` are provided.
2025-10-29 09:09:40 -04:00
Tamir Duberstein fe3f5c4e7d aya-build: read AYA_BPF_TARGET_ARCH
This allows users to set `bpf_target_arch` from the environment without
touching RUSTFLAGS.
2025-10-29 09:07:17 -04:00
Tamir Duberstein 4b0ddfc2b0 aya-build: simplify
Cargo sets `CARGO_CFG_BPF_TARGET_ARCH` so we don't have to inspect
`CARGO_ENCODED_RUSTFLAGS`.
2025-10-29 09:04:44 -04:00
Tamir Duberstein 0c7c8097b2 aya-build: clarify naming 2025-10-29 09:02:07 -04:00
Tamir Duberstein e2c50ac221 aya-build: use OsString::into_string 2025-10-29 09:00:06 -04:00
Tamir Duberstein b4bcf52ef1 aya-build: pass bpf_target_arch with cfg
Retire the use of `CARGO_CFG_BPF_TARGET_ARCH` -- using a `cfg` allows
cargo to properly use a cache per cfg, making `./clippy.sh` much faster.

```
Cold: ./clippy.sh --target x86_64-unknown-linux-gnu -p aya-build  75.38s user 137.28s system 211% cpu 1:40.43 total
Warm: ./clippy.sh --target x86_64-unknown-linux-gnu -p aya-build   4.46s user   3.41s system  71% cpu   11.01 total
```
2025-10-26 11:44:47 -04:00
Tamir Duberstein d9704be77d aya-build: remove cargo_metadata from public API 2025-10-26 09:50:52 -04:00
Tamir Duberstein f610453ec2 ebpf: extract CARGO_CFG_BPF_TARGET_ARCH logic 2025-10-26 07:24:46 -04:00
Tamir Duberstein 5f5305c2a8 lint all crates; enable strict pointer lints 2025-09-29 05:19:23 -04:00
dependabot[bot] a7e3e6d4d9 build(deps): bump the cargo-crates group with 2 updates
Updates the requirements on [cargo_metadata](https://github.com/oli-obk/cargo_metadata) and [object](https://github.com/gimli-rs/object) to permit the latest version.

Updates `cargo_metadata` to 0.19.2
- [Release notes](https://github.com/oli-obk/cargo_metadata/releases)
- [Changelog](https://github.com/oli-obk/cargo_metadata/blob/main/CHANGELOG.md)
- [Commits](https://github.com/oli-obk/cargo_metadata/compare/0.19.0...0.19.2)

Updates `object` to 0.36.7
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.36.0...0.36.7)

---
updated-dependencies:
- dependency-name: cargo_metadata
  dependency-version: 0.19.2
  dependency-type: direct:production
  dependency-group: cargo-crates
- dependency-name: object
  dependency-version: 0.36.7
  dependency-type: direct:production
  dependency-group: cargo-crates
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-02 14:56:17 -04:00
Tamir Duberstein eab5661a0e aya-build: enable BTF 2025-04-21 10:11:26 -04:00
Thomas Eizinger 6d36fe13d3 aya-build: Allow setting Rust nightly version
At present, `aya_build` will always use `+nightly` to build the
eBPF kernel. This is problematic in environments such as CI, where
tools always need to be installed first. Installing the current
nightly Rust toolchain gives you a new toolchain every day. This
poisones caches and makes CI jobs non-deterministic.

Resolves: #1226
2025-03-28 21:34:08 -04:00
Tamir Duberstein 49a828ec56 taplo: reorder-keys
Group non-workspace keys before workspace ones for readability.
2025-03-17 11:38:09 -04:00
Tamir Duberstein a43e40ae1d introduce workspace lints, warn on unused crates
In practice this will forbid unused dependencies because we run clippy
with `--deny warnings`.

Workspace lints is a nice place to ratchet up lints through the codebase
all at once and consistently.
2025-03-06 14:46:03 -05:00
Tamir Duberstein f0a9f19ddc Bump edition to 2024
Change FromRawTracepointArgs::arg to return T rather than *const T which
seems to have been returning a dangling pointer.

Arguably this is not strictly necessary; edition 2024 seems to be
focused on increased strictness around unsafe code which doesn't unlock
new functionality for our users. That said, this work revealed an
apparent bug (see above) that we wouldn't otherwise catch due to
allow-by-default lints.
2025-03-04 10:43:56 -05:00
Tamir Duberstein 4101a5a55d Use #[expect(...)] rather than #[allow(...)]
This is stricter, and revealed a few unused allowances.
2025-03-04 10:43:56 -05:00
Tamir Duberstein 3d8cb08b7f aya-build: add explicit irrefutable pattern
This is required in Rust 1.80 at least.
2024-12-01 22:25:15 +00:00
Tamir Duberstein 015c0df0f4 aya-build: enable anyhow/std
This is needed before Rust 1.81.
2024-12-01 22:25:15 +00:00
Tamir Duberstein 6970353b58 aya-build: add description 2024-12-01 22:25:15 +00:00
Tamir Duberstein 2b2af44915 Extract aya-build for building eBPF crates
We'll use this in the template and book to avoid duplicating all the
code.
2024-12-01 08:07:04 +00:00