fix(build): copy newly added files from resource directories - #15629
Conversation
Package Changes Through 9433cc9There are 14 changes which include tauri with minor, tauri-cli with minor, @tauri-apps/cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-bundler with minor, tauri-build with minor, tauri-macos-sign with minor, tauri-codegen with minor, tauri-macros with minor, tauri-plugin with minor, tauri-driver with minor, @tauri-apps/api with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Legend-Master
left a comment
There was a problem hiding this comment.
Please sign your past commits before I start reviewing so we don't lose much history going forwards.
The resource copy only emitted `cargo:rerun-if-changed` for the individual files resolved at build time. When a new file was added to a resource directory, cargo had no reason to re-run the build script, so the file was never copied until an unrelated rebuild happened. Track every walked/globbed resource directory in `ResourcePathsIter` and emit a `rerun-if-changed` for each after copying, so adding or removing a file inside a resource directory re-runs the script and picks it up. Closes tauri-apps#14992
e42b1c2 to
c8911c4
Compare
|
@Legend-Master signed and re-pushed — the commit is now |
Closes #14992
Closes #15390
copy_resourcesonly emittedcargo:rerun-if-changedfor the individual files it resolved at build time. Since resource dirs/globs are expanded once during the build, a file added to a resource directory afterwards is unknown to cargo — the build script never re-runs, so the new file isn't copied until some unrelated change (editingtauri.conf.json,build.rs, or an already-tracked file) forces a rebuild. The documented workaround is to manually addcargo:rerun-if-changed=<dir>.Fix:
ResourcePathsIternow records each directory it walks and the fixed base of each glob, exposed viarerun_if_changed().copy_resourcesemits arerun-if-changedfor each after copying, so adding or removing a file inside a resource directory re-runs the script and copies it.Added a unit test covering directory, glob, and single-file patterns. Existing resource-path tests still pass.