Skip to content

Commit 33ba157

Browse files
authored
Use macos12 machines in official build (#88793)
1 parent 9fc8cb9 commit 33ba157

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed

eng/pipelines/common/xplat-setup.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,13 @@ jobs:
146146
name: $(DncEngInternalBuildPool)
147147
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
148148

149-
# OSX Build Pool (we don't have on-prem OSX BuildPool
150-
${{ if in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator') }}:
149+
# OSX Build Pool (we don't have on-prem OSX BuildPool). Use 11 on public, 12 on internal.
150+
${{ if and(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), eq(variables['System.TeamProject'], 'public')) }}:
151151
vmImage: 'macos-11'
152152

153+
${{ if and(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), ne(variables['System.TeamProject'], 'public')) }}:
154+
vmImage: 'macos-12'
155+
153156
# Official Build Windows Pool
154157
${{ if and(or(eq(parameters.osGroup, 'windows'), eq(parameters.jobParameters.hostedOs, 'windows')), ne(variables['System.TeamProject'], 'public')) }}:
155158
name: $(DncEngInternalBuildPool)

src/native/libs/System.Globalization.Native/pal_locale.m

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{
1414
NSLocale *currentLocale = [NSLocale currentLocale];
1515
NSString *localeName = @"";
16-
16+
1717
if (!currentLocale)
1818
{
1919
return strdup([localeName UTF8String]);
@@ -27,7 +27,7 @@
2727
{
2828
localeName = currentLocale.localeIdentifier;
2929
}
30-
30+
3131
return strdup([localeName UTF8String]);
3232
}
3333

@@ -143,7 +143,7 @@
143143
case LocaleString_MonetaryThousandSeparator:
144144
case LocaleString_Iso639LanguageThreeLetterName:
145145
case LocaleString_ParentName:
146-
case LocaleString_Iso3166CountryName2:
146+
case LocaleString_Iso3166CountryName2:
147147
default:
148148
value = "";
149149
break;
@@ -169,14 +169,14 @@
169169
Returns a numeric string pattern in a format that we can match against the
170170
appropriate managed pattern. Examples:
171171
For PositiveMonetaryNumberFormat "¤#,##0.00" becomes "Cn"
172-
For NegativeNumberFormat "#,##0.00;(#,##0.00)" becomes "(n)"
172+
For NegativeNumberFormat "#,##0.00;(#,##0.00)" becomes "(n)"
173173
*/
174174
static char* NormalizeNumericPattern(const char* srcPattern, int isNegative)
175175
{
176176
int iStart = 0;
177177
int iEnd = strlen(srcPattern);
178178

179-
// ';' separates positive and negative subpatterns.
179+
// ';' separates positive and negative subpatterns.
180180
// When there is no explicit negative subpattern,
181181
// an implicit negative subpattern is formed from the positive pattern with a prefixed '-'.
182182
char * ptrNegativePattern = strrchr(srcPattern,';');
@@ -328,7 +328,7 @@ static int GetPatternIndex(char* normalizedPattern,const char* patterns[], int p
328328

329329
static int32_t GetValueForNumberFormat(NSLocale *currentLocale, LocaleNumberData localeNumberData)
330330
{
331-
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
331+
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
332332
numberFormatter.locale = currentLocale;
333333
const char *pFormat;
334334
int32_t value;
@@ -390,7 +390,9 @@ static int32_t GetValueForNumberFormat(NSLocale *currentLocale, LocaleNumberData
390390

391391
int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, LocaleNumberData localeNumberData)
392392
{
393+
#ifndef NDEBUG
393394
bool isSuccess = true;
395+
#endif
394396
int32_t value;
395397
NSString *locName = [NSString stringWithFormat:@"%s", localeName];
396398
NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:locName];
@@ -402,36 +404,38 @@ int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, Local
402404
const char *measurementSystem = [[currentLocale objectForKey:NSLocaleMeasurementSystem] UTF8String];
403405
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
404406
const char *us_measurementSystem = [[usLocale objectForKey:NSLocaleMeasurementSystem] UTF8String];
405-
value = (measurementSystem == us_measurementSystem) ? 1 : 0;
407+
value = (measurementSystem == us_measurementSystem) ? 1 : 0;
406408
break;
407409
}
408410
case LocaleNumber_FractionalDigitsCount:
409411
{
410-
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
412+
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
411413
numberFormatter.locale = currentLocale;
412414
numberFormatter.numberStyle = NSNumberFormatterDecimalStyle;
413415
value = (int32_t)numberFormatter.maximumFractionDigits;
414416
break;
415417
}
416418
case LocaleNumber_MonetaryFractionalDigitsCount:
417419
{
418-
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
420+
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
419421
numberFormatter.locale = currentLocale;
420422
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
421423
value = (int32_t)numberFormatter.maximumFractionDigits;
422424
break;
423-
}
425+
}
424426
case LocaleNumber_PositiveMonetaryNumberFormat:
425427
case LocaleNumber_NegativeMonetaryNumberFormat:
426428
case LocaleNumber_NegativeNumberFormat:
427429
case LocaleNumber_NegativePercentFormat:
428430
case LocaleNumber_PositivePercentFormat:
429431
{
430432
value = GetValueForNumberFormat(currentLocale, localeNumberData);
433+
#ifndef NDEBUG
431434
if (value < 0)
432435
{
433436
isSuccess = false;
434437
}
438+
#endif
435439
break;
436440
}
437441
case LocaleNumber_FirstWeekOfYear:
@@ -451,12 +455,14 @@ int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, Local
451455
value = WeekRule_FirstFourDayWeek;
452456
}
453457
else
454-
{
458+
{
455459
value = -1;
460+
#ifndef NDEBUG
456461
isSuccess = false;
462+
#endif
457463
}
458464
break;
459-
}
465+
}
460466
case LocaleNumber_ReadingLayout:
461467
{
462468
NSLocaleLanguageDirection langDir = [NSLocale characterDirectionForLanguage:[currentLocale objectForKey:NSLocaleLanguageCode]];
@@ -473,7 +479,9 @@ int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, Local
473479
}
474480
default:
475481
value = -1;
482+
#ifndef NDEBUG
476483
isSuccess = false;
484+
#endif
477485
break;
478486
}
479487

