def Build(config: Config,
          packagePath: PackagePath,
          featureList: List[str],
          outputPath: Optional[str] = None) -> None:
    currentPath = packagePath.AbsoluteDirPath
    contentBuildDir = ToolSharedValues.CONTENT_BUILD_FOLDER_NAME
    contentBuildPath = IOUtil.Join(currentPath, contentBuildDir)

    contentOutputPath = GetContentOutputPath(
        packagePath) if outputPath is None else outputPath

    if not IOUtil.IsDirectory(contentBuildPath):
        config.LogPrintVerbose(
            1,
            "No '{0}' directory present at '{1}' so there is no content to process."
            .format(contentBuildDir, currentPath))
        return

    packageBuildPath = IOUtil.Join(currentPath, config.GetBuildDir())
    if not config.DisableWrite:
        IOUtil.SafeMakeDirs(packageBuildPath)

    contentProcessorManager = GetContentProcessorManager(config, featureList)
    Builder(config, packageBuildPath, contentBuildPath, contentOutputPath,
            contentProcessorManager)
示例#2
0
def Build(config: Config, currentPath: str, featureList: List[str]) -> None:
    contentBuildDir = __CONTENT_BUILD_DIR
    contentOutputDir = __CONTENT_OUTPUT_DIR
    contentBuildPath = IOUtil.Join(currentPath, contentBuildDir)
    contentOutputPath = IOUtil.Join(currentPath, contentOutputDir)
    if not IOUtil.IsDirectory(contentBuildPath):
        config.LogPrintVerbose(
            1,
            "No '{0}' directory present at '{1}' so there is no content to process."
            .format(contentBuildDir, currentPath))
        return

    packageBuildPath = IOUtil.Join(currentPath, config.GetBuildDir())
    if not config.DisableWrite:
        IOUtil.SafeMakeDirs(packageBuildPath)

    toolFinder = ToolFinder(config)
    features = Features(config, featureList)
    Builder(config, packageBuildPath, contentBuildPath, contentOutputPath,
            features, toolFinder)
