Exemple #1
0
    def __CreateCommandList(
            self, builder: PipelineCommandBuilder, sourcePackage: Package,
            sourceRecipe: PackageExperimentalRecipe) -> List[PipelineCommand]:
        if sourceRecipe.Pipeline is None:
            raise Exception("Invalid recipe")

        #isAndroidBuild = (sourcePackage.ResolvedPlatform is not None and sourcePackage.ResolvedPlatform.Name == PlatformNameString.ANDROID)

        builder.Begin(sourcePackage, sourceRecipe)
        #if not isAndroidBuild:
        for sourceCommand in sourceRecipe.Pipeline.CommandList:
            builder.Add(sourceCommand, False)
        #else:
        #    # We handle cmake differently in android builds for now
        #    # This is until we get a proper solution that will allow us to prebuild libraries
        #    for index, sourceCommand in enumerate(sourceRecipe.Pipeline.CommandList):
        #        skip = False
        #        if sourceCommand.CommandType == BuildRecipePipelineCommand.CMakeBuild:
        #            # Validate our pipeline assumptions that allow CMakeBuild to work on android
        #            if index != (len(sourceRecipe.Pipeline.CommandList)-1):
        #                raise Exception("CMakeBuild can only be the last entry in a android package {0} recipe".format(sourcePackage.Name))
        #            elif sourceCommand.JoinCommandList is not None and len(sourceCommand.JoinCommandList) > 0:
        #                raise Exception("CMakeBuild in a android package {0} recipe can not contian join commands".format(sourcePackage.Name))
        #            skip = True
        #        builder.Add(sourceCommand, skip)
        return builder.End()
Exemple #2
0
 def __init__(self, log: Log, builder: PipelineCommandBuilder,
              sourcePackage: Package,
              sourceRecipe: PackageExperimentalRecipe) -> None:
     super().__init__()
     self._Log = log
     self.SourcePackage = sourcePackage
     self.SourceRecipe = sourceRecipe
     self.SourcePipeline = sourceRecipe.Pipeline
     self.InstallPath = sourceRecipe.ResolvedInstallLocation
     self.BuildPath = builder.GetBuildPath(sourceRecipe)
     self.CommandList = self.__CreateCommandList(builder,
                                                 self.SourcePackage,
                                                 self.SourceRecipe)
Exemple #3
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!")