def Run(log: Log, toolConfig: ToolConfig, formatPackageList: List[Package], customPackageFileFilter: Optional[CustomPackageFileFilter], packageRecipeResultManager: PackageRecipeResultManager, clangFormatConfiguration: ClangFormatConfiguration, cmakeConfig: GeneratorCMakeConfig, repairEnabled: bool, buildThreads: int, useLegacyTidyMethod: bool) -> None: """ RunClangFormat on a package at a time """ # Lookup the recommended build threads using the standard build algorithm numBuildThreads = PlatformBuildUtil.GetRecommendedBuildThreads( buildThreads) clangExeInfo = PerformClangUtil.LookupRecipeResults( packageRecipeResultManager, clangFormatConfiguration.RecipePackageName, MagicValues.ClangFormatCommand) ninjaExeInfo = PerformClangUtil.LookupRecipeResults( packageRecipeResultManager, clangFormatConfiguration.NinjaRecipePackageName, MagicValues.NinjaCommand) log.LogPrint("ClangFormat version: {0}".format(clangExeInfo.Version)) log.LogPrint("Ninja version: {0}".format(ninjaExeInfo.Version)) log.LogPrint("Running clang-format") # Filter the package list so it only contains things we can process finalPackageList = [ package for package in formatPackageList if PerformClangUtil.CanProcessPackage(package) ] sortedPackages = list(finalPackageList) sortedPackages.sort(key=lambda s: s.Name.lower()) #test = set() #for entry in sortedPackages: # if entry.Name in test: # raise Exception("duplicated package") # else: # test.add(entry.Name) if useLegacyTidyMethod: count = PerformClangFormatHelper.Process( log, toolConfig, customPackageFileFilter, clangFormatConfiguration, clangExeInfo, sortedPackages, repairEnabled, numBuildThreads) else: count = PerformClangFormatHelper2.Process( log, toolConfig, customPackageFileFilter, clangFormatConfiguration, cmakeConfig, clangExeInfo, ninjaExeInfo, sortedPackages, repairEnabled, numBuildThreads) if count == 0: if customPackageFileFilter is None: log.DoPrintWarning("No files processed") else: log.DoPrintWarning( "No files processed, could not find a package that matches {0}" .format(customPackageFileFilter))
def Run(log: Log, toolConfig: ToolConfig, formatPackageList: List[Package], customPackageFileFilter: Optional[CustomPackageFileFilter], packageRecipeResultManager: PackageRecipeResultManager, clangFormatConfiguration: ClangFormatConfiguration, repairEnabled: bool, buildThreads: int) -> None: """ RunClangFormat on a package at a time """ # Lookup the recommended build threads using the standard build algorithm buildThreads = PlatformBuildUtil.GetRecommendedBuildThreads(buildThreads) clangExeInfo = PerformClangUtil.LookupRecipeResults(packageRecipeResultManager, clangFormatConfiguration.RecipePackageName, MagicValues.ClangFormatCommand) if log.Verbosity >= 1: PerformClangUtil.ShowVersion(log, clangExeInfo) log.LogPrint("Running clang-format") # Filter the package list so it only contains things we can process finalPackageList = [package for package in formatPackageList if PerformClangUtil.CanProcessPackage(package)] sortedPackages = list(finalPackageList) sortedPackages.sort(key=lambda s: s.Name.lower()) count = PerformClangFormatHelper.Process(log, toolConfig, customPackageFileFilter, clangFormatConfiguration, clangExeInfo, sortedPackages, repairEnabled, buildThreads) if count == 0: if customPackageFileFilter is None: log.DoPrintWarning("No files processed") else: log.DoPrintWarning("No files processed, could not find a package that matches {0}".format(customPackageFileFilter))
def __init__(self, log: Log, generatorOriginalName: str, isCMakeGenerator: bool, buildThreads: int) -> None: self.Log = log self.AdditionalBuildArguments = [] # type: List[str] # The CMake generator adds the necessary parameters automatically # A future pass on this code should move the AddBuildThreads arguments to the generators instead as its more appropriate. numBuildThreads = 1 if not isCMakeGenerator: numBuildThreads = PlatformBuildUtil.AddBuildThreads( log, self.AdditionalBuildArguments, generatorOriginalName, buildThreads) else: numBuildThreads = PlatformBuildUtil.GetRecommendedBuildThreads( buildThreads) self.NumBuildThreads = numBuildThreads
def Run(log: Log, toolConfig: ToolConfig, platformId: str, topLevelPackage: Package, tidyPackageList: List[Package], userBuildVariantsDict: Dict[str, str], pythonScriptRoot: str, generatorContext: GeneratorContext, sdkConfigTemplatePath: str, packageRecipeResultManager: PackageRecipeResultManager, performClangTidyConfig: PerformClangTidyConfig, customPackageFileFilter: Optional[CustomPackageFileFilter], clangFormatFilename: Optional[str], buildThreads: int) -> None: """ RunClangTidy on a package at a time :param topLevelPackage: the top level system package :param tidyPackageList: the packages to 'tidy' :param userBuildVariantsDict: the variant configuration supplied by the user :param performClangTidyConfig: :param customPackageFileFilter: :param clangFormatFilename: :param repairEnabled: """ # Lookup the recommended build threads using the standard build algorithm buildThreads = PlatformBuildUtil.GetRecommendedBuildThreads( buildThreads) clangExeInfo = PerformClangUtil.LookupRecipeResults( packageRecipeResultManager, performClangTidyConfig.ClangTidyConfiguration.RecipePackageName, MagicValues.ClangTidyCommand) BuildVariantUtil.ValidateUserVariantSettings(log, topLevelPackage, userBuildVariantsDict) BuildVariantUtil.LogVariantSettings(log, userBuildVariantsDict) resolvedVariantSettingsDict = BuildVariantUtil.CreateCompleteStaticVariantSettings( topLevelPackage.ResolvedAllVariantDict, userBuildVariantsDict) if log.Verbosity >= 1: PerformClangUtil.ShowVersion(log, clangExeInfo) log.LogPrint("Running clang-tidy") # Filter the package list so it only contains things we can process finalPackageList = [ package for package in tidyPackageList if PerformClangUtil.CanProcessPackage(package) ] generatorConfig = GeneratorConfig(sdkConfigTemplatePath, toolConfig) generatorReportDict = generatorContext.Generator.GenerateReport( log, generatorConfig, finalPackageList) # Validate report dict for package in finalPackageList: if package not in generatorReportDict: raise Exception( "Generator report is missing information for package '{0}'" .format(package.Name)) localVariantInfo = LocalVariantInfo(resolvedVariantSettingsDict, generatorReportDict, pythonScriptRoot) count = PerformClangTidyHelper.ProcessAllPackages( log, toolConfig, platformId, pythonScriptRoot, performClangTidyConfig, clangExeInfo, finalPackageList, customPackageFileFilter, localVariantInfo, buildThreads) if count == 0: if customPackageFileFilter is None: log.DoPrintWarning("No files processed") else: log.DoPrintWarning( "No files processed, could not find a package that matches {0}" .format(customPackageFileFilter))