Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
b558f33
-OutFolder
aholstrup1 Dec 3, 2025
af04486
-Ruleset
aholstrup1 Dec 3, 2025
736a83c
testAppFiles
aholstrup1 Dec 3, 2025
1014671
testAppFiles
aholstrup1 Dec 3, 2025
a6a38ca
fixes
aholstrup1 Dec 4, 2025
10e0911
Out-Null
aholstrup1 Dec 4, 2025
f2a3a24
Delete file if already exist
aholstrup1 Dec 4, 2025
17cebfb
-OutputFolder
aholstrup1 Dec 4, 2025
c45193f
--logdirectory
aholstrup1 Dec 8, 2025
fc2a3b3
resolve ruleset path
aholstrup1 Dec 8, 2025
621a786
compilerolder
aholstrup1 Dec 8, 2025
93447e2
updates
aholstrup1 Dec 9, 2025
2f6f35c
encoding
aholstrup1 Dec 9, 2025
15f1799
maxcpucount
aholstrup1 Dec 12, 2025
87c3c3c
precompile implementation
aholstrup1 Dec 12, 2025
1f62b13
PreCompileApp
aholstrup1 Dec 12, 2025
351ab66
lower MaxCpuCount
aholstrup1 Dec 12, 2025
1c7bf07
no parallel tasks
aholstrup1 Dec 12, 2025
d9470f0
test
aholstrup1 Dec 17, 2025
9e5d346
build versioning
aholstrup1 Dec 17, 2025
19b518c
ifs
aholstrup1 Dec 17, 2025
2e381e6
analyzers
aholstrup1 Dec 18, 2025
17378b0
download al tool
aholstrup1 Dec 19, 2025
11f2f59
logging
aholstrup1 Dec 19, 2025
32d1b24
logging
aholstrup1 Dec 19, 2025
604ed91
test
aholstrup1 Dec 19, 2025
bfb98a1
cops
aholstrup1 Dec 19, 2025
230ec92
Use from nuget
aholstrup1 Dec 19, 2025
83bf66f
fix
aholstrup1 Dec 19, 2025
fdee523
temp fix
aholstrup1 Dec 19, 2025
015c3a0
analyzer support
aholstrup1 Dec 19, 2025
7355cbe
Revert "analyzer support"
aholstrup1 Dec 19, 2025
cbd7346
Merge branch 'main' of https://github.com/microsoft/al-go into aholst…
aholstrup1 Dec 19, 2025
70c44a6
test compile action
aholstrup1 Dec 19, 2025
cd2f5c0
change default
aholstrup1 Dec 19, 2025
f55469f
fix
aholstrup1 Dec 19, 2025
9a46426
fix import
aholstrup1 Dec 19, 2025
0e206f1
fix
aholstrup1 Dec 19, 2025
61495e2
Change default log level
aholstrup1 Jan 12, 2026
1620859
change output folder
aholstrup1 Jan 13, 2026
c22da81
Produce build output file
aholstrup1 Jan 13, 2026
fa4cf85
Validate MaxCpuCount
aholstrup1 Jan 14, 2026
8b0f736
include build output always
aholstrup1 Jan 14, 2026
deafa5e
get altool from compilerfolder
aholstrup1 Jan 19, 2026
84417d6
Do not call compile when there's nothing to compile
aholstrup1 Jan 19, 2026
168f3e5
Add some more missing pieces
aholstrup1 Jan 21, 2026
bd27c5d
implement version numbering
aholstrup1 Jan 23, 2026
ce9aa9f
lowercase
aholstrup1 Jan 26, 2026
e1835bd
Fix
aholstrup1 Jan 26, 2026
54b31c6
log app version
aholstrup1 Jan 26, 2026
8dee891
build version fix
aholstrup1 Jan 26, 2026
bd48bdd
bug fixes
aholstrup1 Jan 26, 2026
bffbfa4
test apps
aholstrup1 Jan 26, 2026
5fb04a6
Refactor build number logic
aholstrup1 Jan 26, 2026
3d458db
less logging
aholstrup1 Jan 26, 2026
a53bd5c
test incremental builds
aholstrup1 Jan 26, 2026
0a9841b
projectFolder
aholstrup1 Jan 26, 2026
614323b
incremental builds
aholstrup1 Jan 26, 2026
cebb507
parameters
aholstrup1 Jan 26, 2026
8585159
comments
aholstrup1 Jan 26, 2026
f5eec78
debugging
aholstrup1 Jan 26, 2026
be6e007
comments
aholstrup1 Jan 26, 2026
d2d2d2e
Skip runpipeline if nothing to do
aholstrup1 Jan 26, 2026
b41114c
test
aholstrup1 Jan 26, 2026
97ee586
Merge branch 'main' of https://github.com/microsoft/al-go into aholst…
aholstrup1 Jan 27, 2026
2926dd7
Refactor
aholstrup1 Jan 27, 2026
e596519
fix
aholstrup1 Jan 27, 2026
07cef32
Get-Command
aholstrup1 Jan 27, 2026
2851c3e
default to max parallelism
aholstrup1 Jan 27, 2026
7067b2f
Move code
aholstrup1 Jan 27, 2026
1556896
-AppType
aholstrup1 Jan 27, 2026
70c9445
Cleanup
aholstrup1 Jan 27, 2026
2f461dd
Update precompile call
aholstrup1 Jan 27, 2026
b9629ab
Let negative mean max
aholstrup1 Jan 27, 2026
4727254
init appFiles and testAppFiles
aholstrup1 Jan 27, 2026
588a7fc
Merge branch 'main' of https://github.com/microsoft/al-go into aholst…
aholstrup1 Jan 28, 2026
57c6a27
Get-BasePath
aholstrup1 Jan 28, 2026
f565e2e
DownloadExternalProjectDependencies
aholstrup1 Jan 28, 2026
ca18c9f
Cleanup
aholstrup1 Jan 28, 2026
b3c5b89
Refactor
aholstrup1 Jan 28, 2026
cf19a39
Logging
aholstrup1 Jan 28, 2026
23ff383
Initial implementation
aholstrup1 Jan 28, 2026
abd86aa
Add PS5 compatibility
aholstrup1 Jan 28, 2026
a0b3ecd
Remove duplicate check
aholstrup1 Jan 28, 2026
2a2e1cf
Remove logic from Runpipeline
aholstrup1 Jan 28, 2026
323d90a
releasenotes
aholstrup1 Jan 28, 2026
e992e7f
Check secret exists
aholstrup1 Jan 28, 2026
37a1b20
handle empty sanitizedFileName
aholstrup1 Jan 28, 2026
840a612
Handle duplicate files
aholstrup1 Jan 28, 2026
3bbd0d1
Error message
aholstrup1 Jan 28, 2026
b0d5fa4
releasenotes
aholstrup1 Jan 28, 2026
15554dc
Use Invoke-CommandWithRetry
aholstrup1 Jan 28, 2026
b65ba77
Merge branch 'aholstrup/installApps_download' of https://github.com/a…
aholstrup1 Jan 28, 2026
6dfc3bd
Documentation
aholstrup1 Jan 29, 2026
26ffcb4
PerTenantExtensionCop
aholstrup1 Jan 29, 2026
e005e8b
PTECop
aholstrup1 Jan 29, 2026
b869b49
Get-BuildMetadata
aholstrup1 Jan 29, 2026
ec5d85e
More refactor
aholstrup1 Jan 29, 2026
543b760
AssemblyProbingPaths
aholstrup1 Jan 30, 2026
5b1ae66
Set MaximumDotNetVersion
aholstrup1 Jan 30, 2026
7de91df
Logging improvements
aholstrup1 Jan 30, 2026
f2eac74
logging for AssemblyProbingPaths
aholstrup1 Jan 30, 2026
c7ffc12
add to test app files
aholstrup1 Jan 30, 2026
3df5c8a
ReportSuppressedDiagnostics
aholstrup1 Jan 30, 2026
cf519c3
warnings
aholstrup1 Jan 30, 2026
3fd07eb
More refactor
aholstrup1 Jan 30, 2026
332efbd
More refactor
aholstrup1 Jan 30, 2026
9997895
Move Update-AppJsonProperties
aholstrup1 Jan 30, 2026
ad9e91e
Remove cleanup
aholstrup1 Jan 30, 2026
d5b933f
Move Get-AssemblyProbingPaths
aholstrup1 Jan 30, 2026
1ad77d7
Export Update-AppJsonProperties
aholstrup1 Jan 30, 2026
e69be86
Remove GenerateCrossReferences
aholstrup1 Feb 2, 2026
0768bcc
ErrorLogPath
aholstrup1 Feb 2, 2026
66b506c
--generatereportlayout
aholstrup1 Feb 2, 2026
fe50ef3
Fix one todo
aholstrup1 Feb 2, 2026
ab35ab3
Update comment
aholstrup1 Feb 2, 2026
5f4a3e5
useWorkspaceCompilation handling in run-alpipeline
aholstrup1 Feb 2, 2026
befd271
Suggestions
aholstrup1 Feb 2, 2026
2c7a5bc
Unit tests
aholstrup1 Feb 2, 2026
b7be092
More tests
aholstrup1 Feb 2, 2026
4e7f054
E2E test
aholstrup1 Feb 2, 2026
5d77646
Cleanup al-go-helper
aholstrup1 Feb 2, 2026
81b4ec4
More cleanup
aholstrup1 Feb 2, 2026
576130c
Skip incremental build download for useWorkspaceCompilation
aholstrup1 Feb 2, 2026
9dfe417
Fix for version numbering
aholstrup1 Feb 2, 2026
95c9a2e
debugging
aholstrup1 Feb 2, 2026
77f7399
Update logdirectory
aholstrup1 Feb 2, 2026
42dbe18
Add LogDirectory
aholstrup1 Feb 2, 2026
85b966d
Update
aholstrup1 Feb 3, 2026
f67b239
Fix?
aholstrup1 Feb 3, 2026
1a18d7e
test
aholstrup1 Feb 3, 2026
930d288
Refactor
aholstrup1 Feb 3, 2026
86efa2f
Handle bcptTestFolders later
aholstrup1 Feb 3, 2026
78dba78
Handle BCPT later
aholstrup1 Feb 3, 2026
4c22df7
telemetry
aholstrup1 Feb 3, 2026
b311749
Fix trace
aholstrup1 Feb 3, 2026
319d38b
Docs and cleanup
aholstrup1 Feb 3, 2026
8257dee
More cleanup
aholstrup1 Feb 3, 2026
c74fa44
Fix for how install apps is set
aholstrup1 Feb 3, 2026
1c2a9d3
Handling for .zip files
aholstrup1 Feb 3, 2026
7c2cc34
Add tests
aholstrup1 Feb 4, 2026
afab810
Merge branch 'main' of https://github.com/microsoft/al-go into aholst…
aholstrup1 Feb 4, 2026
0b446c0
Cleanup
aholstrup1 Feb 4, 2026
50b19d5
Import Github-Helper.psm1
aholstrup1 Feb 4, 2026
cc992ad
Add handling of local paths
aholstrup1 Feb 4, 2026
cc03d43
Make sure all app files are always copied to dependencies folder
aholstrup1 Feb 4, 2026
0ba2ae6
Update test
aholstrup1 Feb 4, 2026
25d5c24
Fix compatibility issue
aholstrup1 Feb 4, 2026
8995cc8
Fix test
aholstrup1 Feb 4, 2026
488057f
debugging
aholstrup1 Feb 4, 2026
7d393ce
Check if folder exists
aholstrup1 Feb 4, 2026
8f660fe
Better logging
aholstrup1 Feb 4, 2026
8c6e34e
Fix trailing whitespace and missing blank line
aholstrup1 Feb 4, 2026
4b9cf82
remove out folder
aholstrup1 Feb 4, 2026
697edbb
Change directory
aholstrup1 Feb 4, 2026
ff159c2
Suggestions batch 1
aholstrup1 Feb 4, 2026
324518c
suggestions batch 2
aholstrup1 Feb 4, 2026
0703fd4
Handling for missing secret
aholstrup1 Feb 9, 2026
f98b798
Merge branch 'main' of https://github.com/microsoft/al-go into aholst…
aholstrup1 Feb 9, 2026
4cf6c3d
Merge branch 'main' of https://github.com/microsoft/al-go into aholst…
aholstrup1 Feb 9, 2026
bbfbe81
Merge branch 'aholstrup/installApps_download' of https://github.com/a…
aholstrup1 Feb 9, 2026
a3fdec4
Handle ruleset
aholstrup1 Feb 10, 2026
498fa33
Remove skipupgrade
aholstrup1 Feb 10, 2026
41a5e6d
Use cache folder
aholstrup1 Feb 10, 2026
4018bd1
Docs
aholstrup1 Feb 16, 2026
ad2c91d
Merge branch 'main' of https://github.com/microsoft/AL-Go into aholst…
aholstrup1 Feb 16, 2026
51465ad
Add step to workflow
aholstrup1 Feb 16, 2026
6fc8a41
change verbosity settings
aholstrup1 Feb 18, 2026
b6c7e1d
Verbose
aholstrup1 Feb 18, 2026
1e1c078
LogLevel
aholstrup1 Feb 18, 2026
512a54b
update action
aholstrup1 Feb 18, 2026
3d35410
loglevel
aholstrup1 Feb 19, 2026
a479f14
Merge branch 'main' of https://github.com/microsoft/AL-Go into aholst…
aholstrup1 Mar 6, 2026
f00e1b7
Update reusable workflow
aholstrup1 Mar 6, 2026
4410f1a
Use nextmajor artifact
aholstrup1 Mar 6, 2026
f59f50b
Fixes
aholstrup1 Mar 9, 2026
265004c
update e2e test
aholstrup1 Mar 9, 2026
bf65282
SMH
aholstrup1 Mar 9, 2026
faa9044
update to get-altool
aholstrup1 Mar 9, 2026
ba71dad
Skip workspace compilation on linux
aholstrup1 Mar 9, 2026
fb4ae5f
Fixes
aholstrup1 Mar 9, 2026
eb8cfc5
pre-commit
aholstrup1 Mar 9, 2026
28fc683
releasenotes
aholstrup1 Mar 9, 2026
b44a376
fix releasenotes
aholstrup1 Mar 9, 2026
c5b17b0
CustomAnalyzers
aholstrup1 Mar 9, 2026
6d7fed2
Suggestions
aholstrup1 Mar 9, 2026
53ade94
Updates to Get-CustomAnalyzers
aholstrup1 Mar 10, 2026
706c62d
messages
aholstrup1 Mar 10, 2026
b65542e
Refactor Get-ScriptOverrides so we can reuse it
aholstrup1 Mar 10, 2026
b2b99a2
Minor review changes
aholstrup1 Mar 10, 2026
b95985e
Fix for Get-ScriptOverrides
aholstrup1 Mar 10, 2026
28af88b
move workspace files to temp folder
aholstrup1 Mar 11, 2026
547c1eb
Findings
aholstrup1 Mar 11, 2026
316c897
test coverage
aholstrup1 Mar 11, 2026
d09796a
Merge branch 'main' of https://github.com/microsoft/AL-Go into aholst…
aholstrup1 Mar 11, 2026
8d95f3d
Copy installapps to the packagecache folder
aholstrup1 Mar 11, 2026
731e688
Update e2eTests/scenarios/WorkspaceCompilation/runtest.ps1
aholstrup1 Mar 11, 2026
140efd1
Update Actions/Compile/Compile.ps1
aholstrup1 Mar 11, 2026
cf11682
Update Actions/Compile/README.md
aholstrup1 Mar 11, 2026
fc50752
Update RELEASENOTES.md
aholstrup1 Mar 11, 2026
70d06c0
Update e2eTests/scenarios/WorkspaceCompilation/runtest.ps1
aholstrup1 Mar 11, 2026
cd9fa13
settings.md
aholstrup1 Mar 11, 2026
104fb60
Update note
aholstrup1 Mar 11, 2026
6e1acc5
suggestion
aholstrup1 Mar 11, 2026
1b44672
Update Get-ScriptOverrides
aholstrup1 Mar 11, 2026
a3edd5e
update tests
aholstrup1 Mar 11, 2026
9b74268
update e2e
aholstrup1 Mar 11, 2026
7bbce7c
AL-Go-Helper.ps1
aholstrup1 Mar 11, 2026
761ea57
temp folder
aholstrup1 Mar 11, 2026
d25dee7
move workspacefile back to project folder
aholstrup1 Mar 11, 2026
8fa4f95
Get-Location
aholstrup1 Mar 11, 2026
0ee8cd5
always return generated files
aholstrup1 Mar 12, 2026
b59a8e6
features document
aholstrup1 Mar 13, 2026
bcdd215
Rename action inputs
aholstrup1 Mar 13, 2026
5bd3186
cleanup
aholstrup1 Mar 13, 2026
4acd95f
readme
aholstrup1 Mar 13, 2026
1a6404c
env variables
aholstrup1 Mar 13, 2026
022e7c0
proper docs
aholstrup1 Mar 13, 2026
54a204e
RunAndCheck
aholstrup1 Mar 13, 2026
3fae296
Update settings structure
aholstrup1 Mar 13, 2026
ff58312
outnull
aholstrup1 Mar 13, 2026
a265be7
clarify todos
aholstrup1 Mar 13, 2026
1f52668
variable nam
aholstrup1 Mar 13, 2026
5862e27
rename
aholstrup1 Mar 13, 2026
c945e03
change parsing
aholstrup1 Mar 13, 2026
80f919e
update e2e
aholstrup1 Mar 13, 2026
3a535d1
cleanup workspace file
aholstrup1 Mar 13, 2026
cbceeae
only copy files to output on success
aholstrup1 Mar 13, 2026
77aa736
add secrets back
aholstrup1 Mar 13, 2026
b1d80ac
comment
aholstrup1 Mar 13, 2026
7ccb294
dotnetRoot
aholstrup1 Mar 13, 2026
d79fa41
Handle 0 in parallelism
aholstrup1 Mar 13, 2026
3c8d853
Smaller fixes
aholstrup1 Mar 13, 2026
dc26f26
test coverage
aholstrup1 Mar 13, 2026
5de9918
alwyas pop location
aholstrup1 Mar 16, 2026
c346e4d
OutputWarning
aholstrup1 Mar 16, 2026
ddd162e
Parameter
aholstrup1 Mar 16, 2026
62a347d
inconsistent style
aholstrup1 Mar 16, 2026
f380a96
casing
aholstrup1 Mar 16, 2026
0be0105
groups in New-BuildOutputFile
aholstrup1 Mar 16, 2026
8281826
Update implementation for build by and url
aholstrup1 Mar 16, 2026
e307ea3
Suggestions - Part 1
aholstrup1 Mar 17, 2026
3725814
Rename action folder
aholstrup1 Mar 17, 2026
4034e72
More naming changes
aholstrup1 Mar 17, 2026
bf9de54
Merge branch 'main' of https://github.com/microsoft/AL-Go into aholst…
aholstrup1 Mar 17, 2026
9594f16
update settings with the current limitations
aholstrup1 Mar 17, 2026
0091b95
Merge branch 'main' into aholstrup/workspace_compilationm
aholstrup1 Mar 18, 2026
6b6ebd2
update defaultapplication and runtime
aholstrup1 Mar 20, 2026
8946923
Merge branch 'main' into aholstrup/workspace_compilationm
aholstrup1 Mar 23, 2026
f815f43
Merge branch 'main' into aholstrup/workspace_compilationm
aholstrup1 Mar 23, 2026
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
855 changes: 855 additions & 0 deletions Actions/.Modules/CompileFromWorkspace.psm1

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Actions/.Modules/ReadSettings.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ function GetDefaultSettings
"enableUICop" = $false
"enableCodeAnalyzersOnTestApps" = $false
"customCodeCops" = @()
"preprocessorSymbols" = @()
"features" = @()
"trackALAlertsInGitHub" = $false
"failOn" = "error"
"treatTestFailuresAsWarnings" = $false
Expand Down Expand Up @@ -211,6 +213,10 @@ function GetDefaultSettings
"environments" = @()
"buildModes" = @()
"useCompilerFolder" = $false
"workspaceCompilation" = [ordered]@{
"enabled" = $false
"parallelism" = 1
}
"pullRequestTrigger" = "pull_request"
"bcptThresholds" = [ordered]@{
"DurationWarning" = 10
Expand Down Expand Up @@ -564,6 +570,11 @@ function ReadSettings {
$settings.projectName = $project # Default to project path as project name
}

# Interpret zero or negative parallelism as the max number of processors
if ($settings.workspaceCompilation.parallelism -le 0) {
$settings.workspaceCompilation.parallelism = [System.Environment]::ProcessorCount
}

$settings | ValidateSettings

$settings
Expand Down
29 changes: 29 additions & 0 deletions Actions/.Modules/settings.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,20 @@
},
"description": "See https://aka.ms/ALGoSettings#customcodecops"
},
"preprocessorSymbols": {
"type": "array",
"items": {
"type": "string"
},
"description": "Preprocessor symbols to use when compiling the app. See https://aka.ms/ALGoSettings#preprocessorsymbols"
},
"features": {
"type": "array",
"items": {
"type": "string"
},
"description": "Features to enable when compiling the app. See https://aka.ms/ALGoSettings#features"
},
"trackALAlertsInGitHub": {
"type": "boolean",
"description": "Enable tracking of AL Alerts in GitHub. See https://aka.ms/ALGoSettings#trackALAlertsInGitHub"
Expand Down Expand Up @@ -518,6 +532,21 @@
"type": "boolean",
"description": "Use the compiler folder instead of a BC container. See https://aka.ms/ALGoSettings#usecompilerfolder"
},
"workspaceCompilation": {
"type": "object",
"description": "PREVIEW: Configuration for workspace compilation. See https://aka.ms/ALGoSettings#workspacecompilation",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable workspace compilation for building apps"
},
"parallelism": {
"type": "integer",
"description": "The number of parallel processes to use for workspace compilation. Set to 0 or -1 to use all available processors."
}
},
"additionalProperties": false
},
"pullRequestTrigger": {
"type": "string",
"pattern": "^(pull_request|pull_request_target)$",
Expand Down
93 changes: 83 additions & 10 deletions Actions/AL-Go-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,42 @@ $runAlPipelineOverrides = @(
"PipelineFinalize"
)

<#
.SYNOPSIS
Gets script overrides from the AL-Go folder.
.DESCRIPTION
Checks the specified AL-Go folder for .ps1 scripts matching the provided override names.
Returns a hashtable mapping each found override name to its script block.
.PARAMETER ALGoFolderName
The folder where the AL-Go scripts are located.
.PARAMETER OverrideScriptNames
An array of script names to look for (without .ps1 extension).
.OUTPUTS
Hashtable with override script names as keys and their script blocks as values.
#>
function Get-ScriptOverrides() {
param(
[Parameter(Mandatory = $true)]
[string] $ALGoFolderName,
[Parameter(Mandatory = $true)]
[string[]] $OverrideScriptNames
)
$overrides = @{}
foreach ($scriptName in $OverrideScriptNames) {
$scriptPath = Join-Path $ALGoFolderName "$scriptName.ps1"
if (Test-Path -Path $scriptPath -Type Leaf) {
OutputDebug "Add override for $scriptName ($scriptPath)"
Trace-Information -Message "Using override for $scriptName"
$scriptBlock = (Get-Command $scriptPath | Select-Object -ExpandProperty ScriptBlock)
if (-not $scriptBlock) {
OutputError -message "Failed to get scriptblock for $scriptName.ps1, please check the override for validity."
}
$overrides[$scriptName] = $scriptBlock
}
}
return $overrides
}

# Well known AppIds
$platformAppId = "8874ed3a-0643-4247-9ced-7a7002f7135d"
$systemAppId = "63ca2fa4-4f03-4f2b-a480-172fef340d3f"
Expand Down Expand Up @@ -1570,16 +1606,7 @@ function CreateDevEnv {

Push-Location $projectFolder
try {
$runAlPipelineOverrides | ForEach-Object {
$scriptName = $_
$scriptPath = Join-Path $ALGoFolderName "$ScriptName.ps1"
if (Test-Path -Path $scriptPath -Type Leaf) {
Write-Host "Add override for $scriptName"
$runAlPipelineParams += @{
"$scriptName" = (Get-Command $scriptPath | Select-Object -ExpandProperty ScriptBlock)
}
}
}
$runAlPipelineParams += (Get-ScriptOverrides -ALGoFolderName $ALGoFolderName -OverrideScriptNames $runAlPipelineOverrides)

if ($kind -eq "local") {
$runAlPipelineParams += @{
Expand Down Expand Up @@ -2411,3 +2438,49 @@ function RunAndCheck {
throw "$($args[0]) $($rest | ForEach-Object { $_ }) failed with exit code $LASTEXITCODE"
}
}

<#
.SYNOPSIS
Get the version number components based on the versioning strategy
.DESCRIPTION
Get the version number components based on the versioning strategy defined in the settings.
.PARAMETER Settings
The settings object containing versioning information.
.RETURNS
A PSCustomObject with MajorMinorVersion, BuildNumber, and RevisionNumber properties.
#>
function Get-VersionNumber() {
param(
[Parameter(Mandatory=$true)]
$Settings
)
$majorMinorVersion = ""
$appBuild = $Settings.appBuild
$appRevision = $Settings.appRevision

if ($Settings.versioningStrategy -eq -1) {
$artifactVersion = [Version]$Settings.artifact.Split('/')[4]
$majorMinorVersion = "$($artifactVersion.Major).$($artifactVersion.Minor)"
$appBuild = $artifactVersion.Build
$appRevision = $artifactVersion.Revision
} elseif (($Settings.versioningStrategy -band 16) -eq 16) {
# For versioningStrategy +16, the version number is taken from repoVersion setting
$repoVersion = [System.Version]$Settings.repoVersion
$majorMinorVersion = "$($repoVersion.Major).$($repoVersion.Minor)"
if (($Settings.versioningStrategy -band 15) -eq 3) {
# For versioning strategy 3, we need to get the build number from repoVersion setting
$appBuild = $repoVersion.Build
if ($appBuild -eq -1) {
OutputWarning -message "RepoVersion setting only contains Major.Minor version. When using versioningStrategy 3, it should contain 3 digits"
$appBuild = 0
}
}
}

# Construct object to return
return [PSCustomObject]@{
MajorMinorVersion = $majorMinorVersion
BuildNumber = $appBuild
RevisionNumber = $appRevision
}
}
190 changes: 190 additions & 0 deletions Actions/CompileApps/Compile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
Param(
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
[Parameter(HelpMessage = "ArtifactUrl to use for the build", Mandatory = $false)]
[string] $artifact = "",
[Parameter(HelpMessage = "Project folder", Mandatory = $false)]
[string] $project = "",
[Parameter(HelpMessage = "Specifies a mode to use for the build steps", Mandatory = $false)]
[string] $buildMode = 'Default',
[Parameter(HelpMessage = "A path to a JSON-formatted list of dependency apps", Mandatory = $false)]
[string] $dependencyAppsJson = '',
[Parameter(HelpMessage = "A path to a JSON-formatted list of dependency test apps", Mandatory = $false)]
[string] $dependencyTestAppsJson = '',
[Parameter(HelpMessage = "RunId of the baseline workflow run", Mandatory = $false)]
[string] $baselineWorkflowRunId = '0',
[Parameter(HelpMessage = "SHA of the baseline workflow run", Mandatory = $false)]
[string] $baselineWorkflowSHA = ''
)

. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
Import-Module (Join-Path -Path $PSScriptRoot "..\.Modules\CompileFromWorkspace.psm1" -Resolve)
Import-Module (Join-Path $PSScriptRoot '..\TelemetryHelper.psm1' -Resolve)
Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "..\DetermineProjectsToBuild\DetermineProjectsToBuild.psm1" -Resolve) -DisableNameChecking
DownloadAndImportBcContainerHelper

# ANALYZE - Analyze the repository and determine settings
$baseFolder = (Get-BasePath)
$settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable
$settings = AnalyzeRepo -settings $settings -baseFolder $baseFolder -project $project -doNotCheckArtifactSetting
$settings = CheckAppDependencyProbingPaths -settings $settings -token $token -baseFolder $baseFolder -project $project

# Check if there are any app folders or test app folders to compile
if ($settings.appFolders.Count -eq 0 -and $settings.testFolders.Count -eq 0) {
Write-Host "No app folders or test app folders specified for compilation. Skipping compilation step."
return
}

$projectFolder = Join-Path $baseFolder $project
Push-Location $projectFolder
try {
# Set up output folders
$buildArtifactFolder = Join-Path $projectFolder ".buildartifacts"
$appOutputFolder = Join-Path $buildArtifactFolder "Apps"
$testAppOutputFolder = Join-Path $buildArtifactFolder "TestApps"
if (-not (Test-Path $buildArtifactFolder)) {
New-Item $buildArtifactFolder -ItemType Directory -Force | Out-Null
}
if (-not (Test-Path $appOutputFolder)) {
New-Item $appOutputFolder -ItemType Directory -Force | Out-Null
}
if (-not (Test-Path $testAppOutputFolder)) {
New-Item $testAppOutputFolder -ItemType Directory -Force | Out-Null
}

# Check for precompile and postcompile overrides
$scriptOverrides = Get-ScriptOverrides -ALGoFolderName (Join-Path $projectFolder ".AL-Go") -OverrideScriptNames @("PreCompileApp", "PostCompileApp")

# Prepare build metadata
$buildMetadata = Get-BuildMetadata

# Get version number
$versionNumber = Get-VersionNumber -Settings $settings

# Get ruleset file if specified
$rulesetPath = $settings.rulesetFile
if ($settings.rulesetFile) {
$rulesetPath = Join-Path $projectFolder $settings.rulesetFile -Resolve
if (-not (Test-Path $rulesetPath)) {
throw "Ruleset file specified in settings.rulesetFile not found at path '$rulesetPath'."
}
}

# Read existing install apps and test apps from JSON files
$dependencyApps = @()
$dependencyTestApps = @()

if ($dependencyAppsJson -and (Test-Path $dependencyAppsJson)) {
try {
$dependencyApps += Get-Content -Path $dependencyAppsJson | ConvertFrom-Json
}
catch {
throw "Failed to parse JSON file at path '$dependencyAppsJson'. Error: $($_.Exception.Message)"
}
}

if ($dependencyTestAppsJson -and (Test-Path $dependencyTestAppsJson)) {
try {
$dependencyTestApps += Get-Content -Path $dependencyTestAppsJson | ConvertFrom-Json
}
catch {
throw "Failed to parse JSON file at path '$dependencyTestAppsJson'. Error: $($_.Exception.Message)"
}
}

# Set up a compiler folder
$containerName = GetContainerName($project)
$cacheFolder = ""
if ($settings.gitHubRunner -like "windows-*" -or $settings.gitHubRunner -like "ubuntu-*") {
# On GitHub-hosted runners, use a folder in the runner temp directory for caching to speed up subsequent builds
$cacheFolder = Join-Path $ENV:RUNNER_TEMP ".artifactcache"
}
$compilerFolder = New-BcCompilerFolder -artifactUrl $artifact -containerName "$($containerName)compiler" -cacheFolder $cacheFolder
$packageCachePath = Join-Path $compilerFolder "symbols"

# Copy dependency apps to the package cache so the compiler can resolve them
foreach ($appFile in $dependencyApps) {
$appFile = $appFile.Trim('()')
if ($appFile -and (Test-Path $appFile)) {
Copy-Item -Path $appFile -Destination $packageCachePath -Force
OutputDebug "Copied dependency app to package cache: $(Split-Path $appFile -Leaf)"
}
}

# Incremental Builds - Determine unmodified apps from baseline workflow run if applicable
if ($baselineWorkflowSHA -and $baselineWorkflowRunId -ne '0' -and $settings.incrementalBuilds.mode -eq 'modifiedApps') {
#TODO: Implement support for incremental builds (AB#620492)
Write-Host "Incremental builds based on modified apps is not yet implemented."
}

if ((-not $settings.skipUpgrade) -and $settings.enableAppSourceCop) {
# TODO: Missing implementation of around using latest release as a baseline (skipUpgrade) / Appsourcecop.json baseline implementation (AB#620310)
Write-Host "Checking for required upgrades using AppSourceCop..."
}

# Update the app jsons with version number (and other properties) from the app manifest files
Update-AppJsonProperties -Folders ($settings.appFolders + $settings.testFolders) `
-MajorMinorVersion $versionNumber.MajorMinorVersion -BuildNumber $versionNumber.BuildNumber -RevisionNumber $versionNumber.RevisionNumber `
-BuildBy $buildMetadata.BuildBy -BuildUrl $buildMetadata.BuildUrl

# Collect common parameters for Build-AppsInWorkspace
$buildParams = @{
CompilerFolder = $compilerFolder
PackageCachePath = $packageCachePath
LogDirectory = $buildArtifactFolder
Ruleset = $rulesetPath
AssemblyProbingPaths = (Get-AssemblyProbingPaths -CompilerFolder $compilerFolder)
PreprocessorSymbols = $settings.preprocessorSymbols
Features = $settings.features
MajorMinorVersion = $versionNumber.MajorMinorVersion
BuildNumber = $versionNumber.BuildNumber
RevisionNumber = $versionNumber.RevisionNumber
MaxCpuCount = $settings.workspaceCompilation.parallelism
SourceRepositoryUrl = $buildMetadata.SourceRepositoryUrl
SourceCommit = $buildMetadata.SourceCommit
ReportSuppressedDiagnostics = $settings.reportSuppressedDiagnostics
EnableExternalRulesets = $settings.enableExternalRulesets
PreCompileApp = $scriptOverrides['PreCompileApp']
PostCompileApp = $scriptOverrides['PostCompileApp']
Analyzers = (Get-CodeAnalyzers -Settings $settings)
CustomAnalyzers = (Get-CustomAnalyzers -Settings $settings -CompilerFolder $compilerFolder)
}

# Start compilation
$appFiles = @()
$testAppFiles = @()
try {
if ($settings.appFolders.Count -gt 0) {
# Compile Apps
$appFiles = Build-AppsInWorkspace @buildParams `
-Folders $settings.appFolders `
-OutFolder $appOutputFolder `
-AppType 'app'
}

if ($settings.testFolders.Count -gt 0) {
if (-not ($settings.enableCodeAnalyzersOnTestApps)) {
$buildParams.Analyzers = @()
}

# Compile Test Apps
$testAppFiles = Build-AppsInWorkspace @buildParams `
-Folders $settings.testFolders `
-OutFolder $testAppOutputFolder `
-AppType 'testApp'
}

} finally {
New-BuildOutputFile -BuildArtifactFolder $buildArtifactFolder -BuildOutputPath (Join-Path $projectFolder "BuildOutput.txt") -DisplayInConsole -FailOn $settings.failOn
}

# OUTPUT - Output the updated list of dependency apps and test apps to JSON files for downstream steps
$dependencyApps += $appFiles
$dependencyTestApps += $testAppFiles
Trace-Information -message "Compilation completed. Compiled $(@($appFiles).Count) apps and $(@($testAppFiles).Count) test apps."

ConvertTo-Json $dependencyApps -Depth 99 -Compress | Out-File -Encoding UTF8 -FilePath $dependencyAppsJson
ConvertTo-Json $dependencyTestApps -Depth 99 -Compress | Out-File -Encoding UTF8 -FilePath $dependencyTestAppsJson
} finally {
Pop-Location
}
Loading
Loading