Skip to content

Commit b8f4753

Browse files
Stebalienraulk
andauthored
feat: add a tool to extract bundle into a file (#223)
Co-authored-by: Raúl Kripalani <[email protected]>
1 parent 256450a commit b8f4753

File tree

7 files changed

+33
-16
lines changed

7 files changed

+33
-16
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ jobs:
6666
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6767
with:
6868
command: version
69-
- name: Making bundle
69+
- name: Writing bundle
7070
env:
7171
BUILD_FIL_NETWORK: ${{ matrix.network }}
72-
run: ./build-bundle.sh
72+
run: |
73+
cargo run -- -o output/builtin-actors.car
7374
- name: Uploading bundle to Estuary
7475
env:
7576
ESTUARY_TOKEN: ${{ secrets.ESTUARY_TOKEN }}

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ fil_actors_runtime = { version = "8.0.0-alpha.1", path = "./actors/runtime", fea
2727
fil_actor_bundler = "3.0.0"
2828
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
2929

30+
[dependencies]
31+
clap = { version = "3.1.8", features = ["derive"] }
32+
3033
[features]
3134
default = [] ## translates to mainnet
3235
mainnet = []

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ publish:
5252

5353
# Create a bundle in a deterministic location
5454
bundle: deps-build
55-
./build-bundle.sh
55+
cargo run -- -o output/builtin-actors.car
5656

5757
# Check if the working tree is clean.
5858
check-clean:

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,9 @@ Instructions to build from source (option 1):
149149

150150
1. Clone the repo.
151151
2. Check out the relevant branch or tag (see Versioning section below).
152-
3. `cargo build` from the workspace root.
153-
4. Copy the CARv1 file generated the location printed in this log line:
154-
```
155-
warning: bundle=/path/to/repo/target/debug/build/filecoin_canonical_actors_bundle-aef13b28a60e195b/out/bundle/bundle.car
156-
```
157-
All output is printed as a warning only due to limitations in the Cargo build
158-
script mechanisms.
152+
3. `make bundle` from the workspace root.
153+
154+
The bundle be written to `output/builtin-actors.car`.
159155

160156
Both options are compatible with automation via scripts or CI pipelines.
161157

build-bundle.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/main.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use clap::Parser;
2+
use std::io::Write;
3+
4+
use fil_builtin_actors_bundle::BUNDLE_CAR;
5+
6+
#[derive(Parser)]
7+
#[clap(name = env!("CARGO_PKG_NAME"))]
8+
#[clap(version = env!("CARGO_PKG_VERSION"))]
9+
#[clap(about = "Writes a CAR file containing Wasm bytecode for Filecoin actors.", long_about = None)]
10+
struct Cli {
11+
/// The output car path. Defaults to STDOUT.
12+
#[clap(short, long, required = false)]
13+
output: Option<String>,
14+
}
15+
16+
fn main() -> Result<(), std::io::Error> {
17+
let cli = Cli::parse();
18+
match cli.output {
19+
Some(path) => std::fs::write(path, BUNDLE_CAR),
20+
None => std::io::stdout().write_all(BUNDLE_CAR),
21+
}
22+
}

0 commit comments

Comments
 (0)