示例#3
0
    def Process(self, currentDirPath: str, toolConfig: ToolConfig,
                localToolConfig: LocalToolConfig) -> None:
        config = Config(self.Log, toolConfig,
                        localToolConfig.PackageConfigurationType,
                        localToolConfig.BuildVariantsDict,
                        localToolConfig.AllowDevelopmentPlugins)

        if localToolConfig.DryRun:
            config.ForceDisableAllWrite()
        if localToolConfig.IgnoreNotSupported:
            config.IgnoreNotSupported = True

        if localToolConfig.Graph:
            self.ToolAppContext.PluginConfigContext.EnableGraph()

        self.ToolAppContext.PluginConfigContext.SetLegacyGeneratorType(
            localToolConfig.GenType)

        buildVariantConfig = BuildVariantConfigUtil.GetBuildVariantConfig(
            localToolConfig.BuildVariantsDict)
        platformGeneratorPlugin = self.ToolAppContext.PluginConfigContext.GetGeneratorPluginById(
            localToolConfig.PlatformName, localToolConfig.Generator,
            buildVariantConfig, config.ToolConfig.DefaultPackageLanguage,
            config.ToolConfig.CMakeConfiguration,
            localToolConfig.GetUserCMakeConfig(), False)
        generatorContext = GeneratorContext(
            config, self.ErrorHelpManager,
            localToolConfig.BuildPackageFilters.RecipeFilterManager,
            config.ToolConfig.Experimental, platformGeneratorPlugin)

        theFiles = MainFlow.DoGetFiles(
            config,
            toolConfig.GetMinimalConfig(platformGeneratorPlugin.CMakeConfig),
            currentDirPath, localToolConfig.Recursive)

        packages = MainFlow.DoGenerateBuildFiles(
            self.ToolAppContext.PluginConfigContext,
            config,
            self.ErrorHelpManager,
            theFiles,
            platformGeneratorPlugin,
            localToolConfig.BuildPackageFilters,
            writeGraph=localToolConfig.Graph2)

        # If the platform was manually switched, then check if the build platform is supported,
        # if its not disable recipe building and log a warning
        if localToolConfig.DefaultPlatformName != localToolConfig.PlatformName:
            if not PlatformUtil.TryCheckBuildPlatform(
                    localToolConfig.PlatformName):
                self.Log.DoPrintWarning(
                    "Build recipes not supported for '{0}' on this OS".format(
                        localToolConfig.PlatformName))
                localToolConfig.DontBuildRecipes = True

        if localToolConfig.ListVariants or localToolConfig.ListBuildVariants:
            requestedFiles = None if config.IsSDKBuild else theFiles
            if not isinstance(packages, dict):
                self.__DoShowList(packages, requestedFiles,
                                  localToolConfig.ListVariants,
                                  localToolConfig.ListBuildVariants,
                                  platformGeneratorPlugin)
            else:
                for platformName, platformResult in packages.items():
                    platformPackageList = platformResult[0]
                    if len(platformPackageList) > 0:
                        self.Log.DoPrint("Generator: {0}".format(platformName))
                        try:
                            self.Log.PushIndent()
                            self.__DoShowList(
                                platformPackageList, requestedFiles,
                                localToolConfig.ListVariants,
                                localToolConfig.ListBuildVariants,
                                platformResult[1])
                        finally:
                            self.Log.PopIndent()
        elif not localToolConfig.DontBuildRecipes:
            self.__DoBuildRecipes(config, generatorContext, packages,
                                  localToolConfig.ForceClaimInstallArea,
                                  localToolConfig.BuildThreads)

            if generatorContext.Generator.IsCMake:
                # Ensure we do what corrosponds to a  "FslBuild -c config" for cmake generators
                if localToolConfig.BuildPackageFilters is None or localToolConfig.BuildPackageFilters.ExtensionNameList is None:
                    raise Exception(
                        "localToolConfig.BuildPackageFilters.ExtensionNameList not set"
                    )
                requestedFiles = None if config.IsSDKBuild else theFiles
                requestedPackages = BuildHelper.FindRequestedPackages(
                    config, packages, requestedFiles)

                localToolConfigCommand = CommandType.Config
                localToolConfigEnableContentBuilder = True
                localToolConfigForAllExe = None

                Builder.BuildPackages(
                    self.Log, config.GetBuildDir(), config.SDKPath,
                    config.SDKConfigTemplatePath, config.DisableWrite,
                    config.IsDryRun, toolConfig, generatorContext, packages,
                    requestedPackages, localToolConfig.BuildVariantsDict,
                    localToolConfig.RemainingArgs, localToolConfigForAllExe,
                    platformGeneratorPlugin,
                    localToolConfigEnableContentBuilder,
                    localToolConfig.ForceClaimInstallArea,
                    localToolConfig.BuildThreads, localToolConfigCommand, True)
