Browse Source

Re-organize into a single workspace

This commit moves the aya-log projects from the subtree and adds them to
the main cargo workspace. It also brings the BPF crates into the
workspace and moves the macro crates up a level since they aren't BPF
code.

Miri was disabled for aya-bpf as the previous config wasn't actually
checking anything.

CI, clippy, fmt and release configurations have all been adjusted
appropriately.

CI was not properly running for other supported arches which was also
ixed here.

Signed-off-by: Dave Tucker <[email protected]>
Dave Tucker 2 years ago
parent
commit
dc31e11
48 changed files with 131 additions and 548 deletions
  1. 2 0
      .cargo/config
  2. 6 46
      .github/workflows/build-aya-bpf.yml
  3. 22 5
      .github/workflows/build-aya.yml
  4. 2 13
      .github/workflows/lint.yml
  5. 2 2
      .vim/coc-settings.json
  6. 2 2
      .vscode/settings.json
  7. 21 2
      Cargo.toml
  8. 1 1
      aya-bpf-macros/Cargo.toml
  9. 0 0
      aya-bpf-macros/src/expand.rs
  10. 0 0
      aya-bpf-macros/src/lib.rs
  11. 1 1
      aya-log-common/Cargo.toml
  12. 1 0
      aya-log-common/release.toml
  13. 0 0
      aya-log-common/src/lib.rs
  14. 0 0
      aya-log-ebpf-macros/Cargo.toml
  15. 0 0
      aya-log-ebpf-macros/src/expand.rs
  16. 0 0
      aya-log-ebpf-macros/src/lib.rs
  17. 0 2
      aya-log/.cargo/config.toml
  18. 0 9
      aya-log/.github/dependabot.yml
  19. 0 37
      aya-log/.github/workflows/build-bpf.yml
  20. 0 26
      aya-log/.github/workflows/build.yml
  21. 0 41
      aya-log/.github/workflows/lint.yml
  22. 0 13
      aya-log/.gitignore
  23. 0 3
      aya-log/.vim/coc-settings.json
  24. 0 3
      aya-log/.vscode/settings.json
  25. 27 2
      aya-log/Cargo.toml
  26. 0 27
      aya-log/aya-log/Cargo.toml
  27. 0 73
      aya-log/aya-log/README.md
  28. 0 12
      aya-log/ebpf/Cargo.toml
  29. 0 13
      aya-log/ebpf/example/Cargo.toml
  30. 0 22
      aya-log/ebpf/example/src/main.rs
  31. 0 4
      aya-log/ebpf/rustfmt.toml
  32. 0 6
      aya-log/release.toml
  33. 0 4
      aya-log/rustfmt.toml
  34. 0 0
      aya-log/src/lib.rs
  35. 0 12
      aya-log/xtask/Cargo.toml
  36. 0 61
      aya-log/xtask/src/build_ebpf.rs
  37. 0 29
      aya-log/xtask/src/main.rs
  38. 0 0
      bpf/.cargo/config.toml
  39. 0 2
      bpf/Cargo.toml
  40. 1 1
      bpf/aya-bpf/Cargo.toml
  41. 2 2
      bpf/aya-log-ebpf/Cargo.toml
  42. 0 0
      bpf/aya-log-ebpf/src/lib.rs
  43. 0 0
      bpf/rust-toolchain.toml
  44. 0 1
      bpf/rustfmt.toml
  45. 1 1
      netlify.toml
  46. 6 0
      release.toml
  47. 1 13
      test/integration-ebpf/Cargo.toml
  48. 33 57
      xtask/src/docs/mod.rs

+ 2 - 0
.cargo/config

@@ -1,5 +1,7 @@
 [alias]
 xtask = "run --package xtask --"
+build-bpfel = "build -Zbuild-std=core --target=bpfel-unknown-none"
+build-bpfeb = "build -Zbuild-std=core --target=bpfeb-unknown-none"
 
 [target.armv7-unknown-linux-gnueabi]
 linker = "arm-linux-gnueabi-gcc"

+ 6 - 46
.github/workflows/build-aya-bpf.yml

@@ -31,59 +31,19 @@ jobs:
       - uses: actions-rs/toolchain@v1
         with:
           toolchain: nightly
