Skip to content

(MAINT) Always rebuild for updated translations - #1711

Open
Mikey Lombardi (He/Him) (michaeltlombardi) wants to merge 1 commit into
PowerShell:mainfrom
michaeltlombardi:maint/main/rebuild-on-i18n-changes
Open

(MAINT) Always rebuild for updated translations#1711
Mikey Lombardi (He/Him) (michaeltlombardi) wants to merge 1 commit into
PowerShell:mainfrom
michaeltlombardi:maint/main/rebuild-on-i18n-changes

Conversation

@michaeltlombardi

Copy link
Copy Markdown
Collaborator

PR Summary

This change ensures that:

  1. Every Rust crate in the repository that has a locales folder also has a build.rs build script file.
  2. Every build script for a Rust crate in the repository includes a cargo directive to rebuild the crate when any files in the locales directory are modified, including when a new file is created.
  3. Changes to translations are picked up immediately, including when working through Rust unit and integration tests.

PR Context

Prior to this change the Rust projects in the repository did not automatically rebuild when translation files in the locales directory are updated.

This caused a frustrating developer experience where the developer was required to update a Rust source code file to trigger a rebuild. If the contributor only needed to update the code to trigger a rebuild they were then required to change the code back afterward.

Copilot AI 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.

🟢 Approval recommended

The changes are low-risk and consistently ensure translation updates trigger rebuilds, with only a minor consistency tweak suggested for one build-script directive prefix.

Pull request overview

This PR improves the Rust i18n developer experience by ensuring crates with locales/ trigger rebuilds when translation files change, so updated translations are picked up immediately (including during unit/integration test workflows).

Changes:

  • Added minimal build.rs scripts to multiple crates to emit cargo:rerun-if-changed=locales.
  • Updated existing build scripts to also watch locales/ (e.g., resources/registry, lib/dsc-lib-jsonschema, dsc-bicep-ext).
  • Standardized rebuild triggers around translation updates across the repo’s Rust crates that ship translations.
File summaries
File Description
xtask/build.rs Adds a build script that reruns when xtask/locales/ changes.
resources/WindowsUpdate/build.rs Adds a build script that reruns when locales/ changes.
resources/windows_service/build.rs Adds a build script that reruns when locales/ changes.
resources/windows_firewall/build.rs Adds a build script that reruns when locales/ changes.
resources/sshdconfig/build.rs Adds a build script that reruns when locales/ changes.
resources/runcommandonset/build.rs Adds a build script that reruns when locales/ changes.
resources/registry/build.rs Extends existing build script to rerun when locales/ changes.
resources/dscecho/build.rs Adds a build script that reruns when locales/ changes.
resources/dism_dsc/build.rs Adds a build script that reruns when locales/ changes.
lib/dsc-lib/build.rs Adds a build script that reruns when locales/ changes.
lib/dsc-lib-registry/build.rs Adds a build script that reruns when locales/ changes.
lib/dsc-lib-jsonschema/build.rs Extends existing build script to rerun when locales/ changes.
dsc/build.rs Adds a build script that reruns when locales/ changes.
dsc-bicep-ext/build.rs Extends existing build script to rerun when locales/ changes.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

println!("cargo::rerun-if-changed=.versions.json");
println!("cargo::rerun-if-changed=.versions.ps1");
// Always rebuild if translations are updated.
println!("cargo:rerun-if-changed=locales");
Prior to this change the Rust projects in the repository did not
automatically rebuild when translation files in the `locales` directory
are updated.

This caused a frustrating developer experience where the developer was
_required_ to update a Rust source code file to trigger a rebuild. If
the contributor only needed to update the code to trigger a rebuild
they were then required to change the code back afterward.

This change ensures that:

1. Every Rust crate in the repository that has a `locales` folder also
   has a `build.rs` build script file.
1. Every build script for a Rust crate in the repository includes a
   cargo directive to rebuild the crate when any files in the `locales`
   directory are modified, including when a new file is created.
1. Changes to translations are picked up immediately, including when
   working through Rust unit and integration tests.
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