diff --git a/edk2toolext/invocables/edk2_pr_eval.py b/edk2toolext/invocables/edk2_pr_eval.py index e2673a615..df7a64111 100644 --- a/edk2toolext/invocables/edk2_pr_eval.py +++ b/edk2toolext/invocables/edk2_pr_eval.py @@ -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.