+          components: rust-src
           override: true
 
       - uses: Swatinem/rust-cache@v1
 
       - name: Prereqs
-        run: cargo install cross --git https://github.com/cross-rs/cross
+        run: cargo install bpf-linker
 
       - name: Build
         env:
           CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }}
         run: |
-          pushd bpf
-          cargo build --workspace --exclude aya-bpf-macros --verbose
-          popd
-
-      - name: Run tests
-        env:
-          CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }}
-        run: |
-          pushd bpf
-          cargo test --workspace --exclude aya-bpf-macros --verbose
-          popd
-
-  build-macros:
-    strategy:
-      matrix:
-        arch:
-          - x86_64-unknown-linux-gnu
-          - aarch64-unknown-linux-gnu
-          - armv7-unknown-linux-gnueabi
-          - riscv64gc-unknown-none-elf
-    runs-on: ubuntu-20.04
-    steps:
-      - uses: actions/checkout@v2
-
-      - uses: actions-rs/toolchain@v1
-        with:
-          toolchain: nightly
-          override: true
-
-      - uses: Swatinem/rust-cache@v1
-
-      - name: Prereqs
-        run: cargo install cross --git https://github.com/cross-rs/cross
-
-      - name: Build bpf macros
-        run: |
-          pushd bpf
-          cross build -p aya-bpf-macros --verbose
-          popd
-
-      - name: Test bpf macros
-        run: |
-          pushd bpf
-          RUST_BACKTRACE=full cross test -p aya-bpf-macros --verbose
-          popd
+          cargo build-bpfel -p aya-bpf --verbose
+          cargo build-bpfeb -p aya-bpf --verbose
+          cargo build-bpfel -p aya-log-ebpf --verbose
+          cargo build-bpfeb -p aya-log-ebpf --verbose

+ 22 - 5
.github/workflows/build-aya.yml

@@ -21,19 +21,38 @@ jobs:
           - x86_64-unknown-linux-gnu
           - aarch64-unknown-linux-gnu
           - armv7-unknown-linux-gnueabi
-          - riscv64gc-unknown-none-elf
+          - riscv64gc-unknown-linux-gnu
     runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
+
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: stable
+          override: true
+
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: nightly
+          override: false
+
       - uses: Swatinem/rust-cache@v1
       - name: Prereqs
         run: cargo install cross --git https://github.com/cross-rs/cross
 
       - name: Build
-        run: cross build --verbose
+        run: cross build --verbose --target ${{matrix.arch}}
 
       - name: Run test
-        run: RUST_BACKTRACE=full cross test --verbose
+        env:
+          RUST_BACKTRACE: full
+        run: |
+          cross test --verbose -p aya --target ${{matrix.arch}}
+          cross test --verbose -p aya-gen --target ${{matrix.arch}}
+          cross test --verbose -p aya-log --target ${{matrix.arch}}
+          cross test --verbose -p aya-log-ebpf-macros --target ${{matrix.arch}}
+          # aya-bpf-macros can only be tested on nightly since its tests depend on aya-bpf, which requires the never type
+          cross +nightly test --verbose -p aya-bpf-macros --target ${{matrix.arch}}
 
   test:
     runs-on: ubuntu-20.04
@@ -60,12 +79,10 @@ jobs:
           sudo apt-get -qy install linux-tools-common qemu-system-x86 cloud-image-utils openssh-client libelf-dev gcc-multilib
           cargo install bpf-linker
 
-
       - name: Lint integration tests
         run: |
           cargo xtask build-integration-test-ebpf --libbpf-dir ./libbpf
           cargo clippy -p integration-test -- --deny warnings
-          cargo clippy -p integration-test-macros -- --deny warnings
 
       - name: Run integration tests
         run: |

+ 2 - 13
.github/workflows/lint.yml

@@ -30,22 +30,11 @@ jobs:
       - name: Check formatting
         run: |
           cargo fmt --all -- --check
-          (cd bpf && cargo fmt --all -- --check)
-          (cd test/integration-ebpf && cargo fmt --all -- --check)
 
       - name: Run clippy
         run: |
