Skip to content

Commit

Permalink
Update nuget package bundling (#86)
Browse files Browse the repository at this point in the history
## Description

Updates the logic that is responsible to bundling the nuget contents in
the appropriate manner. This update replaces the standalone script with
a post build plugin that will be executed when the command line argument
`--bundle` is added to either the MultiFlavorBuild or SingleFlavorBuild
build scripts.

Additionally, update the dsc to generate pdbs on release builds in
addition to debug builds. Also ensures pdb, map, and build available and
a part of the bundle that is generated for a NuGet release. These
changes make it easier for the local story, such that developers can run
the `py MultiFlavorBuild.py ... --bundle`, and the structure of the
NuGet package is generated. Instead of copying over the newly compiled
binaries to the NuGet package in the platform, the developer can simply
set the `SHARED_CRYPTO_PATH=<workspace/Bundle>` and build.

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

Ensured compiling, bundling, and releasing continues to work:
https://dev.azure.com/projectmu/mu/_build/results?buildId=69830&view=results

## Integration Instructions

N/A
  • Loading branch information
Javagedes authored May 28, 2024
1 parent 3813d60 commit b4778db
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 266 deletions.
95 changes: 29 additions & 66 deletions .azuredevops/pipelines/template-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,14 @@ jobs:
-f ${{ item.Value.Flavor }}
-a ${{ item.Value.ArchList }}
-t ${{ parameters.build_targets }}
--bundle
--stop-on-fail
TOOL_CHAIN_TAG=${{ item.Value.ToolChain }}
- task: CopyFiles@2
displayName: Filter Driver Binaries # To reduce network consumption.
inputs:
sourceFolder: 'Build/CryptoBin_${{ item.Value.Flavor }}'
contents: |
**/*.efi
**/*.depex
**/BUILD_REPORT.TXT
targetFolder: '$(Build.ArtifactStagingDirectory)/Drivers'
flattenFolders: false
- task: PublishPipelineArtifact@1
displayName: Publish Driver Binaries
displayName: Publish Bundle
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/Drivers'
targetPath: 'Bundle'
artifactName: CryptoBin_${{ Item.Value.ArchList }}_${{ item.Value.Flavor }}

- ${{ if eq(item.Value.CopyExtra, true) }}:
Expand Down Expand Up @@ -161,70 +152,42 @@ jobs:
patterns: 'CryptoBin_*/**'
path: '$(Pipeline.Workspace)/Staging'

- task: DownloadPipelineArtifact@2
displayName: Download Logs Artifacts
inputs:
patterns: '*_Logs/**'
path: '$(Pipeline.Workspace)/Logs'

- task: DownloadPipelineArtifact@2
displayName: Download Extras Artifacts
inputs:
artifact: Package_Extras
path: '$(Pipeline.Workspace)/Extras'

- task: PythonScript@0
displayName: Merge CryptoBin Artifacts
env:
ARTIFACT_DIR: '$(Pipeline.Workspace)/Staging'
OUT_DIR: '$(Pipeline.Workspace)/FinalPackage'
inputs:
scriptSource: 'inline'
script: |
import os
import shutil
from pathlib import Path
dest_folder = os.environ['OUT_DIR']
src_folder = os.environ['ARTIFACT_DIR']
if not os.path.exists(dest_folder):
os.makedirs(dest_folder)

for content in Path(src_folder).iterdir():
print(content)
shutil.copytree(content, dest_folder, dirs_exist_ok=True)

- task: CopyFiles@2
displayName: Move Logs into Staging
displayName: Copy License
inputs:
sourceFolder: '$(Pipeline.Workspace)/Logs'
contents: |
**/*.txt
targetFolder: '$(Pipeline.Workspace)/Staging'
sourceFolder: '$(Pipeline.Workspace)/Extras'
contents: 'License.txt'
targetFolder: '$(Pipeline.Workspace)/FinalPackage'
flattenFolders: true

# Files in staging exists in this format
# {FLAVOR}
# -- CryptoPkg
# ---- {TARGET}_{TOOLCHAIN}
# ------ Crypto(Pei|Dxe|Smm).efi
# ------ {GUID}
# -------- DEBUG
# ---------- Crypto(Pei|Dxe|Smm).efi
# -------- OUTPUT
# ---------- Crypto(Pei|Dxe|Smm).efi
# ---------- Crypto(Pei|Dxe|Smm).depex
# -- UPDATE_LOG.txt
# -- CI_BUILDLOG.txt
# -- edk2-BaseCryptoDriver.config.json

# {FLAVOR} = ALL, TINY_SHA, ...
# {TARGET} = DEBUG, RELEASE
# {TOOLCHAIN} = VS2019, VS2017
# {ARCH} = IA32, X64, AARCH64

# We need them laid out like this
# {FLAVOR}
# -- {TARGET}
# ---- {ARCH}
# ------- Crypto(Pei|Dxe|Smm).efi
# ---- BuildReport.txt
# ---- Crypto(Pei|Dxe|Smm).depex
# License.txt
# Readme.md

- task: PythonScript@0
displayName: Assemble Release Package
inputs:
scriptSource: filePath
scriptPath: AssembleNugetPackage.py
arguments: > # Use this to avoid newline characters in multiline string
-v
-f
-l
-e $(Pipeline.Workspace)/Extras/License.txt
-o $(Pipeline.Workspace)/FinalPackage
$(Pipeline.Workspace)/Staging
- task: PublishPipelineArtifact@1
displayName: Publish Binaries
inputs:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Build/
Conf/

NugetPackage/
Bundle/
194 changes: 0 additions & 194 deletions AssembleNugetPackage.py

This file was deleted.

File renamed without changes.
4 changes: 4 additions & 0 deletions CryptoBinPkg/CryptoBinPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@
GCC:*_*_*_CC_FLAGS = -D ENABLE_MD5_DEPRECATED_INTERFACES
RVCT:*_*_*_CC_FLAGS = -DENABLE_MD5_DEPRECATED_INTERFACES
!endif
MSFT:RELEASE_*_*_CC_FLAGS = /Zi
MSFT:RELEASE_*_*_DLINK_FLAGS = /DEBUG /OPT:REF /OPT:ICF=10 /ALT /PDBALTPATH:$(MODULE_NAME)
MSFT:RELEASE_*_*_ASM_FLAGS = /Zi
MSFT:RELEASE_*_*_NASM_FLAGS = -g

[BuildOptions.X64.EDKII.PEIM, BuildOptions.AARCH64.EDKII.PEIM]
MSFT:*_*_*_DLINK_FLAGS = /FILEALIGN:0x1000 # meet requirement for PEIM section and file alignment to match.
Expand Down
Loading

0 comments on commit b4778db

Please sign in to comment.