mirror of https://github.com/acidanthera/audk.git
ArmVirtPkg/PlatformCI: factor out reusable PlatformBuildLib.py
In order to reduce the amount of code duplication, refactor the PlatformBuild.py script that builds ArmVirtQemu.dsc into a reusable PlatformBuildLib.py containing most of the bits and pieces, and a small QemuBuild.py which is specific to the DSC in question. Suggested-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
parent
619f077252
commit
01a06884a1
ArmVirtPkg/PlatformCI
|
@ -30,42 +30,42 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
QEMU_AARCH64_DEBUG:
|
QEMU_AARCH64_DEBUG:
|
||||||
Build.File: "$(package)/PlatformCI/PlatformBuild.py"
|
Build.File: "$(package)/PlatformCI/QemuBuild.py"
|
||||||
Build.Arch: "AARCH64"
|
Build.Arch: "AARCH64"
|
||||||
Build.Flags: ""
|
Build.Flags: ""
|
||||||
Build.Target: "DEBUG"
|
Build.Target: "DEBUG"
|
||||||
Run.Flags: $(run_flags)
|
Run.Flags: $(run_flags)
|
||||||
Run: $(should_run)
|
Run: $(should_run)
|
||||||
QEMU_AARCH64_RELEASE:
|
QEMU_AARCH64_RELEASE:
|
||||||
Build.File: "$(package)/PlatformCI/PlatformBuild.py"
|
Build.File: "$(package)/PlatformCI/QemuBuild.py"
|
||||||
Build.Arch: "AARCH64"
|
Build.Arch: "AARCH64"
|
||||||
Build.Flags: ""
|
Build.Flags: ""
|
||||||
Build.Target: "RELEASE"
|
Build.Target: "RELEASE"
|
||||||
Run.Flags: $(run_flags)
|
Run.Flags: $(run_flags)
|
||||||
Run: $(should_run)
|
Run: $(should_run)
|
||||||
QEMU_AARCH64_NOOPT:
|
QEMU_AARCH64_NOOPT:
|
||||||
Build.File: "$(package)/PlatformCI/PlatformBuild.py"
|
Build.File: "$(package)/PlatformCI/QemuBuild.py"
|
||||||
Build.Arch: "AARCH64"
|
Build.Arch: "AARCH64"
|
||||||
Build.Flags: ""
|
Build.Flags: ""
|
||||||
Build.Target: "NOOPT"
|
Build.Target: "NOOPT"
|
||||||
Run.Flags: $(run_flags)
|
Run.Flags: $(run_flags)
|
||||||
Run: $(should_run)
|
Run: $(should_run)
|
||||||
QEMU_ARM_DEBUG:
|
QEMU_ARM_DEBUG:
|
||||||
Build.File: "$(package)/PlatformCI/PlatformBuild.py"
|
Build.File: "$(package)/PlatformCI/QemuBuild.py"
|
||||||
Build.Arch: "ARM"
|
Build.Arch: "ARM"
|
||||||
Build.Flags: ""
|
Build.Flags: ""
|
||||||
Build.Target: "DEBUG"
|
Build.Target: "DEBUG"
|
||||||
Run.Flags: $(run_flags)
|
Run.Flags: $(run_flags)
|
||||||
Run: $(should_run)
|
Run: $(should_run)
|
||||||
QEMU_ARM_RELEASE:
|
QEMU_ARM_RELEASE:
|
||||||
Build.File: "$(package)/PlatformCI/PlatformBuild.py"
|
Build.File: "$(package)/PlatformCI/QemuBuild.py"
|
||||||
Build.Arch: "ARM"
|
Build.Arch: "ARM"
|
||||||
Build.Flags: ""
|
Build.Flags: ""
|
||||||
Build.Target: "RELEASE"
|
Build.Target: "RELEASE"
|
||||||
Run.Flags: $(run_flags)
|
Run.Flags: $(run_flags)
|
||||||
Run: $(should_run)
|
Run: $(should_run)
|
||||||
QEMU_ARM_NOOPT:
|
QEMU_ARM_NOOPT:
|
||||||
Build.File: "$(package)/PlatformCI/PlatformBuild.py"
|
Build.File: "$(package)/PlatformCI/QemuBuild.py"
|
||||||
Build.Arch: "ARM"
|
Build.Arch: "ARM"
|
||||||
Build.Flags: ""
|
Build.Flags: ""
|
||||||
Build.Target: "NOOPT"
|
Build.Target: "NOOPT"
|
||||||
|
|
|
@ -17,21 +17,6 @@ from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager
|
||||||
from edk2toollib.utility_functions import RunCmd
|
from edk2toollib.utility_functions import RunCmd
|
||||||
from edk2toollib.utility_functions import GetHostInfo
|
from edk2toollib.utility_functions import GetHostInfo
|
||||||
|
|
||||||
# ####################################################################################### #
|
|
||||||
# Common Configuration #
|
|
||||||
# ####################################################################################### #
|
|
||||||
|
|
||||||
|
|
||||||
class CommonPlatform():
|
|
||||||
''' Common settings for this platform. Define static data here and use
|
|
||||||
for the different parts of stuart
|
|
||||||
'''
|
|
||||||
PackagesSupported = ("ArmVirtPkg",)
|
|
||||||
ArchSupported = ("AARCH64", "ARM")
|
|
||||||
TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")
|
|
||||||
Scopes = ('armvirt', 'edk2-build')
|
|
||||||
WorkspaceRoot = os.path.realpath(os.path.join(
|
|
||||||
os.path.dirname(os.path.abspath(__file__)), "..", ".."))
|
|
||||||
|
|
||||||
# ####################################################################################### #
|
# ####################################################################################### #
|
||||||
# Configuration for Update & Setup #
|
# Configuration for Update & Setup #
|
||||||
|
@ -139,7 +124,7 @@ class SettingsManager(UpdateSettingsManager, SetupSettingsManager, PrEvalSetting
|
||||||
|
|
||||||
The tuple should be (<workspace relative path to dsc file>, <input dictionary of dsc key value pairs>)
|
The tuple should be (<workspace relative path to dsc file>, <input dictionary of dsc key value pairs>)
|
||||||
'''
|
'''
|
||||||
return (os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc"), {})
|
return (CommonPlatform.DscName, {})
|
||||||
|
|
||||||
|
|
||||||
# ####################################################################################### #
|
# ####################################################################################### #
|
||||||
|
@ -163,7 +148,7 @@ class PlatformBuilder(UefiBuilder, BuildSettingsManager):
|
||||||
"TARGET_ARCH", args.build_arch.upper(), "From CmdLine")
|
"TARGET_ARCH", args.build_arch.upper(), "From CmdLine")
|
||||||
|
|
||||||
shell_environment.GetBuildVars().SetValue(
|
shell_environment.GetBuildVars().SetValue(
|
||||||
"ACTIVE_PLATFORM", "ArmVirtPkg/ArmVirtQemu.dsc", "From CmdLine")
|
"ACTIVE_PLATFORM", CommonPlatform.DscName, "From CmdLine")
|
||||||
|
|
||||||
def GetWorkspaceRoot(self):
|
def GetWorkspaceRoot(self):
|
||||||
''' get WorkspacePath '''
|
''' get WorkspacePath '''
|
|
@ -0,0 +1,31 @@
|
||||||
|
# @file
|
||||||
|
# Script to Build OVMF UEFI firmware
|
||||||
|
#
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
##
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
from PlatformBuildLib import SettingsManager
|
||||||
|
from PlatformBuildLib import PlatformBuilder
|
||||||
|
|
||||||
|
# ####################################################################################### #
|
||||||
|
# Common Configuration #
|
||||||
|
# ####################################################################################### #
|
||||||
|
class CommonPlatform():
|
||||||
|
''' Common settings for this platform. Define static data here and use
|
||||||
|
for the different parts of stuart
|
||||||
|
'''
|
||||||
|
PackagesSupported = ("ArmVirtPkg",)
|
||||||
|
ArchSupported = ("AARCH64", "ARM")
|
||||||
|
TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")
|
||||||
|
Scopes = ('armvirt', 'edk2-build')
|
||||||
|
WorkspaceRoot = os.path.realpath(os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)), "..", ".."))
|
||||||
|
|
||||||
|
DscName = os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc")
|
||||||
|
|
||||||
|
import PlatformBuildLib
|
||||||
|
PlatformBuildLib.CommonPlatform = CommonPlatform
|
Loading…
Reference in New Issue