-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from mchodzikiewicz/feature/no_std
Add no_std support
- Loading branch information
Showing
23 changed files
with
246 additions
and
92 deletions.
There are no files selected for viewing
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,47 +1,14 @@ | ||
[package] | ||
name = "shadow-rs" | ||
version = "0.37.0" | ||
authors = ["baoyachi <[email protected]>"] | ||
edition = "2021" | ||
description = "A build-time information stored in your rust project" | ||
keywords = ["cargo", "build-script", "build", "shadow", "compile"] | ||
readme = "README.md" | ||
categories = ["development-tools", "development-tools::build-utils"] | ||
repository = "https://github.com/baoyachi/shadow-rs" | ||
documentation = "https://docs.rs/shadow-rs" | ||
homepage = "https://github.com/baoyachi/shadow-rs" | ||
license = "MIT AND Apache-2.0" | ||
exclude = ["shadow-rs.png", "build_module.png"] | ||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
|
||
[dependencies] | ||
is_debug = "1.0.2" | ||
const_format = { version = "0.2.22", default-features = false } | ||
time = { version = "0.3.36", features = ["formatting", "local-offset", "parsing"], default-features = false } | ||
|
||
|
||
#! Optional Dependencies: | ||
|
||
## Use `libgit2` as a backend for git operations | ||
git2 = { version = "0.19.0", default-features = false, optional = true } | ||
|
||
## Better support for querying the local system time | ||
tzdb = { version = "0.6.0", optional = true, default-features = false, features = ["local"] } | ||
|
||
document-features = { version = "0.2", optional = true } | ||
|
||
cargo_metadata = { version = "0.18.1", optional = true, default-features = false } | ||
serde_json = { version = "1", default-features = false, optional = true } | ||
|
||
[features] | ||
default = ["git2", "tzdb"] | ||
metadata = ["cargo_metadata", "serde_json"] | ||
|
||
[dev-dependencies] | ||
winnow = "0.6" | ||
|
||
[workspace] | ||
members = ["example_shadow", "example_shadow_hook", "example_wasm"] | ||
members = [ | ||
"shadow-rs", | ||
"shadow-rs-consumer", | ||
"example_shadow", | ||
"example_shadow_hook", | ||
"example_wasm", | ||
] | ||
|
||
exclude = [ | ||
"example_no_std" | ||
] | ||
|
||
resolver = "2" |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
.idea | ||
shadow.rs |
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 = "example_no_std" | ||
version = "0.1.8" | ||
authors = ["baoyachi <[email protected]>", "mchodzikiewicz <[email protected]>"] | ||
edition = "2021" | ||
build = "build.rs" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
shadow-rs-consumer = { path = "../shadow-rs-consumer" } | ||
log = "0.4.22" | ||
|
||
[build-dependencies] | ||
shadow-rs = { path = "../shadow-rs", default-features = false } |
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,8 @@ | ||
use shadow_rs::ShadowBuilder; | ||
|
||
fn main() { | ||
ShadowBuilder::builder() | ||
.deny_const(Default::default()) | ||
.build() | ||
.unwrap(); | ||
} |
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,18 @@ | ||
#![no_std] | ||
#![no_main] | ||
|
||
use shadow_rs_consumer::shadow; | ||
|
||
shadow!(build); | ||
|
||
use core::panic::PanicInfo; | ||
|
||
#[panic_handler] | ||
fn panic(_info: &PanicInfo) -> ! { | ||
loop {} | ||
} | ||
|
||
#[allow(clippy::all, clippy::pedantic, clippy::restriction, clippy::nursery)] | ||
pub fn func() { | ||
log::info!("short_commit: {}", build::SHORT_COMMIT); | ||
} |
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
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 @@ | ||
[package] | ||
name = "shadow-rs-consumer" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
const_format = "0.2.34" |
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,27 @@ | ||
#![no_std] | ||
/// Add a module with the provided name which contains the build information generated by `shadow-rs`. | ||
/// | ||
/// # Example | ||
/// | ||
/// ```ignore | ||
/// use shadow_rs::shadow; | ||
/// | ||
/// shadow!(my_build_information); | ||
/// | ||
/// fn main() { | ||
/// println!("I'm version {}!", my_build_information::VERSION); | ||
/// } | ||
/// ``` | ||
/// | ||
/// The convention, however, is to use `shadow!(build);`. | ||
#[macro_export] | ||
macro_rules! shadow { | ||
($build_mod:ident) => { | ||
#[doc = r#"shadow-rs mod"#] | ||
pub mod $build_mod { | ||
include!(concat!(env!("OUT_DIR"), "/shadow.rs")); | ||
} | ||
}; | ||
} | ||
|
||
pub use const_format::formatcp; |
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,46 @@ | ||
[package] | ||
name = "shadow-rs" | ||
version = "0.37.0" | ||
authors = ["baoyachi <[email protected]>"] | ||
edition = "2021" | ||
description = "A build-time information stored in your rust project" | ||
keywords = ["cargo", "build-script", "build", "shadow", "compile"] | ||
readme = "README.md" | ||
categories = ["development-tools", "development-tools::build-utils"] | ||
repository = "https://github.com/baoyachi/shadow-rs" | ||
documentation = "https://docs.rs/shadow-rs" | ||
homepage = "https://github.com/baoyachi/shadow-rs" | ||
license = "MIT AND Apache-2.0" | ||
exclude = ["shadow-rs.png", "build_module.png"] | ||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
|
||
[dependencies] | ||
is_debug = "1.0.2" | ||
const_format = { version = "0.2.22", default-features = false } | ||
time = { version = "0.3.36", features = ["formatting", "local-offset", "parsing"], default-features = false } | ||
#TODO: not sure how to bootstrap this, but once shadow-rs-consumer is published on crates.io, this dep should point to that version | ||
shadow-rs-consumer = { path = "../shadow-rs-consumer"} | ||
|
||
#! Optional Dependencies: | ||
|
||
## Use `libgit2` as a backend for git operations | ||
git2 = { version = "0.19.0", default-features = false, optional = true } | ||
|
||
## Better support for querying the local system time | ||
tzdb = { version = "0.6.0", optional = true, default-features = false, features = ["local"] } | ||
|
||
document-features = { version = "0.2", optional = true } | ||
|
||
cargo_metadata = { version = "0.18.1", optional = true, default-features = false } | ||
serde_json = { version = "1", default-features = false, optional = true } | ||
|
||
[features] | ||
default = ["std", "git2", "tzdb"] | ||
metadata = ["cargo_metadata", "serde_json"] | ||
std = [] | ||
|
||
[dev-dependencies] | ||
winnow = "0.6" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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.