Skip to content
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
1 change: 0 additions & 1 deletion Aspire.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@
<Project Path="tests/Aspire.Hosting.Sdk.Tests/Aspire.Hosting.Sdk.Tests.csproj" />
<Project Path="tests/Aspire.Managed.Tests/Aspire.Managed.Tests.csproj" />
<Project Path="tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj" />
<Project Path="tests/Aspire.SmolSemVer.Tests/Aspire.SmolSemVer.Tests.csproj" />
<Project Path="tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj" />
<Project Path="tests/Aspire.TestUtilities/Aspire.TestUtilities.csproj" />
<Project Path="tests/ConfigurationSchemaGenerator.Tests/ConfigurationSchemaGenerator.Tests.csproj" />
Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<PackageVersion Include="System.IO.Hashing" Version="10.0.3" />
<PackageVersion Include="Yarp.ReverseProxy" Version="2.3.0" />
<PackageVersion Include="StreamJsonRpc" Version="2.22.23" />
<PackageVersion Include="Semver" Version="3.0.0" />
<PackageVersion Include="Sigstore" Version="0.4.0" />
<PackageVersion Include="Tuf" Version="0.4.0" />
<PackageVersion Include="Microsoft.DevTunnels.Connections" Version="1.3.12" />
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Agents/ClaudeCode/ClaudeCodeCliRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.Agents.ClaudeCode;

Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Cli/Agents/ClaudeCode/IClaudeCodeCliRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Semver;

namespace Aspire.Cli.Agents.ClaudeCode;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Agents/CopilotCli/CopilotCliRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.Agents.CopilotCli;

Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Cli/Agents/CopilotCli/ICopilotCliRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Semver;

namespace Aspire.Cli.Agents.CopilotCli;

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Cli/Agents/OpenCode/IOpenCodeCliRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Semver;

namespace Aspire.Cli.Agents.OpenCode;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Agents/OpenCode/OpenCodeCliRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.Agents.OpenCode;

Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Cli/Agents/Playwright/IPlaywrightCliRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Semver;

namespace Aspire.Cli.Agents.Playwright;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Aspire.Cli.Resources;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.Agents.Playwright;

