Skip to content

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

Merged
Legend-Master merged 4 commits into
tauri-apps:devfrom
tenderdeve:fix/14992-copy-new-resource-files
Jul 21, 2026
Merged

fix(build): copy newly added files from resource directories#15629
Legend-Master merged 4 commits into
tauri-apps:devfrom
tenderdeve:fix/14992-copy-new-resource-files

Conversation

@tenderdeve

@tenderdeve tenderdeve commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Closes #14992
Closes #15390

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.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through 9433cc9

There 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 Versions

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

package current next
@tauri-apps/api 2.11.1 2.12.0
tauri-utils 2.9.3 2.10.0
tauri-macos-sign 2.3.4 2.4.0
tauri-bundler 2.9.4 2.10.0
tauri-runtime 2.11.3 2.12.0
tauri-runtime-wry 2.11.4 2.12.0
tauri-codegen 2.6.3 2.7.0
tauri-macros 2.6.3 2.7.0
tauri-plugin 2.6.3 2.7.0
tauri-build 2.6.3 2.7.0
tauri 2.11.5 2.12.0
@tauri-apps/cli 2.11.4 2.12.0
tauri-cli 2.11.4 2.12.0
tauri-driver 2.0.6 2.1.0

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

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@tenderdeve
tenderdeve force-pushed the fix/14992-copy-new-resource-files branch from e42b1c2 to c8911c4 Compare July 20, 2026 10:35
@tenderdeve

Copy link
Copy Markdown
Contributor Author

@Legend-Master signed and re-pushed — the commit is now c8911c4ec (GitHub shows it Verified). Ready for review whenever you are.

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

@Legend-Master
Legend-Master merged commit 19215f6 into tauri-apps:dev Jul 21, 2026
27 checks passed
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.

[feat] Support skip resource watching [bug] tauri does not copy new files from resource directories

2 participants