示例#4
0
    def __init__(self, config: Config, genFile: XmlGenFile) -> None:
        super().__init__()
        self._BasicConfig = config
        self.GenFile = genFile
        self.SourceFileHash = genFile.SourceFileHash
        self.XMLElement = genFile.XMLElement
        self.TemplateType = genFile.TemplateType
        self.AllowCheck = genFile.AllowCheck
        self.PackageNameBasedIncludePath = genFile.PackageNameBasedIncludePath
        self.EnableExtendedSourceExtensions = genFile.EnableExtendedSourceExtensions  # type: bool

        # Clone all attributes that exist on a genFile
        self.BaseIncludePath = genFile.BaseIncludePath
        self.BaseSourcePath = genFile.BaseSourcePath
        self.PackageLocation = genFile.PackageLocation
        self.Name = genFile.Name
        self.ShortName = genFile.ShortName
        self.Namespace = genFile.Namespace
        self.Type = genFile.Type
        self.IsVirtual = genFile.IsVirtual
        self.PlatformDefaultSupportedValue = genFile.PlatformDefaultSupportedValue
        #self.__DirectDependencies = genFile.DirectDependencies
        self.DirectDefines = genFile.DirectDefines
        self.Platforms = self.__BuildPlatformsDict(genFile.Platforms)
        self.AbsolutePath = genFile.AbsolutePath
        self.AbsoluteIncludePath = genFile.AbsoluteIncludePath
        self.AbsoluteSourcePath = genFile.AbsoluteSourcePath
        self.AbsoluteContentPath = genFile.AbsoluteContentPath
        self.AbsoluteContentSourcePath = genFile.AbsoluteContentSourcePath
        self.AbsoluteBuildPath = IOUtil.Join(
            self.AbsolutePath,
            config.GetBuildDir()) if self.AbsolutePath is not None else None
        self.AllowDependencyOnThis = self.__ResolveAllowDependencyOnThis(
            self.Type)
        self.PackageLanguage = genFile.PackageLanguage
        self.BuildCustomization = PackageBuildCustomization(
            genFile.BuildCustomization)
        # The year the package was created
        self.CreationYear = genFile.CreationYear
        self.CompanyName = genFile.CompanyName

        # Fill all the package attributes that will be resolved with a initial value
        self.ResolvedPlatform = None  # type: Optional[PackagePlatform]
        self.ResolvedPlatformNotSupported = False
        self.ResolvedPlatformDirectSupported = True
        self.ResolvedPlatformName = None  # type: Optional[str]
        # All direct dependencies of this package
        self.ResolvedDirectDependencies = []  # type: List['PackageDependency']
        # All dependencies both direct and indirect
        self.ResolvedAllDependencies = []  # type: List['PackageDependency']
        # The build order of dependent packages
        self.ResolvedBuildOrder = []  # type: List['Package']
        # This is basically the 'resolved build order of the package' filtered down to packages that contain a experimental recipe.
        self.ResolvedExperimentalRecipeBuildOrder = []  # type: List['Package']
        self.ResolvedToolDependencyOrder = []  # type: List['Package']
        # The known recipe variants, currently used for android ABI's
        self.ResolvedRecipeVariants = []  # type: List[str]
        self.ResolvedBuildSourceFiles = None  # type: Optional[List[str]]
        # The content files in this package
        self.ResolvedBuildContentFiles = None  # type: Optional[List[str]]
        # The content source files in this package (the content files that need to be build)
        self.ResolvedBuildContentSourceFiles = None  # type: Optional[List[str]]
        # The public include files in this package
        self.ResolvedBuildPublicIncludeFiles = None  # type: Optional[List[str]]
        # All include files in this package (public+private)
        self.ResolvedBuildAllIncludeFiles = None  # type: Optional[List[str]]
        self.ResolvedBuildAllIncludeDirs = None  # type: Optional[List[str]]
        self.ResolvedBuildPublicIncludeDirs = None  # type: Optional[List[str]]
        self.ResolvedBuildPrivateIncludeDirs = None  # type: Optional[List[str]]
        # All direct featue uses of this package
        self.ResolvedDirectUsedFeatures = []  # type: List[PackageRequirement]
        # All feature uses both direct and indirect
        self.ResolvedAllUsedFeatures = []  # type: List[PackageRequirement]
        # All direct requirements of this package
        self.ResolvedDirectRequirements = []  # type: List[PackageRequirement]
        # All requirements both direct and indirect
        self.ResolvedAllRequirements = []  # type: List[PackageRequirement]
        # All the direct cpp defines of this package
        self.ResolvedBuildDirectDefines = None  # type: Optional[List['PackageDefine']]
        # All the cpp defines that touch this package (direct and inherited)
        self.ResolvedBuildAllDefines = []  # type: List['PackageDefine']
        # All the public cpp defines that touch this package (direct and inherited)
        self.ResolvedBuildAllPublicDefines = None  # type: Optional[List['PackageDefine']]
        # All the private cpp defines that touch this package (direct and inherited)
        self.ResolvedBuildAllPrivateDefines = None  # type: Optional[List['PackageDefine']]
        # All direct external dependencies
        self.ResolvedDirectExternalDependencies = [
        ]  # type: List[PackageExternalDependency]
        # All the ExternalDeps that touch this package (direct and inherited)
        self.ResolvedBuildAllExternalDependencies = None  # type: Optional[List[PackageExternalDependency]]
        # All the public ExternalDeps that touch this package (direct and inherited)
        self.ResolvedBuildAllPublicExternalDependencies = None  # type: Optional[List[PackageExternalDependency]]
        # All the private ExternalDeps that touch this package (direct and inherited)
        self.ResolvedBuildAllPrivateExternalDependencies = None  # type: Optional[List[PackageExternalDependency]]
        self.ResolvedDirectVariants = [
        ]  # type: List['PackagePlatformVariant']
        self.ResolvedAllVariantDict = {
        }  # type: Dict[str, 'PackagePlatformVariant']
        self.ResolvedMakeConfigName = None  # type: Optional[str]
        self.ResolvedMakeObjectPath = None  # type: Optional[str]

        # The complete variant name containing both the normal and virtual variant names
        # in a format that is suitable for insertion into make files.
        # Beware this is just a hint and any generator is free to ignore it!
        # - each normal variant is inserted as a ${VARIANT_NAME} in the string
        # - each virtual variant is inserted as a $(VARIANT_NAME) in the string
        self.ResolvedVariantNameHint = ""  # type: str

        # The complete variant name containing both the normal and virtual variant names
        # in a format that is suitable for insertion into make files.
        # Beware this is just a hint and any generator is free to ignore it!
        # - each normal variant is inserted as a $(VARIANT_NAME) in the string
        # - each virtual variant is inserted as a $(VARIANT_NAME) in the string
        self.ResolvedMakeVariantNameHint = None  # type: Optional[str]

        # The normal variant format string each variant is inserted as a ${VARIANT_NAME} in the string
        self.ResolvedNormalVariantNameHint = None  # type: Optional[str]
        # The virtual variant format string each variant is inserted as a $(VARIANT_NAME) in the string
        self.ResolvedVirtualVariantNameHint = None  # type: Optional[str]

        # A list of all normal variant names in a order that matches the one used for the name hints
        self.ResolvedNormalVariantNameList = []  # type: List[str]
        # A list of all virtual variant names in a order that matches the one used for the name hints
        self.ResolvedVirtualVariantNameList = []  # type: List[str]

        # The resolved direct experimental recipe if one exist
        self.ResolvedDirectExperimentalRecipe = None  # type: Optional[PackageExperimentalRecipe]

        # All variant dependencies (this is the dependencies pulled in by all variants)
        # Since we do a simple static evaluation of all variant dependencies that results in a fixed
        # build order for all variants we do a very strict variant dependency evaluation.
        # This means that while it could easly be possible for one variant to require
        # A->B->C->D and another to require D->C->B->A its simply not supported
        # since we require the global build order to stay fixed so we can do a static
        # build order setup
        #self.ResolvedDirectVariantDependencies = []
        # This is up the the build generator to set, it will be a PackageGeneratorReport object or None if the builder doesn't support it
        self.ResolvedBuildPath = None  # type: Optional[str]
