add a hack so bigdecimal can be the package name and the feature name

This commit is contained in:
Ryan Leckey 2020-03-24 02:56:14 -07:00
parent f2ca42256b
commit 43a72657f9
5 changed files with 10 additions and 6 deletions

View file

@ -39,13 +39,13 @@ jobs:
# check w/deny warnings in sqlx-core: async-std
- working-directory: sqlx-core
run: cargo rustc --no-default-features --features 'bigdecimal_bigint ipnetwork chrono time uuid postgres mysql tls runtime-async-std' -- -D warnings --emit=metadata
run: cargo rustc --no-default-features --features 'bigdecimal ipnetwork chrono time uuid postgres mysql tls runtime-async-std' -- -D warnings --emit=metadata
# check w/deny warnings in sqlx-core: tokio
# `cargo rustc -p sqlx-core` ignores `--no-default-features` and builds with `runtime-async-std` anyway
# https://github.com/rust-lang/cargo/issues/5364
- working-directory: sqlx-core
run: cargo rustc --no-default-features --features 'bigdecimal_bigint ipnetwork chrono time uuid postgres mysql tls runtime-tokio' -- -D warnings --emit=metadata
run: cargo rustc --no-default-features --features 'bigdecimal ipnetwork chrono time uuid postgres mysql tls runtime-tokio' -- -D warnings --emit=metadata
# check w/deny warnings: async-std
- run: cargo rustc --no-default-features --features 'bigdecimal ipnetwork chrono time uuid postgres mysql macros tls runtime-async-std' -- -D warnings --emit=metadata

View file

@ -46,7 +46,7 @@ mysql = [ "sqlx-core/mysql", "sqlx-macros/mysql" ]
sqlite = [ "sqlx-core/sqlite", "sqlx-macros/sqlite" ]
# types
bigdecimal = ["sqlx-core/bigdecimal_bigint", "sqlx-macros/bigdecimal"]
bigdecimal = ["sqlx-core/bigdecimal", "sqlx-macros/bigdecimal"]
chrono = [ "sqlx-core/chrono", "sqlx-macros/chrono" ]
ipnetwork = [ "sqlx-core/ipnetwork", "sqlx-macros/ipnetwork" ]
uuid = [ "sqlx-core/uuid", "sqlx-macros/uuid" ]

View file

@ -17,7 +17,7 @@ default = [ "runtime-async-std" ]
unstable = []
# we need a feature which activates `num-bigint` as well because
# `bigdecimal` uses types from it but does not reexport (tsk tsk)
bigdecimal_bigint = ["bigdecimal", "num-bigint"]
bigdecimal = ["bigdecimal_", "num-bigint"]
postgres = [ "md-5", "sha2", "base64", "sha-1", "rand", "hmac", "futures-channel/sink", "futures-util/sink" ]
json = ["serde", "serde_json"]
mysql = [ "sha-1", "sha2", "generic-array", "num-bigint", "base64", "digest", "rand" ]
@ -31,7 +31,7 @@ async-native-tls = { version = "0.3.2", default-features = false, optional = tru
async-std = { version = "1.5.0", features = [ "unstable" ], optional = true }
async-stream = { version = "0.2.1", default-features = false }
base64 = { version = "0.12.0", default-features = false, optional = true, features = [ "std" ] }
bigdecimal = { version = "0.1.0", optional = true }
bigdecimal_ = { version = "0.1.0", optional = true, package = "bigdecimal" }
bitflags = { version = "1.2.1", default-features = false }
byteorder = { version = "1.3.4", default-features = false, features = [ "std" ] }
chrono = { version = "0.4.10", default-features = false, features = [ "clock" ], optional = true }

View file

@ -9,6 +9,10 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
// #![warn(missing_docs)]
// HACK: Allow a feature name the same name as a dependency
#[cfg(feature = "bigdecimal")]
extern crate bigdecimal_ as bigdecimal;
mod runtime;
#[macro_use]

View file

@ -27,7 +27,7 @@ postgres = [ "sqlx/postgres" ]
sqlite = [ "sqlx/sqlite" ]
# type
bigdecimal = [ "sqlx/bigdecimal_bigint" ]
bigdecimal = [ "sqlx/bigdecimal" ]
chrono = [ "sqlx/chrono" ]
time = [ "sqlx/time" ]
ipnetwork = [ "sqlx/ipnetwork" ]