-          cargo clippy -p aya -- --deny warnings
-          cargo clippy -p aya-gen -- --deny warnings
-          cargo clippy -p xtask -- --deny warnings
-          (cd bpf && cargo clippy -p aya-bpf -- --deny warnings)
-          (cd test/integration-ebpf && cargo clippy -- --deny warnings)
+          cargo clippy --workspace --exclude integration-test -- --deny warnings
 
       - name: Run miri
-        env:
-          MIRIFLAGS: -Zmiri-disable-stacked-borrows
         run: |
-          cargo miri test --all-targets
-          pushd bpf
-          cargo miri test
-          popd
+          cargo miri test --all-targets

+ 2 - 2
.vim/coc-settings.json

@@ -1,4 +1,4 @@
 {
-  "rust-analyzer.linkedProjects": ["Cargo.toml", "bpf/Cargo.toml", "test/integration-ebpf/Cargo.toml"],
-  "rust-analyzer.checkOnSave.allTargets": false
+  "rust-analyzer.checkOnSave.allTargets": false,
+  "rust-analyzer.checkOnSave.command": "clippy"
 }

+ 2 - 2
.vscode/settings.json

@@ -1,4 +1,4 @@
 {
-  "rust-analyzer.linkedProjects": ["Cargo.toml", "bpf/Cargo.toml", "test/integration-ebpf/Cargo.toml"],
-  "rust-analyzer.checkOnSave.allTargets": false
+  "rust-analyzer.checkOnSave.allTargets": false,
+  "rust-analyzer.checkOnSave.command": "clippy"
 }

+ 21 - 2
Cargo.toml

@@ -1,3 +1,22 @@
 [workspace]
-members = ["aya", "aya-gen", "test/integration-test", "test/integration-test-macros", "xtask"]
-default-members = ["aya", "aya-gen"]
+members = [
+    "aya", "aya-gen", "aya-log", "aya-log-common", "test/integration-test", "test/integration-test-macros", "xtask",
+    # macros
+    "aya-bpf-macros", "aya-log-ebpf-macros",
+    # ebpf crates
+    "bpf/aya-bpf", "bpf/aya-bpf-bindings", "bpf/aya-log-ebpf", "test/integration-ebpf"
+]
+default-members = ["aya", "aya-gen", "aya-log", "aya-bpf-macros", "aya-log-ebpf-macros"]
+
+[profile.dev]
+panic = "abort"
+
+[profile.release]
+panic = "abort"
+
+[profile.dev.package.integration-ebpf]
+opt-level = 2
+overflow-checks = false
+
+[profile.release.package.integration-ebpf]
+debug = 2

+ 1 - 1
bpf/aya-bpf-macros/Cargo.toml → aya-bpf-macros/Cargo.toml

@@ -13,4 +13,4 @@ quote = "1.0"
 syn = {version = "1.0", features = ["full"]}
 
 [dev-dependencies]
-aya-bpf = { path = "../aya-bpf" }
+aya-bpf = { path = "../bpf/aya-bpf" }

+ 0 - 0
bpf/aya-bpf-macros/src/expand.rs → aya-bpf-macros/src/expand.rs


+ 0 - 0
bpf/aya-bpf-macros/src/lib.rs → aya-bpf-macros/src/lib.rs


+ 1 - 1
aya-log/aya-log-common/Cargo.toml → aya-log-common/Cargo.toml

@@ -14,7 +14,7 @@ default = []
 userspace = [ "aya" ]
 
 [dependencies]
-aya = { version = "0.11.0", optional=true }
+aya = { path = "../aya", version = "0.11.0", optional=true }
 
 [lib]
 path = "src/lib.rs"

+ 1 - 0
aya-log-common/release.toml

@@ -0,0 +1 @@
+shared-version = true

+ 0 - 0
aya-log/aya-log-common/src/lib.rs → aya-log-common/src/lib.rs


+ 0 - 0
aya-log/ebpf/aya-log-ebpf-macros/Cargo.toml → aya-log-ebpf-macros/Cargo.toml


+ 0 - 0
aya-log/ebpf/aya-log-ebpf-macros/src/expand.rs → aya-log-ebpf-macros/src/expand.rs


+ 0 - 0
aya-log/ebpf/aya-log-ebpf-macros/src/lib.rs → aya-log-ebpf-macros/src/lib.rs


