Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build-info-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "build-info-build"
version = "0.0.36"
version = "0.0.37"
description = "Provides the data consumed by the build-info crate. Use as a build-dependency."
readme = "../README.md"
authors = ["Daniel Schemmel <[email protected]>"]
Expand All @@ -23,7 +23,7 @@ rustc_version = "0.4"
serde_json = "1"
zstd = "0.13"

build-info-common = { version = "=0.0.36", path = "../build-info-common", features = ["serde"] }
build-info-common = { version = "=0.0.37", path = "../build-info-common", features = ["serde"] }

[features]
default = ["git"]
Expand Down
14 changes: 14 additions & 0 deletions build-info-build/src/build_script_options/crate_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ impl crate::BuildScriptOptions {
self.collect_dev_dependencies = collect_dependencies;
self
}

/// Disables polling the network
///
/// This is to allow building workspaces on doc.rs
pub fn set_offline(mut self, offline: bool) -> Self {
self.offline = offline;
self
}
}

pub(crate) struct Manifest {
Expand All @@ -82,9 +90,15 @@ pub(crate) fn read_manifest(
collect_runtime_dependencies: DependencyDepth,
collect_build_dependencies: DependencyDepth,
collect_dev_dependencies: DependencyDepth,
offline: bool,
) -> Manifest {
let mut args = vec!["--filter-platform".to_string(), target_platform.to_string()];

// Disable network access
if offline {
args.push("--offline".to_string());
}

// Cargo does not provide a proper list of enabled features, so we collect metadata once to find all possible
// features, convert them to the equivalent `CARGO_FEATURE_` representation, check for collisions, and then rerun
// the command with the appropriate feature flags selected.
Expand Down
5 changes: 5 additions & 0 deletions build-info-build/src/build_script_options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ pub struct BuildScriptOptions {

/// Enable dev dependency collection
collect_dev_dependencies: DependencyDepth,

/// Disable network access
offline: bool,
}
static BUILD_SCRIPT_RAN: AtomicBool = AtomicBool::new(false);

Expand Down Expand Up @@ -68,6 +71,7 @@ impl BuildScriptOptions {
self.collect_runtime_dependencies,
self.collect_build_dependencies,
self.collect_dev_dependencies,
self.offline
);
let version_control = version_control::get_info();

Expand Down Expand Up @@ -131,6 +135,7 @@ impl Default for BuildScriptOptions {
collect_runtime_dependencies: DependencyDepth::None,
collect_build_dependencies: DependencyDepth::None,
collect_dev_dependencies: DependencyDepth::None,
offline: false,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion build-info-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "build-info-common"
version = "0.0.36"
version = "0.0.37"
description = "Part of the build-info and build-info-build crates: This crate provides the types that are serialized by build-info-build and used by build-info."
readme = "../README.md"
authors = ["Daniel Schemmel <[email protected]>"]
Expand Down
4 changes: 2 additions & 2 deletions build-info-proc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "build-info-proc"
version = "0.0.36"
version = "0.0.37"
description = "Part of the build-info crate: This crate provides the proc-macros."
readme = "../README.md"
authors = ["Daniel Schemmel <[email protected]>"]
Expand All @@ -27,7 +27,7 @@ serde_json = "1"
syn = { version = "2", features = ["full"] }
zstd = "0.13"

build-info-common = { version = "=0.0.36", path = "../build-info-common", features = ["serde"] }
build-info-common = { version = "=0.0.37", path = "../build-info-common", features = ["serde"] }

[dev-dependencies]
pretty_assertions = "1"
Expand Down
6 changes: 3 additions & 3 deletions build-info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "build-info"
version = "0.0.36"
version = "0.0.37"
description = "Collects build-information of your Rust crate."
readme = "README.md"
authors = ["Daniel Schemmel <[email protected]>"]
Expand All @@ -11,8 +11,8 @@ edition = "2021"
rust-version = "1.70.0"

[dependencies]
build-info-common = { version = "=0.0.36", path = "../build-info-common", optional = true, features = ["serde"] }
build-info-proc = { version = "=0.0.36", path = "../build-info-proc" }
build-info-common = { version = "=0.0.37", path = "../build-info-common", optional = true, features = ["serde"] }
build-info-proc = { version = "=0.0.37", path = "../build-info-proc" }
bincode = { version = "1", optional = true }

[features]
Expand Down
6 changes: 3 additions & 3 deletions dependency-tree/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dependency-tree"
version = "0.0.36"
version = "0.0.37"
description = "A sample program that uses the build-info crate to print a tree of all dependencies."
readme = "../README.md"
authors = ["Daniel Schemmel <[email protected]>"]
Expand All @@ -10,7 +10,7 @@ repository = "https://github.com/danielschemmel/build-info/"
license = "MIT OR Apache-2.0"

[dependencies]
build-info = { version = "=0.0.36", path = "../build-info" }
build-info = { version = "=0.0.37", path = "../build-info" }

[build-dependencies]
build-info-build = { version = "=0.0.36", path = "../build-info-build" }
build-info-build = { version = "=0.0.37", path = "../build-info-build" }
6 changes: 3 additions & 3 deletions sample/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sample"
version = "0.0.36"
version = "0.0.37"
description = "A sample program that uses the build-info crate."
readme = "../README.md"
authors = ["Daniel Schemmel <[email protected]>"]
Expand All @@ -10,7 +10,7 @@ repository = "https://github.com/danielschemmel/build-info/"
license = "MIT OR Apache-2.0"

[dependencies]
build-info = { version = "=0.0.36", path = "../build-info" }
build-info = { version = "=0.0.37", path = "../build-info" }

[build-dependencies]
build-info-build = { version = "=0.0.36", path = "../build-info-build" }
build-info-build = { version = "=0.0.37", path = "../build-info-build" }