示例#5
0
    def Process(self, currentDirPath: str, toolConfig: ToolConfig,
                localToolConfig: LocalToolConfig) -> None:
        # Check if a environment variable has been set to disable this tool
        # This is for example done by FslBuild to prevent multiple executions of content building.
        toolEnabled = IOUtil.TryGetEnvironmentVariable(
            CONFIG_FSLBUILDCONTENT_ENABLED)

        featureList = localToolConfig.BuildPackageFilters.FeatureNameList

        config = Config(self.Log, toolConfig,
                        localToolConfig.PackageConfigurationType,
                        localToolConfig.BuildVariantsDict,
                        localToolConfig.AllowDevelopmentPlugins)

        # Get the platform and see if its supported
        buildVariantConfig = BuildVariantConfigUtil.GetBuildVariantConfig(
            localToolConfig.BuildVariantsDict)
        generator = self.ToolAppContext.PluginConfigContext.GetGeneratorPluginById(
            localToolConfig.PlatformName, localToolConfig.Generator,
            buildVariantConfig, config.ToolConfig.DefaultPackageLanguage,
            config.ToolConfig.CMakeConfiguration,
            localToolConfig.GetUserCMakeConfig(), False)
        PlatformUtil.CheckBuildPlatform(generator.PlatformName)
        generatorContext = GeneratorContext(
            config, self.ErrorHelpManager,
            localToolConfig.BuildPackageFilters.RecipeFilterManager,
            config.ToolConfig.Experimental, generator)

        self.Log.LogPrint("Active platform: {0}".format(
            generator.PlatformName))

        discoverFeatureList = '*' in featureList
        topLevelPackage = None
        if discoverFeatureList or localToolConfig.Project is None:
            if discoverFeatureList:
                config.LogPrint(
                    "No features specified, so using package to determine them"
                )
            topLevelPackage = self.__ResolveAndGetTopLevelPackage(
                generatorContext, config, currentDirPath,
                toolConfig.GetMinimalConfig(generator.CMakeConfig),
                localToolConfig.Recursive)
            if discoverFeatureList:
                featureList = [
                    entry.Name
                    for entry in topLevelPackage.ResolvedAllUsedFeatures
                ]
            #if localToolConfig.Project is None:
            #    executeablePackage = PackageListUtil.FindFirstExecutablePackage(packages)
            #    localToolConfig.Project = executeablePackage.ShortName

        if localToolConfig.Validate:
            Validate.ValidatePlatform(config, localToolConfig.PlatformName,
                                      featureList)
            if topLevelPackage is None:
                topLevelPackage = self.__ResolveAndGetTopLevelPackage(
                    generatorContext, config, currentDirPath,
                    toolConfig.GetMinimalConfig(generator.CMakeConfig),
                    localToolConfig.Recursive)
            RecipeBuilder.ValidateInstallationForPackages(
                self.Log, config.SDKPath, generatorContext,
                topLevelPackage.ResolvedBuildOrder)

        if toolEnabled is not None and not ParseUtil.ParseBool(toolEnabled):
            if self.Log.Verbosity > 0:
                print(
                    "FslBuildContent has been disabled by environment variable {0} set to {1}"
                    .format(CONFIG_FSLBUILDCONTENT_ENABLED, toolEnabled))
            return

        locations = toolConfig.PackageConfiguration[
            localToolConfig.PackageConfigurationType].Locations
        if not localToolConfig.Recursive or topLevelPackage is None:
            location = self.__TryFindLocation(locations, currentDirPath)
            if location is None:
                raise Exception(
                    "Could not locate location for {0}".format(currentDirPath))
            packagePath = PackagePath(currentDirPath, location)
            ContentBuilder.Build(self.Log, config.GetBuildDir(),
                                 config.DisableWrite, toolConfig, packagePath,
                                 featureList, localToolConfig.Output)
        else:
            # Location not found, but its ok since '-r' was specified and we have a top level package
            for foundPackage in topLevelPackage.ResolvedBuildOrder:
                if foundPackage.Type == PackageType.Executable:
                    foundFeatureList = [
                        entry.Name
                        for entry in foundPackage.ResolvedAllUsedFeatures
                    ]
                    if foundPackage.Path is None:
                        raise Exception("Invalid package")
                    ContentBuilder.Build(self.Log, config.GetBuildDir(),
                                         config.DisableWrite, toolConfig,
                                         foundPackage.Path, foundFeatureList)
