mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
no_std support (#232)
- Disable default features in dependencies - Use anyhow::Error::msg to map errors. Note: anyhow will itself be removed later. - lazy_static/spin_no_std used in no_std environments - ensure_no_std binary is built to target thumbv7m-none-eabi to ensure that there are no std dependencies. thumbv7m-none-eabi target has no std support. - The opa-no-std feature enables only those Regorus features that work with no_std. - Enable tests with no_std - Update sizes of regorus binary in README.md - Ensure that regorus example can be built with only std - Ensure that regorus example can be built with no_std Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
01fc234a33
commit
e86b590f91
69
Cargo.toml
69
Cargo.toml
@@ -6,6 +6,7 @@ members = [
|
||||
"bindings/wasm",
|
||||
"bindings/java",
|
||||
"bindings/ruby/ext/regorusrb",
|
||||
"tests/ensure_no_std",
|
||||
]
|
||||
|
||||
[package]
|
||||
@@ -15,7 +16,7 @@ version = "0.1.5"
|
||||
edition = "2021"
|
||||
license-file = "LICENSE"
|
||||
repository = "https://github.com/microsoft/regorus"
|
||||
keywords = ["interpreter", "opa", "policy-as-code", "rego"]
|
||||
keywords = ["interpreter", "no_std", "opa", "policy-as-code", "rego"]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -33,14 +34,15 @@ crypto = ["dep:constant_time_eq", "dep:hmac", "dep:hex", "dep:md-5", "dep:sha1",
|
||||
deprecated = []
|
||||
hex = ["dep:data-encoding"]
|
||||
http = []
|
||||
jwt = ["dep:jsonwebtoken", "dep:data-encoding"]
|
||||
glob = ["dep:wax"]
|
||||
graph = []
|
||||
jsonschema = ["dep:jsonschema"]
|
||||
jwt = ["dep:jsonwebtoken", "dep:data-encoding", "dep:itertools"]
|
||||
no_std = ["lazy_static/spin_no_std"]
|
||||
opa-runtime = []
|
||||
regex = ["dep:regex"]
|
||||
semver = ["dep:semver"]
|
||||
std = ["serde_json/std"]
|
||||
std = ["rand/std", "rand/std_rng", "serde_json/std"]
|
||||
time = ["dep:chrono", "dep:chrono-tz"]
|
||||
uuid = ["dep:uuid"]
|
||||
urlquery = ["dep:url"]
|
||||
@@ -67,41 +69,62 @@ full-opa = [
|
||||
"yaml"
|
||||
]
|
||||
|
||||
# Features that can be used in no_std environments.
|
||||
# Note that: the spin_no_std feature in lazy_static must be specified.
|
||||
opa-no-std = [
|
||||
"arc",
|
||||
"base64",
|
||||
"base64url",
|
||||
"coverage",
|
||||
"crypto",
|
||||
"deprecated",
|
||||
"graph",
|
||||
"hex",
|
||||
"no_std",
|
||||
"opa-runtime",
|
||||
"regex",
|
||||
"semver",
|
||||
# Configure lazy_static to use spinlocks.
|
||||
"lazy_static/spin_no_std"
|
||||
]
|
||||
|
||||
# This feature enables some testing utils for OPA tests.
|
||||
opa-testutil = []
|
||||
rand = ["dep:rand"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = { version = "1.0.45", default-features=false }
|
||||
anyhow = { version = "1.0.45", default-features = false }
|
||||
serde = {version = "1.0.150", default-features = false, features = ["derive", "rc"] }
|
||||
serde_json = { version = "1.0.89", default-features=false, features = ["alloc"] }
|
||||
serde_yaml = {version = "0.9.16", optional = true }
|
||||
lazy_static = "1.4.0"
|
||||
rand = "0.8.5"
|
||||
num = "0.4.1"
|
||||
serde_json = { version = "1.0.89", default-features = false, features = ["alloc"] }
|
||||
lazy_static = { version = "1.4.0", default-features = false }
|
||||
|
||||
# Crypto
|
||||
constant_time_eq = {version = "0.3.0", optional = true}
|
||||
hmac = {version = "0.12.1", optional = true}
|
||||
sha2 = {version= "0.10.8", optional = true}
|
||||
hex = {version = "0.4.3", optional = true}
|
||||
sha1 = {version = "0.10.6", optional = true}
|
||||
md-5 = {version = "0.10.6", optional = true}
|
||||
constant_time_eq = {version = "0.3.0", optional = true, default-features = false }
|
||||
hmac = {version = "0.12.1", optional = true, default-features = false}
|
||||
sha2 = {version= "0.10.8", optional = true, default-features = false }
|
||||
hex = {version = "0.4.3", optional = true, default-features = false, features = ["alloc"] }
|
||||
sha1 = {version = "0.10.6", optional = true, default-features = false }
|
||||
md-5 = {version = "0.10.6", optional = true, default-features = false }
|
||||
|
||||
data-encoding = { version = "2.4.0", optional = true }
|
||||
data-encoding = { version = "2.4.0", optional = true, default-features=false, features = ["alloc"] }
|
||||
scientific = { version = "0.5.2" }
|
||||
|
||||
regex = {version = "1.10.2", optional = true}
|
||||
semver = {version = "1.0.20", optional = true}
|
||||
regex = {version = "1.10.2", optional = true, default-features = false }
|
||||
semver = {version = "1.0.20", optional = true, default-features = false }
|
||||
wax = { version = "0.6.0", features = [], default-features = false, optional = true }
|
||||
url = { version = "2.5.0", optional = true }
|
||||
uuid = { version = "1.6.1", features = ["v4", "fast-rng"], optional = true }
|
||||
uuid = { version = "1.6.1", default-features = false, features = ["v4", "fast-rng"], optional = true }
|
||||
jsonschema = { version = "0.17.1", default-features = false, optional = true }
|
||||
chrono = { version = "0.4.31", optional = true }
|
||||
chrono-tz = { version = "0.8.5", optional = true }
|
||||
jsonwebtoken = { version = "9.2.0", optional = true }
|
||||
itertools = "0.12.1"
|
||||
itertools = { version = "0.12.1", default-features = false, optional = true }
|
||||
|
||||
serde_yaml = {version = "0.9.16", default-features = false, optional = true }
|
||||
rand = { version = "0.8.5", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1.0.45"
|
||||
cfg-if = "1.0.0"
|
||||
clap = { version = "4.4.7", features = ["derive"] }
|
||||
prettydiff = { version = "0.6.4", default-features = false }
|
||||
@@ -131,6 +154,12 @@ name="kata"
|
||||
harness=false
|
||||
test=false
|
||||
|
||||
[[example]]
|
||||
name="regorus"
|
||||
harness=false
|
||||
test=false
|
||||
doctest=false
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
# To build locally:
|
||||
# RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --no-deps
|
||||
|
||||
Reference in New Issue
Block a user