Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__log outputting encoded values #5306

Merged
merged 46 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
4352aa3
AbiEncode rait auto implementation
xunilrj Nov 28, 2023
4df144b
correctly generating codec auto impl for AbiEncode
xunilrj Nov 29, 2023
401baed
fmt and clippy issues
xunilrj Nov 29, 2023
f4bad57
correctly auto impl abi_encode
xunilrj Dec 2, 2023
b57c137
auto impl for AbiEncode
xunilrj Dec 5, 2023
2d11652
clippy and fmt issues
xunilrj Dec 5, 2023
59005f8
clippy and fmt issues
xunilrj Dec 5, 2023
3b3283a
fix bug on impl type check
xunilrj Dec 7, 2023
9a2b94e
fmt and clippy issues
xunilrj Dec 7, 2023
68d2c13
more integer data types being encoded
xunilrj Dec 7, 2023
8fbe957
abi_encode for vec
xunilrj Dec 8, 2023
93fcbe2
improve test for auto impl
xunilrj Dec 8, 2023
c4f9c4c
fix tests
xunilrj Dec 11, 2023
19113e6
fmt and clippy issues
xunilrj Dec 11, 2023
0554ec0
__log desugaring to __log(encode())
xunilrj Dec 12, 2023
24e8699
fmt and clippy issues
xunilrj Dec 12, 2023
7a89ab3
implement abi_encode for sway examples
xunilrj Dec 12, 2023
4bca2e1
fix sway examples
xunilrj Dec 12, 2023
b2c87e0
fix forc fmt issues
xunilrj Dec 12, 2023
e547e69
impl encode for arrays
xunilrj Dec 13, 2023
537f125
correctly collect logged types
xunilrj Dec 14, 2023
61804a6
fmt and clippy issues
xunilrj Dec 14, 2023
80417dd
auto impl for generic types
xunilrj Dec 17, 2023
f747617
do not auto impl with codec module not acessible
xunilrj Dec 17, 2023
8044485
auto impl for generic types (with limitations)
xunilrj Dec 19, 2023
9635009
fmt and clippy issues
xunilrj Dec 19, 2023
0a9711c
empty aut impl for enums
xunilrj Dec 19, 2023
05a36c4
remove manual impl AbiEncode
xunilrj Dec 20, 2023
a3cf2f5
finishing enum auto impl for AbiEncode
xunilrj Dec 20, 2023
dc0427b
encoding beginh experimental flag
xunilrj Dec 21, 2023
cec4ae7
fix changes
xunilrj Dec 22, 2023
ea8f6a6
fixing tests
xunilrj Dec 23, 2023
4407df1
fixing tests
xunilrj Dec 23, 2023
fa4a7d5
cleaning up PR
xunilrj Jan 8, 2024
4cda707
cleaning up PR
xunilrj Jan 9, 2024
d0b2f33
fmt and clippy issues
xunilrj Jan 9, 2024
6db7f61
moving auto impl code to a module
xunilrj Jan 9, 2024
f352e22
fmt and clippy issues
xunilrj Jan 9, 2024
f19a3c8
allow custom AbiEncode for auto-impl-able strus/enums
xunilrj Jan 10, 2024
93d7b30
fmt and clippy issues
xunilrj Jan 10, 2024
0bd33db
fmt and clippy issues
xunilrj Jan 10, 2024
7d051a0
remove impl node to avoid unused warnings
xunilrj Jan 10, 2024
d42cf86
expected doc
xunilrj Jan 10, 2024
9ed5396
fmt issues
xunilrj Jan 10, 2024
cab5815
Merge branch 'master' into xunilrj/trait-auto-impl
JoshuaBatty Jan 15, 2024
0255947
Merge branch 'master' into xunilrj/trait-auto-impl
JoshuaBatty Jan 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions forc-pkg/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ pub struct BuildProfile {
#[serde(default)]
pub error_on_warnings: bool,
pub reverse_results: bool,
#[serde(default)]
pub experimental: ExperimentalFlags,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)]
#[serde(rename_all = "kebab-case")]
pub struct ExperimentalFlags {
pub new_encoding: bool,
}

