def __TryValidateInstallation(basicConfig: BasicConfig, validationEngine: ValidationEngine, package: Package, packagesToBuild: List[Package], recipePackageStateCache: RecipePackageStateCache, cmakeConfig: GeneratorCMakeConfig) -> bool: if package.ResolvedDirectExperimentalRecipe is None: raise Exception("Invalid package") sourceRecipe = package.ResolvedDirectExperimentalRecipe installPath = sourceRecipe.ResolvedInstallLocation if installPath is not None: if not IOUtil.IsDirectory(installPath.ResolvedPath): basicConfig.LogPrintVerbose( 2, "Installation directory not located: {0}".format( installPath.ResolvedPath)) return False elif basicConfig.Verbosity >= 2: basicConfig.LogPrint( "Installation directory located at '{0}'".format( installPath.ResolvedPath)) # Check if the user decided to do a build override by creating the required file. # This allows the user to tell the system that it has been build and it should mind its own buisness packageHasUserBuildOverride = False if not installPath is None: overrideFilename = IOUtil.Join( installPath.ResolvedPath, __g_BuildPackageInformationOverrideFilename) packageHasUserBuildOverride = IOUtil.IsFile(overrideFilename) if packageHasUserBuildOverride: basicConfig.LogPrint( "Package {0} contained a build override file '{1}'".format( package.Name, __g_BuildPackageInformationOverrideFilename)) if not __RunValidationEngineCheck(validationEngine, package): if packageHasUserBuildOverride: raise Exception( "Package {0} contained a build override file '{1}', but it failed validation. Fix the issues or delete the override file '{2}'" .format(package.Name, __g_BuildPackageInformationOverrideFilename, overrideFilename)) basicConfig.LogPrintVerbose(2, "Install validation failed") return False # If there is a user build override we dont check the build dependency json file if packageHasUserBuildOverride: return True # If there is no build pipeline we consider the validation to be completed, else we need to check the saved build info if not PackageRecipeUtil.HasBuildPipeline(package): return True if not BuildInfoFileUtil.TryValidateBuildInformation( basicConfig, package, packagesToBuild, recipePackageStateCache, cmakeConfig, __g_BuildPackageInformationFilename): basicConfig.LogPrintVerbose( 2, "Install validator failed to load build information") return False return True
def __DoBuildPackagesInOrder( config: Config, generatorContext: GeneratorContext, resolvedBuildOrder: List[Package], builderSettings: BuilderSettings, packageRecipeResultManager: PackageRecipeResultManager) -> None: basicConfig = generatorContext.BasicConfig if not generatorContext.RecipePathBuilder.IsEnabled: basicConfig.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( basicConfig, generatorContext.RecipePathBuilder.TargetLocation.ResolvedPath, config.SDKPath, builderSettings.ForceClaimInstallArea, __g_installAreaInformationFilename) if resolvedBuildOrder is None: basicConfig.LogPrintVerbose(2, "No recipes to build") 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: basicConfig.LogPrintVerbose(2, "No recipes to build") return recipePackageStateCache = RecipePackageStateCache(basicConfig) validationEngine = ValidationEngine(basicConfig, generatorContext.VariableProcessor, packageRecipeResultManager) missingPackagesInBuildOrder = __FindMissingInstallations( basicConfig, validationEngine, resolvedBuildOrder, recipePackageStateCache) builder = PipelineCommandBuilder(generatorContext, builderSettings.CheckBuildCommands, builderSettings.BuildThreads) recipeRecords = __CreatePipelines(basicConfig, builder, missingPackagesInBuildOrder) for recipeRecord in recipeRecords: basicConfig.LogPrint("Package location: {0}".format( recipeRecord.SourcePackage.AbsolutePath)) try: basicConfig.PushIndent() if not recipeRecord.SourcePackage.ResolvedPlatformDirectSupported: raise Exception( "The package '{0}' is not supported on this platform". format(recipeRecord.SourcePackage.Name)) if not recipeRecord.Pipeline is None: basicConfig.DoPrint("Building package: {0}".format( recipeRecord.SourcePackage.Name)) if builderSettings.PreDeleteBuild: # We clear the build path to prepare for a new build IOUtil.SafeRemoveDirectoryTree( recipeRecord.Pipeline.BuildPath) for command in recipeRecord.Pipeline.CommandList: if not config.IsDryRun: command.Execute() # We finished building, so lets save some information about what we did BuildInfoFileUtil.SaveBuildInformation( basicConfig, recipeRecord, recipePackageStateCache, __g_BuildPackageInformationFilename) if builderSettings.PostDeleteBuild: # We clear the build path if a build is successfull IOUtil.SafeRemoveDirectoryTree( recipeRecord.Pipeline.BuildPath, True) else: # Since we are trying to build this it means that the installation validation failed earlier and # we apparently have no pipelines that could remedy it, so force the install validation to occur so # we fail early as 'dependent' pipes might fail to build due to this # generatorContext.RecipeFilterManager if generatorContext.RecipeFilterManager.AllRecipesEnabled or recipeRecord.SourcePackage.Name in generatorContext.RecipeFilterManager.ContentDict: basicConfig.DoPrintWarning( "Missing installation of package '{0}' and no recipe for solving it is available" .format(recipeRecord.SourcePackage.Name)) else: basicConfig.LogPrintVerbose( 4, "Package '{0}' recipe not enabled".format( recipeRecord.SourcePackage.Name)) validationEngine.Process(recipeRecord.SourcePackage) finally: basicConfig.PopIndent() validationEngine.Process(recipeRecord.SourcePackage) packageCount = len(recipeRecords) if packageCount > 0: basicConfig.LogPrint("Build {0} packages".format(packageCount)) else: basicConfig.LogPrintVerbose(2, "No recipe was build!")