def __Filter(self, platformContext: PlatformContext, packageFilters: PackageFilters, autoAddRecipeExternals: bool, sourceGenFiles: List[XmlGenFile]) -> List[XmlGenFile]: if not packageFilters.ContainsFilters(): return sourceGenFiles self.Log.LogPrint("- Filtering") try: self.Log.PushIndent() packageResolver = PackageResolver(platformContext, self.Config, sourceGenFiles, autoAddRecipeExternals, False, self.MarkExternalLibFirstUse, packageFilters.RecipeFilterManager) packages = packageResolver.Packages topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) requestedFiles = self.SourceFiles requestedPackages = PackageUtil.TryGetPackageListFromFilenames(topLevelPackage, requestedFiles, False) resolvedBuildOrder = PackageFilter.Filter(self.Log, topLevelPackage, requestedPackages, packageFilters) # Now do a lookup of package -> Genfile to provide a filtered gen file list genFileSet = set(sourceGenFiles) return [package.GenFile for package in resolvedBuildOrder if package.GenFile is not None and package.GenFile in genFileSet] finally: self.Log.PopIndent()
def __TestGetPackageLoader(config: Config, files: List[str], platformId: str) -> PackageLoader: packageFilters = PackageFilters() platformGeneratorPlugin = PluginConfig.GetGeneratorPluginById( platformId, GeneratorType.Default, True, config.ToolConfig.CMakeConfiguration, None) return PackageLoader(config, files, platformGeneratorPlugin)
def __ResolveAndGetTopLevelPackage(self, generatorContext: GeneratorContext, config: Config, currentDir: str, toolMiniConfig: ToolMinimalConfig, recursive: bool) -> Package: # Since we use this to discover filters, we just use a empty one noPackageFilters = PackageFilters() theFiles = MainFlow.DoGetFiles(config, toolMiniConfig, currentDir, recursive) packages = MainFlow.DoGetPackages(generatorContext, config, theFiles, noPackageFilters) return PackageListUtil.GetTopLevelPackage(packages)
def __TestGenerateBuildFiles(config: Config, files: List[str], platformId: str) -> Dict[str, List[Package]]: packageFilters = PackageFilters() platform = PluginConfig.GetGeneratorPluginById(platformId, True) buildFilesDict = DoGenerateBuildFiles3(config, files, platform, packageFilters) return { dictKey: dictValue[0] for dictKey, dictValue in buildFilesDict.items() }
def __init__(self) -> None: self.AllowDevelopmentPlugins = DefaultValue.AllowDevelopmentPlugins self.BuildThreads = DefaultValue.BuildThreads self.DefaultPlatformName = DefaultValue.PlatformName self.ForceClaimInstallArea = DefaultValue.ForceClaimInstallArea self.PlatformName = DefaultValue.PlatformName self.RemainingArgs = DefaultValue.RemainingArgs self.VSVersion = None # type: Optional[int] self.BuildPackageFilters = PackageFilters() self.BuildVariantsDict = {} # type: Dict[str, str] self.Recursive = False
def __TestGetPackageLoader(config: Config, files: List[str], platformId: str) -> PackageLoader: packageFilters = PackageFilters() #generatorCMakeConfig = __GetTestGeneratorCMakeConfig() log = config # type: Log pluginConfigContext = PluginConfig.InitPluginConfigContext( log, config.ToolConfig.ToolVersion, allowDevelopmentPlugins=True) buildVariantConfig = BuildVariantConfig.Debug platformGeneratorPlugin = pluginConfigContext.GetGeneratorPluginById( platformId, GeneratorType.Default, buildVariantConfig, True, config.ToolConfig.CMakeConfiguration, None) return PackageLoader(config, files, platformGeneratorPlugin)
def ForceCheckBuildTools(configToolCheck: Config, generatorContext: GeneratorContext, toolPackageNames: List[str]) -> PackageRecipeResultManager: configToolCheck.LogPrint("BuildTools check"); plugin = generatorContext.Platform filePathList = [] # type: List[str] packageFilters = PackageFilters() packages = MainFlow.DoGetPackages(generatorContext, configToolCheck, filePathList, packageFilters, forceImportPackageNames=toolPackageNames) packageRecipeResultManager = PackageRecipeResultManager(configToolCheck); builderConfig = BuilderConfig() builderConfig.Settings.CheckBuildCommands = True RecipeBuilder.BuildPackages(configToolCheck, generatorContext, builderConfig, packages, packageRecipeResultManager) return packageRecipeResultManager
def __TestGenerateBuildFiles(config: Config, files: List[str], platformId: str) -> Dict[str, List[Package]]: errorHelpManager = ErrorHelpManager() packageFilters = PackageFilters() log = config # type: Log #generatorCMakeConfig = __GetTestGeneratorCMakeConfig() pluginConfigContext = PluginConfig.InitPluginConfigContext( log, config.ToolConfig.ToolVersion, allowDevelopmentPlugins=True) buildVariantConfig = BuildVariantConfig.Debug platform = pluginConfigContext.GetGeneratorPluginById( platformId, GeneratorType.Default, buildVariantConfig, True, config.ToolConfig.CMakeConfiguration, None) buildFilesDict = DoGenerateBuildFiles3(pluginConfigContext, config, errorHelpManager, files, platform, packageFilters) return { dictKey: dictValue[0] for dictKey, dictValue in buildFilesDict.items() }
def __init__(self) -> None: self.AllowDevelopmentPlugins = DefaultValue.AllowDevelopmentPlugins self.BuildThreads = DefaultValue.BuildThreads self.DefaultPlatformName = DefaultValue.PlatformName self.ForceClaimInstallArea = DefaultValue.ForceClaimInstallArea self.PlatformName = DefaultValue.PlatformName self.Generator = DefaultValue.Generator self.RemainingArgs = DefaultValue.RemainingArgs self.VSVersion = None # type: Optional[int] self.BuildPackageFilters = PackageFilters() self.BuildVariantsDict = {} # type: Dict[str, str] self.Recursive = False self.CMakeBuildDir = DefaultValue.CMakeBuildDir self.CMakeInstallPrefix = DefaultValue.CMakeInstallPrefix self.CMakeGeneratorName = DefaultValue.CMakeGeneratorName self.CMakeConfigArgs = DefaultValue.CMakeConfigArgs self.CMakeConfigGlobalArgs = DefaultValue.CMakeConfigGlobalArgs self.CMakeAllowFindPackage = DefaultValue.CMakeAllowFindPackage
def __TestGenerateBuildFilesAllPlatforms( config: Config, files: List[str]) -> Dict[str, List[Package]]: res = {} # type: Dict[str, List[Package]] for platformId in PackageConfig.APPROVED_PLATFORM_NAMES: errorHelpManager = ErrorHelpManager() packageFilters = PackageFilters() log = config # type: Log #generatorCMakeConfig = __GetTestGeneratorCMakeConfig() pluginConfigContext = PluginConfig.InitPluginConfigContext( log, config.ToolConfig.ToolVersion, allowDevelopmentPlugins=True) pluginConfigContext.SetVSVersion( str(config.ToolConfig.GetVisualStudioDefaultVersion())) buildVariantConfig = BuildVariantConfig.Debug platform = pluginConfigContext.GetGeneratorPluginById( platformId, GeneratorType.Default, buildVariantConfig, config.ToolConfig.DefaultPackageLanguage, config.ToolConfig.CMakeConfiguration, None, False) resultTuple = DoGenerateBuildFilesNow(pluginConfigContext, config, errorHelpManager, files, platform, packageFilters) if resultTuple is not None: res[platformId] = resultTuple[0] return res
def __TestGetPackageLoader(config: Config, files: List[str], platformId: str) -> PackageLoader: packageFilters = PackageFilters() platformGeneratorPlugin = PluginConfig.GetGeneratorPluginById(platformId, True) return PackageLoader(config, files, platformGeneratorPlugin)