impl DependencyDetails {
Expand Down Expand Up @@ -718,6 +726,9 @@ impl BuildProfile {
json_abi_with_callpaths: false,
error_on_warnings: false,
reverse_results: false,
experimental: ExperimentalFlags {
new_encoding: false,
},
}
}

Expand All @@ -736,6 +747,9 @@ impl BuildProfile {
json_abi_with_callpaths: false,
error_on_warnings: false,
reverse_results: false,
experimental: ExperimentalFlags {
new_encoding: false,
},
}
}
}
Expand Down
30 changes: 20 additions & 10 deletions forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::{
lock::Lock,
manifest::{BuildProfile, Dependency, ManifestFile, MemberManifestFiles, PackageManifestFile},
manifest::{
BuildProfile, Dependency, ExperimentalFlags, ManifestFile, MemberManifestFiles,
PackageManifestFile,
},
source::{self, IPFSNode, Source},
};
use anyhow::{anyhow, bail, Context, Error, Result};
Expand Down Expand Up @@ -308,6 +311,8 @@ pub struct BuildOpts {
pub tests: bool,
/// The set of options to filter by member project kind.
pub member_filter: MemberFilter,
/// Set of experimental flags
pub experimental: ExperimentalFlags,
}

/// The set of options to filter type of projects to build in a workspace.
Expand Down Expand Up @@ -1551,14 +1556,17 @@ pub fn sway_build_config(
manifest_dir.to_path_buf(),
build_target,
)
.print_dca_graph(build_profile.print_dca_graph.clone())
.print_dca_graph_url_format(build_profile.print_dca_graph_url_format.clone())
.print_finalized_asm(build_profile.print_finalized_asm)
.print_intermediate_asm(build_profile.print_intermediate_asm)
.print_ir(build_profile.print_ir)
.include_tests(build_profile.include_tests)
.time_phases(build_profile.time_phases)
.metrics(build_profile.metrics_outfile.clone());
.with_print_dca_graph(build_profile.print_dca_graph.clone())
.with_print_dca_graph_url_format(build_profile.print_dca_graph_url_format.clone())
.with_print_finalized_asm(build_profile.print_finalized_asm)
.with_print_intermediate_asm(build_profile.print_intermediate_asm)
.with_print_ir(build_profile.print_ir)
.with_include_tests(build_profile.include_tests)
.with_time_phases(build_profile.time_phases)
.with_metrics(build_profile.metrics_outfile.clone())
.with_experimental(sway_core::ExperimentalFlags {
new_encoding: build_profile.experimental.new_encoding,
});
Ok(build_config)
}

Expand Down Expand Up @@ -2031,6 +2039,7 @@ fn build_profile_from_opts(
metrics_outfile,
tests,
error_on_warnings,
experimental,
..
} = build_options;
let mut selected_build_profile = BuildProfile::DEBUG;
Expand Down Expand Up @@ -2084,6 +2093,7 @@ fn build_profile_from_opts(
profile.include_tests |= tests;
profile.json_abi_with_callpaths |= pkg.json_abi_with_callpaths;
profile.error_on_warnings |= error_on_warnings;
profile.experimental = experimental.clone();

Ok((selected_build_profile.to_string(), profile))
}
Expand Down Expand Up @@ -2627,7 +2637,7 @@ pub fn check(
build_target,
&profile,
)?
.include_tests(include_tests);
.with_include_tests(include_tests);

let input = manifest.entry_string()?;
let handler = Handler::default();
Expand Down
3 changes: 3 additions & 0 deletions forc-plugins/forc-client/src/cmd/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,7 @@ pub struct Command {
/// ]
#[clap(long, verbatim_doc_comment, name = "JSON_FILE_PATH")]
pub override_storage_slots: Option<String>,

#[clap(long)]
pub experimental_new_encoding: bool,
}
3 changes: 3 additions & 0 deletions forc-plugins/forc-client/src/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ pub struct Command {
/// Arguments to pass into main function with forc run.
#[clap(long)]
pub args: Option<Vec<String>>,

#[clap(long)]
pub experimental_new_encoding: bool,
}
5 changes: 4 additions & 1 deletion forc-plugins/forc-client/src/op/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use fuel_tx::{Output, Salt, TransactionBuilder};
use fuel_vm::prelude::*;
use fuels_accounts::provider::Provider;
use futures::FutureExt;
use pkg::BuiltPackage;
use pkg::{manifest::ExperimentalFlags, BuiltPackage};
use serde::{Deserialize, Serialize};
use std::time::Duration;
use std::{
Expand Down Expand Up @@ -348,6 +348,9 @@ fn build_opts_from_cmd(cmd: &cmd::Deploy) -> pkg::BuildOpts {
build_target: BuildTarget::default(),
tests: false,
member_filter: pkg::MemberFilter::only_contracts(),
experimental: ExperimentalFlags {
new_encoding: cmd.experimental_new_encoding,
},
}
}