+ 0 - 2
aya-log/.cargo/config.toml

@@ -1,2 +0,0 @@
-[alias]
-xtask = "run --package xtask --"

+ 0 - 9
aya-log/.github/dependabot.yml

@@ -1,9 +0,0 @@
-# Please see the documentation for all configuration options:
-# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
-
-version: 2
-updates:
-  - package-ecosystem: "cargo"
-    directory: "/"
-    schedule:
-      interval: "weekly"

+ 0 - 37
aya-log/.github/workflows/build-bpf.yml

@@ -1,37 +0,0 @@
-name: build-bpf
-
-on:
-  push:
-    branches:
-      - main
-
-  pull_request:
-    branches:
-      - main
-
-env:
-  CARGO_TERM_COLOR: always
-
-jobs:
-  build:
-    runs-on: ubuntu-20.04
-
-    steps:
-      - uses: actions/checkout@v2
-
-      - uses: actions-rs/toolchain@v1
-        with:
-          toolchain: nightly
-          components: rust-src
-          override: true
-
-      - uses: Swatinem/rust-cache@v1
-
-      - name: Pre-requisites
-        run: cargo install bpf-linker
-
-      - name: Build
-        run: |
-          pushd ebpf
-          cargo build --verbose
-          popd

+ 0 - 26
aya-log/.github/workflows/build.yml

@@ -1,26 +0,0 @@
-name: build
-
-on:
-  push:
-    branches:
-      - main
-
-  pull_request:
-    branches:
-      - main
-
-env:
-  CARGO_TERM_COLOR: always
-
-jobs:
-  build:
-    runs-on: ubuntu-20.04
-    steps:
-      - uses: actions/checkout@v2
-      - uses: Swatinem/rust-cache@v1
-
-      - name: Build
-        run: cargo build --verbose
-
-      - name: Run tests
-        run: RUST_BACKTRACE=full cargo test --verbose

+ 0 - 41
aya-log/.github/workflows/lint.yml

@@ -1,41 +0,0 @@
-name: lint
-
-on:
-  push:
-    branches:
-      - main
-
-  pull_request:
-    branches:
-      - main
-
-env:
-  CARGO_TERM_COLOR: always
-
-jobs:
-  lint:
-    runs-on: ubuntu-20.04
-
-    steps:
-      - uses: actions/checkout@v2
-
-      - uses: actions-rs/toolchain@v1
-        with:
-          profile: minimal
-          toolchain: nightly
-          components: rustfmt, clippy, rust-src
-          override: true
-
-      - name: Check formatting
-        run: |
-          cargo fmt --all -- --check
-          pushd ebpf
-          cargo fmt --all -- --check
-          popd
-
-      - name: Run clippy
-        run: |
-          cargo clippy -- --deny warnings
-          pushd ebpf
-          cargo clippy -- --deny warnings
-          popd

+ 0 - 13
aya-log/.gitignore

