Skip to content

Run common tests from build script and tighten localization packaging/resource handling#4583

Closed
shai-almog wants to merge 6 commits intomasterfrom
codex/add-tests-and-fix-localization-issues
Closed

Run common tests from build script and tighten localization packaging/resource handling#4583
shai-almog wants to merge 6 commits intomasterfrom
codex/add-tests-and-fix-localization-issues

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Ensure localization resources are present and packaged correctly for generated projects and enable running the relevant common-module tests during local builds.
  • Replace ad-hoc assumptions about specific language bundles with a data-driven handling based on ProjectOptions.PreviewLanguage.

Description

  • Added INITIALIZR_RUN_TESTS support and RUN_TESTS_DEFAULT to scripts/initializr/build.sh, with helper functions should_run_tests and run_common_tests to optionally run the common module tests before platform-specific packaging steps.
  • Constrained the tests invoked from the build script to GeneratorModelMatrixTest and GeneratorModelLocalizationPackagingTest via -Dtest=... to validate localization packaging behavior.
  • In GeneratorModel, introduced readRequiredResourceToString and addLocalizationEntry and switched localization file insertion to use these helpers so missing required resources now raise an IOException rather than silently returning null.
  • Updated GeneratorModelMatrixTest to assert localization bundles via iteration over ProjectOptions.PreviewLanguage instead of hardcoding languages, and added a new GeneratorModelLocalizationPackagingTest that compiles a dummy class and verifies generated localization resources load via a classloader.

Testing

  • Ran the selected common module tests with Maven using ./mvnw -pl common -am test -DskipTests=false -DfailIfNoTests=false -Dtest=GeneratorModelMatrixTest,GeneratorModelLocalizationPackagingTest and both tests completed successfully.
  • The new packaging test compiles a temporary class, writes generated localization resources, and verifies resource resolution via a URLClassLoader, and it passed in the automated run.

Codex Task

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Cloudflare Preview

@shai-almog shai-almog closed this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant