Skip to content

Commit

Permalink
add support for doc_auto_cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
tlowerison committed Nov 1, 2023
1 parent bfc9285 commit 94386fc
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["leptos_form"]
resolver = "2"

[workspace.package]
version = "0.1.0"
version = "0.1.1"
edition = "2021"
rust-version = "1.75.0"
authors = ["Trey Lowerison <19714082+tlowerison@users.noreply.github.com>"]
Expand Down
7 changes: 7 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ license-file.workspace = true
categories.workspace = true
keywords.workspace = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
derivative.workspace = true
derive_more.workspace = true
Expand All @@ -25,6 +29,9 @@ chrono = { workspace = true, optional = true }
num-bigint = { workspace = true, optional = true }
uuid = { workspace = true, optional = true }

[build-dependencies]
rustc_version = "0.4.0"

[features]
bigdecimal = ["dep:bigdecimal"]
chrono = ["dep:chrono"]
Expand Down
12 changes: 12 additions & 0 deletions core/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use rustc_version::{version_meta, Channel};

fn main() {
// Set cfg flags depending on release channel
let channel = match version_meta().unwrap().channel {
Channel::Stable => "CHANNEL_STABLE",
Channel::Beta => "CHANNEL_BETA",
Channel::Nightly => "CHANNEL_NIGHTLY",
Channel::Dev => "CHANNEL_DEV",
};
println!("cargo:rustc-cfg={}", channel)
}
1 change: 1 addition & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::non_canonical_clone_impl)]
#![cfg_attr(CHANNEL_NIGHTLY, feature(doc_auto_cfg))]

#[macro_use]
extern crate derivative;
Expand Down
7 changes: 7 additions & 0 deletions leptos_form/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ license-file.workspace = true
categories.workspace = true
keywords.workspace = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
leptos.workspace = true
leptos_form_core.workspace = true
Expand All @@ -21,6 +25,9 @@ wasm-bindgen.workspace = true
[dev-dependencies]
serde.workspace = true

[build-dependencies]
rustc_version = "0.4.0"

[features]
bigdecimal = ["leptos_form_core/bigdecimal"]
chrono = ["leptos_form_core/chrono"]
Expand Down
12 changes: 12 additions & 0 deletions leptos_form/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use rustc_version::{version_meta, Channel};

fn main() {
// Set cfg flags depending on release channel
let channel = match version_meta().unwrap().channel {
Channel::Stable => "CHANNEL_STABLE",
Channel::Beta => "CHANNEL_BETA",
Channel::Nightly => "CHANNEL_NIGHTLY",
Channel::Dev => "CHANNEL_DEV",
};
println!("cargo:rustc-cfg={}", channel)
}
1 change: 1 addition & 0 deletions leptos_form/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(CHANNEL_NIGHTLY, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]

pub use ::leptos_form_core::*;
Expand Down
2 changes: 1 addition & 1 deletion release-plz.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies_update = true
git_tag_enable = true

# disable GitHub releases
git_release_enable = false
git_release_enable = true

# labels for the release PR
pr_labels = ["release"]
Expand Down

0 comments on commit 94386fc

Please sign in to comment.