diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index 744cdd0348..fc7379cc6c 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -10,11 +10,6 @@ "useProjectDependencies": true, "repoVersion": "26.0", "cleanModePreprocessorSymbols": [ - "CLEAN17", - "CLEAN18", - "CLEAN19", - "CLEAN20", - "CLEAN21", "CLEAN22", "CLEAN23", "CLEAN24", diff --git a/.github/actions/TestPreprocessorSymbols/action.ps1 b/.github/actions/TestPreprocessorSymbols/action.ps1 index 97f45fbddf..e82b9a0487 100644 --- a/.github/actions/TestPreprocessorSymbols/action.ps1 +++ b/.github/actions/TestPreprocessorSymbols/action.ps1 @@ -19,7 +19,7 @@ if ($CurrentVersion -le 26) { # Define the preprocessor symbols to check for $symbolConfigs = @( - @{stem = "CLEAN"; lowerBound = ($CurrentVersion - 4); upperBound = $mainVersion}, + @{stem = "CLEAN"; lowerBound = (Get-MinAllowedCleanTagVersion); upperBound = $mainVersion}, @{stem = "CLEANSCHEMA"; lowerBound = $schemaLowerBound; upperBound = $mainVersion + 3} # next lowerbound, after cleanup should be 25, then ) diff --git a/build/scripts/GuardingV2ExtensionsHelper.psm1 b/build/scripts/GuardingV2ExtensionsHelper.psm1 index 0810b9149f..36dd8f142b 100644 --- a/build/scripts/GuardingV2ExtensionsHelper.psm1 +++ b/build/scripts/GuardingV2ExtensionsHelper.psm1 @@ -268,4 +268,18 @@ function Get-MaxAllowedObsoleteVersion() { return [System.Version]::Parse($alGoSettings.repoVersion).Major } +function Get-MinAllowedCleanTagVersion() { + Import-Module -Name $PSScriptRoot\EnlistmentHelperFunctions.psm1 + [int] $currentVersion = (Get-ConfigValue -Key "repoVersion" -ConfigType AL-Go) -split '\.' | Select-Object -First 1 + $lowerBound = $CurrentVersion - 4 + return $lowerBound +} + +function Get-PreprocessorSymbols() { + [int] $upperBound = Get-MaxAllowedObsoleteVersion + [int] $lowerBound = Get-MinAllowedCleantagVersion + + return $lowerBound..$upperBound | ForEach-Object { "CLEAN$_" } +} + Export-ModuleMember -Function *-* diff --git a/build/scripts/PreCompileApp.ps1 b/build/scripts/PreCompileApp.ps1 index 886a80cd3b..b131e9e6ce 100644 --- a/build/scripts/PreCompileApp.ps1 +++ b/build/scripts/PreCompileApp.ps1 @@ -53,6 +53,8 @@ if($appType -eq 'app') else { Compile-AppInBcContainer @tempParameters | Out-Null } + + $parameters.Value["preprocessorsymbols"] = Get-PreprocessorSymbols } if(($appBuildMode -eq 'Strict') -and !(Test-IsStrictModeEnabled)) {