def ValidateInstallationForPackages(log: Log, configSDKPath: str, generatorContext: GeneratorContext, resolvedBuildOrder: List[Package], builderSettings: BuilderSettings = BuilderSettings(), packageRecipeResultManager: Optional[PackageRecipeResultManager] = None) -> None: if packageRecipeResultManager is None: packageRecipeResultManager = PackageRecipeResultManager(log) if not generatorContext.RecipePathBuilder.IsEnabled: log.LogPrintVerbose(3, "External building has been disabled in the Project.gen file") return if generatorContext.RecipePathBuilder.TargetLocation is None: raise Exception("Invalid path builder") # Claim the 'package' install directory to prevent multiple builds from using the same # as it would give concurrency issues BuildAreaInfoFileUtil.ProcessInstallDirClaim(log, generatorContext.RecipePathBuilder.TargetLocation.ResolvedPath, configSDKPath, builderSettings.ForceClaimInstallArea, __g_installAreaInformationFilename) if resolvedBuildOrder is None: return # Filter all packages that don't have a experimental recipe resolvedBuildOrder = [entry for entry in resolvedBuildOrder if not entry.ResolvedDirectExperimentalRecipe is None] if len(resolvedBuildOrder) == 0: return recipePackageStateCache = RecipePackageStateCache(log) # Here we basically run the installation validation engine and see if there is anything that triggers a exception validationEngine = ValidationEngine(log, generatorContext.VariableProcessor, packageRecipeResultManager, generatorContext.ErrorHelpManager) __FindMissingInstallations(log, validationEngine, resolvedBuildOrder, recipePackageStateCache, generatorContext.CMakeConfig)
def BuildPackagesInOrder(log: Log, configSDKPath: str, configIsDryRun: bool, generatorContext: GeneratorContext, resolvedBuildOrder: List[Package], builderSettings: BuilderSettings = BuilderSettings(), packageRecipeResultManager: Optional[PackageRecipeResultManager] = None) -> None: if packageRecipeResultManager is None: packageRecipeResultManager = PackageRecipeResultManager(log) __DoBuildPackagesInOrder(log, configSDKPath, configIsDryRun, generatorContext, resolvedBuildOrder, builderSettings, packageRecipeResultManager)
def BuildPackagesInOrder( config: Config, generatorContext: GeneratorContext, resolvedBuildOrder: List[Package], builderSettings: BuilderSettings = BuilderSettings(), packageRecipeResultManager: Optional[PackageRecipeResultManager] = None ) -> None: if packageRecipeResultManager is None: packageRecipeResultManager = PackageRecipeResultManager(config) __DoBuildPackagesInOrder(config, generatorContext, resolvedBuildOrder, builderSettings, packageRecipeResultManager)
def __init__(self) -> None: self.Settings = BuilderSettings()
def __init__(self, generatorContext: GeneratorContext, config: Config, topLevelPackage: Package, buildConfig: BuildConfigRecord, enableContentBuilder: bool, forceClaimInstallArea: bool) -> None: super().__init__() self.Log = config localPlatformBuildContext = LocalPlatformBuildContext( config, generatorContext.Generator.OriginalPlatformName, generatorContext.Generator.IsCMake, buildConfig.BuildThreads) # Do a final filter that removes all unsupported packages resolvedBuildOrder = topLevelPackage.ResolvedBuildOrder resolvedBuildOrder = PackageFilter.FilterNotSupported( self.Log, topLevelPackage, resolvedBuildOrder) if not PackageFilter.WasThisAExecutableBuildAndAreThereAnyLeft( topLevelPackage.ResolvedBuildOrder, resolvedBuildOrder): self.Log.DoPrint("No executables left, skipping all") return # Run the recipe builder on the packages we have left # We run the recipe builder on the resolvedBuildOrder since it all required packages, not just the ones we need to build as libs and executables builderSettings = BuilderSettings() builderSettings.ForceClaimInstallArea = forceClaimInstallArea builderSettings.BuildThreads = buildConfig.BuildThreads RecipeBuilder.BuildPackagesInOrder(config, generatorContext, resolvedBuildOrder, builderSettings) resolvedBuildOrderBuildable = PackageFilter.FilterBuildablePackages( resolvedBuildOrder) if len(resolvedBuildOrderBuildable) == 0: config.DoPrint("Nothing to build!") return generatorConfig = GeneratorConfig( generatorContext.PlatformName, config.SDKConfigTemplatePath, config.ToolConfig, localPlatformBuildContext.NumBuildThreads, buildConfig.BuildCommand) generatorConfigReport = generatorContext.Generator.TryGenerateConfigReport( self.Log, generatorConfig, topLevelPackage) packageCount = len(resolvedBuildOrderBuildable) resolvedBuildOrderBuildable = self.__ApplyPlatformOrderChanges( resolvedBuildOrderBuildable, buildConfig.PlatformName) originalBuildArgs = buildConfig.BuildArgs # Handle the configure step masterBuildReport = None # type: Optional[GeneratorBuildReport] masterBuildVariableReport = None # type: Optional[GeneratorVariableReport] if generatorConfigReport is not None: # Setup some extra variables for configure self.__AddCustomVariables(generatorConfigReport.VariableReport, config.ToolConfig.ProjectInfo) self.__ConfigureBuild(generatorConfigReport, buildConfig) masterBuildReport = generatorConfigReport.MasterBuildReport masterBuildVariableReport = generatorConfigReport.MasterBuildVariableReport if masterBuildVariableReport is not None: self.__AddCustomVariables(masterBuildVariableReport, config.ToolConfig.ProjectInfo) # Acquire information about the build step generatorReport = generatorContext.Generator.GenerateReport( self.Log, generatorConfig, resolvedBuildOrderBuildable) generatorReportDict = generatorReport.PackageReportDict for generatorEntry in generatorReportDict.values(): if generatorEntry.VariableReport is not None: self.__AddCustomVariables(generatorEntry.VariableReport, config.ToolConfig.ProjectInfo) # Default content building for all platform (for those generators that don't add it to the build file) builderCanBuildContent = (generatorConfigReport is not None and generatorConfigReport.CanBuildContent) if enableContentBuilder and not builderCanBuildContent: for package in resolvedBuildOrderBuildable: if package.Type == PackageType.Executable: featureList = [ entry.Name for entry in package.ResolvedAllUsedFeatures ] if package.Path is None: raise Exception("Invalid package") ContentBuilder.Build(config, package.Path, featureList) # Windows runs its validation checks slightly differently runValidationChecks = (buildConfig.PlatformName != PlatformNameString.WINDOWS) buildContext = LocalBuildContext(config, localPlatformBuildContext, generatorReportDict, generatorContext.GeneratorName) if masterBuildReport is not None: if masterBuildVariableReport is None: raise Exception("master-build must have a variable report") self.__BuildMaster(buildConfig, buildContext, masterBuildReport, masterBuildVariableReport, topLevelPackage, originalBuildArgs, builderCanBuildContent, runValidationChecks, config.IsDryRun) # Build and run all the packages in the resolvedBuildOrderBuildable self.__BuildAndRunPackages(config, buildConfig, buildContext, resolvedBuildOrderBuildable, originalBuildArgs, builderCanBuildContent, runValidationChecks, masterBuildReport is None, config.IsDryRun, generatorConfig) if packageCount > 0: config.LogPrint("Build {0} packages".format(packageCount)) else: config.DoPrint("Nothing build!") if generatorContext.Generator.IsCMake and buildConfig.BuildCommand == CommandType.Clean: self.Log.DoPrint( "*** To do a full cmake clean build delete the out of source build folder ***" ) if not generatorContext.Generator.SupportCommandClean and buildConfig.BuildCommand == CommandType.Clean: self.Log.DoPrint("*** clean not supported by this builder ***") if not generatorContext.Generator.SupportCommandInstall and buildConfig.BuildCommand == CommandType.Install: self.Log.DoPrint("*** install not supported by this builder ***")
def __init__(self, generatorContext: GeneratorContext, config: Config, topLevelPackage: Package, buildConfig: BuildConfigRecord, enableContentBuilder: bool, forceClaimInstallArea: bool) -> None: super(Builder, self).__init__() self.Log = config localPlatformBuildContext = LocalPlatformBuildContext( config, generatorContext.Generator.OriginalName, buildConfig.BuildCommand, buildConfig.BuildThreads) # Do a final filter that removes all unsupported packages resolvedBuildOrder = topLevelPackage.ResolvedBuildOrder resolvedBuildOrder = PackageFilter.FilterNotSupported( self.Log, topLevelPackage, resolvedBuildOrder) if not PackageFilter.WasThisAExecutableBuildAndAreThereAnyLeft( topLevelPackage.ResolvedBuildOrder, resolvedBuildOrder): self.Log.DoPrint("No executables left, skipping all") return # Run the recipe builder on the packages we have left # We run the recipe builder on the resolvedBuildOrder since it all required packages, not just the ones we need to build as libs and executables builderSettings = BuilderSettings() builderSettings.ForceClaimInstallArea = forceClaimInstallArea builderSettings.BuildThreads = buildConfig.BuildThreads RecipeBuilder.BuildPackagesInOrder(config, generatorContext, resolvedBuildOrder, builderSettings) resolvedBuildOrderBuildable = PackageFilter.FilterBuildablePackages( resolvedBuildOrder) if len(resolvedBuildOrderBuildable) == 0: config.DoPrint("Nothing to build!") return generatorConfig = GeneratorConfig(config.SDKConfigTemplatePath, config.ToolConfig) generatorReportDict = generatorContext.Generator.GenerateReport( self.Log, generatorConfig, resolvedBuildOrderBuildable) packageCount = len(resolvedBuildOrderBuildable) resolvedBuildOrderBuildable = self.__ApplyPlatformOrderChanges( resolvedBuildOrderBuildable, buildConfig.PlatformName) originalBuildArgs = buildConfig.BuildArgs # Default content building for all platform (for those generators that don't add it to the build file) if enableContentBuilder: for package in resolvedBuildOrderBuildable: if package.Type == PackageType.Executable: featureList = [ entry.Name for entry in package.ResolvedAllUsedFeatures ] if package.AbsolutePath is None: raise Exception("Invalid package") ContentBuilder.Build(config, package.AbsolutePath, featureList) # Windows runs its validation checks slightly differently runValidationChecks = (buildConfig.PlatformName != PlatformNameString.WINDOWS) buildContext = LocalBuildContext(config, localPlatformBuildContext, generatorReportDict, generatorContext.GeneratorName) for package in resolvedBuildOrderBuildable: config.LogPrint("Building package: {0}".format(package.Name)) config.LogPrint("Package location: {0}".format( package.AbsolutePath)) if not config.IsDryRun: buildEnv = os.environ.copy() # type: Dict[str, str] buildEnv[CONFIG_FSLBUILDCONTENT_ENABLED] = "false" BuildVariantUtil.ExtendEnvironmentDictWithVariants( config, buildEnv, package, buildConfig.VariantSettingsDict) buildConfig.BuildArgs = list(originalBuildArgs) if config.Verbosity > 4: config.DoPrint("Package build arguments1: {0}".format( buildConfig.BuildArgs)) config.DoPrint("General build arguments2: {0}".format( originalBuildArgs)) strRunCommands = buildConfig.RunCommand runCommands = None # type: Optional[List[str]] if strRunCommands is not None: userRunCommands = shlex.split(strRunCommands) runCommands = self.__TryGenerateRunCommandForExecutable( buildContext, package, buildConfig.VariantSettingsDict, userRunCommands) if runValidationChecks: featureList = [ entry.Name for entry in package.ResolvedAllUsedFeatures ] Validate.ValidatePlatform(config, buildConfig.PlatformName, featureList, 4) self.__BuildPackage(buildContext, package, buildConfig, buildEnv, runCommands) if packageCount > 0: config.LogPrint("Build {0} packages".format(packageCount)) else: config.DoPrint("Nothing build!")