@@ -490,11 +498,10 @@ int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, Local
490498
*/
491499
int32_t GlobalizationNative_GetLocaleInfoPrimaryGroupingSizeNative(const char* localeName, LocaleNumberData localeGroupingData)
492500
{
493-
bool isSuccess = true;
494501
NSString *locName = [NSString stringWithFormat:@"%s", localeName];
495502
NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:locName];
496-
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
497-
numberFormatter.locale = currentLocale;
503+
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
504+
numberFormatter.locale = currentLocale;
498505

499506
switch (localeGroupingData)
500507
{
@@ -505,11 +512,10 @@ int32_t GlobalizationNative_GetLocaleInfoPrimaryGroupingSizeNative(const char* l
505512
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
506513
break;
507514
default:
508-
isSuccess = false;
509-
assert(isSuccess);
515+
assert(false);
510516
break;
511517
}
512-
return [numberFormatter groupingSize];
518+
return [numberFormatter groupingSize];
513519
}
514520

515521
/*
@@ -520,11 +526,10 @@ int32_t GlobalizationNative_GetLocaleInfoPrimaryGroupingSizeNative(const char* l
520526
*/
521527
int32_t GlobalizationNative_GetLocaleInfoSecondaryGroupingSizeNative(const char* localeName, LocaleNumberData localeGroupingData)
522528
{
523-
bool isSuccess = true;
524529
NSString *locName = [NSString stringWithFormat:@"%s", localeName];
525530
NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:locName];
526-
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
527-
numberFormatter.locale = currentLocale;
531+
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
532+
numberFormatter.locale = currentLocale;
528533

529534
switch (localeGroupingData)
530535
{
@@ -535,8 +540,7 @@ int32_t GlobalizationNative_GetLocaleInfoSecondaryGroupingSizeNative(const char*
535540
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
536541
break;
537542
default:
538-
isSuccess = false;
539-
assert(isSuccess);
543+
assert(false);
540544
break;
541545
}
542546

0 commit comments

Comments
 (0)