def TryGetInstallPath( self, xmlSourceRecipe: XmlExperimentalRecipe) -> Optional[ResolvedPath]: if xmlSourceRecipe is None: return None elif not xmlSourceRecipe.ExternalInstallDirectory is None: if not xmlSourceRecipe.Pipeline is None: self.__Log.DoPrintWarning( "SourceRecipe ExternalInstallDirectory overrides Pipeline '{0}'" .format(xmlSourceRecipe.Name)) sourcePath = xmlSourceRecipe.ExternalInstallDirectory resolvedPath = self.__VariableProcessor.ResolveAbsolutePathWithLeadingEnvironmentVariablePathAsDir( sourcePath) return ResolvedPath(sourcePath, resolvedPath) if not self.IsEnabled or self.InstallRootLocation is None: raise Exception( "Can not TryGetInstallPath since the builder functionality has been disabled, please enable the builder functionality for this project" ) if xmlSourceRecipe.Pipeline is None: return None sourcePath = IOUtil.Join(self.InstallRootLocation.SourcePath, xmlSourceRecipe.Name) resolvedPath = IOUtil.Join(self.InstallRootLocation.ResolvedPath, xmlSourceRecipe.Name) return ResolvedPath(sourcePath, resolvedPath)
def __init__(self, log: Log, package: Package, clangFormatConfiguration: ClangFormatConfiguration, filteredFiles: Optional[List[str]]) -> None: allFiles = [] # type: List[ResolvedPath] if package.ResolvedBuildAllIncludeFiles is not None and package.AllowCheck and not package.IsVirtual: if package.AbsolutePath is None or package.ResolvedBuildSourceFiles is None: raise Exception("Invalid package") if filteredFiles is None: for fileName in package.ResolvedBuildAllIncludeFiles: fullPath = IOUtil.Join(package.AbsolutePath, fileName) # Only process files with the expected extension if PerformClangUtil.IsValidExtension( fileName, clangFormatConfiguration.FileExtensions): allFiles.append(ResolvedPath(fileName, fullPath)) for fileName in package.ResolvedBuildSourceFiles: fullPath = IOUtil.Join(package.AbsolutePath, fileName) if PerformClangUtil.IsValidExtension( fileName, clangFormatConfiguration.FileExtensions): allFiles.append(ResolvedPath(fileName, fullPath)) if package.ResolvedContentFiles is not None: for resolvedPath in package.ResolvedContentFiles: if PerformClangUtil.IsValidExtension( resolvedPath.ResolvedPath, clangFormatConfiguration.FileExtensions): allFiles.append( self.__GetResolvedPath(package, resolvedPath)) if package.ResolvedContentBuilderSyncInputFiles is not None: for resolvedPath in package.ResolvedContentBuilderSyncInputFiles: if PerformClangUtil.IsValidExtension( resolvedPath.ResolvedPath, clangFormatConfiguration.FileExtensions): allFiles.append( self.__GetResolvedPath(package, resolvedPath)) if package.ResolvedContentBuilderBuildInputFiles is not None: for resolvedPath in package.ResolvedContentBuilderBuildInputFiles: if PerformClangUtil.IsValidExtension( resolvedPath.ResolvedPath, clangFormatConfiguration.FileExtensions): allFiles.append( self.__GetResolvedPath(package, resolvedPath)) else: for fileEntry in filteredFiles: allFiles.append( self.__GetResolvedPathFromAbsPath(package, fileEntry)) self.AllFiles = allFiles
def __init__(self, log: Log, variableProcessor: VariableProcessor, recipeBuilderSetup: Optional[RecipeBuilderSetup], platformName: str, cmakeConfig: GeneratorCMakeConfig) -> None: super().__init__() self.__Log = log # type: Log self.__VariableProcessor = variableProcessor # type: VariableProcessor self.IsEnabled = recipeBuilderSetup is not None # type: bool self.TargetLocation = None # Optional[ResolvedPath] self.DownloadCacheRootPath = None # Optional[str] self.__TempRootPath = None # Optional[str] self.__TempPipelineRootPath = None # Optional[str] self.InstallRootLocation = None # Optional[ResolvedPath] self.ReadonlyCache_DownloadCacheRootPath = None # Optional[str] if self.IsEnabled and recipeBuilderSetup is not None: targetLocation = recipeBuilderSetup.TargetLocation readonlyCachePath = recipeBuilderSetup.ReadonlyCachePath if not IOUtil.IsAbsolutePath(targetLocation.ResolvedPath): raise Exception( "Install area path is not absolute: '{0}'".format( targetLocation.ResolvedPath)) if not readonlyCachePath is None and not IOUtil.IsAbsolutePath( readonlyCachePath): raise Exception( "Install area readonly cache path is not absolute: '{0}'". format(readonlyCachePath)) self.TargetLocation = targetLocation self.DownloadCacheRootPath = IOUtil.Join( targetLocation.ResolvedPath, ".DownloadCache") self.__TempRootPath = IOUtil.Join(targetLocation.ResolvedPath, ".Temp") baseTempDirectory = IOUtil.Join(self.__TempRootPath, "pipeline") baseTempDirectory = IOUtil.Join(baseTempDirectory, platformName) self.__TempPipelineRootPath = IOUtil.Join( baseTempDirectory, cmakeConfig.GeneratorRecipeShortName) sourceBaseInstallDirectory = IOUtil.Join(targetLocation.SourcePath, platformName) sourceInstallRootPath = IOUtil.Join( sourceBaseInstallDirectory, cmakeConfig.GeneratorRecipeShortName) baseInstallDirectory = IOUtil.Join(targetLocation.ResolvedPath, platformName) installRootPath = IOUtil.Join(baseInstallDirectory, cmakeConfig.GeneratorRecipeShortName) self.InstallRootLocation = ResolvedPath(sourceInstallRootPath, installRootPath) self.ReadonlyCache_DownloadCacheRootPath = None if readonlyCachePath is None else IOUtil.Join( readonlyCachePath, ".DownloadCache")
def __GetResolvedPathFromAbsPath(self, package: Package, absFilePath: str) -> ResolvedPath: if package.Path is None: raise Exception("invalid package") packagePath = package.Path.AbsoluteDirPath + '/' if not absFilePath.startswith(packagePath): raise Exception("file '{0}' is not part of the package at path '{1}'".format(absFilePath, packagePath)) relativePath = absFilePath[len(packagePath):] return ResolvedPath(relativePath, absFilePath)
def ResolveDirectoryPath(self, sourcePath: str, checkExists: bool = True) -> ResolvedPath: if sourcePath.find('..') != -1: raise Exception("'..' is now allowed in directory paths ('{0}')".format(sourcePath)) if sourcePath.find('\\') != -1: raise Exception("'\\' is now allowed in directory paths ('{0}')".format(sourcePath)) resolvedPath = self.__VariableProcessor.ResolveAbsolutePathWithLeadingEnvironmentVariablePathAsDir(sourcePath, checkExists=checkExists) return ResolvedPath(sourcePath, resolvedPath)
def ResolveFilePath(self, sourcePath: str) -> ResolvedPath: if sourcePath.find('..') != -1: raise Exception("'..' is now allowed in file paths ('{0}')".format(sourcePath)) if sourcePath.find('\\') != -1: raise Exception("'\\' is now allowed in file paths ('{0}')".format(sourcePath)) resolvedPath = self.__VariableProcessor.ResolveAbsolutePathWithLeadingEnvironmentVariablePathAsFile(sourcePath) return ResolvedPath(sourcePath, resolvedPath)
def __init__(self, projectId: ProjectId, projectName: str, projectVersion: str, projectDirectory: str, basePackages: List[ToolConfigBasePackage], parentContext: Optional['ToolConfigProjectContext']) -> None: super().__init__() self.ProjectId = projectId self.ProjectName = projectName self.ProjectVersion = projectVersion self.Location = ResolvedPath(projectDirectory, projectDirectory) self.BasePackages = basePackages self.ParentContext = parentContext
def __init__(self, basicConfig: BasicConfig, recipeFilterManager: RecipeFilterManager, experimental: Optional[ToolConfigExperimental], generator: GeneratorPlugin) -> None: cmakeGenerator = CMakeTypes.TryDetermineCMakeGenerator(generator) cmakeGeneratorShortName = None if cmakeGenerator is not None: cmakeGeneratorShortName = CMakeTypes.TryGetCompilerShortIdFromGeneratorName( cmakeGenerator) shortCompilerName = "NotDefined" if cmakeGeneratorShortName is None else cmakeGeneratorShortName if cmakeGeneratorShortName is None: if basicConfig.Verbosity >= 2: basicConfig.LogPrintWarning( "No CMake short generator id has been defined, defaulting to '{0}'" .format(shortCompilerName)) recipeBuilderSetup = None allowDownloads = False if experimental is not None: targetLocation = ResolvedPath( experimental.DefaultThirdPartyInstallDirectory.DynamicName, experimental.DefaultThirdPartyInstallDirectory.ResolvedPath) installReadonlySource = experimental.DefaultThirdPartyInstallReadonlyCacheDirectory readonlyCachePath = None if installReadonlySource is None else installReadonlySource.ResolvedPath # type: Optional[str] recipeBuilderSetup = RecipeBuilderSetup(targetLocation, readonlyCachePath) if IOUtil.TryGetEnvironmentVariable( experimental.DisableDownloadEnv) != None: allowDownloads = False basicConfig.LogPrint( "Downloads disabled since the environment variable {0} was defined" .format(experimental.DisableDownloadEnv)) elif experimental.AllowDownloads: allowDownloads = True else: basicConfig.LogPrint( "Downloads disabled since the project has it disabled by default" ) super().__init__(basicConfig, generator.PlatformName, generator.PlatformName, shortCompilerName, recipeBuilderSetup) #allowDownload=True, disableDownloadEnv=None self.BasicConfig = basicConfig self.Generator = generator # for now the generator is also the platform and the existing code use that name so maintain compatibility for now self.Platform = generator self.AllowDownloads = allowDownloads self.RecipeFilterManager = recipeFilterManager
def __init__(self, log: Log, errorHelpManager: ErrorHelpManager, recipeFilterManager: RecipeFilterManager, experimental: Optional[ToolConfigExperimental], generator: GeneratorPlugin) -> None: if generator.CMakeConfig is None: raise Exception("Invalid generator") recipeBuilderSetup = None allowDownloads = False if experimental is not None: targetLocation = ResolvedPath( experimental.DefaultThirdPartyInstallDirectory.DynamicName, experimental.DefaultThirdPartyInstallDirectory.ResolvedPath) installReadonlySource = experimental.DefaultThirdPartyInstallReadonlyCacheDirectory readonlyCachePath = None if installReadonlySource is None else installReadonlySource.ResolvedPath # type: Optional[str] recipeBuilderSetup = RecipeBuilderSetup(targetLocation, readonlyCachePath) if IOUtil.TryGetEnvironmentVariable( experimental.DisableDownloadEnv) is not None: allowDownloads = False log.LogPrint( "Downloads disabled since the environment variable {0} was defined" .format(experimental.DisableDownloadEnv)) elif experimental.AllowDownloads: allowDownloads = True else: log.LogPrint( "Downloads disabled since the project has it disabled by default" ) validVariableDict = {} # type: Dict[str, object] validVariableDict['PlatformName'] = generator.PlatformName validVariableDict['IsCMakeBuild'] = generator.IsCMake generatorInfo = GeneratorInfo(generator.IsCMake, generator.CMakeConfig.AllowFindPackage, validVariableDict) super().__init__(log, errorHelpManager, generator.PlatformName, generator.PlatformName, generatorInfo, generator.CMakeConfig, recipeBuilderSetup) #allowDownload=True, disableDownloadEnv=None self.Log = log self.Generator = generator # for now the generator is also the platform and the existing code use that name so maintain compatibility for now self.Platform = generator self.AllowDownloads = allowDownloads self.RecipeFilterManager = recipeFilterManager
def __init__(self, config: Config, packageProjectContext: PackageProjectContext, 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 self.IsUnitTest = genFile.UnitTest # type: bool self.ShowInMainReadme = genFile.ShowInMainReadme # 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.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] # 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