Skip to content

Commit

Permalink
edk2_pr_eval.py: Build all packages on file change outside package
Browse files Browse the repository at this point in the history
Updates `get_packages_to_build()` to return all possible packages if
a file is modified outside a package.

Originally, this was implemented behind a new argument with the
default behavior unchanged. However, feedback indicated it would
be easier to adopt without an argument and this would be acceptable
behavior.

This does mean some files, such as documentation files, could trigger
packages to build that would have not previously built. However, the
impact and frequency of this is considered minimal enough to not
justify additional complexity. The change mainly focuses on files
such as dependency trackers (e.g. PIP requirements, submodules),
Python scripts, and other files that can impact overall build
results.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
  • Loading branch information
makubacki committed Nov 1, 2022
1 parent ca7d9e2 commit 20ee61a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions edk2toolext/invocables/edk2_pr_eval.py
Expand Up @@ -120,6 +120,23 @@ def get_packages_to_build(self, possible_packages: list) -> dict:
if rc != 0:
return {}

#
# Policy 0 - A file outside a package was modified and force build
# all packages on a modified file outside a package setting
# is enabled.
#
# Note: GetContainingPackage() returns the top most directory from the
# workspace root for a given file path if the file is not in a
# package.
#
for f in files:
if self.edk2_path_obj.GetContainingPackage(os.path.abspath(f)) \
not in possible_packages:
return dict.fromkeys(possible_packages,
"Policy 0 - Build all packages if "
"a file is modified outside a "
"package.")

remaining_packages = possible_packages.copy() # start with all possible packages and remove each
# package once it is determined to be build. This optimization
# avoids checking packages that already will be built.
Expand Down

0 comments on commit 20ee61a

Please sign in to comment.