Skip to content

fix(build): copy newly added files from resource directories#15629

Open
tenderdeve wants to merge 1 commit into
tauri-apps:devfrom
tenderdeve:fix/14992-copy-new-resource-files
Open

fix(build): copy newly added files from resource directories#15629
tenderdeve wants to merge 1 commit into
tauri-apps:devfrom
tenderdeve:fix/14992-copy-new-resource-files

Conversation

@tenderdeve

Copy link
Copy Markdown

Closes #14992

copy_resources only emitted cargo:rerun-if-changed for 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 (editing tauri.conf.json, build.rs, or an already-tracked file) forces a rebuild. The documented workaround is to manually add cargo:rerun-if-changed=<dir>.

Fix: ResourcePathsIter now records each directory it walks and the fixed base of each glob, exposed via rerun_if_changed(). copy_resources emits a rerun-if-changed for 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.

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
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through e42b1c2

There are 2 changes which include tauri-build with patch, tauri-utils with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tauri-utils 2.9.3 2.9.4
tauri-bundler 2.9.4 2.9.5
tauri-runtime 2.11.3 2.11.4
tauri-runtime-wry 2.11.4 2.11.5
tauri-codegen 2.6.3 2.6.4
tauri-macros 2.6.3 2.6.4
tauri-plugin 2.6.3 2.6.4
tauri-build 2.6.3 2.6.4
tauri 2.11.4 2.11.5
@tauri-apps/cli 2.11.4 2.11.5
tauri-cli 2.11.4 2.11.5

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 Legend-Master added this to the 2.12 milestone Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] tauri does not copy new files from resource directories

2 participants