Skip to content

Commit

Permalink
added removing sdk references for dryrun in Build.ps1, added keyscann…
Browse files Browse the repository at this point in the history
…er excludes for sdk artifacts
  • Loading branch information
Afroz Mohammed authored and afroz429 committed Aug 14, 2024
1 parent 35a69b1 commit 605d0dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
24 changes: 21 additions & 3 deletions buildtools/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ function DownloadSdkArtifacts {
}
}

# same as msbuild task clean-sdk-references in build.proj
function Remove-SdkReferences {
$sdkFolderPath = 'Include/sdk/assemblies'
if (Test-Path $sdkFolderPath) {
$null = Remove-Item $sdkFolderPath -Recurse -Force
}
}

$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

Expand Down Expand Up @@ -130,8 +138,16 @@ try {
# for Release, $SdkArtifactsUri is uri to _sdk-versions.json in github repo aws-sdk-net
# https://raw.githubusercontent.com/aws/aws-sdk-net/{path to_sdk-versions.json}

$cleanSDKReferenceInMsBuild = 'true'
if ($BuildType -eq 'DRY_RUN') {
Write-Host "Removing Sdk References for DRY_RUN build"
Remove-SdkReferences
# for dry run, the clean-sdk-references should be set to false
# so that the sdk dlls that are downloaded in Build.ps1 DownloadSdkArtifacts are not overwritten in the generator by downloading artifacts from github
$cleanSDKReferenceInMsBuild = 'false'
}

# for Dry run, $SdkArtifactsUri can be _sdk-versions.json or dry run artifacts from .NET build.

if ($SdkArtifactsUri) {
DownloadSdkArtifacts -SdkArtifactsUri $SdkArtifactsUri
}
Expand All @@ -146,7 +162,8 @@ try {
if ($RunAsStagingBuild -eq 'true') {
msbuild ./buildtools/build.proj `
/t:staging-build `
/p:Configuration=$Configuration
/p:Configuration=$Configuration `
/p:CleanSdkReferences=$cleanSDKReferenceInMsBuild
}
else {
msbuild ./buildtools/build.proj `
Expand All @@ -157,7 +174,8 @@ try {
/p:Configuration=$Configuration `
/p:SignModules=$SignModules `
/p:DraftReleaseNotes=true `
/p:SkipCmdletGeneration=false
/p:SkipCmdletGeneration=false `
/p:CleanSdkReferences=$cleanSDKReferenceInMsBuild
}
$BuildResult = $LASTEXITCODE
}
Expand Down
1 change: 1 addition & 0 deletions buildtools/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@
<ItemGroup>
<FolderException Include="Include/sdk/models"/>
<FolderException Include="PSGalleryDownloads"/>
<FolderException Include="Include/sdk/assemblies"/>
</ItemGroup>

<KeyScannerTask Folder="$(MSBuildProjectDirectory)/.." FilePattern="**" PrivateKeyExceptions="@(PrivateKeyException)" FileExceptions="@(FileException)" FolderExceptions="@(FolderException)" ParallelScan="true" />
Expand Down

0 comments on commit 605d0dd

Please sign in to comment.