Skip to content

Commit d384536

Browse files
am11ilonatommy
andauthored
Parse version > 9 in dotnet.py (#4470)
* Parse version > 9 in dotnet.py * More fixes * Print sdk dirs found in the CI * Update scripts/dotnet.py * Move diag to exception message * Delete special condition (since we were not using the fork earlier) * Reapply the workaround (needed after all= * Allow more digits on the 1st position of version. * return 10.0 for nativeaot9.0 * Update azure-pipelines.yml * revert 9.0->10.0 * Update channel_map.py * Update Data.cs * make regex non-greedy * Address feedback --------- Co-authored-by: Ilona Tomkowicz <[email protected]>
1 parent ce03dee commit d384536

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

scripts/dotnet.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def get_target_framework_moniker(framework: str) -> str:
9292
return 'net8.0'
9393
if framework == 'nativeaot9.0':
9494
return 'net9.0'
95+
if framework == 'nativeaot10.0':
96+
return 'net10.0'
9597
else:
9698
return framework
9799

@@ -119,7 +121,7 @@ class VersionsAction(Action):
119121
def __call__(self, parser, namespace, values, option_string=None):
120122
if values:
121123
for version in values:
122-
if not search(r'^\d\.\d+\.\d+', version):
124+
if not search(r'^\d+\.\d+\.\d+', version):
123125
raise ArgumentTypeError(
124126
'Version "{}" is in the wrong format'.format(version))
125127
setattr(namespace, self.dest, values)
@@ -528,7 +530,7 @@ def run(self,
528530
FrameworkVersion = NamedTuple('FrameworkVersion', major=int, minor=int)
529531
@tracer.start_as_current_span("dotnet_get_framework_version") # type: ignore
530532
def get_framework_version(framework: str) -> FrameworkVersion:
531-
groups = search(r".*(\d)\.(\d)$", framework)
533+
groups = search(r".*?(\d+)\.(\d+)$", framework)
532534
if not groups:
533535
raise ValueError("Unknown target framework: {}".format(framework))
534536

@@ -594,12 +596,16 @@ def get_dotnet_version_from_path(
594596
# Attempt 2: Increase the minor version by 1 and retry.
595597
sdk = next((f for f in sdks if f.startswith(
596598
"{}.{}".format(version.major, version.minor + 1))), None)
599+
if not sdk:
600+
if version.major == 9:
601+
sdk = next((f for f in sdks if f.startswith("10.0")), None)
597602
if not sdk:
598603
sdk = next((f for f in sdks if f.startswith(
599604
"{}.{}".format('6', '0'))), None)
600605
if not sdk:
601606
raise RuntimeError(
602-
"Unable to determine the .NET SDK used for {}".format(framework)
607+
f"Unable to determine the .NET SDK used for {framework}. "
608+
f"SDKs found in {sdk_path}: {sdks}. Major version: {version.major}"
603609
)
604610

605611
return sdk

src/tools/ResultsComparer/Data.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ private static string GetMoniker(string key)
158158
return "nativeaot9.0-preview" + key[key.IndexOf("nativeaot9.0-preview") + "nativeaot9.0-preview".Length];
159159
if (key.Contains("net9.0"))
160160
return "net9.0";
161+
if (key.StartsWith("net10.0"))
162+
return "net10.0";
163+
if (key.StartsWith("nativeaot10.0"))
164+
return key;
161165

162166
return null;
163167
}

0 commit comments

Comments
 (0)