-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: add clap-cargo-extra and clean up * feat: rebuild only when needed * fix: display filename that errored * feat: nightly optimizations * feat: upgrade to use clap-cargo-extra and add transitive deps * fix(CI): add toolchain file * chore: update readme and ensure examples are not published Co-authored-by: Willem Wyndham <[email protected]> Co-authored-by: Willem Wyndham <[email protected]>
- Loading branch information
1 parent
3174c8d
commit 4bdac75
Showing
18 changed files
with
496 additions
and
185 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
[package] | ||
name = "rust-counter-tutorial" | ||
version = "0.1.0" | ||
authors = ["Near Inc <[email protected]>"] | ||
edition = "2018" | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
brotli = "3.3.4" | ||
near-sdk = { git = "https://github.com/ahalabs/near-sdk-rs", tag = "v4.0.0-4" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
[package] | ||
name = "status-message-advanced" | ||
version = "0.1.0" | ||
authors = ["Near Inc <[email protected]>"] | ||
edition = "2018" | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[package] | ||
name = "status-message" | ||
version = "0.1.0" | ||
authors = ["Near Inc <[email protected]>"] | ||
edition = "2018" | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
near-sdk = { git = "https://github.com/ahalabs/near-sdk-rs", tag = "v4.0.0-4" } | ||
|
||
witgen-dep = { path = "../witgen-dep"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
rustflags = ["-C", "link-args=-s"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "witgen-dep-dep" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[dependencies] | ||
witgen = "0.15.0" | ||
|
||
[package.metadata.witgen] | ||
export = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use witgen::witgen; | ||
|
||
#[witgen] | ||
pub struct InnerType { | ||
pub text: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
rustflags = ["-C", "link-args=-s"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "witgen-dep" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[dependencies] | ||
witgen = "0.15.0" | ||
witgen-dep-dep = { path = "../witgen-dep-dep" } | ||
|
||
[package.metadata.witgen] | ||
export = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use witgen::witgen; | ||
use witgen_dep_dep::InnerType; | ||
|
||
#[witgen] | ||
pub struct TestDep { | ||
pub inner: InnerType, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[toolchain] | ||
channel = "stable" | ||
targets = ["wasm32-unknown-unknown"] | ||
components = ["rustc", "cargo", "rustfmt", "clippy", "rust-src"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use anyhow::{Context, Result}; | ||
use cargo_metadata::Package; | ||
use filetime::FileTime; | ||
use std::{fs, path::Path}; | ||
|
||
pub trait PackageExt { | ||
fn witgen_dep(&self) -> bool; | ||
} | ||
|
||
impl PackageExt for Package { | ||
fn witgen_dep(&self) -> bool { | ||
self.metadata | ||
.as_object() | ||
.map_or(false, |metadata| metadata.contains_key("witgen")) | ||
} | ||
} | ||
|
||
pub fn get_time(path: &Path) -> Result<FileTime> { | ||
Ok(FileTime::from_last_modification_time( | ||
&fs::metadata(path).context(format!("failed to access {}", path.to_string_lossy()))?, | ||
)) | ||
} | ||
|
||
pub fn compress_file(p: &Path) -> Result<Vec<u8>> { | ||
let buf = fs::read(p) | ||
.map_err(anyhow::Error::from) | ||
.with_context(|| format!("{}", p.to_string_lossy()))? | ||
.into_boxed_slice(); | ||
let mut out = Vec::<u8>::new(); | ||
let params = brotli::enc::BrotliEncoderParams { | ||
quality: 11, | ||
..Default::default() | ||
}; | ||
|
||
brotli::BrotliCompress(&mut buf.as_ref(), &mut out, ¶ms)?; | ||
Ok(out) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod ext; | ||
pub mod raen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.