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

Fix AppReproducersTest#timezonesBakedIn #287

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

jerboaa
Copy link
Collaborator

@jerboaa jerboaa commented Sep 26, 2024

With GraalVM prior to 24.2.0 the default locale (and included locale) for a native image was determined by the -Duser.language and -Duser.country settings as image build time. With GraalVM >= 24.2.0 the build settings of language/country have no effect in terms of included locales in the resulting native image. Therefore, -H:IncludeLocales, needs to be used at build time instead. Also at image runtime the default language is determined by the system locale. For the purpose of the test we'd want the French language which we need to set at image runtime when the test runs.

Tested with GraalVM community 23+37 (which uses the old scheme) and with a latest JDK 24-based mandrel build which uses the new scheme. Both pass.

24.1:

[...]
Command: native-image -J-Duser.country=CA -J-Duser.language=fr -jar target/timezones.jar target/timezones
[...]
Command: ./target/timezones
jeu. sept. 26 12:48:51 CEST 2024
heure normale de l’Europe centrale

24.2

[...]
Command: native-image -H:IncludeLocales=fr-CA -jar target/timezones.jar target/timezones
[...]
Command: ./target/timezones -Duser.language=fr
jeu. sept. 26 12:53:57 CEST 2024
heure normale d’Europe centrale

Closes: #285

With GraalVM prior to 24.2.0 the default locale (and included locale)
for a native image was determined by the -Duser.language and
-Duser.country settings as image build time. With GraalVM >= 24.2.0 the
build settings of language/country have no effect in terms of included
locales in the resulting native image. Therefore, -H:IncludeLocales,
needs to be used at build time instead. Also at image runtime the
default language is determined by the system locale. For the purpose of
the test we'd want the French language which we need to set at image
runtime when the test runs.

Closes: Karm#285
@jerboaa jerboaa requested review from Karm and zakkak September 26, 2024 10:55
Copy link
Collaborator

@zakkak zakkak left a comment

Choose a reason for hiding this comment

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

LGTM. I am just wondering whether we should instead fix this on the Quarkus side by adding user.language-user.country to the included locales like we do for quarkus.default-locale and quarkus.native.user-language-quarkus.native.country in quarkusio/quarkus#43448

@jerboaa
Copy link
Collaborator Author

jerboaa commented Sep 26, 2024

LGTM.

Thanks for the review.

I am just wondering whether we should instead fix this on the Quarkus side by adding user.language-user.country to the included locales like we do for quarkus.default-locale and quarkus.native.user-language-quarkus.native.country in quarkusio/quarkus#43448

I'm not sure we should. Having the build system locale included by default isn't something which I think all users are aware of. Maybe raise as an issue and see what the desired outcome of it is.

@zakkak
Copy link
Collaborator

zakkak commented Sep 26, 2024

Maybe raise as an issue and see what the desired outcome of it is.

Done in quarkusio/quarkus#43533

@jerboaa
Copy link
Collaborator Author

jerboaa commented Sep 26, 2024

@Karm OK with this? CI looks good too :)

Copy link
Owner

@Karm Karm left a comment

Choose a reason for hiding this comment

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

THX @jerboaa

@Karm Karm merged commit eb523a2 into Karm:master Sep 26, 2024
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.

AppReproducersTest#timezonesBakedIn fails with latest GraalVM for JDK 24
3 participants