Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 04bf9f3

Browse files
committed
Merge pull request #2825 from develop
1712.1 release
2 parents db05d76 + 22fb297 commit 04bf9f3

File tree

46 files changed

+1403
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1403
-113
lines changed

Frameworks/CoreFoundation/PlugIn.subproj/CFBundle_Locale.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,10 @@ CF_PRIVATE CFArrayRef _CFBundleCopyUserLanguages() {
531531
static CFArrayRef _CFBundleUserLanguages = NULL;
532532
static dispatch_once_t once = 0;
533533
dispatch_once(&once, ^{
534+
// WINOBJC: __CFAppleLanguages does not exist on Windows
535+
#if DEPLOYMENT_TARGET_WINDOWS
536+
_CFBundleUserLanguages = CFLocaleCopyPreferredLanguages();
537+
#else
534538
CFArrayRef preferencesArray = NULL;
535539
if (__CFAppleLanguages) {
536540
CFDataRef data;
@@ -555,6 +559,7 @@ CF_PRIVATE CFArrayRef _CFBundleCopyUserLanguages() {
555559
_CFBundleUserLanguages = NULL;
556560
}
557561
if (preferencesArray) CFRelease(preferencesArray);
562+
#endif
558563
});
559564

560565
if (_CFBundleUserLanguages) {
@@ -663,8 +668,66 @@ static CFStringRef _CFBundleCopyLanguageFoundInLocalizations(CFArrayRef localiza
663668
return NULL;
664669
}
665670

671+
// WINOBJC: Helper functions for workaround in _CFBundleCreateMutableArrayOfFallbackLanguages
672+
static CFStringRef _copyStringTruncated(CFStringRef localization, CFRange cutoff) {
673+
return CFStringCreateWithSubstring(NULL, localization, CFRangeMake(0, cutoff.location));
674+
}
675+
676+
static CFStringRef _copyStringWithUnderscores(CFStringRef localization) {
677+
CFMutableStringRef underscoredString = CFStringCreateMutableCopy(NULL, 0, localization);
678+
CFStringFindAndReplace(underscoredString, CFSTR("-"), CFSTR("_"), CFRangeMake(0, CFStringGetLength(underscoredString)), 0);
679+
return underscoredString;
680+
}
681+
666682
// Given a list of localizations (e.g., provided as argument to API, or present as .lproj directories), return a mutable array of localizations in preferred order. Returns NULL if nothing is found.
667683
static CFMutableArrayRef _CFBundleCreateMutableArrayOfFallbackLanguages(CFArrayRef availableLocalizations, CFArrayRef preferredLocalizations) {
684+
// WINOBJC: The API that performs the work described below does not exist in our 3rd party libraries. ualoc_ is an Apple ICU addition.
685+
#if DEPLOYMENT_TARGET_WINDOWS
686+
// Here we need to intersect the preferred languages with the available localizations
687+
// We know the user languages are in preferred order, add to this list in this order
688+
// Prefer the full language locale, attempt to convert any hyphens to underscores as
689+
// Windows language settings are retrieved with hyphens while underscores are commonly used for localization.
690+
// Finally, attempt to truncate any underscores from the language to find a base localization.
691+
// For example, an english locale will appear as "en-US" and a German locale will appear as "de-DE".
692+
// A localization for "en-US" may be set up as "en-US", "en_US", or even just "en".
693+
694+
CFMutableArrayRef resultArray = CFArrayCreateMutable(kCFAllocatorSystemDefault, 0, &kCFTypeArrayCallBacks);
695+
696+
for (CFIndex i = 0, preferredCount = CFArrayGetCount(preferredLocalizations); i < preferredCount; i++) {
697+
CFStringRef preferredLocalization = (CFStringRef)CFArrayGetValueAtIndex(preferredLocalizations, i);
698+
for (CFIndex j = 0, availableCount = CFArrayGetCount(availableLocalizations); j < availableCount; j++) {
699+
CFStringRef availableLocalization = (CFStringRef)CFArrayGetValueAtIndex(availableLocalizations, j);
700+
if(CFStringCompare(preferredLocalization, availableLocalization, 0) == kCFCompareEqualTo) {
701+
CFArrayAppendValue(resultArray, preferredLocalization);
702+
}
703+
CFRange hyphenation;
704+
if (CFStringFindWithOptions(preferredLocalization, CFSTR("-"), CFRangeMake(0, CFStringGetLength(preferredLocalization)), kCFCompareCaseInsensitive, &hyphenation) == true) {
705+
CFStringRef underscoreNotationLocalization = _copyStringWithUnderscores(preferredLocalization);
706+
if (CFStringCompare(underscoreNotationLocalization, availableLocalization, 0) == kCFCompareEqualTo) {
707+
CFArrayAppendValue(resultArray, underscoreNotationLocalization);
708+
}
709+
710+
CFStringRef truncatedLocalization = _copyStringTruncated(underscoreNotationLocalization, hyphenation);
711+
if (CFStringCompare(truncatedLocalization, availableLocalization, 0) == kCFCompareEqualTo) {
712+
CFArrayAppendValue(resultArray, truncatedLocalization);
713+
}
714+
715+
CFRelease(underscoreNotationLocalization);
716+
CFRelease(truncatedLocalization);
717+
} else if (CFStringFindWithOptions(preferredLocalization, CFSTR("_"), CFRangeMake(0, CFStringGetLength(preferredLocalization)), kCFCompareCaseInsensitive, &hyphenation) == true) {
718+
CFStringRef truncatedLocalization = _copyStringTruncated(preferredLocalization, hyphenation);
719+
if (CFStringCompare(truncatedLocalization, availableLocalization, 0) == kCFCompareEqualTo) {
720+
CFArrayAppendValue(resultArray, truncatedLocalization);
721+
}
722+
CFRelease(truncatedLocalization);
723+
}
724+
}
725+
}
726+
if (CFArrayGetCount(resultArray) > 0) {
727+
return resultArray;
728+
}
729+
return NULL;
730+
#endif
668731
// stringPointers must be the length of list
669732
char * (^makeBuffer)(CFArrayRef, char **) = ^(CFArrayRef list, char *stringPointers[]) {
670733
#if !__HAS_APPLE_ICU__

build/Tests/UnitTests/Foundation.WindowsOnly/Foundation.WindowsOnly.UnitTests.vcxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,11 @@
237237
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\WindowsOnly\NSRecursiveLockInternalTests.mm" />
238238
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\WindowsOnly\NSPointerArrayInternalTests.mm" />
239239
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\WindowsOnly\ArchivalInternalTests.mm" />
240+
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\WindowsOnly\BundleInternalTests.mm" />
240241
</ItemGroup>
241242
<ItemGroup>
242243
<ClInclude Include="$(StarboardBasePath)\tests\unittests\Foundation\RuntimeTestHelpers.h" />
243244
</ItemGroup>
244245
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
245246
<Import Project="$(StarboardBasePath)\common\winobjc.packagereference.override.targets" Condition="Exists('$(StarboardBasePath)\common\winobjc.packagereference.override.targets')" />
246-
</Project>
247+
</Project>

build/Tests/UnitTests/Foundation.WindowsOnly/Foundation.WindowsOnly.UnitTests.vcxproj.filters

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
<ClangCompile Include="$(StarboardBasePath)\Frameworks\Foundation\NSString+HSTRING.mm" />
2828
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\WindowsOnly\ArchivalInternalTests.mm" />
2929
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\WindowsOnly\FoundationInternalTests.mm" />
30+
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\WindowsOnly\BundleInternalTests.mm" />
3031
</ItemGroup>
31-
</Project>
32+
</Project>

build/Tests/UnitTests/Foundation/Foundation.UnitTests.vcxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@
317317
<ClangCompile Include="$(StarboardBasePath)\tests\UnitTests\Foundation\NSObject_NSKeyValueSetAdaptersTests.mm" />
318318
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\NSUUIDTests.mm" />
319319
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\NSNotificationQueueTests.mm" />
320+
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\DispatchTests.mm" />
320321
</ItemGroup>
321322
<ItemGroup>
322323
<Text Include="..\..\..\tests\unittests\Foundation\NSFileManagerUT.txt">
@@ -349,4 +350,4 @@
349350
<Copy SourceFiles="@(ReferenceFoundationTestResourceFile)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="True" />
350351
</Target>
351352
<Import Project="$(StarboardBasePath)\common\winobjc.packagereference.override.targets" Condition="Exists('$(StarboardBasePath)\common\winobjc.packagereference.override.targets')" />
352-
</Project>
353+
</Project>

build/Tests/UnitTests/Foundation/Foundation.UnitTests.vcxproj.filters

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\NSScannerTests.mm" />
153153
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\FoundationTests.mm" />
154154
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\NSNotificationQueueTests.mm" />
155+
<ClangCompile Include="$(StarboardBasePath)\tests\unittests\Foundation\DispatchTests.mm" />
155156
</ItemGroup>
156157
<ItemGroup>
157158
<Text Include="..\..\..\tests\unittests\Foundation\NSFileManagerUT.txt" />
@@ -162,4 +163,4 @@
162163
<UniqueIdentifier>{1beaf0a2-ff8a-415b-ac31-aeb41c89f25d}</UniqueIdentifier>
163164
</Filter>
164165
</ItemGroup>
165-
</Project>
166+
</Project>

build/Tests/UnitTests/WOCStdLib/WOCStdLib.UnitTests.vcxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@
204204
<ClangCompile Include="..\..\..\..\tests\unittests\WOCStdLib\mach\mach_task_info_test.mm" />
205205
<ClangCompile Include="..\..\..\..\tests\unittests\WOCStdLib\mach\mach_test.mm" />
206206
<ClangCompile Include="..\..\..\..\tests\unittests\WOCStdLib\inettests.mm" />
207+
<ClangCompile Include="..\..\..\..\tests\UnitTests\WOCStdLib\OSSpinLockTest.mm" />
207208
</ItemGroup>
208209
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
209-
<Import Project="$(StarboardBasePath)\common\winobjc.packagereference.override.targets" Condition="Exists('$(StarboardBasePath)\common\winobjc.packagereference.override.targets')"/>
210+
<Import Project="$(StarboardBasePath)\common\winobjc.packagereference.override.targets" Condition="Exists('$(StarboardBasePath)\common\winobjc.packagereference.override.targets')" />
210211
</Project>

deps/3rdparty/libdispatch/build/libdispatch.vcxproj

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|ARM">
55
<Configuration>Debug</Configuration>
@@ -37,27 +37,27 @@
3737
<ConfigurationType>DynamicLibrary</ConfigurationType>
3838
<UseDebugLibraries>true</UseDebugLibraries>
3939
<CharacterSet>Unicode</CharacterSet>
40-
<PlatformToolset>v140</PlatformToolset>
40+
<PlatformToolset>v141</PlatformToolset>
4141
</PropertyGroup>
4242
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
4343
<ConfigurationType>DynamicLibrary</ConfigurationType>
4444
<UseDebugLibraries>true</UseDebugLibraries>
4545
<CharacterSet>Unicode</CharacterSet>
46-
<PlatformToolset>v140</PlatformToolset>
46+
<PlatformToolset>v141</PlatformToolset>
4747
</PropertyGroup>
4848
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
4949
<ConfigurationType>DynamicLibrary</ConfigurationType>
5050
<UseDebugLibraries>false</UseDebugLibraries>
5151
<WholeProgramOptimization>true</WholeProgramOptimization>
5252
<CharacterSet>Unicode</CharacterSet>
53-
<PlatformToolset>v140</PlatformToolset>
53+
<PlatformToolset>v141</PlatformToolset>
5454
</PropertyGroup>
5555
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
5656
<ConfigurationType>DynamicLibrary</ConfigurationType>
5757
<UseDebugLibraries>false</UseDebugLibraries>
5858
<WholeProgramOptimization>true</WholeProgramOptimization>
5959
<CharacterSet>Unicode</CharacterSet>
60-
<PlatformToolset>v140</PlatformToolset>
60+
<PlatformToolset>v141</PlatformToolset>
6161
</PropertyGroup>
6262
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
6363
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
@@ -82,13 +82,11 @@
8282
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
8383
<IntDir>$(SolutionDir)obj\$(Platform)\$(TargetOsAndVersion)\$(Configuration)\</IntDir>
8484
<IncludePath>.;$(IncludePath)</IncludePath>
85-
8685
<TargetName>libdispatch</TargetName>
8786
</PropertyGroup>
8887
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
8988
<IntDir>$(SolutionDir)obj\$(Platform)\$(TargetOsAndVersion)\$(Configuration)\</IntDir>
9089
<IncludePath>.;$(IncludePath)</IncludePath>
91-
9290
<TargetName>libdispatch</TargetName>
9391
</PropertyGroup>
9492
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -100,13 +98,11 @@
10098
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
10199
<IntDir>$(SolutionDir)obj\$(Platform)\$(TargetOsAndVersion)\$(Configuration)\</IntDir>
102100
<IncludePath>.;$(IncludePath)</IncludePath>
103-
104101
<TargetName>libdispatch</TargetName>
105102
</PropertyGroup>
106103
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
107104
<IntDir>$(SolutionDir)obj\$(Platform)\$(TargetOsAndVersion)\$(Configuration)\</IntDir>
108105
<IncludePath>.;$(IncludePath)</IncludePath>
109-
110106
<TargetName>libdispatch</TargetName>
111107
</PropertyGroup>
112108
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -220,6 +216,7 @@
220216
</ClangCompile>
221217
</ItemDefinitionGroup>
222218
<ItemGroup>
219+
<None Include="project.json" />
223220
<ClangCompile Include="..\platform\windows\libkern\OSAtomic.c" />
224221
<ClangCompile Include="..\platform\windows\platform.c" />
225222
<ClangCompile Include="..\platform\windows\pthread.c" />
@@ -249,19 +246,13 @@
249246
<ClangCompile Include="..\src\shims\mach.c" />
250247
</ItemGroup>
251248
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
252-
253249
<PropertyGroup>
254-
<PrebuiltPath Condition="'$(PrebuiltPath)' == ''">$(WINOBJC_SDK_ROOT)\deps\prebuilt\Universal Windows\$(PlatformTarget)\$(Configuration)\\</PrebuiltPath>
250+
<PrebuiltRoot Condition="'$(PrebuiltRoot)' == ''">$(WINOBJC_SDK_ROOT)\tools\deps\prebuilt\\</PrebuiltRoot>
251+
<PrebuiltPath Condition="'$(PrebuiltPath)' == ''">$(PrebuiltRoot)\Universal Windows\$(PlatformTarget)\$(Configuration)\\</PrebuiltPath>
255252
</PropertyGroup>
256-
<Target Name="CopyContent" AfterTargets="Build">
253+
<Target Name="RemovePackageBinaries" BeforeTargets="Build;Deploy;_CopyFilesMarkedCopyLocal">
257254
<ItemGroup>
258-
<LibraryOutput Include="$(OutDir)\*.lib" />
259-
<LibraryOutput Include="$(OutDir)\*.dll" />
260-
<LibraryOutput Include="$(OutDir)\*.pdb" />
261-
<Headers Include="..\dispatch\*.h" />
262-
<Headers Include="..\src\*.h" />
255+
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" />
263256
</ItemGroup>
264-
<Copy DestinationFolder="$(PrebuiltPath)" SkipUnchangedFiles="True" SourceFiles="@(LibraryOutput)" />
265-
<Copy DestinationFolder="$(WINOBJC_SDK_ROOT)\deps\prebuilt\include\dispatch\\" SkipUnchangedFiles="True" SourceFiles="@(Headers)" />
266257
</Target>
267258
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"dependencies": {
3+
"WinObjC.Language": "*",
4+
},
5+
"frameworks": {
6+
"uap10.0": {
7+
"imports": "native"
8+
}
9+
},
10+
"runtimes": {
11+
"win10-arm": {},
12+
"win10-x86": {},
13+
"win10-arm-aot": {},
14+
"win10-x86-aot": {}
15+
}
16+
}

0 commit comments

Comments
 (0)