Skip to content
Open
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
11 changes: 6 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<AspireMajorVersion>9</AspireMajorVersion>
<AspireVersion>$(AspireMajorVersion).5.0</AspireVersion>
<AspireMajorVersion>13</AspireMajorVersion>
<AspireVersion>$(AspireMajorVersion).0.0-preview.1.25523.9</AspireVersion>
<AspireAppHostSdkVersion>$(AspireVersion)</AspireAppHostSdkVersion>
<AspirePreviewSuffix>preview.1.25474.7</AspirePreviewSuffix>
<AspNetCoreVersion>9.0.0</AspNetCoreVersion>
<DotNetExtensionsVersion>9.0.9</DotNetExtensionsVersion>
<DotNetExtensionsVersion>9.0.10</DotNetExtensionsVersion>
<OpenTelemetryVersion>1.12.0</OpenTelemetryVersion>
<TestContainersVersion>4.7.0</TestContainersVersion>
<MEAIVersion>9.9.0</MEAIVersion>
<ServiceDiscoveryVersion>10.0.0-preview.1.25520.3</ServiceDiscoveryVersion>
<IsPackable>false</IsPackable>
<MoqVersion>4.20.72</MoqVersion>

Expand All @@ -39,8 +40,8 @@

<!-- Versioning -->
<PropertyGroup>
<ToolkitMinorVersion>8</ToolkitMinorVersion>
<ToolkitPatchVersion>1</ToolkitPatchVersion>
<ToolkitMinorVersion>0</ToolkitMinorVersion>
<ToolkitPatchVersion>0</ToolkitPatchVersion>
<ToolkitPreviewVersion>preview.1</ToolkitPreviewVersion>

<VersionPrefix>$(AspireMajorVersion).$(ToolkitMinorVersion).$(ToolkitPatchVersion)</VersionPrefix>
Expand Down
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<PackageVersion Include="Aspire.Hosting.Dapr" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Azure.AppContainers" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Azure.Redis" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Keycloak" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Keycloak.Authentication" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.NodeJS" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Python" Version="$(AspireVersion)" />
Expand Down Expand Up @@ -46,7 +48,7 @@
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.7" />
<!-- .NET packages -->
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.9.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="$(AspireVersion)" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="$(ServiceDiscoveryVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(DotNetExtensionsVersion)" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="$(DotNetExtensionsVersion)" />
Expand Down Expand Up @@ -106,8 +108,6 @@
<PackageVersion Include="xunit.extensibility.execution" Version="2.9.3" />
<PackageVersion Include="Microsoft.DotNet.XUnitExtensions" Version="9.0.0-beta.24568.1" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="Aspire.Hosting.Keycloak" Version="$(AspireVersion)-$(AspirePreviewSuffix)" />
<PackageVersion Include="Aspire.Keycloak.Authentication" Version="$(AspireVersion)-$(AspirePreviewSuffix)" />
<PackageVersion Include="Moq" Version="$(MoqVersion)" />
<!-- Build dependencies -->
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
Expand All @@ -116,7 +116,7 @@
<PackageVersion Include="Testcontainers.MsSql" Version="$(TestContainersVersion)" />
</ItemGroup>
<ItemGroup Label=".NET 9 Overrides" Condition="'$(TargetFramework)' == 'net9.0'">
<PackageVersion Update="Microsoft.Extensions.Logging.Abstractions" Version="9.0.9" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.9" />
<PackageVersion Update="Microsoft.Extensions.Logging.Abstractions" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.10" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using CommunityToolkit.Aspire.Hosting.Deno;

var builder = DistributedApplication.CreateBuilder(args);

builder.AddDenoTask("vite-demo", taskName: "dev")
Expand Down
8 changes: 7 additions & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet9-transport" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet9-transport/nuget/v3/index.json" />
<add key="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
</packageSources>
<packageSourceMapping>
<packageSource key="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json">
<package pattern="Aspire*" />
<package pattern="Microsoft.Extensions.ServiceDiscovery*" />
</packageSource>
<packageSource key="dotnet-eng">
<package pattern="Microsoft.DotNet.XUnitExtensions" />
</packageSource>
<packageSource key="dotnet9-transport">
<package pattern="Microsoft.DotNet.GenAPI.Task" />
<package pattern="*" />
</packageSource>
<packageSource key="nuget">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
</configuration>
23 changes: 19 additions & 4 deletions src/CommunityToolkit.Aspire.Hosting.Bun/BunAppExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Lifecycle;
using CommunityToolkit.Aspire.Hosting.Bun;
using CommunityToolkit.Aspire.Utils;
using Microsoft.Extensions.Hosting;