示例#6
0
    def __init__(self, config: Config, generatorInfo: GeneratorInfo,
                 packageProjectContext: PackageProjectContext,
                 genFile: XmlGenFile) -> None:
        super().__init__()

        log = config  # type: Log

        self._BasicConfig = config
        self.GenFile = genFile
        self.SourceFileHash = genFile.SourceFileHash
        self.XMLElement = genFile.XMLElement
        self.TemplateType = genFile.TemplateType
        self.AllowCheck = genFile.AllowCheck
        self.PackageNameBasedIncludePath = genFile.PackageNameBasedIncludePath
        self.EnableExtendedSourceExtensions = genFile.EnableExtendedSourceExtensions  # type: bool
        self.IsUnitTest = genFile.UnitTest  # type: bool
        self.ShowInMainReadme = genFile.ShowInMainReadme

        # Apply condition filters to the 'read list'
        self.__FilteredExternalDependencies = FilterXmlElementUtil.FilterOnConditionsExternalDependency(
            log, generatorInfo, self.GenFile.ExternalDependencies)
        self.__DirectDependencies = FilterXmlElementUtil.FilterOnConditionsDependency(
            log, generatorInfo, self.GenFile.DirectDependencies)

        # Clone all attributes that exist on a genFile
        self.BaseIncludePath = genFile.BaseIncludePath
        self.BaseSourcePath = genFile.BaseSourcePath
        self.PackageLocation = genFile.PackageLocation
        self.Name = genFile.Name
        self.ShortName = genFile.ShortName
        self.Namespace = genFile.Namespace
        self.Type = genFile.Type
        self.IsVirtual = genFile.IsVirtual
        self.PlatformDefaultSupportedValue = genFile.PlatformDefaultSupportedValue
        #self.__DirectDependencies = genFile.DirectDependencies
        self.DirectDefines = genFile.DirectDefines
        self.Platforms = self.__BuildPlatformsDict(log, generatorInfo,
                                                   genFile.Platforms)
        self.Path = genFile.PackageFile  # type: Optional[PackagePath]
        self.AbsolutePath = None if genFile.PackageFile is None else genFile.PackageFile.AbsoluteDirPath
        self.AbsoluteIncludePath = None if genFile.IncludePath is None else genFile.IncludePath.AbsoluteDirPath
        self.AbsoluteSourcePath = None if genFile.SourcePath is None else genFile.SourcePath.AbsoluteDirPath

        self.ContentPath = genFile.ContentPath
        self.ContentSourcePath = genFile.ContentSourcePath

        self.AbsoluteBuildPath = IOUtil.Join(
            self.AbsolutePath,
            config.GetBuildDir()) if self.AbsolutePath is not None else None
        self.AllowDependencyOnThis = self.__ResolveAllowDependencyOnThis(
            self.Type)
        self.PackageLanguage = genFile.PackageLanguage
        self.BuildCustomization = PackageBuildCustomization(
            genFile.BuildCustomization)
        # The year the package was created
        self.CreationYear = genFile.CreationYear
        self.CompanyName = genFile.CompanyName

        # Fill all the package attributes that will be resolved with a initial value
        self.ResolvedPlatform = None  # type: Optional[PackagePlatform]
        self.ResolvedPlatformNotSupported = False
        self.ResolvedPlatformDirectSupported = True
        self.ResolvedPlatformName = None  # type: Optional[str]
        # All direct dependencies of this package
        self.ResolvedDirectDependencies = []  # type: List['PackageDependency']
        # All dependencies both direct and indirect
        self.ResolvedAllDependencies = []  # type: List['PackageDependency']
        # The build order of dependent packages
        self.ResolvedBuildOrder = []  # type: List['Package']
        # This is basically the 'resolved build order of the package' filtered down to packages that contain a experimental recipe.
        self.ResolvedExperimentalRecipeBuildOrder = []  # type: List['Package']
        self.ResolvedToolDependencyOrder = []  # type: List['Package']
        # The known recipe variants, currently used for android ABI's
        self.ResolvedRecipeVariants = []  # type: List[str]
        self.ResolvedBuildSourceFiles = None  # type: Optional[List[str]]

        # ContentBuilder input files

        # The content source files in this package (content input files that are send through the builder)
        self.ResolvedContentBuilderBuildInputFiles = None  # type: Optional[List[PathRecord]]
        # The content files in this package (content input files that are not send through the builder)
        self.ResolvedContentBuilderSyncInputFiles = None  # type: Optional[List[PathRecord]]
        # All input files to the content builder system (this includes both build files and synced files)
        # but it does not include the files in "Content" as they are not send through the ContentBuilder
        self.ResolvedContentBuilderAllInputFiles = None  # type: Optional[List[PathRecord]]

        # ContentBuilder output files

        # All files generated by the content builder "build" process (content output files)
        self.ResolvedContentBuilderBuildOuputFiles = []  # type: List[str]
        # All files generated by the content builder "sync" process (content output files)
        self.ResolvedContentBuilderSyncOutputFiles = []  # type: List[str]
        # All files generated by content builder system (this includes both build files and synced files)
        # but it does not include the files in "Content" as they are not send through the ContentBuilder
        self.ResolvedContentBuilderAllOuputFiles = []  # type: List[str]

        # Content files

        # Content files from "Content" except those generated by the content builder
        self.ResolvedContentFiles = []  # type: List[PathRecord]

        # The public include files in this package
        self.ResolvedBuildPublicIncludeFiles = None  # type: Optional[List[str]]
        # The private include files in this package
        self.ResolvedBuildPrivateIncludeFiles = None  # type: Optional[List[str]]
        # All include files in this package (public+private)
        self.ResolvedBuildAllIncludeFiles = None  # type: Optional[List[str]]
        self.ResolvedBuildAllIncludeDirs = None  # type: Optional[List[str]]
        self.ResolvedBuildPublicIncludeDirs = None  # type: Optional[List[str]]
        self.ResolvedBuildPrivateIncludeDirs = None  # type: Optional[List[str]]
        self.ResolvedBuildDirectPrivateIncludeDirs = [
        ]  # type: List[ResolvedPath]
        # Known special files that might mean something to some generators
        self.ResolvedSpecialFiles = []  # type: List[ResolvedPath]
        # All direct featue uses of this package
        self.ResolvedDirectUsedFeatures = []  # type: List[PackageRequirement]
        # All feature uses both direct and indirect
        self.ResolvedAllUsedFeatures = []  # type: List[PackageRequirement]
        # All direct requirements of this package
        self.ResolvedDirectRequirements = []  # type: List[PackageRequirement]
        # All requirements both direct and indirect
        self.ResolvedAllRequirements = []  # type: List[PackageRequirement]
        # All the direct cpp defines of this package
        self.ResolvedBuildDirectDefines = None  # type: Optional[List['PackageDefine']]
        # All the cpp defines that touch this package (direct and inherited)
        self.ResolvedBuildAllDefines = []  # type: List['PackageDefine']
        # All the public cpp defines that touch this package (direct and inherited)
        self.ResolvedBuildAllPublicDefines = None  # type: Optional[List['PackageDefine']]
        # All the private cpp defines that touch this package (direct and inherited)
        self.ResolvedBuildAllPrivateDefines = None  # type: Optional[List['PackageDefine']]
        # All direct external dependencies
        self.ResolvedDirectExternalDependencies = [
        ]  # type: List[PackageExternalDependency]
        # All the ExternalDeps that touch this package (direct and inherited)
        self.ResolvedBuildAllExternalDependencies = None  # type: Optional[List[PackageExternalDependency]]
        # All the public ExternalDeps that touch this package (direct and inherited)
        self.ResolvedBuildAllPublicExternalDependencies = None  # type: Optional[List[PackageExternalDependency]]
        # All the private ExternalDeps that touch this package (direct and inherited)
        self.ResolvedBuildAllPrivateExternalDependencies = None  # type: Optional[List[PackageExternalDependency]]
        self.ResolvedDirectVariants = [
        ]  # type: List['PackagePlatformVariant']
        self.ResolvedAllVariantDict = {
        }  # type: Dict[str, 'PackagePlatformVariant']
        self.ResolvedMakeConfigName = None  # type: Optional[str]
        self.ResolvedMakeObjectPath = None  # type: Optional[str]

        # The complete variant name containing both the normal and virtual variant names
        # in a format that is suitable for insertion into make files.
        # Beware this is just a hint and any generator is free to ignore it!
        # - each normal variant is inserted as a ${VARIANT_NAME} in the string
        # - each virtual variant is inserted as a $(VARIANT_NAME) in the string
        self.ResolvedVariantNameHint = ""  # type: str

        # The complete variant name containing both the normal and virtual variant names
        # in a format that is suitable for insertion into make files.
        # Beware this is just a hint and any generator is free to ignore it!
        # - each normal variant is inserted as a $(VARIANT_NAME) in the string
        # - each virtual variant is inserted as a $(VARIANT_NAME) in the string
        self.ResolvedMakeVariantNameHint = None  # type: Optional[str]

        # The normal variant format string each variant is inserted as a ${VARIANT_NAME} in the string
        self.ResolvedNormalVariantNameHint = None  # type: Optional[str]
        # The virtual variant format string each variant is inserted as a $(VARIANT_NAME) in the string
        self.ResolvedVirtualVariantNameHint = None  # type: Optional[str]

        # A list of all normal variant names in a order that matches the one used for the name hints
        self.ResolvedNormalVariantNameList = []  # type: List[str]
        # A list of all virtual variant names in a order that matches the one used for the name hints
        self.ResolvedVirtualVariantNameList = []  # type: List[str]

        # The resolved direct experimental recipe if one exist
        self.ResolvedDirectExperimentalRecipe = None  # type: Optional[PackageExperimentalRecipe]

        # All variant dependencies (this is the dependencies pulled in by all variants)
        # Since we do a simple static evaluation of all variant dependencies that results in a fixed
        # build order for all variants we do a very strict variant dependency evaluation.
        # This means that while it could easly be possible for one variant to require
        # A->B->C->D and another to require D->C->B->A its simply not supported
        # since we require the global build order to stay fixed so we can do a static
        # build order setup
        #self.ResolvedDirectVariantDependencies = []
        # This is up the the build generator to set, it will be a PackageGeneratorReport object or None if the builder doesn't support it
        self.ResolvedBuildPath = None  # type: Optional[str]

        # Contains about the project this package is associated with
        self.ProjectContext = packageProjectContext

        # The resolved path for the package
        packageFile = genFile.PackageFile
        self.ResolvedPath = ResolvedPath(
            packageFile.PackageRootLocation.Name + '/' +
            packageFile.RootRelativeDirPath,
            packageFile.AbsoluteDirPath) if packageFile is not None else None
