Skip to content

Commit

Permalink
restore default open was errantly even more overzealous than the defa…
Browse files Browse the repository at this point in the history
…ult is; removing (#5)
  • Loading branch information
LittleBoxOfSunshine authored May 29, 2024
1 parent 5a9ba6f commit 98369e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "omnicopy_to_output"
description = "Generalized post build copy to place files in output directory"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
authors = ["Chris Henk <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand Down
19 changes: 5 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@
//! Large resources may not exist in your project. We can still copy those to output, but cargo will
//! not detect changes and invalidate the cache. Emitting [cargo:rerun-if-changed](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed)
//! instructions will inform cargo these files exist, but then will change cache invalidation to _only_
//! what you specify. We can use the helper [`cargo_rerun_if_project_changed`] to restore the default
//! behavior along with the helper [`cargo_rerun_if_changed`] to include the out of project resources.
//! what you specify. Note, as soon as you do this in one place the default "anything in package"
//! rules no longer apply. This is something you ideally are configuring anyway though.
//!
//! ```no_run
//! use omnicopy_to_output::{copy_to_output, cargo_rerun_if_project_changed, cargo_rerun_if_changed};
//! use omnicopy_to_output::{copy_to_output, cargo_rerun_if_changed};
//!
//! fn main() {
//! cargo_rerun_if_project_changed().expect("Could not determine project root");
//! fn main() {//!
//! let path_to_large_resources = "/path/to/large/resources";
//! cargo_rerun_if_changed(path_to_large_resources);
//! copy_to_output(path_to_large_resources).expect("Could not copy");
Expand All @@ -70,7 +69,7 @@
//! cache instructions.
//!
//! We support accommodating:
//! - Build types (e.g retail vs test; integration tests see files)
//! - Build types (e.g. retail vs test; integration tests see files)
//! - Target
//! - Cross compilation (special case target)
//! - Workspace or single crate build
Expand Down Expand Up @@ -172,11 +171,3 @@ pub fn cargo_rerun_if_path_changed(path: &Path) -> Result<()> {
);
Ok(())
}

/// Restores the default cargo cache invalidation, which is to monitor the project directory. If you emit
/// [cargo:rerun-if-changed](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed)
/// it will only monitor what you provide. In this context, if you're just looking to also monitor external
/// files in additional to your project (including source code) you can use this to achieve that goal.
pub fn cargo_rerun_if_project_changed() -> Result<()> {
cargo_rerun_if_path_changed(&get_project_root()?)
}

0 comments on commit 98369e4

Please sign in to comment.