Skip to content

Track SPACEWASM_CONFIG changes in the c_api build script - #152

Merged
Kronos3 merged 1 commit into
nasa:mainfrom
kadircanyildirm-crypto:fix/spacewasm-config-rerun
Aug 1, 2026
Merged

Track SPACEWASM_CONFIG changes in the c_api build script#152
Kronos3 merged 1 commit into
nasa:mainfrom
kadircanyildirm-crypto:fix/spacewasm-config-rerun

Conversation

@kadircanyildirm-crypto

Copy link
Copy Markdown
Contributor

build.rs reads SPACEWASM_CONFIG but never emits cargo:rerun-if-env-changed for it, so cargo does not rebuild when the variable changes — the previous configuration stays compiled in.

This breaks the workflow crates/spacewasm_c_example/README.md documents:

SPACEWASM_CONFIG=my_config.rs cargo build -p spacewasm_c_api

Reproduction

On 23a1db2, point the variable at a file that is not valid Rust:

target dir result
clean exit 101 — the file is read
already built with another config exit 0 — build succeeds, cargo reports Fresh

A build that must fail passes, and target/debug/build/spacewasm_c_api-*/output still records the old path. So MAX_CONTROL_FRAMES, MAX_STACK_DEPTH, GLOBAL_ALLOCATOR_MAX_PAGES and GLOBAL_ALLOCATOR_PAGE_SIZE can silently keep the previous build's values.

Fix

One line. Editing the config file's contents is already tracked through include! dep-info, so rerun-if-changed is not needed:

build.rs env change external file edit default config edit
current missed ok ok
rerun-if-env-changed only ok ok ok
both directives ok ok ok

Also corrects the doc comment above generate_header(), which names a generate-header feature; the cfg gate and Cargo.toml both use codegen.

Checks

Debian bookworm, rustc 1.97.1: cargo fmt --all -- --check, cargo clippy -p spacewasm_c_api --all-targets -- -D warnings, cargo test -p spacewasm_c_api (35 passed), cargo test -p spacewasm_c_example (2 passed).

AI-assisted (Claude Code) per AI_POLICY.md; I ran every command above myself.

build.rs reads SPACEWASM_CONFIG but never emitted
cargo:rerun-if-env-changed for it, so changing the variable did not
trigger a rebuild and the previous configuration stayed compiled in.
This broke the workflow documented in spacewasm_c_example/README.md.

Also fix the doc comment above generate_header(), which named a
generate-header feature; the cfg gate and Cargo.toml both use codegen.
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

CoreMark Benchmark Results

Current Score: 251.193
Baseline Score (main): 245.957
Difference: +5.236 (2.13%)

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Code Coverage Report

Current Coverage: 95.29%
Baseline Coverage (main): 95.29%
Difference: +0.00%

@Kronos3 Kronos3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks for your contribution!

@Kronos3
Kronos3 merged commit a22e4ed into nasa:main Aug 1, 2026
17 checks passed
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

Successfully merging this pull request may close these issues.

2 participants