Vendor dependencies

This commit is contained in:
2026-08-01 16:11:49 +03:00
parent 7f139a0241
commit 6b5e7f0f8b
29706 changed files with 9575646 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
[tasks.bench]
toolchain = "nightly"
command = "cargo"
args = ["bench", "${@}"]
[tasks.bench-maths]
toolchain = "nightly"
command = "cargo"
args = ["bench", "--features", "maths", "${@}"]
[tasks.bench-legacy]
toolchain = "nightly"
command = "cargo"
args = ["bench", "--no-default-features", "--features", "serde,std,legacy-ops", "${@}"]
[tasks.benchcmp]
dependencies = [
"benchcmp-legacy",
"benchcmp-default"
]
install_crate = "benchcmp"
command = "cargo"
args = ["benchcmp", "target/legacy.bench", "target/default.bench"]
[tasks.benchcmp-default]
script = "cargo +nightly bench > target/default.bench"
[tasks.benchcmp-legacy]
script = "cargo +nightly bench --no-default-features --features serde,std,legacy-ops > target/legacy.bench"
+28
View File
@@ -0,0 +1,28 @@
[tasks.coverage]
dependencies = ["codecov-clean"]
env = { "CARGO_INCREMENTAL" = "0", "RUSTFLAGS" = "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort", "RUSTDOCFLAGS" = "-Cpanic=abort" }
run_task = "codecov-grcov"
[tasks.codecov-grcov]
dependencies = ["codecov-build", "codecov-test"]
command = "grcov"
args = [".", "-s", ".", "--binary-path", "./target/debug/", "-t", "html", "--branch", "--ignore-not-existing", "-o", "./target/debug/coverage/"]
[tasks.codecov-open]
command = "open"
args = [ "./target/debug/coverage/index.html" ]
[tasks.codecov-clean]
toolchain = "nightly"
command = "cargo"
args = [ "clean" ]
[tasks.codecov-build]
toolchain = "nightly"
command = "cargo"
args = [ "build", "-p", "rust_decimal", "--features=default" ]
[tasks.codecov-test]
toolchain = "nightly"
command = "cargo"
args = [ "test", "-p", "rust_decimal", "--features=default" ]
+20
View File
@@ -0,0 +1,20 @@
[env]
FUZZ_RUNS = 1000
[tasks.fuzz]
dependencies = [
"fuzz-arithmetic",
"fuzz-constructors"
]
[tasks.fuzz-arithmetic]
toolchain = "nightly"
install_crate = "cargo-fuzz"
command = "cargo"
args = ["fuzz", "run", "arithmetic", "--", "-runs=${FUZZ_RUNS}"]
[tasks.fuzz-constructors]
toolchain = "nightly"
install_crate = "cargo-fuzz"
command = "cargo"
args = ["fuzz", "run", "constructors", "--", "-runs=${FUZZ_RUNS}"]
@@ -0,0 +1,72 @@
//! ```cargo
//! [dependencies]
//! glob = "*"
//! ```
use glob::glob;
use std::env;
use std::error::Error;
use std::fs;
use std::io::{self, BufRead};
fn main() -> Result<(), Box<dyn Error>> {
let parent_dir = env::var("CARGO_MAKE_WORKING_DIRECTORY").expect("CARGO_MAKE_WORKING_DIRECTORY not specified");
let version_type = env::var("RUST_DECIMAL_BUILD_VERSION").expect("RUST_DECIMAL_BUILD_VERSION not specified");
// Load in the build number
let build_number = format!("{parent_dir}/.buildnumber");
let (major, minor, revision) = parse_build_number(&build_number, &version_type)?;
println!("{major}.{minor}.{revision}");
// Process all cargo files
for entry in glob("./Cargo.toml").expect("Failed to read glob pattern") {
let path = entry?;
let toml = fs::read_to_string(&path)?;
let mut updated_toml = String::new();
let mut added = false;
for line in toml.lines() {
if !added && line.starts_with("version =") {
added = true;
updated_toml.push_str(&format!("version = \"{major}.{minor}.{revision}\"\n"));
} else {
updated_toml.push_str(line);
updated_toml.push('\n');
}
}
fs::write(&path, updated_toml)?;
}
// Also, update the readme with the build number
let readme_path = format!("{parent_dir}/README.md");
let readme = fs::read_to_string(&readme_path)?;
let mut updated_readme = String::new();
for line in readme.lines() {
if line.starts_with("rust_decimal = \"") {
updated_readme.push_str(&format!("rust_decimal = \"{major}.{minor}\"\n"));
} else if line.starts_with("rust_decimal_macros = \"") {
updated_readme.push_str(&format!("rust_decimal_macros = \"{major}.{minor}\"\n"));
} else {
updated_readme.push_str(line);
updated_readme.push('\n');
}
}
fs::write(&readme_path, updated_readme)?;
// Finally, write the build number back
fs::write(build_number, format!("{major}\n{minor}\n{revision}\n",))?;
Ok(())
}
fn parse_build_number(path: &String, version_type: &String) -> Result<(u32, u32, u32), Box<dyn Error>> {
let file = fs::File::open(path)?;
let mut lines = io::BufReader::new(file).lines();
let major: u32 = lines.next().expect("missing major version")?.parse()?;
let minor: u32 = lines.next().expect("missing minor version")?.parse()?;
let revision: u32 = lines.next().expect("missing revision version")?.parse()?;
Ok(match &version_type[..] {
"major" => (major + 1, 0, 0),
"minor" => (major, minor + 1, 0),
"revision" => (major, minor, revision + 1),
_ => (major, minor, revision),
})
}
+46
View File
@@ -0,0 +1,46 @@
extend = [
{ path = "tests/db.toml" },
{ path = "tests/macros.toml" },
{ path = "tests/maths.toml" },
{ path = "tests/misc.toml" },
{ path = "tests/serde.toml" }
]
[tasks.test]
clear = true
dependencies = ["test-no-std", "test-default"]
# Some tests need cleaning before hand to ensure we don't inadvertantly test
# using prebuilt logic
[tasks.clean-no-std]
alias = "clean"
[tasks.test-no-std]
dependencies = ["clean-no-std"]
command = "cargo"
args = ["test", "--no-default-features"]
[tasks.clean-default]
alias = "clean"
[tasks.test-default]
dependencies = ["clean-default"]
command = "cargo"
args = ["test", "--workspace", "--features=default"]
[tasks.test-legacy-ops]
command = "cargo"
args = ["test", "--workspace", "--features=legacy-ops"]
# This should reflect the steps in github
[tasks.test-all]
dependencies = [
"test-no-std",
"test-default",
"test-legacy-ops",
"test-maths",
"test-misc",
"test-db",
"test-serde",
"test-macros"
]
+56
View File
@@ -0,0 +1,56 @@
[tasks.test-db]
dependencies = [
"test-db-mysql-all",
"test-db-postgres-all"
]
[tasks.test-db-postgres-all]
dependencies = [
"test-db-postgres",
"test-db-tokio-postgres",
"test-db-diesel-postgres"
]
# DB Tests require cleaning beforehand to avoid target conflicts
[tasks.clean-db-postgres]
alias = "clean"
[tasks.test-db-postgres]
dependencies = ["clean-db-postgres"]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=db-postgres", "postgres", "--", "--skip", "generated"]
[tasks.clean-db-tokio-postgres]
alias = "clean"
[tasks.test-db-tokio-postgres]
dependencies = ["clean-db-tokio-postgres"]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=db-tokio-postgres", "postgres", "--", "--skip", "generated"]
[tasks.test-db-mysql-all]
dependencies = [
"test-db-diesel-mysql",
]
[tasks.test-db-diesel]
dependencies = [
"test-db-diesel-mysql",
"test-db-diesel-postgres",
]
[tasks.clean-db-diesel-mysql]
alias = "clean"
[tasks.test-db-diesel-mysql]
dependencies = ["clean-db-diesel-mysql"]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=db-diesel-mysql", "mysql", "--", "--skip", "generated"]
[tasks.clean-db-diesel-postgres]
alias = "clean"
[tasks.test-db-diesel-postgres]
dependencies = ["clean-db-diesel-postgres"]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=db-diesel-postgres", "postgres", "--", "--skip", "generated"]
@@ -0,0 +1,2 @@
[tasks.test-macros]
workspace = true
+18
View File
@@ -0,0 +1,18 @@
[tasks.test-maths]
dependencies = [
"test-maths-default",
"test-maths-legacy",
"test-maths-nopanic",
]
[tasks.test-maths-default]
command = "cargo"
args = ["test", "--workspace", "--no-default-features", "--features=maths", "maths", "--", "--skip", "generated"]
[tasks.test-maths-legacy]
command = "cargo"
args = ["test", "--workspace", "--no-default-features", "--features=maths,legacy-ops", "maths", "--", "--skip", "generated"]
[tasks.test-maths-nopanic]
command = "cargo"
args = ["test", "--workspace", "--no-default-features", "--features=maths-nopanic", "maths", "--", "--skip", "generated"]
+47
View File
@@ -0,0 +1,47 @@
[tasks.test-misc]
dependencies = [
"test-proptest",
"test-rust-fuzz",
"test-rocket-traits",
"test-borsh",
"test-rkyv",
"test-rand"
]
[tasks.test-proptest]
command = "cargo"
args = ["test", "--workspace", "--no-default-features", "--features=proptest", "proptest_tests", "--", "--skip", "generated"]
[tasks.test-rust-fuzz]
command = "cargo"
args = ["test", "--workspace", "--no-default-features", "--features=rust-fuzz", "rust_fuzz_tests", "--", "--skip", "generated"]
[tasks.test-rocket-traits]
command = "cargo"
args = ["test", "--workspace", "--features=rocket-traits", "rocket_tests"]
[tasks.test-borsh]
command = "cargo"
args = ["test", "--workspace", "--features=borsh", "borsh_tests", "--", "--skip", "generated"]
[tasks.test-ndarray]
command = "cargo"
args = ["test", "--workspace", "--features=ndarray", "nd_array_tests", "--", "--skip", "generated"]
[tasks.test-rkyv]
command = "cargo"
args = ["test", "--workspace", "--features=rkyv", "--features=rkyv-safe", "rkyv_tests", "--", "--skip", "generated"]
[tasks.test-rand]
dependencies = [
"test-rand-0_8",
"test-rand-0_9"
]
[tasks.test-rand-0_8]
command = "cargo"
args = ["test", "--workspace", "--features=rand", "rand_tests", "--", "--skip", "generated"]
[tasks.test-rand-0_9]
command = "cargo"
args = ["test", "--workspace", "--features=rand-0_9", "rand_tests", "--", "--skip", "generated"]
+43
View File
@@ -0,0 +1,43 @@
[tasks.test-serde]
dependencies = [
"test-serde-float",
"test-serde-str",
"test-serde-str-float",
"test-serde-arbitrary-precision",
"test-serde-arbitrary-precision-float",
"test-serde-with-arbitrary-precision",
"test-serde-with-float",
"test-serde-with-str",
]
[tasks.test-serde-float]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=serde-float", "serde", "--", "--skip", "generated"]
[tasks.test-serde-str]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=serde-str", "serde", "--", "--skip", "generated"]
[tasks.test-serde-str-float]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=serde-str,serde-float", "serde", "--", "--skip", "generated"]
[tasks.test-serde-arbitrary-precision]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=serde-arbitrary-precision", "serde", "--", "--skip", "generated"]
[tasks.test-serde-arbitrary-precision-float]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=serde-arbitrary-precision,serde-float", "serde", "--", "--skip", "generated"]
[tasks.test-serde-with-arbitrary-precision]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=serde-with-arbitrary-precision", "serde", "--", "--skip", "generated"]
[tasks.test-serde-with-float]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=serde-with-float", "serde", "--", "--skip", "generated"]
[tasks.test-serde-with-str]
command = "cargo"
args = ["test", "--workspace", "--tests", "--features=serde-with-str", "serde", "--", "--skip", "generated"]
+36
View File
@@ -0,0 +1,36 @@
[tasks.format]
clear = true
workspace = true
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--", "--emit=files"]
[tasks.clippy]
clear = true
workspace = true
install_crate = "clippy"
command = "cargo"
args = ["clippy"]
[tasks.outdated]
install_crate = "cargo-outdated"
command = "cargo"
args = ["outdated", "-R"]
[tasks.version-minor]
env = { "RUST_DECIMAL_BUILD_VERSION" = "minor" }
run_task = "propagate-version"
[tasks.version-revision]
env = { "RUST_DECIMAL_BUILD_VERSION" = "revision" }
run_task = "propagate-version"
[tasks.propagate-version]
private = true
script_runner = "@rust"
script = { file = "${CARGO_MAKE_WORKING_DIRECTORY}/make/scripts/version.rs", absolute_path = true }
[tasks.semver-check]
install_crate = "cargo-semver-checks"
command = "cargo"
args = ["semver-checks"]