Expand Down Expand Up @@ -46,10 +44,27 @@ public static IResourceBuilder<BunAppResource> AddBunApp(
/// Ensures the Bun packages are installed before the application starts using Bun as the package manager.
/// </summary>
/// <param name="resource">The Bun app resource.</param>
/// <param name="configureInstaller">Configure the Bun installer resource.</param>
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
public static IResourceBuilder<BunAppResource> WithBunPackageInstallation(this IResourceBuilder<BunAppResource> resource)
public static IResourceBuilder<BunAppResource> WithBunPackageInstallation(this IResourceBuilder<BunAppResource> resource, Action<IResourceBuilder<BunInstallerResource>>? configureInstaller = null)
{
resource.ApplicationBuilder.Services.TryAddLifecycleHook<BunPackageInstallerLifecycleHook>();
// Only install packages during development, not in publish mode
if (!resource.ApplicationBuilder.ExecutionContext.IsPublishMode)
{
var installerName = $"{resource.Resource.Name}-bun-install";
var installer = new BunInstallerResource(installerName, resource.Resource.WorkingDirectory);

var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
.WithArgs("install")
.WithParentRelationship(resource.Resource)
.ExcludeFromManifest();

// Make the parent resource wait for the installer to complete
resource.WaitForCompletion(installerBuilder);

configureInstaller?.Invoke(installerBuilder);
}

return resource;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Aspire.Hosting.ApplicationModel;

/// <summary>
/// A resource that represents a Bun package installer.
/// </summary>
/// <param name="name">The name of the resource.</param>
/// <param name="workingDirectory">The working directory to use for the command.</param>
public class BunInstallerResource(string name, string workingDirectory)
: ExecutableResource(name, "bun", workingDirectory);

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
using Aspire.Hosting.Lifecycle;
using Aspire.Hosting.Utils;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net.Sockets;
using System.Threading.Tasks;
using static CommunityToolkit.Aspire.Hosting.Dapr.CommandLineArgs;

namespace CommunityToolkit.Aspire.Hosting.Dapr;
Expand All @@ -23,14 +21,21 @@ internal sealed class DaprDistributedApplicationLifecycleHook(
IConfiguration configuration,
IHostEnvironment environment,
ILogger<DaprDistributedApplicationLifecycleHook> logger,
IOptions<DaprOptions> options) : IDistributedApplicationLifecycleHook, IDisposable
IOptions<DaprOptions> options) : IDistributedApplicationEventingSubscriber, IDisposable
{
private readonly DaprOptions _options = options.Value;

private string? _onDemandResourcesRootPath;

public async Task BeforeStartAsync(DistributedApplicationModel appModel, CancellationToken cancellationToken = default)
public Task SubscribeAsync(IDistributedApplicationEventing eventing, DistributedApplicationExecutionContext executionContext, CancellationToken cancellationToken)
{
eventing.Subscribe<BeforeStartEvent>(OnBeforeStartAsync);
return Task.CompletedTask;
}

private async Task OnBeforeStartAsync(BeforeStartEvent @event, CancellationToken cancellationToken = default)
{
var appModel = @event.Model;
string appHostDirectory = GetAppHostDirectory();

// Set up WaitAnnotations for Dapr components based on their value provider dependencies
Expand Down Expand Up @@ -91,7 +96,7 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
hasValueProviders = true;
}
}

// Check if there are any secrets that need to be added to the secret store
if (componentReferenceAnnotation.Component.TryGetAnnotationsOfType<DaprComponentSecretAnnotation>(out var secretAnnotations))
{
Expand All @@ -100,7 +105,7 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
secrets[secretAnnotation.Key] = (await secretAnnotation.Value.GetValueAsync(cancellationToken))!;
}
}

// If we have any secrets or value providers, ensure the secret store path is added
if ((secrets.Count > 0 || hasValueProviders) && onDemandResourcesPaths.TryGetValue("secretstore", out var secretStorePath))
{
Expand Down Expand Up @@ -139,7 +144,7 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
{
context.EnvironmentVariables.TryAdd(secret.Key, secret.Value);
}

// Add value provider references
foreach (var (envVarName, valueProvider) in endpointEnvironmentVars)
{
Expand Down Expand Up @@ -509,10 +514,10 @@ private async Task<IReadOnlyDictionary<string, string>> StartOnDemandDaprCompone
.ToList();

// If any of the components have secrets or value provider references, we will add an on-demand secret store component.
bool needsSecretStore = onDemandComponents.Any(component =>
bool needsSecretStore = onDemandComponents.Any(component =>
(component.TryGetAnnotationsOfType<DaprComponentSecretAnnotation>(out var secretAnnotations) && secretAnnotations.Any()) ||
(component.TryGetAnnotationsOfType<DaprComponentValueProviderAnnotation>(out var valueProviderAnnotations) && valueProviderAnnotations.Any()));

if (needsSecretStore)
{
onDemandComponents.Add(new DaprComponentResource("secretstore", DaprConstants.BuildingBlocks.SecretStore));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static IDistributedApplicationBuilder AddDapr(this IDistributedApplicatio
builder.Services.Configure(configure);
}

builder.Services.TryAddLifecycleHook<DaprDistributedApplicationLifecycleHook>();
builder.Services.TryAddEventingSubscriber<DaprDistributedApplicationLifecycleHook>();

return builder;
}
Expand Down
Loading
Loading