Skip to content

Refactor the CFTimeZone initialization #2017

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

Merged
merged 9 commits into from
Mar 30, 2019
Merged

Conversation

compnerd
Copy link
Member

Refactor the initialization codepath a bit to make it more obvious how to modify this to support Windows and alter to query the information from the system.

@millenomi
Copy link
Contributor

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd compnerd force-pushed the outception branch 2 times, most recently from 65157df to 25097d5 Compare March 18, 2019 21:28
@compnerd compnerd force-pushed the outception branch 3 times, most recently from 891ef8c to 635169b Compare March 19, 2019 22:50
@compnerd
Copy link
Member Author

@swift-ci please test

Use an early return to reduce indentation.  NFC.
Extract the initializing body of the function into a helper.  This helps
reduce the overall amount of code in the function, and more importantly
makes it easier to improve support for Windows.
Remove the unnecessary condition which is always set to true.
Move the plist into a Windows resource file.  This cleans up the code
path and makes it easier to work with.
In order to accept the full Unicode supported Olson names, we need the inverted
database for mapping the olson name to the Windows timezone.  This plist
provides that mapping derived from the Unicode CLDR data.  This will permit us
to support CFTimeZone creation on Windows.
Since Windows uses its own names for timezones, the Unicode corsotium provides
the canonical mapping for the timezones.  Use the Unicode CLDR to generate the
mapping plist requires transformation, which this XSLT provides.  These XSLs
allow the creation of both the Olson -> Windows mapping and the Windows -> Olson
mapping.  Since the latter only preserves the primary name and not the secondary
ones, we split the inverted database.
This queries the timezone information from the registry on Windows to create and
initialize the timezone.  This should allow CFTimeZoneCreate to function.  Doing
this will finally allow Foundation to use timezones on Windows!
These are source files as far as the CoreFoundation build is concerned.  Add a
dependency on the files.
This was adding a spurious `-I` to the compile flags which resulted in the
output being placed incorrectly.  Simply elide the flags for RC targets.
@spevans
Copy link
Contributor

spevans commented Mar 21, 2019

@swift-ci please test

@millenomi
Copy link
Contributor

@swift-ci please test and merge

1 similar comment
@compnerd
Copy link
Member Author

@swift-ci please test and merge

@swift-ci swift-ci merged commit ba8ae94 into swiftlang:master Mar 30, 2019
@compnerd compnerd deleted the outception branch March 30, 2019 02:13
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.

4 participants