@@ -1,13 +0,0 @@
-### https://raw.github.com/github/gitignore/master/Rust.gitignore
-
-# Generated by Cargo
-# will have compiled files and executables
-debug/
-target/
-
-# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
-# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
-Cargo.lock
-
-# These are backup files generated by rustfmt
-**/*.rs.bk

+ 0 - 3
aya-log/.vim/coc-settings.json

@@ -1,3 +0,0 @@
-{
-  "rust-analyzer.linkedProjects": ["Cargo.toml", "ebpf/Cargo.toml"]
-}

+ 0 - 3
aya-log/.vscode/settings.json

@@ -1,3 +0,0 @@
-{
-  "rust-analyzer.linkedProjects": ["Cargo.toml", "ebpf/Cargo.toml"]
-}

+ 27 - 2
aya-log/Cargo.toml

@@ -1,2 +1,27 @@
-[workspace]
-members = ["aya-log", "aya-log-common", "xtask"]
+[package]
+name = "aya-log"
+version = "0.1.11-dev.0"
+description = "A logging library for eBPF programs."
+keywords = ["ebpf", "bpf", "log", "logging"]
+license = "MIT OR Apache-2.0"
+authors = ["The Aya Contributors"]
+repository = "https://github.com/aya-rs/aya-log"
+readme = "README.md"
+documentation = "https://docs.rs/aya-log"
+edition = "2018"
+
+[dependencies]
+aya = { path = "../aya", version = "0.11.0", features=["async_tokio"] }
+aya-log-common = { path = "../aya-log-common", version = "0.1.11-dev.0", features=["userspace"] }
+dyn-fmt = "0.3.0"
+thiserror = "1"
+log = "0.4"
+bytes = "1.1"
+tokio = { version = "1.2.0" }
+
+[dev-dependencies]
+simplelog = "0.12"
+testing_logger = "0.1.1"
+
+[lib]
+path = "src/lib.rs"

+ 0 - 27
aya-log/aya-log/Cargo.toml

@@ -1,27 +0,0 @@
-[package]
-name = "aya-log"
-version = "0.1.11-dev.0"
-description = "A logging library for eBPF programs."
-keywords = ["ebpf", "bpf", "log", "logging"]
-license = "MIT OR Apache-2.0"
-authors = ["The Aya Contributors"]
-repository = "https://github.com/aya-rs/aya-log"
-readme = "README.md"
-documentation = "https://docs.rs/aya-log"
-edition = "2018"
-
-[dependencies]
-aya = { version = "0.11.0", features=["async_tokio"] }
-aya-log-common = { version = "0.1.11-dev.0", path = "../aya-log-common", features=["userspace"] }
-dyn-fmt = "0.3.0"
-thiserror = "1"
-log = "0.4"
-bytes = "1.1"
-tokio = { version = "1.2.0" }
-
-[dev-dependencies]
-simplelog = "0.12"
-testing_logger = "0.1.1"
-
-[lib]
-path = "src/lib.rs"

+ 0 - 73
aya-log/aya-log/README.md

@@ -1,73 +0,0 @@
-# aya-log - a logging library for eBPF programs
-
-## Overview
-
-`aya-log` is a logging library for eBPF programs written using [aya]. Think of
-it as the [log] crate for eBPF.
-
-## Installation
-
-### User space
-
-Add `aya-log` to `Cargo.toml`:
-
-```toml
-[dependencies]
-aya-log = { git = "https://github.com/aya-rs/aya-log", branch = "main" }
-```
-
-### eBPF side
-
-Add `aya-log-ebpf` to `Cargo.toml`:
-
-```toml
-[dependencies]
-aya-log-ebpf = { git = "https://github.com/aya-rs/aya-log", branch = "main" }
-```
-
-## Example
-
-Here's an example that uses `aya-log` in conjunction with the [simplelog] crate
-to log eBPF messages to the terminal.
-
-### User space code
-
-```rust
-use simplelog::{ColorChoice, ConfigBuilder, LevelFilter, TermLogger, TerminalMode};
-use aya_log::BpfLogger;
-
-TermLogger::init(
-    LevelFilter::Debug,
-    ConfigBuilder::new()
-        .set_target_level(LevelFilter::Error)
-        .set_location_level(LevelFilter::Error)
-        .build(),
-    TerminalMode::Mixed,
-    ColorChoice::Auto,
-)
-.unwrap();
-
-// Will log using the default logger, which is TermLogger in this case
-BpfLogger::init(&mut bpf).unwrap();
-```
-
-### eBPF code
-
-```rust
-use aya_log_ebpf::info;
-
-fn try_xdp_firewall(ctx: XdpContext) -> Result<u32, ()> {
-    if let Some(port) = tcp_dest_port(&ctx)? {
-        if block_port(port) {
-            info!(&ctx, "❌ blocked incoming connection on port: {}", port);
-            return Ok(XDP_DROP);
-        }
-    }
-
-    Ok(XDP_PASS)
-}
-```
-
-[aya]: https://github.com/aya-rs/aya
-[log]: https://docs.rs/log
-[simplelog]: https://docs.rs/simplelog

+ 0 - 12
aya-log/ebpf/Cargo.toml

@@ -1,12 +0,0 @@
-[workspace]
-members = ["aya-log-ebpf", "aya-log-ebpf-macros", "example"]
-
-
-[profile.dev]
-panic = "abort"
-debug = 1
-opt-level = 2
-overflow-checks = false
-
-[profile.release]
-panic = "abort"

+ 0 - 13
aya-log/ebpf/example/Cargo.toml

@@ -1,13 +0,0 @@
-[package]
-name = "example"
-version = "0.1.0"
-edition = "2018"
-publish = false
-
-[dependencies]
-aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" }
-aya-log-ebpf = { path = "../aya-log-ebpf" }
-
-[[bin]]
-name = "example"
-path = "src/main.rs"

+ 0 - 22
aya-log/ebpf/example/src/main.rs

@@ -1,22 +0,0 @@
-#![no_std]
-#![no_main]
-
-use aya_bpf::{macros::tracepoint, programs::TracePointContext, BpfContext};
-use aya_log_ebpf::{debug, error, info, trace, warn};
-
-#[tracepoint]
-pub fn example(ctx: TracePointContext) -> u32 {
-    error!(&ctx, "this is an error message 🚨");
-    warn!(&ctx, "this is a warning message ⚠️");
-    info!(&ctx, "this is an info message ℹ️");
-    debug!(&ctx, "this is a debug message ️🐝");
-    trace!(&ctx, "this is a trace message 🔍");
-    let pid = ctx.pid();
-    info!(&ctx, "a message with args PID: {}", pid);
-    0
-}
-
-#[panic_handler]
-fn panic(_info: &core::panic::PanicInfo) -> ! {
-    unsafe { core::hint::unreachable_unchecked() }
-}

+ 0 - 4
aya-log/ebpf/rustfmt.toml

@@ -1,4 +0,0 @@
-unstable_features = true
-reorder_imports = true
-imports_granularity = "Crate"
-

+ 0 - 6
aya-log/release.toml

@@ -1,7 +1 @@
-pre-release-commit-message = "aya-log, aya-log-common: release version {{version}}"
-post-release-commit-message = "aya-log, aya-log-common: start next development iteration {{next_version}}"
-consolidate-pushes = true
-consolidate-commits = true
 shared-version = true
-dev-version = true
-dev-version-ext = "dev.0"

+ 0 - 4
aya-log/rustfmt.toml

@@ -1,4 +0,0 @@
-unstable_features = true
-reorder_imports = true
-imports_granularity = "Crate"
-

+ 0 - 0
aya-log/aya-log/src/lib.rs → aya-log/src/lib.rs


+ 0 - 12
aya-log/xtask/Cargo.toml

@@ -1,12 +0,0 @@
-[package]
-name = "xtask"
-publish = false
-version = "0.1.0"
-edition = "2018"
-
-[dependencies]
-structopt = {version = "0.3", default-features = false }
-anyhow = "1"
-
-[package.metadata.release]
-release = false

+ 0 - 61
aya-log/xtask/src/build_ebpf.rs

@@ -1,61 +0,0 @@
-use std::{path::PathBuf, process::Command};
-
-use structopt::StructOpt;
-
-#[derive(Debug, Copy, Clone)]
-pub enum Architecture {
-    BpfEl,
-    BpfEb,
-}
-
-impl std::str::FromStr for Architecture {
-    type Err = String;
-
-    fn from_str(s: &str) -> Result<Self, Self::Err> {
-        Ok(match s {
-            "bpfel-unknown-none" => Architecture::BpfEl,
-            "bpfeb-unknown-none" => Architecture::BpfEb,
-            _ => return Err("invalid target".to_owned()),
-        })
-    }
-}
-
-impl std::fmt::Display for Architecture {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        f.write_str(match self {
-            Architecture::BpfEl => "bpfel-unknown-none",
-            Architecture::BpfEb => "bpfeb-unknown-none",
-        })
-    }
-}
-
-#[derive(StructOpt)]
-pub struct Options {
-    #[structopt(default_value = "bpfel-unknown-none", long)]
-    target: Architecture,
-    #[structopt(long)]
-    release: bool,
-}
-
-pub fn build(opts: Options) -> Result<(), anyhow::Error> {
-    let dir = PathBuf::from("aya-log-ebpf");
-    let target = format!("--target={}", opts.target);
-    let mut args = vec![
-        "+nightly",
-        "build",
-        "--verbose",
-        target.as_str(),
-        "-Z",
-        "build-std=core",
-    ];
-    if opts.release {
-        args.push("--release")
-    }
-    let status = Command::new("cargo")
-        .current_dir(&dir)
-        .args(&args)
-        .status()
-        .expect("failed to build bpf examples");
-    assert!(status.success());
-    Ok(())
-}

+ 0 - 29
aya-log/xtask/src/main.rs

@@ -1,29 +0,0 @@
-mod build_ebpf;
-
-use std::process::exit;
-
-use structopt::StructOpt;
-#[derive(StructOpt)]
-pub struct Options {
-    #[structopt(subcommand)]
-    command: Command,
-}
-
-#[derive(StructOpt)]
-enum Command {
-    BuildEbpf(build_ebpf::Options),
-}
-
-fn main() {
-    let opts = Options::from_args();
-
-    use Command::*;
-    let ret = match opts.command {
-        BuildEbpf(opts) => build_ebpf::build(opts),
-    };
-
-    if let Err(e) = ret {
-        eprintln!("{:#}", e);
-        exit(1);
-    }
-}

+ 0 - 0
aya-log/ebpf/.cargo/config.toml → bpf/.cargo/config.toml


+ 0 - 2
bpf/Cargo.toml

@@ -1,2 +0,0 @@
-[workspace]
-members = ["aya-bpf", "aya-bpf-macros", "aya-bpf-bindings"]

+ 1 - 1
bpf/aya-bpf/Cargo.toml

@@ -6,5 +6,5 @@ edition = "2018"
 
 [dependencies]
 aya-bpf-cty = { path = "../aya-bpf-cty" }
-aya-bpf-macros = { path = "../aya-bpf-macros" }
+aya-bpf-macros = { path = "../../aya-bpf-macros" }
 aya-bpf-bindings = { path = "../aya-bpf-bindings" }

+ 2 - 2
aya-log/ebpf/aya-log-ebpf/Cargo.toml → bpf/aya-log-ebpf/Cargo.toml

@@ -4,9 +4,9 @@ version = "0.1.0"
 edition = "2018"
 
 [dependencies]
-aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" }
+aya-bpf = { path = "../aya-bpf" }
 aya-log-common = { path = "../../aya-log-common" }
-aya-log-ebpf-macros = { path = "../aya-log-ebpf-macros" }
+aya-log-ebpf-macros = { path = "../../aya-log-ebpf-macros" }
 
 [lib]
 path = "src/lib.rs"

+ 0 - 0
aya-log/ebpf/aya-log-ebpf/src/lib.rs → bpf/aya-log-ebpf/src/lib.rs


+ 0 - 0
aya-log/ebpf/rust-toolchain.toml → bpf/rust-toolchain.toml


+ 0 - 1
bpf/rustfmt.toml

@@ -1 +0,0 @@
-../rustfmt.toml

+ 1 - 1
netlify.toml

@@ -1,3 +1,3 @@
 [build]
   publish = "site"
-  command = "rustup toolchain install nightly && cargo xtask docs"
+  command = "rustup toolchain install nightly -c rust-src && cargo xtask docs"

+ 6 - 0
release.toml

@@ -0,0 +1,6 @@
+pre-release-commit-message = "{crate_name}: release version {{version}}"
+post-release-commit-message = "{crate_name}: start next development iteration {{next_version}}"
+consolidate-pushes = true
+consolidate-commits = true
+dev-version = true
+dev-version-ext = "dev.0"

+ 1 - 13
test/integration-ebpf/Cargo.toml

@@ -21,16 +21,4 @@ path = "src/pass.rs"
 
 [[bin]]
 name = "test"
-path = "src/test.rs"
-
-[profile.dev]
-panic = "abort"
-opt-level = 2
-overflow-checks = false
-
-[profile.release]
-panic = "abort"
-debug = 2
-
-[workspace]
-members = []
+path = "src/test.rs"

+ 33 - 57
xtask/src/docs/mod.rs

@@ -8,67 +8,19 @@ use std::{fs, io, io::Write};
 use indoc::indoc;
 
 pub fn docs() -> Result<(), anyhow::Error> {
-    let mut working_dir = PathBuf::from(".");
-
-    let replace = Command::new("sed")
-        .current_dir(&working_dir)
-        .args(vec![
-            "-i.bak",
-            "s/crabby.svg/crabby_dev.svg/",
-            "aya/src/lib.rs",
-        ])
-        .status()
-        .expect("failed to replace logo");
-    assert!(replace.success());
-
-    let mut header_path = PathBuf::from(".");
-    header_path.push("header.html");
+    let current_dir = PathBuf::from(".");
+    let header_path = current_dir.join("header.html");
     let mut header = fs::File::create(&header_path).expect("can't create header.html");
     header
         .write_all(r#"<meta name="robots" content="noindex">"#.as_bytes())
         .expect("can't write header.html contents");
     header.flush().expect("couldn't flush contents");
-
     let abs_header_path = fs::canonicalize(&header_path).unwrap();
-    let args = vec!["+nightly", "doc", "--no-deps", "--all-features"];
-
-    let status = Command::new("cargo")
-        .current_dir(&working_dir)
-        .env(
-            "RUSTDOCFLAGS",
-            format!("--html-in-header {}", abs_header_path.to_str().unwrap()),
-        )
-        .args(&args)
-        .status()
-        .expect("failed to build aya docs");
-    assert!(status.success());
-
-    working_dir.push("bpf");
-
-    let replace = Command::new("sed")
-        .current_dir(&working_dir)
-        .args(vec![
-            "-i.bak",
-            "s/crabby.svg/crabby_dev.svg/",
-            "aya-bpf/src/lib.rs",
-        ])
-        .status()
-        .expect("failed to replace logo");
-    assert!(replace.success());
-
-    let status = Command::new("cargo")
-        .current_dir(&working_dir)
-        .env(
-            "RUSTDOCFLAGS",
-            format!("--html-in-header {}", abs_header_path.to_str().unwrap()),
-        )
-        .args(&args)
-        .status()
-        .expect("failed to build aya-bpf docs");
-    assert!(status.success());
 
-    copy_dir_all("./target/doc", "site/user")?;
-    copy_dir_all("./bpf/target/doc", "site/bpf")?;
+    build_docs(&current_dir.join("aya"), &abs_header_path)?;
+    build_docs(&current_dir.join("bpf/aya-bpf"), &abs_header_path)?;
+    copy_dir_all("./target/doc", "./site/user")?;
+    copy_dir_all("./target/bpfel-unknown-none/doc", "./site/bpf")?;
 
     let mut robots = fs::File::create("site/robots.txt").expect("can't create robots.txt");
     robots
@@ -98,14 +50,38 @@ pub fn docs() -> Result<(), anyhow::Error> {
             .as_bytes(),
         )
         .expect("can't write index.html");
+    Ok(())
+}
+
+fn build_docs(working_dir: &PathBuf, abs_header_path: &Path) -> Result<(), anyhow::Error> {
+    let replace = Command::new("sed")
+        .current_dir(&working_dir)
+        .args(vec!["-i.bak", "s/crabby.svg/crabby_dev.svg/", "src/lib.rs"])
+        .status()
+        .expect("failed to replace logo");
+    assert!(replace.success());
 
-    fs::rename("aya/src/lib.rs.bak", "aya/src/lib.rs").unwrap();
-    fs::rename("bpf/aya-bpf/src/lib.rs.bak", "bpf/aya-bpf/src/lib.rs").unwrap();
+    let args = vec!["+nightly", "doc", "--no-deps", "--all-features"];
 
+    let status = Command::new("cargo")
+        .current_dir(&working_dir)
+        .env(
+            "RUSTDOCFLAGS",
+            format!("--html-in-header {}", abs_header_path.to_str().unwrap()),
+        )
+        .args(&args)
+        .status()
+        .expect("failed to build aya docs");
+    assert!(status.success());
+    fs::rename(
+        working_dir.join("src/lib.rs.bak"),
+        working_dir.join("src/lib.rs"),
+    )
+    .unwrap();
     Ok(())
 }
 
-fn copy_dir_all<P: AsRef<Path>>(src: P, dst: P) -> io::Result<()> {
+fn copy_dir_all<P1: AsRef<Path>, P2: AsRef<Path>>(src: P1, dst: P2) -> io::Result<()> {
     fs::create_dir_all(&dst)?;
     for entry in fs::read_dir(src)? {
         let entry = entry?;