Skip to content

Commit 615e9d4

Browse files
committed
The last comment I had missed requested I remove logging and surface things on the resources themselves. To that end I've cut those tests and removed the logging statements.
1 parent 178fde7 commit 615e9d4

File tree

4 files changed

+0
-191
lines changed

4 files changed

+0
-191
lines changed

src/CommunityToolkit.Aspire.Hosting.Perl/PerlAppResourceBuilderExtensions.cs

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,6 @@ private static IResourceBuilder<PerlAppResource> AddPerlAppCore(
165165

166166
var resource = new PerlAppResource(resourceName, entrypoint, resolvedAppDirectory);
167167

168-
if (builder.ExecutionContext.IsRunMode)
169-
{
170-
builder.Eventing.Subscribe<BeforeStartEvent>((evt, _) =>
171-
{
172-
var logger = evt.Services.GetRequiredService<ResourceLoggerService>().GetLogger(resource);
173-
logger.LogInformation("Perl resource '{ResourceName}' configured: entrypoint={Entrypoint}, type={EntrypointType}, workingDirectory={WorkingDirectory}",
174-
resourceName, entrypoint, entrypointType, resolvedAppDirectory);
175-
return Task.CompletedTask;
176-
});
177-
}
178-
179168
// Use just the entrypoint filename — the working directory is already set to appDirectory,
180169
// so Path.Combine(appDirectory, entrypoint) would double-nest the path.
181170
string scriptPath = entrypoint;
@@ -245,9 +234,6 @@ private static IResourceBuilder<PerlAppResource> AddPerlAppCore(
245234

246235
if (builder.ExecutionContext.IsRunMode)
247236
{
248-
// Auto-detect project-level dependency files (GAP-11)
249-
//FEEDBACK: I don't know that I like this behavior. Please explain why I should do this during runtime,
250-
//is this because it happens automatically on publish?
251237
if (HasDependencyFiles(resolvedAppDirectory, builder.AppHostDirectory))
252238
{
253239
resourceBuilder.WithProjectDependencies();
@@ -521,25 +507,6 @@ public static IResourceBuilder<TResource> WithPerlCertificateTrust<TResource>(
521507

522508
builder.Resource.Annotations.Add(new PerlCertificateTrustAnnotation());
523509

524-
if (builder.ApplicationBuilder.ExecutionContext.IsRunMode)
525-
{
526-
builder.ApplicationBuilder.Eventing.Subscribe<BeforeStartEvent>((evt, _) =>
527-
{
528-
var logger = evt.Services.GetRequiredService<ResourceLoggerService>().GetLogger(builder.Resource);
529-
var sslCertFile = Environment.GetEnvironmentVariable("SSL_CERT_FILE");
530-
if (sslCertFile is not null)
531-
{
532-
logger.LogInformation("Certificate trust configured: SSL_CERT_FILE={CertBundlePath}", sslCertFile);
533-
}
534-
else
535-
{
536-
logger.LogDebug("Certificate trust enabled but no SSL_CERT_FILE found in environment");
537-
}
538-
539-
return Task.CompletedTask;
540-
});
541-
}
542-
543510
builder.WithCertificateTrustConfiguration(context =>
544511
{
545512
if (context.CertificateBundlePath is { } bundlePath)
@@ -642,22 +609,6 @@ private static void EnsurePerlbrewEnvironmentCallback<TResource>(
642609

643610
resource.Resource.Annotations.Add(new PerlbrewResourceEnvironmentAnnotation());
644611

645-
if (resource.ApplicationBuilder.ExecutionContext.IsRunMode)
646-
{
647-
resource.ApplicationBuilder.Eventing.Subscribe<BeforeStartEvent>((evt, _) =>
648-
{
649-
if (resource.Resource.TryGetLastAnnotation<PerlbrewEnvironmentAnnotation>(out var annotation) &&
650-
annotation.Environment is { } env)
651-
{
652-
var logger = evt.Services.GetRequiredService<ResourceLoggerService>().GetLogger(resource.Resource);
653-
logger.LogInformation("Perlbrew environment: version={Version}, root={PerlbrewRoot}, perl={PerlPath}",
654-
env.Version, env.PerlbrewRoot, env.GetExecutable("perl"));
655-
}
656-
657-
return Task.CompletedTask;
658-
});
659-
}
660-
661612
resource.WithEnvironment(context =>
662613
{
663614
if (resource.Resource.TryGetLastAnnotation<PerlbrewEnvironmentAnnotation>(out var perlbrewAnnotation) &&
@@ -684,24 +635,6 @@ private static void EnsureLocalLibEnvironmentCallback<TResource>(
684635

685636
resource.Resource.Annotations.Add(new PerlLocalLibResourceEnvironmentAnnotation());
686637

687-
if (resource.ApplicationBuilder.ExecutionContext.IsRunMode)
688-
{
689-
resource.ApplicationBuilder.Eventing.Subscribe<BeforeStartEvent>((evt, _) =>
690-
{
691-
if (resource.Resource.TryGetLastAnnotation<PerlLocalLibAnnotation>(out var annotation))
692-
{
693-
var resolvedPath = ResolveLocalLibPath(resource.Resource.WorkingDirectory, annotation.Path);
694-
var logger = evt.Services.GetRequiredService<ResourceLoggerService>().GetLogger(resource.Resource);
695-
logger.LogInformation("local::lib configured: path='{ConfiguredPath}' resolved to '{ResolvedPath}'",
696-
annotation.Path, resolvedPath);
697-
logger.LogDebug("local::lib environment: PERL5LIB={Perl5Lib}, PERL_LOCAL_LIB_ROOT={LocalLibRoot}",
698-
Path.Combine(resolvedPath, "lib", "perl5"), resolvedPath);
699-
}
700-
701-
return Task.CompletedTask;
702-
});
703-
}
704-
705638
resource.WithEnvironment(context =>
706639
{
707640
if (resource.Resource.TryGetLastAnnotation<PerlLocalLibAnnotation>(out var localLibAnnotation))

tests/CommunityToolkit.Aspire.Hosting.Perl.Tests/AddPerlAppCoreLoggingTests.cs

Lines changed: 0 additions & 46 deletions
This file was deleted.

tests/CommunityToolkit.Aspire.Hosting.Perl.Tests/CertificateTrustLoggingTests.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

tests/CommunityToolkit.Aspire.Hosting.Perl.Tests/LocalLibLoggingTests.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)