Expand Down Expand Up @@ -144,7 +145,8 @@ internal sealed class PlaywrightCliInstaller(
var installedVersion = await playwrightCliRunner.GetVersionAsync(cancellationToken);
if (installedVersion is not null)
{
if (installedVersion.IsAtLeast(packageInfo.Version))
var comparison = SemVersion.ComparePrecedence(installedVersion, packageInfo.Version);
Comment thread
eerhardt marked this conversation as resolved.
if (comparison >= 0)
{
logger.LogDebug(
"playwright-cli {InstalledVersion} is already installed (target: {TargetVersion}), skipping installation.",
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Agents/Playwright/PlaywrightCliRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.Agents.Playwright;

Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Cli/Agents/VsCode/IVsCodeCliRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Semver;

namespace Aspire.Cli.Agents.VsCode;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Agents/VsCode/VsCodeCliRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.Agents.VsCode;

Expand Down
3 changes: 1 addition & 2 deletions src/Aspire.Cli/Aspire.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<PackageReference Include="OpenTelemetry.Exporter.Console" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />

<PackageReference Include="Semver" />
<PackageReference Include="Sigstore" />
<PackageReference Include="System.IO.Hashing" />
<PackageReference Include="Tuf" />
Expand All @@ -74,7 +74,6 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(SharedDir)SmolSemVer.cs" Link="SmolSemVer.cs" />
<Compile Include="$(SharedDir)BundleDiscovery.cs" Link="Layout\BundleDiscovery.cs" />
<Compile Include="$(SharedDir)EnumerableExtensions.cs" Link="Utils\EnumerableExtensions.cs" />
<Compile Include="$(SharedDir)KnownConfigNames.cs" Link="Utils\KnownConfigNames.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Commands/AddCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Aspire.Cli.Resources;
using Aspire.Cli.Telemetry;
using Aspire.Cli.Utils;
using Semver;
using Spectre.Console;
using NuGetPackage = Aspire.Shared.NuGetPackageCli;

Expand Down
3 changes: 2 additions & 1 deletion src/Aspire.Cli/Commands/InitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Aspire.Cli.Utils;
using Microsoft.Extensions.Configuration;
using NuGetPackage = Aspire.Shared.NuGetPackageCli;
using Semver;
using Spectre.Console;

namespace Aspire.Cli.Commands;
Expand Down Expand Up @@ -924,7 +925,7 @@ public string RequiredAppHostFramework

if (SemVersion.TryParse(versionString, SemVersionStyles.Strict, out var version))
{
if (highestVersion is null || version.IsNewerThan(highestVersion))
if (highestVersion is null || SemVersion.ComparePrecedence(version, highestVersion) > 0)
{
highestVersion = version;
highestTfm = tfm;
Expand Down
6 changes: 3 additions & 3 deletions src/Aspire.Cli/Commands/NewCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ private async Task<ResolveTemplateVersionResult> ResolveCliTemplateVersionAsync(

var packages = await selectedChannel.GetTemplatePackagesAsync(ExecutionContext.WorkingDirectory, cancellationToken);
var package = packages
.Where(p => SemVersion.TryParse(p.Version, SemVersionStyles.Strict, out _))
.OrderByDescending(p => SemVersion.Parse(p.Version, SemVersionStyles.Strict), SemVersion.PrecedenceComparer)
.Where(p => Semver.SemVersion.TryParse(p.Version, Semver.SemVersionStyles.Strict, out _))
.OrderByDescending(p => Semver.SemVersion.Parse(p.Version, Semver.SemVersionStyles.Strict), Semver.SemVersion.PrecedenceComparer)
.FirstOrDefault();

if (package is null)
Expand Down Expand Up @@ -441,7 +441,7 @@ internal class NewCommandPrompter(IInteractionService interactionService) : INew
if (explicitGroups.Length == 0 && implicitGroup is not null)
{
// Return the highest version from the implicit channel
return implicitGroup.OrderByDescending(p => SemVersion.Parse(p.Package.Version), SemVersion.PrecedenceComparer).First();
return implicitGroup.OrderByDescending(p => Semver.SemVersion.Parse(p.Package.Version), Semver.SemVersion.PrecedenceComparer).First();
}

// Create a hierarchical selection experience:
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Commands/Sdk/SdkDumpCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Aspire.Cli.Telemetry;
using Aspire.Cli.Utils;
using Microsoft.Extensions.Logging;
using Semver;
using Spectre.Console;

namespace Aspire.Cli.Commands.Sdk;
Expand Down
5 changes: 3 additions & 2 deletions src/Aspire.Cli/DotNet/DotNetSdkInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Extensions.Configuration;
using Semver;

namespace Aspire.Cli.DotNet;

Expand Down Expand Up @@ -71,7 +72,7 @@ internal sealed class DotNetSdkInstaller(IConfiguration configuration) : IDotNet
if (SemVersion.TryParse(versionString, SemVersionStyles.Strict, out var sdkVersion))
{
// Track the highest version
if (highestDetectedVersion == null || sdkVersion.IsNewerThan(highestDetectedVersion))
if (highestDetectedVersion == null || SemVersion.ComparePrecedence(sdkVersion, highestDetectedVersion) > 0)
Comment thread
eerhardt marked this conversation as resolved.
{
highestDetectedVersion = sdkVersion;
}
Expand Down Expand Up @@ -148,6 +149,6 @@ private static bool MeetsMinimumRequirement(SemVersion installedVersion, SemVers
}

// For all other requirements, use strict version comparison
return installedVersion.IsAtLeast(requiredVersion);
return SemVersion.ComparePrecedence(installedVersion, requiredVersion) >= 0;
Comment thread
eerhardt marked this conversation as resolved.
Comment thread
eerhardt marked this conversation as resolved.
}
}
1 change: 1 addition & 0 deletions src/Aspire.Cli/Mcp/Tools/ListIntegrationsTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Aspire.Cli.Backchannel;
using Aspire.Cli.Packaging;
using ModelContextProtocol.Protocol;
using Semver;

namespace Aspire.Cli.Mcp.Tools;

Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Cli/Npm/INpmRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Semver;

namespace Aspire.Cli.Npm;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Npm/NpmRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.Npm;

Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Cli/OpenCode/IOpenCodeCliRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Semver;

namespace Aspire.Cli.OpenCode;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/OpenCode/OpenCodeCliRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.OpenCode;

Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Packaging/PackageChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using Aspire.Cli.NuGet;
using Aspire.Cli.Resources;
using Semver;
using NuGetPackage = Aspire.Shared.NuGetPackageCli;

namespace Aspire.Cli.Packaging;
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Projects/GuestAppHostProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Aspire.Shared.UserSecrets;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Semver;
using Spectre.Console;

namespace Aspire.Cli.Projects;
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Projects/ProjectUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Aspire.Shared;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using Semver;
using Spectre.Console;

namespace Aspire.Cli.Projects;
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Templating/DotNetTemplateFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Aspire.Cli.Telemetry;
using Aspire.Cli.Utils;
using NuGetPackage = Aspire.Shared.NuGetPackageCli;
using Semver;
using Spectre.Console;

namespace Aspire.Cli.Templating;
Expand Down
3 changes: 2 additions & 1 deletion src/Aspire.Cli/Utils/AppHostHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Aspire.Cli.Interaction;
using Aspire.Cli.Telemetry;
using Aspire.Hosting.Backchannel;
using Semver;
using System.Diagnostics;
using System.Globalization;
using Aspire.Cli.Resources;
Expand Down Expand Up @@ -36,7 +37,7 @@ internal static class AppHostHelper
}

var minimumVersion = SemVersion.Parse("9.2.0");
if (aspireVersion.IsOlderThan(minimumVersion))
if (aspireVersion.ComparePrecedenceTo(minimumVersion) < 0)
{
interactionService.DisplayError(string.Format(CultureInfo.CurrentCulture, ErrorStrings.AspireSDKVersionNotSupported, appHostInformation.AspireHostingVersion));
return (false, false, appHostInformation.AspireHostingVersion);
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Cli/Utils/CliUpdateNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Aspire.Cli.NuGet;
using Aspire.Shared;
using Microsoft.Extensions.Logging;
using Semver;

namespace Aspire.Cli.Utils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

<ItemGroup>
<Compile Include="$(SharedDir)NpmVersionHelper.cs" Link="NpmVersionHelper.cs" />
<Compile Include="$(SharedDir)SmolSemVer.cs" Link="SmolSemVer.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Aspire.TypeSystem\Aspire.TypeSystem.csproj" />
<PackageReference Include="Semver" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion src/Aspire.Hosting.Kubernetes/HelmChartOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Text.RegularExpressions;
using Aspire.Hosting.ApplicationModel;
using Semver;

namespace Aspire.Hosting.Kubernetes;

Expand Down Expand Up @@ -129,7 +130,7 @@ private static void ValidateDnsLabel(string value, string target, int maxLength,

private static void ValidateChartVersion(string version)
{
if (!Aspire.SemVersion.TryParse(version, Aspire.SemVersionStyles.Strict, out _))
if (!SemVersion.TryParse(version, SemVersionStyles.Strict, out _))
{
throw new ArgumentException($"Helm chart version '{version}' is invalid. Use a semantic version such as '1.0.0' or '1.0.0-beta.1'.", nameof(version));
}
Expand Down
3 changes: 1 addition & 2 deletions src/Aspire.Hosting/Aspire.Hosting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<Compile Include="$(SharedDir)LaunchProfiles\*.cs" />
<Compile Include="$(SharedDir)OverloadResolutionPriorityAttribute.cs" Link="Utils\OverloadResolutionPriorityAttribute.cs" />
<Compile Include="$(SharedDir)PackageUpdateHelpers.cs" Link="Utils\PackageUpdateHelpers.cs" />
<Compile Include="$(SharedDir)SmolSemVer.cs" Link="SmolSemVer.cs" />
<Compile Include="$(SharedDir)InteractionHelpers.cs" Link="Utils\InteractionHelpers.cs" />
<Compile Include="$(SharedDir)LocaleHelpers.cs" Link="Utils\LocaleHelpers.cs" />
<Compile Include="$(SharedDir)PathLookupHelper.cs" Link="Utils\PathLookupHelper.cs" />
Expand All @@ -69,7 +68,7 @@
<PackageReference Include="Polly.Core" />
<PackageReference Include="JsonPatch.Net" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" />

<PackageReference Include="Semver" />
<PackageReference Include="System.IO.Hashing" />
<PackageReference Include="StreamJsonRpc" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Semver;

namespace Aspire.Hosting.VersionChecking;

internal interface IPackageVersionProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Aspire.Shared;
using Semver;

namespace Aspire.Hosting.VersionChecking;

Expand Down
Loading
Loading