Skip to content

Commit

Permalink
Add preprocessor directives
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthurvdv committed Feb 7, 2024
1 parent f55b06a commit ccc6658
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
Remove-Item -Path "ms-dynamics-smb.al-latest" -Force -Recurse -Verbose;
7z x "ALLanguage_next.vsix" "-oms-dynamics-smb.al-latest" extension\bin\Analyzers -r;
- name: Build next
run: dotnet build --no-restore --configuration Release
run: dotnet build /p:DefineConstants=PreRelease --no-restore --configuration Release

- name: Upload a Build next
uses: actions/[email protected]
Expand Down
13 changes: 10 additions & 3 deletions Design/Rule0033AppManifestRuntimeBehind.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
//using Microsoft.Dynamics.Nav.Analyzers.Common.AppSourceCopConfiguration; // AL Language v12
using Microsoft.Dynamics.Nav.Analyzers.Common; // AL Language v13
using Microsoft.Dynamics.Nav.CodeAnalysis;
using Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics;
using Microsoft.Dynamics.Nav.CodeAnalysis.Packaging;
#if PreRelease
using Microsoft.Dynamics.Nav.Analyzers.Common; // AL Language v13
#else
using Microsoft.Dynamics.Nav.Analyzers.Common.AppSourceCopConfiguration; // AL Language v12
#endif
using System.Collections.Immutable;

namespace BusinessCentral.LinterCop.Design
Expand All @@ -16,8 +19,12 @@ class Rule0033AppManifestRuntimeBehind : DiagnosticAnalyzer

private void CheckAppManifestRuntime(CompilationAnalysisContext ctx)
{
//NavAppManifest manifest = AppSourceCopConfigurationProvider.GetManifest(ctx.Compilation); // AL Language v12
#if PreRelease
NavAppManifest manifest = ManifestHelper.GetManifest(ctx.Compilation); // AL Language v13
#else
NavAppManifest manifest = AppSourceCopConfigurationProvider.GetManifest(ctx.Compilation); // AL Language v12
#endif

if (manifest == null) return;
if (manifest.Runtime == null) return;
if (manifest.Application == null && manifest.Platform == null) return;
Expand Down
14 changes: 11 additions & 3 deletions Design/Rule0052and0053InternalProceduresNotReferenced.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
using Microsoft.Dynamics.Nav.CodeAnalysis.Symbols;
using Microsoft.Dynamics.Nav.CodeAnalysis.Syntax;
using Microsoft.Dynamics.Nav.CodeAnalysis.Packaging;
//using Microsoft.Dynamics.Nav.Analyzers.Common.AppSourceCopConfiguration; // AL Language v12
using Microsoft.Dynamics.Nav.Analyzers.Common; // AL Language v13
#if PreRelease
using Microsoft.Dynamics.Nav.Analyzers.Common; // AL Language v13
#else
using Microsoft.Dynamics.Nav.Analyzers.Common.AppSourceCopConfiguration; // AL Language v12
#endif

using System.Collections.Immutable;

namespace BusinessCentral.LinterCop.Design
Expand All @@ -27,8 +31,12 @@ private class MethodSymbolAnalyzer : IDisposable

public MethodSymbolAnalyzer(CompilationAnalysisContext compilationAnalysisContext)
{
//NavAppManifest manifest = AppSourceCopConfigurationProvider.GetManifest(compilationAnalysisContext.Compilation); // AL Language v12
#if PreRelease
NavAppManifest manifest = ManifestHelper.GetManifest(compilationAnalysisContext.Compilation); // AL Language v13
#else
NavAppManifest manifest = AppSourceCopConfigurationProvider.GetManifest(compilationAnalysisContext.Compilation); // AL Language v12
#endif

if (manifest.InternalsVisibleTo != null && manifest.InternalsVisibleTo.Any())
{
return;
Expand Down

0 comments on commit ccc6658

Please sign in to comment.