Beispiel #1
0
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)
Beispiel #2
0
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!")