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

BREAKING: Migrated resource files to Satellite Assemblies, restructured NuGet packages #38

Merged
merged 43 commits into from
Mar 24, 2022

Conversation

NightOwl888
Copy link
Owner

Closes #13
Closes #16

This changes the build to automate generating resources based on the icu4j JAR file, which means we won't need to keep the resource files in our repository.

The resources are embedded inside satellite assemblies, which is similar to the standard way that it works on the .NET platform. However, since we have our own caching, fallback mechanism, and the resource data is still in ICU4J's big endian binary format, we left out the interaction with ResourceManager, .resx and .resources files and simply use Assembly.GetSatelliteAssembly() to locate our embedded resources directly.

The prior assemblies were all merged into ICU4N, so for deployment there is just 1 NuGet package (ICU4N) containing the assembly and 1 NuGet package (ICU4N.Resources) containing the satellite assemblies.

Note: For .NET Framework 4.0, we ended up with another one named ICU4N.Resources.NETFramework4.0 which contains the exact same files as ICU4N.Resources under the target framework net40. It just doesn't make sense to multi-target and add another 20MB of (literally copied) data to the package just to support the net40 and net403 targets. This ensures there is no impact at all to modern development while supporting this legacy target.

The ICU4N.Resources NuGet package is a transient dependency. If using modern build tools and <PackageReference>, installing ICU4N will automatically add ICU4N.Resources as a private dependency. There will also be a copy of ICU4N.targets added to the current project,, which will add the data as a private dependency to any consumer of the project. This ensures at any level the ICU4N.Resources package can be excluded using <IncludeICU4NResources>false</IncludeICU4NResources>, which allows for a subset of the assemblies or resource data to be deployed with the distribution.

…tally and to download ICU4J on demand if it doesn't exist.
… ensure we download the correct version of ICU4J
…erty and re-mapped usages back to ICUResourceBundle.IcuDataAssembly
…ages back to ICUResourceBundle.IcuDataAssembly
…ages back to ICUResourceBundle.IcuDataAssembly
…mapped usages back to ICUResourceBundle.IcuDataAssembly
…stMissingSatelliteAssembly() test. We may need it later to create more robust satellite assembly testing.
…ifest so we can more quickly decide whether resources are localized.
…tilize it to scan satellite assemblies and folders when specified, including the GAC on Windows.
… build NuGet packages for satellite assemblies. Added an ICU4N.targets file to ICU4N to make a transient dependency that can be disabled by consumers to either ad a direct reference to the NuGet package or create a custom distribution in an alternate NuGet package with a smaller or larger distribution size.
…ly by MSBuild and removed unnecessary AssemblyInfo.cs files
…nd support for loading it (satellite assemblies support this as long as we steer clear from loading them in CultureInfo)
@NightOwl888 NightOwl888 merged commit e9e69d0 into main Mar 24, 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
1 participant