diff --git a/.pytool/Plugin/LicenseCheck/LicenseCheck.py b/.pytool/Plugin/LicenseCheck/LicenseCheck.py index 4877eda10619b..bc73d554c89b1 100644 --- a/.pytool/Plugin/LicenseCheck/LicenseCheck.py +++ b/.pytool/Plugin/LicenseCheck/LicenseCheck.py @@ -70,6 +70,7 @@ def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, self.ok = True self.startcheck = False self.license = True + self.all_file_pass = True count = len(patch) line_index = 0 for line in patch: @@ -80,7 +81,7 @@ def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, if f in added_file: continue added_file_extension = os.path.splitext(added_file)[1] - if added_file_extension in self.file_extension_list: + if added_file_extension in self.file_extension_list and packagename in added_file: self.startcheck = True self.license = False if self.startcheck and self.license_format_preflix in line: @@ -88,14 +89,17 @@ def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, self.license = True if line_index + 1 == count or patch[line_index + 1].startswith('diff --') and self.startcheck: if not self.license: - error_message = "Invalid License in: " + added_file + self.all_file_pass = False + error_message = "Invalid license in: " + added_file logging.error(error_message) self.startcheck = False self.license = True line_index = line_index + 1 - if self.license: + if self.all_file_pass: + tc.SetSuccess() return 0 else: + tc.SetFailed("License Check {0} Failed. ".format(packagename), "LICENSE_CHECK_FAILED") return 1