Skip to content

Commit 0909130

Browse files
committed
Merge branch 'main' of https://github.com/nanoframework/nf-interpreter into develop
***NO_CI***
2 parents 8893840 + d90b430 commit 0909130

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

azure-pipelines-nightly.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,7 @@ jobs:
301301
steps:
302302
- template: azure-pipelines-templates/build-preparations.yml
303303
- template: azure-pipelines-templates/nb-gitversioning.yml
304-
- template: azure-pipelines-templates/download-install-cmake.yml
305304
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
306-
- template: azure-pipelines-templates/download-install-ninja.yml
307305
- template: azure-pipelines-templates/download-srecord.yml
308306
- template: azure-pipelines-templates/download-hexdfu.yml
309307
- template: azure-pipelines-templates/build-chibios-stm32-targets.yml
@@ -724,9 +722,7 @@ jobs:
724722
steps:
725723
- template: azure-pipelines-templates/build-preparations.yml
726724
- template: azure-pipelines-templates/nb-gitversioning.yml
727-
- template: azure-pipelines-templates/download-install-cmake.yml
728725
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
729-
- template: azure-pipelines-templates/download-install-ninja.yml
730726
- template: azure-pipelines-templates/download-hexdfu.yml
731727
- template: azure-pipelines-templates/download-srecord.yml
732728
- template: azure-pipelines-templates/build-azurertos-targets.yml

azure-pipelines.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,7 @@ jobs:
442442
steps:
443443
- template: azure-pipelines-templates/build-preparations.yml
444444
- template: azure-pipelines-templates/nb-gitversioning.yml
445-
- template: azure-pipelines-templates/download-install-cmake.yml
446445
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
447-
- template: azure-pipelines-templates/download-install-ninja.yml
448446
- template: azure-pipelines-templates/download-srecord.yml
449447
- template: azure-pipelines-templates/download-hexdfu.yml
450448
- template: azure-pipelines-templates/build-chibios-stm32-targets.yml
@@ -645,9 +643,7 @@ jobs:
645643
steps:
646644
- template: azure-pipelines-templates/build-preparations.yml
647645
- template: azure-pipelines-templates/nb-gitversioning.yml
648-
- template: azure-pipelines-templates/download-install-cmake.yml
649646
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
650-
- template: azure-pipelines-templates/download-install-ninja.yml
651647
- template: azure-pipelines-templates/download-srecord.yml
652648
- template: azure-pipelines-templates/build-freertos-nxp-targets.yml
653649
- template: azure-pipelines-templates/pack-publish-artifacts.yml
@@ -796,9 +792,7 @@ jobs:
796792
steps:
797793
- template: azure-pipelines-templates/build-preparations.yml
798794
- template: azure-pipelines-templates/nb-gitversioning.yml
799-
- template: azure-pipelines-templates/download-install-cmake.yml
800795
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
801-
- template: azure-pipelines-templates/download-install-ninja.yml
802796
- template: azure-pipelines-templates/download-hexdfu.yml
803797
- template: azure-pipelines-templates/download-srecord.yml
804798
- template: azure-pipelines-templates/build-azurertos-targets.yml

targets/netcore/nanoFramework.nanoCLR.CLI/ClrInstanceOperationsProcessor.cs

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,38 @@ private static async Task<ExitCode> UpdateNanoCLRAsync(
143143
_httpClient.DefaultRequestHeaders.Add("Accept", "*/*");
144144

145145
string repoName = usePreview ? _refTargetsDevRepo : _refTargetsStableRepo;
146+
List<CloudsmithPackageInfo> packageInfo;
147+
string responseBody;
146148

147-
// get latest version available for download
148-
HttpResponseMessage response = await _httpClient.GetAsync($"{repoName}/?query=name:^WIN_DLL_nanoCLR version:^latest$");
149-
string responseBody = await response.Content.ReadAsStringAsync();
149+
if (string.IsNullOrEmpty(targetVersion))
150+
{
151+
// no specific version requested, get latest version available for download
152+
HttpResponseMessage response = await _httpClient.GetAsync($"{repoName}/?query=name:^WIN_DLL_nanoCLR version:^latest$");
153+
154+
responseBody = await response.Content.ReadAsStringAsync();
150155

151-
if (responseBody == "[]")
156+
if (responseBody == "[]")
157+
{
158+
Console.WriteLine($"Error getting latest available nanoCLR package.");
159+
return ExitCode.E9005;
160+
}
161+
}
162+
else
152163
{
153-
Console.WriteLine($"Error getting latest available nanoCLR package.");
154-
return ExitCode.E9005;
164+
// specific version requested, get details for that version
165+
HttpResponseMessage response = await _httpClient.GetAsync($"{repoName}/?query=name:^WIN_DLL_nanoCLR version:{targetVersion}");
166+
167+
responseBody = await response.Content.ReadAsStringAsync();
168+
169+
if (responseBody == "[]")
170+
{
171+
Console.WriteLine($"Error getting package details for v{targetVersion}.");
172+
return ExitCode.E9005;
173+
}
155174
}
156175

157-
var packageInfo = JsonSerializer.Deserialize<List<CloudsmithPackageInfo>>(responseBody);
176+
// parse the response
177+
packageInfo = JsonSerializer.Deserialize<List<CloudsmithPackageInfo>>(responseBody);
158178

159179
if (packageInfo.Count != 1)
160180
{
@@ -165,18 +185,12 @@ private static async Task<ExitCode> UpdateNanoCLRAsync(
165185
{
166186
Version availableFwVersion = Version.Parse(packageInfo[0].Version);
167187

168-
// only perform version check if preview wasn't requested
169-
if (!usePreview && (availableFwVersion < installedVersion))
170-
{
171-
Console.WriteLine($"Current version {installedVersion} higher than available version {packageInfo[0].Version}");
172-
}
173-
174-
if (usePreview
175-
|| (availableFwVersion > installedVersion)
176-
|| (!string.IsNullOrEmpty(targetVersion)
177-
&& (Version.Parse(targetVersion) > Version.Parse(currentVersion))))
188+
// update if the version is different from the installed one (either the requested target version or the latest available in the repo)
189+
if ((!string.IsNullOrEmpty(targetVersion)
190+
&& (Version.Parse(targetVersion) != installedVersion))
191+
|| (availableFwVersion > installedVersion))
178192
{
179-
response = await _httpClient.GetAsync(packageInfo[0].DownloadUrl);
193+
HttpResponseMessage response = await _httpClient.GetAsync(packageInfo[0].DownloadUrl);
180194
response.EnsureSuccessStatusCode();
181195

182196
// need to unload the DLL before updating it
@@ -194,7 +208,7 @@ private static async Task<ExitCode> UpdateNanoCLRAsync(
194208
}
195209
else
196210
{
197-
Console.WriteLine($"Already at v{packageInfo[0].Version}");
211+
Console.WriteLine($"At v{packageInfo[0].Version}, skipping update");
198212
}
199213

200214
return ExitCode.OK;

0 commit comments

Comments
 (0)