Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): enhance app rerun-if-changed for capabilities and frontend dist #8756

Merged
merged 6 commits into from Feb 4, 2024

Conversation

lucasfernog
Copy link
Member

@lucasfernog lucasfernog commented Feb 4, 2024

Spoke about this with @FabianLars ... currently we do not rerun the build script when a new capability file is created, leaving the app in a weird state where the permissions are not parsed and the user has no idea why. The idea was to move the schemas from capabilities/schemas to gen/schemas so we can rerun-if-changed=capabilities.

I'm also applying the same logic to the plugin permissions, which currently does not trigger a rebuild if a new permission is added.

@lucasfernog lucasfernog requested a review from a team as a code owner February 4, 2024 02:05
@FabianLars
Copy link
Member

FabianLars commented Feb 4, 2024

Would it be bad to simply print the rerun instruction with CAPABILITIES_SCHEMA_FOLDER_NAME directly instead of going with the files parent() method.

I think all the templates contain a file already so your way should work but if there is no file yet then adding one does still not trigger a rebuild.

Maybe we call this more of an edge case idk, since as i said the v2 templates contain it and migrating from v1 to v2 causes a rebuild anyway. I just used an "empty" v2 beta project to test this and noticed it that way.

Edit: hmmm i assume this wasn't done to prevent constant rebuilds if the folder doesn't exist :/

@lucasfernog
Copy link
Member Author

we can either assume the folder is there (it should) but i was also trying to support custom capability folder path which are possible via the tauri-build attributes

@lucasfernog
Copy link
Member Author

i'll make a change to be smarter about it

@lucasfernog
Copy link
Member Author

Pushed the same change for plugins (which does force a rebuild on the first local build since we now commit all autogenerated files).

@lucasfernog
Copy link
Member Author

first local build after any permission change, but i think it's a good trade off between feature and DX

Copy link
Member

@FabianLars FabianLars left a comment

Choose a reason for hiding this comment

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

My test flow still doesn't reallyyy work but at least manually re-running tauri dev triggers a rebuild now and that's good enough, thanks for that :)

@lucasfernog lucasfernog merged commit 4e101f8 into dev Feb 4, 2024
29 checks passed
@lucasfernog lucasfernog deleted the fix/capability-schema-path branch February 4, 2024 14:42
@hjmallon
Copy link

I have just updated to v2 in an existing application.

  1. Is there any reason we dont generate the schemas to the target folder which is already gitignored etc?
  2. This change has not been reproduced in tauri-docs and create-tauri-app

(e.g. https://github.com/tauri-apps/tauri-docs/blob/6d9239c2f6df6d0d0690d6dd83c0bc17de524ae7/src/content/docs/references/v2/acl.mdx#L21)

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.

None yet

3 participants