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

Use macos12 machines in official build #88793

Merged
merged 5 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions eng/pipelines/common/xplat-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,13 @@ jobs:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64

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

${{ if and(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), ne(variables['System.TeamProject'], 'public')) }}:
Copy link
Member

Choose a reason for hiding this comment

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

you can use ${{ else }} here

Copy link
Member Author

Choose a reason for hiding this comment

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

Wait, is that new? That has to be new.

vmImage: 'macos-12'

# Official Build Windows Pool
${{ if and(or(eq(parameters.osGroup, 'windows'), eq(parameters.jobParameters.hostedOs, 'windows')), ne(variables['System.TeamProject'], 'public')) }}:
name: $(DncEngInternalBuildPool)
Expand Down
50 changes: 27 additions & 23 deletions src/native/libs/System.Globalization.Native/pal_locale.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{
NSLocale *currentLocale = [NSLocale currentLocale];
NSString *localeName = @"";

if (!currentLocale)
{
return strdup([localeName UTF8String]);
Expand All @@ -27,7 +27,7 @@
{
localeName = currentLocale.localeIdentifier;
}

return strdup([localeName UTF8String]);
}

Expand Down Expand Up @@ -143,7 +143,7 @@
case LocaleString_MonetaryThousandSeparator:
case LocaleString_Iso639LanguageThreeLetterName:
case LocaleString_ParentName:
case LocaleString_Iso3166CountryName2:
case LocaleString_Iso3166CountryName2:
default:
value = "";
break;
Expand All @@ -169,14 +169,14 @@
Returns a numeric string pattern in a format that we can match against the
appropriate managed pattern. Examples:
For PositiveMonetaryNumberFormat "¤#,##0.00" becomes "Cn"
For NegativeNumberFormat "#,##0.00;(#,##0.00)" becomes "(n)"
For NegativeNumberFormat "#,##0.00;(#,##0.00)" becomes "(n)"
*/
static char* NormalizeNumericPattern(const char* srcPattern, int isNegative)
{
int iStart = 0;
int iEnd = strlen(srcPattern);

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

static int32_t GetValueForNumberFormat(NSLocale *currentLocale, LocaleNumberData localeNumberData)
{
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.locale = currentLocale;
const char *pFormat;
int32_t value;
Expand Down Expand Up @@ -390,7 +390,9 @@ static int32_t GetValueForNumberFormat(NSLocale *currentLocale, LocaleNumberData

int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, LocaleNumberData localeNumberData)
{
#ifndef NDEBUG
bool isSuccess = true;
#endif
int32_t value;
NSString *locName = [NSString stringWithFormat:@"%s", localeName];
NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:locName];
Expand All @@ -402,36 +404,38 @@ int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, Local
const char *measurementSystem = [[currentLocale objectForKey:NSLocaleMeasurementSystem] UTF8String];
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
const char *us_measurementSystem = [[usLocale objectForKey:NSLocaleMeasurementSystem] UTF8String];
value = (measurementSystem == us_measurementSystem) ? 1 : 0;
value = (measurementSystem == us_measurementSystem) ? 1 : 0;
break;
}
case LocaleNumber_FractionalDigitsCount:
{
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.locale = currentLocale;
numberFormatter.numberStyle = NSNumberFormatterDecimalStyle;
value = (int32_t)numberFormatter.maximumFractionDigits;
break;
}
case LocaleNumber_MonetaryFractionalDigitsCount:
{
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.locale = currentLocale;
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
value = (int32_t)numberFormatter.maximumFractionDigits;
break;
}
}
case LocaleNumber_PositiveMonetaryNumberFormat:
case LocaleNumber_NegativeMonetaryNumberFormat:
case LocaleNumber_NegativeNumberFormat:
case LocaleNumber_NegativePercentFormat:
case LocaleNumber_PositivePercentFormat:
{
value = GetValueForNumberFormat(currentLocale, localeNumberData);
#ifndef NDEBUG
if (value < 0)
{
isSuccess = false;
}
#endif
break;
}
case LocaleNumber_FirstWeekOfYear:
Expand All @@ -451,12 +455,14 @@ int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, Local
value = WeekRule_FirstFourDayWeek;
}
else
{
{
value = -1;
#ifndef NDEBUG
isSuccess = false;
#endif
}
break;
}
}
case LocaleNumber_ReadingLayout:
{
NSLocaleLanguageDirection langDir = [NSLocale characterDirectionForLanguage:[currentLocale objectForKey:NSLocaleLanguageCode]];
Expand All @@ -473,7 +479,9 @@ int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, Local
}
default:
value = -1;
#ifndef NDEBUG
isSuccess = false;
#endif
break;
}

Expand All @@ -490,11 +498,10 @@ int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, Local
*/
int32_t GlobalizationNative_GetLocaleInfoPrimaryGroupingSizeNative(const char* localeName, LocaleNumberData localeGroupingData)
{
bool isSuccess = true;
NSString *locName = [NSString stringWithFormat:@"%s", localeName];
NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:locName];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.locale = currentLocale;
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.locale = currentLocale;

switch (localeGroupingData)
{
Expand All @@ -505,11 +512,10 @@ int32_t GlobalizationNative_GetLocaleInfoPrimaryGroupingSizeNative(const char* l
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
break;
default:
isSuccess = false;
assert(isSuccess);
assert(false);
break;
}
return [numberFormatter groupingSize];
return [numberFormatter groupingSize];
}

/*
Expand All @@ -520,11 +526,10 @@ int32_t GlobalizationNative_GetLocaleInfoPrimaryGroupingSizeNative(const char* l
*/
int32_t GlobalizationNative_GetLocaleInfoSecondaryGroupingSizeNative(const char* localeName, LocaleNumberData localeGroupingData)
{
bool isSuccess = true;
NSString *locName = [NSString stringWithFormat:@"%s", localeName];
NSLocale *currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:locName];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.locale = currentLocale;
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.locale = currentLocale;

switch (localeGroupingData)
{
Expand All @@ -535,8 +540,7 @@ int32_t GlobalizationNative_GetLocaleInfoSecondaryGroupingSizeNative(const char*
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
break;
default:
isSuccess = false;
assert(isSuccess);
assert(false);
break;
}

Expand Down
Loading