Skip to content

fix(codegen): write output file when contents change - #4889

Merged
lucasfernog merged 1 commit into
tauri-apps:devfrom
brian14708:write-if-changed
Aug 8, 2022
Merged

fix(codegen): write output file when contents change#4889
lucasfernog merged 1 commit into
tauri-apps:devfrom
brian14708:write-if-changed

Conversation

@brian14708

@brian14708 brian14708 commented Aug 8, 2022

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

Currently an app build is needed even when no code has changed. After some investigation, it was trigger by the writing of the temporary icon file used for embedding.

Even with this change, two builds are required to avoid further rebuilds. Maybe it's better to preprocess the icons in build.rs?

@brian14708
brian14708 requested a review from a team as a code owner August 8, 2022 08:15

@lucasfernog lucasfernog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Clever one, thanks!

@lucasfernog

lucasfernog commented Aug 8, 2022

Copy link
Copy Markdown
Member

Even with this change, two builds are required to avoid further rebuilds. Maybe it's better to preprocess the icons in build.rs?

We have a way to do this, enabling the codegen feature of tauri-build and changing your build.rs to:

fn main() {
  let mut codegen = tauri_build::CodegenContext::new();
  if !cfg!(feature = "custom-protocol") {
    codegen = codegen.dev();
  }
  codegen.build();
  tauri_build::build()
}

then change tauri::generate_context!() to tauri::tauri_build_context!().

aaaaaaaactually this has a bug, i'll open a PR to fix it.

@lucasfernog
lucasfernog merged commit f957cbb into tauri-apps:dev Aug 8, 2022
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.

2 participants