Skip to content

Commit

Permalink
.pytool/CISettings.py: Set rust-ci scope and use in tree BaseTools
Browse files Browse the repository at this point in the history
The Rust BaseTool changes are not in the edk2-basetools PIP module,
so this change updates CISettings.py to use the in tree tools by
default.

The `rust-ci` scope is added as an active scope so Rust related
plugins like `RustHostUnitTestPlugin` will run.

Signed-off-by: Michael Kubacki <[email protected]>
  • Loading branch information
makubacki committed Aug 30, 2023
1 parent 98e18fc commit 40bcfe3
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions .pytool/CISettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ def __init__(self):
self.ActualTargets = []
self.ActualArchitectures = []
self.ActualToolChainTag = ""
self.UseBuiltInBaseTools = None
self.ActualScopes = None
# In tree BaseTools are required for Rust build support so enable
# it by default.
self.UseBuiltInBaseTools = False

# ####################################################################################### #
# Extra CmdLine configuration #
Expand All @@ -42,7 +44,6 @@ def __init__(self):
def AddCommandLineOptions(self, parserObj):
group = parserObj.add_mutually_exclusive_group()
group.add_argument("-force_piptools", "--fpt", dest="force_piptools", action="store_true", default=False, help="Force the system to use pip tools")
group.add_argument("-no_piptools", "--npt", dest="no_piptools", action="store_true", default=False, help="Force the system to not use pip tools")

try:
codeql_helpers.add_command_line_option(parserObj)
Expand All @@ -51,10 +52,9 @@ def AddCommandLineOptions(self, parserObj):

def RetrieveCommandLineOptions(self, args):
super().RetrieveCommandLineOptions(args)

if args.force_piptools:
self.UseBuiltInBaseTools = True
if args.no_piptools:
self.UseBuiltInBaseTools = False

try:
self.codeql = codeql_helpers.is_codeql_enabled_on_command_line(args)
Expand Down Expand Up @@ -149,27 +149,17 @@ def SetTargets(self, list_of_requested_target):
def GetActiveScopes(self):
''' return tuple containing scopes that should be active for this process '''
if self.ActualScopes is None:
scopes = ("cibuild", "edk2-build", "host-based-test")
scopes = ("cibuild", "edk2-build", "host-based-test", "rust-ci")

self.ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "")

is_linux = GetHostInfo().os.upper() == "LINUX"

if self.UseBuiltInBaseTools is None:
is_linux = GetHostInfo().os.upper() == "LINUX"
# try and import the pip module for basetools
try:
import edk2basetools
self.UseBuiltInBaseTools = True
except ImportError:
self.UseBuiltInBaseTools = False
pass

if self.UseBuiltInBaseTools == True:
scopes += ('pipbuild-unix',) if is_linux else ('pipbuild-win',)
logging.warning("Using Pip Tools based BaseTools")
else:
logging.warning("Falling back to using in-tree BaseTools")
logging.info("Using in-tree BaseTools")

if is_linux and self.ActualToolChainTag.upper().startswith("GCC"):
if "AARCH64" in self.ActualArchitectures:
Expand Down

0 comments on commit 40bcfe3

Please sign in to comment.