示例#7
0
    def Process(self, currentDirPath: str, toolConfig: ToolConfig,
                localToolConfig: LocalToolConfig) -> None:
        config = Config(self.Log, toolConfig,
                        localToolConfig.PackageConfigurationType,
                        localToolConfig.BuildVariantsDict,
                        localToolConfig.AllowDevelopmentPlugins)

        if localToolConfig.DryRun:
            config.ForceDisableAllWrite()
        if localToolConfig.IgnoreNotSupported:
            config.IgnoreNotSupported = True

        # Get the platform and see if its supported
        buildVariantConfig = BuildVariantConfigUtil.GetBuildVariantConfig(
            localToolConfig.BuildVariantsDict)
        platformGeneratorPlugin = self.ToolAppContext.PluginConfigContext.GetGeneratorPluginById(
            localToolConfig.PlatformName, localToolConfig.Generator,
            buildVariantConfig,
            toolConfig.DefaultPackageLanguage, toolConfig.CMakeConfiguration,
            localToolConfig.GetUserCMakeConfig(), False)
        PlatformUtil.CheckBuildPlatform(platformGeneratorPlugin.PlatformName)

        self.Log.LogPrint("Active platform: {0}".format(
            platformGeneratorPlugin.PlatformName))

        theFiles = MainFlow.DoGetFiles(
            config,
            toolConfig.GetMinimalConfig(platformGeneratorPlugin.CMakeConfig),
            currentDirPath, localToolConfig.Recursive)

        generatorContext = GeneratorContext(
            self.Log, self.ErrorHelpManager,
            localToolConfig.BuildPackageFilters.RecipeFilterManager,
            toolConfig.Experimental, platformGeneratorPlugin)
        self.ToolAppContext.PluginConfigContext.SetLegacyGeneratorType(
            localToolConfig.GenType)

        packageFilters = localToolConfig.BuildPackageFilters
        packages = MainFlow.DoGenerateBuildFilesNoAll(config,
                                                      self.ErrorHelpManager,
                                                      theFiles,
                                                      platformGeneratorPlugin,
                                                      packageFilters)

        topLevelPackage = PackageListUtil.GetTopLevelPackage(packages)

        requestedFiles = None if config.IsSDKBuild else theFiles

        # We need the generator to be able to examine its support

        if localToolConfig.ListFeatures or localToolConfig.ListVariants or localToolConfig.ListExtensions or localToolConfig.ListRequirements:
            if localToolConfig.ListFeatures:
                Builder.ShowFeatureList(self.Log, topLevelPackage,
                                        requestedFiles)
            if localToolConfig.ListVariants:
                Builder.ShowVariantList(self.Log, topLevelPackage,
                                        requestedFiles,
                                        platformGeneratorPlugin)
            if localToolConfig.ListExtensions:
                Builder.ShowExtensionList(self.Log, topLevelPackage,
                                          requestedFiles)
            if localToolConfig.ListRequirements:
                Builder.ShowRequirementList(self.Log, topLevelPackage,
                                            requestedFiles)
        else:
            if localToolConfig.BuildPackageFilters is None or localToolConfig.BuildPackageFilters.ExtensionNameList is None:
                raise Exception(
                    "localToolConfig.BuildPackageFilters.ExtensionNameList not set"
                )
            requestedPackages = BuildHelper.FindRequestedPackages(
                config, packages, requestedFiles)

            Builder.BuildPackages(
                self.Log, config.GetBuildDir(), config.SDKPath,
                config.SDKConfigTemplatePath, config.DisableWrite,
                config.IsDryRun, toolConfig, generatorContext, packages,
                requestedPackages, localToolConfig.BuildVariantsDict,
                localToolConfig.RemainingArgs, localToolConfig.ForAllExe,
                platformGeneratorPlugin, localToolConfig.EnableContentBuilder,
                localToolConfig.ForceClaimInstallArea,
                localToolConfig.BuildThreads, localToolConfig.Command, True)