Sort funcs (#91)

This commit is contained in:
Mike Voronov
2021-06-01 19:27:21 +03:00
committed by GitHub
parent b2827a73ab
commit 17eedfd525
7 changed files with 73 additions and 46 deletions

View File

@ -13,12 +13,12 @@ jobs:
keys:
- marine04-{{ checksum "Cargo.lock" }}
- run: |
rustup toolchain install nightly-2021-03-24
rustup default nightly-2021-03-24
rustup override set nightly-2021-03-24
rustup toolchain install nightly-2021-05-16
rustup default nightly-2021-05-16
rustup override set nightly-2021-05-16
rustup component add rustfmt --toolchain nightly-2021-03-24
rustup component add clippy --toolchain nightly-2021-03-24
rustup component add rustfmt --toolchain nightly-2021-05-16
rustup component add clippy --toolchain nightly-2021-05-16
rustup target add wasm32-wasi
cargo install --path tools/cli

75
Cargo.lock generated
View File

@ -154,9 +154,9 @@ dependencies = [
[[package]]
name = "blake3"
version = "0.3.7"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f"
checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3"
dependencies = [
"arrayref",
"arrayvec",
@ -175,9 +175,9 @@ checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9"
[[package]]
name = "bumpalo"
version = "3.6.1"
version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631"
[[package]]
name = "byteorder"
@ -236,14 +236,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "check-latest"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52785868311163c46203e5be682d01623fc550949e24b7943eb8e4b80c9ca937"
checksum = "686b97f42c02048850cf72da8a67a42c094d57f50e216b735d94aad32fd3c4c9"
dependencies = [
"anyhow",
"chrono",
"reqwest 0.11.3",
"semver 0.11.0",
"semver 1.0.1",
"serde",
]
@ -396,9 +396,9 @@ dependencies = [
[[package]]
name = "crossbeam-epoch"
version = "0.9.4"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52fb27eab85b17fbb9f6fd667089e07d6a2eb8743d02639ee7f6a7a7729c9c94"
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
@ -409,11 +409,10 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.4"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4feb231f0d4d6af81aed15928e58ecf5816aa62a2393e2c82f46973e92a9a278"
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
dependencies = [
"autocfg",
"cfg-if 1.0.0",
"lazy_static",
]
@ -1075,7 +1074,7 @@ dependencies = [
"http",
"indexmap",
"slab",
"tokio 1.6.0",
"tokio 1.6.1",
"tokio-util 0.6.7",
"tracing",
]
@ -1211,7 +1210,7 @@ dependencies = [
"itoa",
"pin-project",
"socket2 0.4.0",
"tokio 1.6.0",
"tokio 1.6.1",
"tower-service",
"tracing",
"want",
@ -1239,7 +1238,7 @@ dependencies = [
"bytes 1.0.1",
"hyper 0.14.8",
"native-tls",
"tokio 1.6.0",
"tokio 1.6.1",
"tokio-native-tls",
]
@ -1418,9 +1417,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.94"
version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36"
[[package]]
name = "local_storage"
@ -1457,7 +1456,7 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "marine"
version = "0.6.5"
version = "0.6.6"
dependencies = [
"Inflector",
"anyhow",
@ -1466,7 +1465,7 @@ dependencies = [
"clap",
"exitfailure",
"marine-it-generator 0.5.2",
"marine-it-parser 0.6.2",
"marine-it-parser 0.6.3",
"marine-module-info-parser 0.1.0",
"semver 0.11.0",
"serde",
@ -1500,7 +1499,7 @@ version = "0.5.2"
dependencies = [
"cargo_toml",
"it-lilo",
"marine-it-parser 0.6.2",
"marine-it-parser 0.6.3",
"marine-macro-impl",
"once_cell",
"serde",
@ -1547,7 +1546,7 @@ dependencies = [
[[package]]
name = "marine-it-parser"
version = "0.6.2"
version = "0.6.3"
dependencies = [
"anyhow",
"itertools 0.10.0",
@ -1617,7 +1616,7 @@ dependencies = [
[[package]]
name = "marine-module-interface"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"anyhow",
"itertools 0.10.0",
@ -1642,7 +1641,7 @@ dependencies = [
"log",
"marine-it-generator 0.5.2",
"marine-it-interfaces 0.4.0",
"marine-it-parser 0.6.2",
"marine-it-parser 0.6.3",
"marine-module-info-parser 0.1.0",
"marine-module-interface",
"marine-utils 0.2.0",
@ -1773,9 +1772,9 @@ dependencies = [
[[package]]
name = "memoffset"
version = "0.6.3"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
"autocfg",
]
@ -2478,7 +2477,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
"tokio 1.6.0",
"tokio 1.6.1",
"tokio-native-tls",
"url",
"wasm-bindgen",
@ -2558,9 +2557,9 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "safe-transmute"
version = "0.11.1"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d95e7284b4bd97e24af76023904cd0157c9cc9da0310beb4139a1e88a748d47"
checksum = "98a01dab6acf992653be49205bdd549f32f17cb2803e8eacf1560bf97259aae8"
[[package]]
name = "schannel"
@ -2617,6 +2616,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
dependencies = [
"semver-parser 0.10.2",
]
[[package]]
name = "semver"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d023dabf011d5dcb5ac64e3685d97d3b0ef412911077a2851455c6098524a723"
dependencies = [
"serde",
]
@ -2966,9 +2973,9 @@ dependencies = [
[[package]]
name = "tokio"
version = "1.6.0"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd3076b5c8cc18138b8f8814895c11eb4de37114a5d127bafdc5e55798ceef37"
checksum = "0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975"
dependencies = [
"autocfg",
"bytes 1.0.1",
@ -2997,7 +3004,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
dependencies = [
"native-tls",
"tokio 1.6.0",
"tokio 1.6.1",
]
[[package]]
@ -3035,7 +3042,7 @@ dependencies = [
"futures-sink",
"log",
"pin-project-lite 0.2.6",
"tokio 1.6.0",
"tokio 1.6.1",
]
[[package]]
@ -3160,9 +3167,9 @@ dependencies = [
[[package]]
name = "unicode-normalization"
version = "0.1.17"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef"
checksum = "33717dca7ac877f497014e10d73f3acf948c342bee31b5ca7892faf94ccc6b49"
dependencies = [
"tinyvec",
]

View File

@ -1,7 +1,7 @@
[package]
name = "marine-it-parser"
description = "Fluence Marine interface types parser"
version = "0.6.2"
version = "0.6.3"
authors = ["Fluence Labs"]
license = "Apache-2.0"
edition = "2018"
@ -12,7 +12,7 @@ path = "src/lib.rs"
[dependencies]
marine-it-interfaces = { path = "../it-interfaces", version = "0.4.0" }
marine-module-interface = { path = "../module-interface", version = "0.1.1" }
marine-module-interface = { path = "../module-interface", version = "0.1.2" }
anyhow = "1.0.31"
walrus = "0.18.0"

View File

@ -1,7 +1,7 @@
[package]
name = "marine-module-interface"
description = "Fluence Marine module interface"
version = "0.1.1"
version = "0.1.2"
authors = ["Fluence Labs"]
license = "Apache-2.0"
edition = "2018"

View File

@ -17,13 +17,32 @@
use serde::Serialize;
use serde::Deserialize;
#[derive(PartialEq, Eq, Debug, Clone, Hash, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct FunctionSignature {
pub name: String,
pub arguments: Vec<(String, String)>,
pub output_types: Vec<String>,
}
use std::cmp::Ordering;
impl PartialOrd for FunctionSignature {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for FunctionSignature {
fn cmp(&self, other: &Self) -> Ordering {
if self.name < other.name {
Ordering::Less
} else if self == other {
Ordering::Equal
} else {
Ordering::Greater
}
}
}
#[derive(PartialEq, Eq, Debug, Clone, Hash, Serialize, Deserialize)]
pub struct RecordField {
pub name: String,

View File

@ -1,7 +1,7 @@
[package]
name = "marine"
description = "Fluence Marine command line tool"
version = "0.6.5"
version = "0.6.6"
authors = ["Fluence Labs"]
repository = "https://github.com/fluencelabs/marine/tools/cli"
license = "Apache-2.0"
@ -13,7 +13,7 @@ path = "src/main.rs"
[dependencies]
marine-it-generator = { path = "../../crates/it-generator", version = "0.5.1" }
marine-it-parser = { path = "../../crates/it-parser", version = "0.6.2" }
marine-it-parser = { path = "../../crates/it-parser", version = "0.6.3" }
marine-module-info-parser = { path = "../../crates/module-info-parser", version = "0.1.0" }
semver = "0.11.0"

View File

@ -92,7 +92,7 @@ fn aqua(args: &clap::ArgMatches<'_>) -> Result<(), anyhow::Error> {
let wasm_path = args.value_of(args::IN_WASM_PATH).unwrap();
let wasm_path = std::path::Path::new(wasm_path);
let module_interface = marine_it_parser::module_interface(wasm_path)?;
let mut module_interface = marine_it_parser::module_interface(wasm_path)?;
for record in module_interface.record_types.iter() {
println!("{}", record);
}
@ -113,6 +113,7 @@ fn aqua(args: &clap::ArgMatches<'_>) -> Result<(), anyhow::Error> {
None => println!("service {}:", service_name),
}
module_interface.function_signatures.sort();
for sign in module_interface.function_signatures {
print!(" {}", sign);
}