Expand Down
5 changes: 4 additions & 1 deletion forc-plugins/forc-client/src/op/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use forc_util::tx_utils::format_log_receipts;
use fuel_core_client::client::FuelClient;
use fuel_tx::{ContractId, Transaction, TransactionBuilder};
use fuels_accounts::provider::Provider;
use pkg::BuiltPackage;
use pkg::{manifest::ExperimentalFlags, BuiltPackage};
use std::time::Duration;
use std::{path::PathBuf, str::FromStr};
use sway_core::language::parsed::TreeType;
Expand Down Expand Up @@ -231,5 +231,8 @@ fn build_opts_from_cmd(cmd: &cmd::Run) -> pkg::BuildOpts {
debug_outfile: cmd.build_output.debug_file.clone(),
tests: false,
member_filter: pkg::MemberFilter::only_scripts(),
experimental: ExperimentalFlags {
new_encoding: cmd.experimental_new_encoding,
},
}
}
69 changes: 39 additions & 30 deletions forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,49 @@ fn test_impl_traits_default() {
);
assert_search_js(
&doc_path,
&expect![[
r#"var SEARCH_INDEX={"core":[{"html_filename":"trait.AsRawSlice.html","module_info":["core","raw_slice"],"name":"AsRawSlice","preview":"Trait to return a type as a <code>raw_slice</code>.\n","type_name":"trait"},{"html_filename":"fn.from_str_array.html","module_info":["core","str"],"name":"from_str_array","preview":"","type_name":"function"},{"html_filename":"trait.Add.html","module_info":["core","ops"],"name":"Add","preview":"Trait for the addition of two values.\n","type_name":"trait"},{"html_filename":"trait.Subtract.html","module_info":["core","ops"],"name":"Subtract","preview":"Trait for the subtraction of two values.\n","type_name":"trait"},{"html_filename":"trait.Multiply.html","module_info":["core","ops"],"name":"Multiply","preview":"Trait for the multiplication of two values.\n","type_name":"trait"},{"html_filename":"trait.Divide.html","module_info":["core","ops"],"name":"Divide","preview":"Trait for the division of two values.\n","type_name":"trait"},{"html_filename":"trait.Mod.html","module_info":["core","ops"],"name":"Mod","preview":"Trait for the modulo of two values.\n","type_name":"trait"},{"html_filename":"trait.Not.html","module_info":["core","ops"],"name":"Not","preview":"Trait to invert a type.\n","type_name":"trait"},{"html_filename":"trait.Eq.html","module_info":["core","ops"],"name":"Eq","preview":"Trait to evaluate if two types are equal.\n","type_name":"trait"},{"html_filename":"trait.Ord.html","module_info":["core","ops"],"name":"Ord","preview":"Trait to evaluate if one value is greater or less than another of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseAnd.html","module_info":["core","ops"],"name":"BitwiseAnd","preview":"Trait to bitwise AND two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseOr.html","module_info":["core","ops"],"name":"BitwiseOr","preview":"Trait to bitwise OR two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseXor.html","module_info":["core","ops"],"name":"BitwiseXor","preview":"Trait to bitwise XOR two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.Shift.html","module_info":["core","ops"],"name":"Shift","preview":"Trait to bit shift a value.\n","type_name":"trait"},{"html_filename":"enum.Never.html","module_info":["core","never"],"name":"Never","preview":"<code>Never</code> represents the type of computations which never resolve to any value at all.","type_name":"enum"},{"html_filename":"struct.StorageKey.html","module_info":["core","storage"],"name":"StorageKey","preview":"Describes a location in storage.\n","type_name":"struct"}],"impl_traits":[{"html_filename":"trait.Foo.html","module_info":["impl_traits","foo"],"name":"Foo","preview":"","type_name":"trait"},{"html_filename":"trait.Baz.html","module_info":["impl_traits","foo"],"name":"Baz","preview":"","type_name":"trait"},{"html_filename":"struct.Bar.html","module_info":["impl_traits","bar"],"name":"Bar","preview":"","type_name":"struct"}]};
"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=SEARCH_INDEX);"#
]],
&expect![[r#"
var SEARCH_INDEX={"core":[{"html_filename":"trait.AsRawSlice.html","module_info":["core","raw_slice"],"name":"AsRawSlice","preview":"Trait to return a type as a <code>raw_slice</code>.\n","type_name":"trait"},{"html_filename":"fn.from_str_array.html","module_info":["core","str"],"name":"from_str_array","preview":"","type_name":"function"},{"html_filename":"trait.Add.html","module_info":["core","ops"],"name":"Add","preview":"Trait for the addition of two values.\n","type_name":"trait"},{"html_filename":"trait.Subtract.html","module_info":["core","ops"],"name":"Subtract","preview":"Trait for the subtraction of two values.\n","type_name":"trait"},{"html_filename":"trait.Multiply.html","module_info":["core","ops"],"name":"Multiply","preview":"Trait for the multiplication of two values.\n","type_name":"trait"},{"html_filename":"trait.Divide.html","module_info":["core","ops"],"name":"Divide","preview":"Trait for the division of two values.\n","type_name":"trait"},{"html_filename":"trait.Mod.html","module_info":["core","ops"],"name":"Mod","preview":"Trait for the modulo of two values.\n","type_name":"trait"},{"html_filename":"trait.Not.html","module_info":["core","ops"],"name":"Not","preview":"Trait to invert a type.\n","type_name":"trait"},{"html_filename":"trait.Eq.html","module_info":["core","ops"],"name":"Eq","preview":"Trait to evaluate if two types are equal.\n","type_name":"trait"},{"html_filename":"trait.Ord.html","module_info":["core","ops"],"name":"Ord","preview":"Trait to evaluate if one value is greater or less than another of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseAnd.html","module_info":["core","ops"],"name":"BitwiseAnd","preview":"Trait to bitwise AND two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseOr.html","module_info":["core","ops"],"name":"BitwiseOr","preview":"Trait to bitwise OR two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseXor.html","module_info":["core","ops"],"name":"BitwiseXor","preview":"Trait to bitwise XOR two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.Shift.html","module_info":["core","ops"],"name":"Shift","preview":"Trait to bit shift a value.\n","type_name":"trait"},{"html_filename":"enum.Never.html","module_info":["core","never"],"name":"Never","preview":"<code>Never</code> represents the type of computations which never resolve to any value at all.","type_name":"enum"},{"html_filename":"struct.StorageKey.html","module_info":["core","storage"],"name":"StorageKey","preview":"Describes a location in storage.\n","type_name":"struct"},{"html_filename":"struct.Buffer.html","module_info":["core","codec"],"name":"Buffer","preview":"","type_name":"struct"},{"html_filename":"trait.AbiEncode.html","module_info":["core","codec"],"name":"AbiEncode","preview":"","type_name":"trait"},{"html_filename":"fn.encode.html","module_info":["core","codec"],"name":"encode","preview":"","type_name":"function"}],"impl_traits":[{"html_filename":"trait.Foo.html","module_info":["impl_traits","foo"],"name":"Foo","preview":"","type_name":"trait"},{"html_filename":"trait.Baz.html","module_info":["impl_traits","foo"],"name":"Baz","preview":"","type_name":"trait"},{"html_filename":"struct.Bar.html","module_info":["impl_traits","bar"],"name":"Bar","preview":"","type_name":"struct"}]};
"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=SEARCH_INDEX);"#]],
);
assert_file_tree(
doc_dir_name,
project_name,
vec![
"core/str/fn.from_str_array.html",
"core/storage/index.html",
"core/ops/trait.Add.html",
"core/ops/index.html",
"core/all.html",
"core/codec/fn.encode.html",
"core/codec/index.html",
"core/codec/struct.Buffer.html",
"core/codec/trait.AbiEncode.html",
"core/index.html",
"core/ops/trait.Subtract.html",
"search.js",
"core/storage/struct.StorageKey.html",
"core/ops/trait.Mod.html",
"core/ops/trait.Shift.html",
"core/ops/trait.Not.html",
"impl_traits/foo/trait.Baz.html",
"core/never/enum.Never.html",
"core/never/index.html",
"core/all.html",
"core/raw_slice/trait.AsRawSlice.html",
"core/ops/index.html",
"core/ops/trait.Add.html",
"core/ops/trait.BitwiseAnd.html",
"core/ops/trait.Eq.html",
"core/ops/trait.BitwiseOr.html",
"core/str/index.html",
"core/raw_slice/index.html",
"impl_traits/all.html",
"impl_traits/index.html",
"core/ops/trait.BitwiseXor.html",
"core/ops/trait.Ord.html",
"core/ops/trait.Divide.html",
"impl_traits/foo/trait.Foo.html",
"impl_traits/bar/struct.Bar.html",
"impl_traits/foo/index.html",
"core/ops/trait.Eq.html",
"core/ops/trait.Mod.html",
"core/ops/trait.Multiply.html",
"core/ops/trait.Not.html",
"core/ops/trait.Ord.html",
"core/ops/trait.Shift.html",
"core/ops/trait.Subtract.html",
"core/raw_slice/index.html",
"core/raw_slice/trait.AsRawSlice.html",
"core/storage/index.html",
"core/storage/struct.StorageKey.html",
"core/str/fn.from_str_array.html",
"core/str/index.html",
"impl_traits/all.html",
"impl_traits/bar/index.html",
"core/never/enum.Never.html",
"impl_traits/bar/struct.Bar.html",
"impl_traits/foo/index.html",
"impl_traits/foo/trait.Baz.html",
"impl_traits/foo/trait.Foo.html",
"impl_traits/index.html",
"search.js",
],
);
}
Expand Down Expand Up @@ -133,11 +136,17 @@ fn assert_search_js(doc_path: &Path, expect: &Expect) {
}

fn assert_file_tree(doc_dir_name: &str, project_name: &str, expected_files: Vec<&str>) {
let doc_root = format!("{}/{}/out/{}", DATA_DIR, project_name, doc_dir_name).into();
let doc_root: PathBuf = format!("{}/{}/out/{}", DATA_DIR, project_name, doc_dir_name).into();
let expected = expected_files
.iter()
.map(PathBuf::from)
.collect::<HashSet<PathBuf>>();
let files = get_relative_file_paths_set(doc_root);
assert_eq!(files, expected);
let files = get_relative_file_paths_set(doc_root.clone());
if files != expected {
let diffs = files.symmetric_difference(&expected);
assert_eq!(
files, expected,
"Symmetric Difference: {diffs:?} at {doc_root:?}"
);
}
}
4 changes: 4 additions & 0 deletions forc-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use fuel_abi_types::error_codes::ErrorSignal;
use fuel_tx as tx;
use fuel_vm::checked_transaction::builder::TransactionBuilderExt;
use fuel_vm::{self as vm};
use pkg::manifest::ExperimentalFlags;
use pkg::TestPassCondition;
use pkg::{Built, BuiltPackage};
use rand::{Rng, SeedableRng};
Expand Down Expand Up @@ -147,6 +148,8 @@ pub struct Opts {
pub time_phases: bool,
/// Output compilation metrics into file.
pub metrics_outfile: Option<String>,
/// Set of experimental flags
pub experimental: ExperimentalFlags,
}

/// The set of options provided for controlling logs printed for each test.
Expand Down Expand Up @@ -405,6 +408,7 @@ impl Opts {
metrics_outfile: self.metrics_outfile,
tests: true,
member_filter: Default::default(),
experimental: self.experimental,
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions forc/src/cli/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ pub struct Command {
/// Also build all tests within the project.
#[clap(long)]
pub tests: bool,

#[clap(long)]
/// Experimental flags for the "new encoding" feature
pub experimental_new_encoding: bool,
}

pub(crate) fn exec(command: Command) -> ForcResult<()> {
Expand Down
4 changes: 4 additions & 0 deletions forc/src/cli/commands/contract_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ pub struct Command {
pub build_profile: BuildProfile,
#[clap(flatten)]
pub salt: Salt,

#[clap(long)]
/// Experimental flags for the "new encoding" feature
pub experimental_new_encoding: bool,
}

pub(crate) fn exec(cmd: Command) -> ForcResult<()> {
Expand Down
4 changes: 4 additions & 0 deletions forc/src/cli/commands/predicate_root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ pub struct Command {
pub build_output: BuildOutput,
#[clap(flatten)]
pub build_profile: BuildProfile,

#[clap(long)]
/// Experimental flags for the "new encoding" feature
pub experimental_new_encoding: bool,
}

pub(crate) fn exec(cmd: Command) -> ForcResult<()> {
Expand Down
8 changes: 8 additions & 0 deletions forc/src/cli/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use clap::Parser;
use forc_pkg as pkg;
use forc_test::{TestFilter, TestRunnerCount, TestedPackage};
use forc_util::{tx_utils::format_log_receipts, ForcError, ForcResult};
use pkg::manifest::ExperimentalFlags;
use tracing::info;

forc_util::cli_examples! {
Expand Down Expand Up @@ -45,6 +46,10 @@ pub struct Command {
/// Number of threads to utilize when running the tests. By default, this is the number of
/// threads available in your system.
pub test_threads: Option<usize>,

#[clap(long)]
/// Experimental flags for the "new encoding" feature
pub experimental_new_encoding: bool,
}

/// The set of options provided for controlling output of a test.
Expand Down Expand Up @@ -223,6 +228,9 @@ fn opts_from_cmd(cmd: Command) -> forc_test::Opts {
binary_outfile: cmd.build.output.bin_file,
debug_outfile: cmd.build.output.debug_file,
build_target: cmd.build.build_target,
experimental: ExperimentalFlags {
new_encoding: cmd.experimental_new_encoding,
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions forc/src/ops/forc_build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::cli::BuildCommand;
use forc_pkg as pkg;
use forc_util::ForcResult;
use pkg::manifest::ExperimentalFlags;

pub fn build(cmd: BuildCommand) -> ForcResult<pkg::Built> {
let opts = opts_from_cmd(cmd);
Expand Down Expand Up @@ -42,5 +43,8 @@ fn opts_from_cmd(cmd: BuildCommand) -> pkg::BuildOpts {
build_target: cmd.build.build_target,
tests: cmd.tests,
member_filter: Default::default(),
experimental: ExperimentalFlags {
new_encoding: cmd.experimental_new_encoding,
},
}
}
4 changes: 4 additions & 0 deletions forc/src/ops/forc_contract_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::cli::ContractIdCommand;
use anyhow::{bail, Result};
use forc_pkg::{self as pkg, build_with_options};
use forc_tracing::println_green;
use pkg::manifest::ExperimentalFlags;
use sway_core::{fuel_prelude::fuel_tx, BuildTarget};
use tracing::info;

Expand Down Expand Up @@ -78,5 +79,8 @@ fn build_opts_from_cmd(cmd: &ContractIdCommand) -> pkg::BuildOpts {
build_target: BuildTarget::default(),
tests: false,
member_filter: pkg::MemberFilter::only_contracts(),
experimental: ExperimentalFlags {
new_encoding: cmd.experimental_new_encoding,
},
}
}
4 changes: 4 additions & 0 deletions forc/src/ops/forc_predicate_root.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::cli::PredicateRootCommand;
use anyhow::Result;
use forc_pkg::{self as pkg, build_with_options};
use pkg::manifest::ExperimentalFlags;
use sway_core::BuildTarget;

pub fn predicate_root(command: PredicateRootCommand) -> Result<()> {
Expand Down Expand Up @@ -46,5 +47,8 @@ fn build_opts_from_cmd(cmd: PredicateRootCommand) -> pkg::BuildOpts {
build_target: BuildTarget::default(),
tests: false,
member_filter: pkg::MemberFilter::only_predicates(),
experimental: ExperimentalFlags {
new_encoding: cmd.experimental_new_encoding,
},
}
}
Loading
Loading