Skip to content

Commit

Permalink
Merge pull request #177 from Concordium/embed-schema-by-default
Browse files Browse the repository at this point in the history
Embed schema by default
  • Loading branch information
lassemoldrup authored Jul 2, 2024
2 parents c32ea1f + a731744 commit 6bb7114
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cargo-concordium/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
tests via the `CARGO_CONCORDIUM_TEST_MODULE_OUTPUT_PATH` environment variable.
- Change the default build output path to `concordium-out/module.wasm.v1`.
- Remove requirement for `--out` flag when using the `--verifiable` flag.
- Embed the schema in the Wasm module by default. Therefore, the `--schema-embed` flag is now deprecated. This behavior can be disabled with the `--no-schema-embed` flag.

## 3.3.0

Expand Down Expand Up @@ -137,11 +138,13 @@
- Use v2 schemas when building v1 contracts.

## 2.0.0

- Add support for V1 contract builds, testing, and execution.
- The output of `cargo concordium build` is now versioned.
- Support contracts written with Rust edition 2021.

## 1.1.1

- Clarify that energy units used by `cargo-concordium` are "interpreter energy"
and not the same as NRG.
- Allow the user to only specify the necessary fields in the JSON context files
Expand Down
26 changes: 23 additions & 3 deletions cargo-concordium/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,19 @@ struct BuildOptions {
name = "schema-embed",
long = "schema-embed",
short = "e",
help = "Builds the contract schema and embeds it into the wasm module."
hidden = true,
help = "(DEPRECATED, now default behaviour) Builds the contract schema and embeds it into \
the wasm module."
)]
schema_embed: bool,
#[structopt(
name = "no-schema-embed",
long = "no-schema-embed",
short = "n",
conflicts_with = "schema-embed",
help = "Do not embed the contract schema into the wasm module."
)]
no_schema_embed: bool,
#[structopt(
name = "schema-out",
long = "schema-out",
Expand Down Expand Up @@ -457,7 +467,7 @@ struct BuildOptions {
impl BuildOptions {
/// Determine the [`SchemaBuildOptions`] based on the input from the user.
fn schema_build_options(&self) -> SchemaBuildOptions {
if self.schema_embed {
if !self.no_schema_embed {
SchemaBuildOptions::BuildAndEmbed
} else if self.schema_out.is_some()
|| self.schema_json_out.is_some()
Expand Down Expand Up @@ -1086,7 +1096,7 @@ fn handle_build(options: BuildOptions, print_extra_info: bool) -> anyhow::Result
.context("Could not write base64 schema file.")?;
}
}
if options.schema_embed && print_extra_info {
if !options.no_schema_embed && print_extra_info {
eprintln!(" Embedding schema into module.\n");
}
}
Expand All @@ -1112,6 +1122,16 @@ fn handle_build(options: BuildOptions, print_extra_info: bool) -> anyhow::Result
bold_style.paint(size)
);
}
if options.schema_embed {
let error_style = ansi_term::Color::Yellow;
eprintln!(
"{}",
error_style.paint(
"\n\nThe `--schema-embed`/`-e` flag is no longer necessary, as it is now the \
default behaviour."
)
)
}
if !is_verifiable_build {
let error_style = ansi_term::Color::Yellow;
eprintln!(
Expand Down

0 comments on commit 6bb7114

Please sign in to comment.