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
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Analyzer.Cli/bin/Debug/net6.0/TemplateAnalyzer.dll",
"program": "${workspaceFolder}/src/Analyzer.Cli/bin/Debug/net8.0/TemplateAnalyzer.dll",

// Runs the analyzer CLI, analyzing the file currently active/being viewed in VS Code.
// Alternatively, change ${file} to the path of a template to analyze that file.
Expand All @@ -17,7 +17,7 @@
"${file}"
//"-p", "path-to-parameters"
],
"cwd": "${workspaceFolder}/src/Analyzer.Cli/bin/Debug/net6.0/",
"cwd": "${workspaceFolder}/src/Analyzer.Cli/bin/Debug/net8.0/",
"console": "internalConsole",
"stopAtEntry": false
},
Expand All @@ -26,7 +26,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Analyzer.Cli/bin/Debug/net6.0/TemplateAnalyzer.dll",
"program": "${workspaceFolder}/src/Analyzer.Cli/bin/Debug/net8.0/TemplateAnalyzer.dll",

// Runs the analyzer CLI, analyzing the directory of the file currently active/being
// viewed in VS Code. Alternatively, change ${fileDirname} to the path of a directory to
Expand All @@ -35,7 +35,7 @@
"analyze-directory",
"${fileDirname}",
],
"cwd": "${workspaceFolder}/src/Analyzer.Cli/bin/Debug/net6.0/",
"cwd": "${workspaceFolder}/src/Analyzer.Cli/bin/Debug/net8.0/",
"console": "internalConsole",
"stopAtEntry": false
},
Expand Down
18 changes: 13 additions & 5 deletions src/Analyzer.BicepProcessor/BicepTemplateProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.IO.Abstractions;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using Bicep.Core;
using Bicep.Core.Analyzers.Interfaces;
Expand All @@ -19,13 +20,14 @@
using Bicep.Core.Navigation;
using Bicep.Core.Registry;
using Bicep.Core.Registry.Auth;
using Bicep.Core.Registry.PublicRegistry;
using Bicep.Core.Registry.Catalog;
using Bicep.Core.Registry.Catalog.Implementation.PublicRegistries;
using Bicep.Core.Semantics.Namespaces;
using Bicep.Core.SourceGraph;
using Bicep.Core.Syntax;
using Bicep.Core.Text;
using Bicep.Core.TypeSystem.Providers;
using Bicep.Core.Utils;
using Bicep.Core.Workspaces;
using Bicep.IO.Abstraction;
using Bicep.IO.FileSystem;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -46,18 +48,22 @@ public static class BicepTemplateProcessor
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddBicepCore(this IServiceCollection services) => services
.AddSingleton<HttpClient>()
.AddSingleton<INamespaceProvider, NamespaceProvider>()
.AddSingleton<IResourceTypeProviderFactory, ResourceTypeProviderFactory>()
.AddSingleton<IContainerRegistryClientFactory, ContainerRegistryClientFactory>()
.AddSingleton<IPublicRegistryModuleMetadataProvider, PublicRegistryModuleMetadataProvider>()
.AddSingleton<IPublicModuleMetadataProvider, PublicModuleMetadataProvider>()
.AddSingleton<IPublicModuleIndexHttpClient, PublicModuleMetadataHttpClient>()
.AddSingleton<ITemplateSpecRepositoryFactory, TemplateSpecRepositoryFactory>()
.AddSingleton<IModuleDispatcher, ModuleDispatcher>()
.AddSingleton<IArtifactRegistryProvider, DefaultArtifactRegistryProvider>()
.AddSingleton<ITokenCredentialFactory, TokenCredentialFactory>()
.AddSingleton<IFileResolver, FileResolver>()
.AddSingleton<IFileExplorer, FileSystemFileExplorer>()
.AddSingleton<IAuxiliaryFileCache, AuxiliaryFileCache>()
.AddSingleton<IEnvironment, BicepEnvironment>()
.AddSingleton<IFileSystem, IOFileSystem>()
.AddSingleton<ISourceFileFactory, SourceFileFactory>()
.AddSingleton<IConfigurationManager, ConfigurationManager>()
.AddSingleton<IBicepAnalyzer, LinterAnalyzer>()
.AddSingleton<IFeatureProviderFactory, FeatureProviderFactory>()
Expand All @@ -74,6 +80,7 @@ public static IServiceCollection AddBicepCore(this IServiceCollection services)
/// </summary>
/// <param name="bicepPath">The Bicep template file path.</param>
/// <returns>The compiled template as a <c>JSON</c> string and its source map.</returns>
#pragma warning disable VSTHRD002 // Avoid problematic synchronous waits
public static (string, BicepMetadata) ConvertBicepToJson(string bicepPath)
{
if (BicepCompiler == null)
Expand Down Expand Up @@ -113,7 +120,7 @@ moduleDeclaration.Path is StringSyntax moduleDeclarationPath &&
// Group by the source file path to allow for easy construction of SourceFileModuleInfo.
var moduleInfo = compilation.SourceFileGrouping.ArtifactLookup
.Where(IsResolvedLocalModuleReference)
.GroupBy(artifact => artifact.Value.Origin)
.GroupBy(artifact => artifact.Value.ReferencingFile)
.Select(grouping =>
{
var bicepSourceFile = grouping.Key;
Expand All @@ -127,7 +134,7 @@ moduleDeclaration.Path is StringSyntax moduleDeclarationPath &&
{
var module = artifactRefAndUriResult.Key as ModuleDeclarationSyntax;
var moduleLine = TextCoordinateConverter.GetPosition(bicepSourceFile.LineStarts, module.Span.Position).line;
var modulePath = new FileInfo(artifactRefAndUriResult.Value.Result.Unwrap().AbsolutePath).FullName; // converts path to current platform
var modulePath = new FileInfo(artifactRefAndUriResult.Value.Result.Unwrap().Uri).FullName; // converts path to current platform

// Use relative paths for bicep to match file paths used in bicep modules and source map
if (modulePath.EndsWith(".bicep"))
Expand All @@ -150,5 +157,6 @@ moduleDeclaration.Path is StringSyntax moduleDeclarationPath &&

return (stringWriter.ToString(), bicepMetadata);
}
#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits
}
}
22 changes: 11 additions & 11 deletions src/Analyzer.BicepProcessor/SourceMapFeatureProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ public SourceMapFeatureProvider(IFeatureProvider features)
/// <inheritdoc/>
public bool SymbolicNameCodegenEnabled => features.SymbolicNameCodegenEnabled;

/// <inheritdoc/>
public bool ExtensibilityEnabled => features.ExtensibilityEnabled;

/// <inheritdoc/>
public bool ResourceTypedParamsAndOutputsEnabled => features.ResourceTypedParamsAndOutputsEnabled;

Expand All @@ -61,27 +58,30 @@ public SourceMapFeatureProvider(IFeatureProvider features)
public bool AssertsEnabled => features.AssertsEnabled;

/// <inheritdoc/>
public bool OptionalModuleNamesEnabled => features.OptionalModuleNamesEnabled;
public bool LegacyFormatterEnabled => features.LegacyFormatterEnabled;

/// <inheritdoc/>
public bool ResourceDerivedTypesEnabled => features.ResourceDerivedTypesEnabled;
public bool LocalDeployEnabled => features.LocalDeployEnabled;

/// <inheritdoc/>
public bool LegacyFormatterEnabled => features.LegacyFormatterEnabled;
public bool ExtendableParamFilesEnabled => features.ExtendableParamFilesEnabled;

/// <inheritdoc/>
public bool LocalDeployEnabled => features.LocalDeployEnabled;
public bool ResourceInfoCodegenEnabled => features.ResourceInfoCodegenEnabled;

/// <inheritdoc/>
public bool ExtendableParamFilesEnabled => features.ExtendableParamFilesEnabled;
public bool WaitAndRetryEnabled => features.WaitAndRetryEnabled;

/// <inheritdoc/>
public bool SecureOutputsEnabled => features.SecureOutputsEnabled;
public bool OnlyIfNotExistsEnabled => features.OnlyIfNotExistsEnabled;

/// <inheritdoc/>
public bool ResourceInfoCodegenEnabled => features.ResourceInfoCodegenEnabled;
public bool ModuleExtensionConfigsEnabled => features.ModuleExtensionConfigsEnabled;

/// <inheritdoc/>
public bool DesiredStateConfigurationEnabled => features.DesiredStateConfigurationEnabled;

/// <inheritdoc/>
public bool ExtensibilityV2EmittingEnabled => features.ExtensibilityV2EmittingEnabled;
public bool ModuleIdentityEnabled => features.ModuleIdentityEnabled;
}
}
12 changes: 6 additions & 6 deletions src/Analyzer.Core.NuGet/Analyzer.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

<dependencies>
<group targetFramework="net8.0">
<dependency id="Azure.Bicep.Core" version="0.25.53" />
<dependency id="Azure.Deployments.Core" version="1.0.1158" />
<dependency id="Azure.Deployments.Expression" version="1.0.1158" />
<dependency id="Azure.Deployments.Templates" version="1.0.1158" />
<dependency id="Azure.Bicep.Core" version="0.37.4" />
<dependency id="Azure.Deployments.Core" version="1.454.0" />
<dependency id="Azure.Deployments.Expression" version="1.454.0" />
<dependency id="Azure.Deployments.Templates" version="1.454.0" />
<dependency id="Newtonsoft.Json" version="13.0.3" />
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="6.0.1" />
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="9.0.3" />
<dependency id="Microsoft.PowerShell.SDK" version="7.4.1" />
<dependency id="Microsoft.PSRule.Rules.Azure" version="1.33.2" />
<dependency id="Microsoft.PSRule.SDK" version="2.9.0" />
<dependency id="Sarif.Sdk" version="2.4.16" />
<dependency id="System.IO.Abstractions" version="20.0.4" />
<dependency id="System.IO.Abstractions" version="21.3.1" />
</group>
</dependencies>

Expand Down
Loading
Loading