From 3a37a0f8878fda3047bdb09e09a6111c915a07eb Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 27 Sep 2024 15:14:44 +0200 Subject: [PATCH] Freddydk/dependencies (#3685) Bug fix for bug found when fixing https://github.com/microsoft/AL-Go/issues/1215 When using compilerFolder or FilesOnly Container, the dependencies artifact doesn't get generated when specifying GenerateDependencyArtifact = true. --------- Co-authored-by: freddydk --- AppHandling/Run-AlPipeline.ps1 | 35 +++++++++++------------ NuGet/Download-BcNuGetPackageToFolder.ps1 | 2 ++ ReleaseNotes.txt | 1 + 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/AppHandling/Run-AlPipeline.ps1 b/AppHandling/Run-AlPipeline.ps1 index db90de721..cc4db024e 100644 --- a/AppHandling/Run-AlPipeline.ps1 +++ b/AppHandling/Run-AlPipeline.ps1 @@ -615,6 +615,12 @@ if ($buildArtifactFolder) { New-Item $buildArtifactFolder -ItemType Directory | Out-Null } } +if ($generateDependencyArtifact) { + $dependenciesFolder = Join-Path $buildArtifactFolder "Dependencies" + if (!(Test-Path $dependenciesFolder)) { + New-Item -ItemType Directory -Path $dependenciesFolder | Out-Null + } +} if (!($appFolders)) { Write-Host "WARNING: No app folders found" @@ -1231,9 +1237,6 @@ Measure-Command { Write-Host -ForegroundColor Yellow "Installing apps for additional country $testCountry" } - if ($generateDependencyArtifact) { - $dependenciesFolder = Join-Path $buildArtifactFolder "Dependencies" - } $tmpAppFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([guid]::NewGuid().ToString()) $tmpAppFiles = @() $installApps | ForEach-Object{ @@ -1261,9 +1264,6 @@ Measure-Command { Write-Host -NoNewline "Copying $($_.SubString($packagesFolder.Length+1)) to symbols folder" if ($generateDependencyArtifact) { Write-Host -NoNewline " and dependencies folder" - if (!(Test-Path $dependenciesFolder)) { - New-Item -ItemType Directory -Path $dependenciesFolder | Out-Null - } Copy-Item -Path $_ -Destination $dependenciesFolder -Force } Write-Host @@ -1348,7 +1348,7 @@ Measure-Command { } if ($generateDependencyArtifact -and !($testCountry)) { $parameters += @{ - "CopyInstalledAppsToFolder" = Join-Path $buildArtifactFolder "Dependencies" + "CopyInstalledAppsToFolder" = $dependenciesFolder } } Invoke-Command -ScriptBlock $InstallMissingDependencies -ArgumentList $Parameters @@ -1837,18 +1837,15 @@ Write-Host -ForegroundColor Yellow @' } if ($generateDependencyArtifact -and !$filesOnly -and !$useCompilerFolder) { - $depFolder = Join-Path $buildArtifactFolder "Dependencies" - Write-Host "Copying dependencies from $depFolder to $appPackagesFolder" - if (Test-Path $depFolder) { - Get-ChildItem -Path $depFolder -Recurse -file -Filter '*.app' | ForEach-Object { - $destName = Join-Path $appPackagesFolder $_.Name - if (Test-Path $destName) { - Write-Host "- $destName already exists" - } - else { - Write-Host "+ Copying $($_.FullName) to $destName" - Copy-Item -Path $_.FullName -Destination $destName -Force - } + Write-Host "Copying dependencies from $dependenciesFolder to $appPackagesFolder" + Get-ChildItem -Path $dependenciesFolder -Recurse -file -Filter '*.app' | ForEach-Object { + $destName = Join-Path $appPackagesFolder $_.Name + if (Test-Path $destName) { + Write-Host "- $destName already exists" + } + else { + Write-Host "+ Copying $($_.FullName) to $destName" + Copy-Item -Path $_.FullName -Destination $destName -Force } } } diff --git a/NuGet/Download-BcNuGetPackageToFolder.ps1 b/NuGet/Download-BcNuGetPackageToFolder.ps1 index cd9ee31e0..52f0c82ed 100644 --- a/NuGet/Download-BcNuGetPackageToFolder.ps1 +++ b/NuGet/Download-BcNuGetPackageToFolder.ps1 @@ -277,8 +277,10 @@ try { $appFiles = Get-Item -Path (Join-Path $package "*.app") } foreach($appFile in $appFiles) { + Write-Host "Copying $($appFile.Name) to $folder" Copy-Item $appFile.FullName -Destination $folder -Force if ($copyInstalledAppsToFolder) { + Write-Host "Copying $($appFile.Name) to $copyInstalledAppsToFolder" Copy-Item $appFile.FullName -Destination $copyInstalledAppsToFolder -Force } } diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 07a08e60e..3434ac6e1 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,4 +1,5 @@ 6.0.25 +Fix issue where generateDependencyArtifact doesn't result in dependencies if useCompilerFolder is true or filesonly containers are used in Run-AlPipeline 6.0.24 Use pre-release altool when running alcops (to be able to get runtime version of nextmajor)