def GetVersion() -> CMakeVersion: exeName = PlatformUtil.GetPlatformDependentExecuteableName( "cmake", PlatformUtil.DetectBuildPlatformType()) path = IOUtil.TryFindExecutable(exeName) if path is None: raise Exception( "Could not locate cmake in path. Please install cmake 3.10.2+ (https://cmake.org/) as it is used to generate build files." ) cmd = [path, "--version"] version = CMakeUtil.RunCommand(cmd) versionString = "cmake version " if not version.startswith(versionString): raise Exception( "Failed to parse cmake version string '{0}'".format( versionString)) version = version[len(versionString):] indexEnd = version.find('\n') indexEnd = indexEnd if indexEnd >= 0 else len(version) version = version[0:indexEnd].strip() parsedVersion = version.split('.') if len(parsedVersion) < 3: raise Exception( "Failed to parse cmake version string: '{0}'".format(version)) while len(parsedVersion) < 3: parsedVersion.append("0") indexNonDigit = CMakeUtil._FindNonDigit(parsedVersion[2]) strBuild = parsedVersion[2][:indexNonDigit] return CMakeVersion(int(parsedVersion[0]), int(parsedVersion[1]), int(strBuild))
def __ValidateAddTool(self, rErrorRecordList: List[ErrorRecord], installationPath: Optional[str], command: XmlRecipeValidateCommandAddTool, packageRecipeResult: PackageRecipeResult) -> bool: toolName = PlatformUtil.GetPlatformDependentExecuteableName( command.Name, PlatformUtil.DetectBuildPlatformType()) result, value = self.__DoValidateFile(rErrorRecordList, installationPath, toolName, False) if self.__Log.Verbosity >= 1: self.__Log.LogPrint("Validating AddTool '{0}': {1}".format( command.Name, result)) if self.__Log.Verbosity >= 2: self.__Log.LogPrint(" '{0}'".format(value)) if result and value is not None: foundVersion = [0] if result and value is not None and command.VersionCommand is not None: if command.VersionCommand is None or command.VersionRegEx is None: raise Exception("Internal error") foundVersion = self.__TryValidateCommandVersion( value, command.VersionCommand, command.VersionRegEx, command.MinVersion, []) result = len(foundVersion) > 0 exeRecord = PackageRecipeResultFoundExecutable( command.Name, command.Name, value, self.__ToVersion(foundVersion)) packageRecipeResult.AddFoundExecutable(exeRecord) return result
def __ValidateAddTool(self, rErrorRecordList: List[ErrorRecord], installationPath: Optional[str], command: XmlRecipeValidateCommandAddTool) -> bool: toolName = PlatformUtil.GetPlatformDependentExecuteableName(command.Name, PlatformUtil.DetectBuildPlatformType()) result, value = self.__DoValidateFile(rErrorRecordList, installationPath, toolName, False) if self.__BasicConfig.Verbosity >= 1: self.__BasicConfig.LogPrint("Validating AddTool '{0}': {1}".format(command.Name, result)) if self.__BasicConfig.Verbosity >= 2: self.__BasicConfig.LogPrint(" '{0}'".format(value)) return result
def __init__(self, generatorContext: GeneratorContext, buildThreads: int, useRecipe: bool = True) -> None: super().__init__(generatorContext, buildThreads, PlatformBuildTypeInfo.CMakeCustom) self.IsSingleConfiguration = True self.__CommandName = PlatformUtil.GetPlatformDependentExecuteableName( "ninja", PlatformUtil.DetectBuildPlatformType()) self.__UseRecipe = useRecipe
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, False, config.ToolConfig.CMakeConfiguration, localToolConfig.GetUserCMakeConfig()) PlatformUtil.CheckBuildPlatform(generator.PlatformName) generatorContext = GeneratorContext(config, self.ErrorHelpManager, localToolConfig.BuildPackageFilters.RecipeFilterManager, config.ToolConfig.Experimental, generator) config.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(), 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(), localToolConfig.Recursive) RecipeBuilder.ValidateInstallationForPackages(config, 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(config, 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(config, foundPackage.Path, foundFeatureList)
def BuildPackages( config: Config, generatorContext: GeneratorContext, builderConfig: BuilderConfig, packages: List[Package], packageRecipeResultManager: Optional[PackageRecipeResultManager] = None ) -> None: if packageRecipeResultManager is None: packageRecipeResultManager = PackageRecipeResultManager(config) PlatformUtil.CheckBuildPlatform(generatorContext.Platform.PlatformName) topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) buildConfig = BuildConfigRecord(config.ToolConfig.ToolVersion, generatorContext.Platform.PlatformName, {}, CommandType.Build, [], None, None, 0) basicConfig = generatorContext.BasicConfig try: basicConfig.LogPrint("- Building recipe packages") basicConfig.PushIndent() __BuildNow(config, generatorContext, builderConfig, topLevelPackage, buildConfig, packageRecipeResultManager) finally: basicConfig.PopIndent()
def TryRun(log: Log, cmdList: List[str]) -> Optional[str]: """ Run the command and capture the output :return: the captured output on sucess, None if it failed """ try: if cmdList[0].endswith( '.py') and PlatformUtil.DetectBuildPlatformType( ) == BuildPlatformType.Windows: cmdList[0] = cmdList[0][:-3] + ".bat" with subprocess.Popen(cmdList, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, universal_newlines=True) as proc: output = proc.stdout.read().strip() proc.stdout.close() result = proc.wait() if result != 0: LocalUtil.DumpCapture(log, 4, output) log.LogPrintWarning( "The command '{0}' failed with '{1}'".format( " ".join(cmdList), result)) return None if isinstance(output, str): return output return None except FileNotFoundError: log.DoPrintWarning( "The command '{0}' failed with 'file not found'.".format( " ".join(cmdList))) return None
def GetDefaultConfigForTest( enableTestMode: bool = False, customUnitTestRoots: Optional[List[str]] = None) -> Config: strToolAppTitle = "UnitTest" log = Log(strToolAppTitle, 0) currentDir = IOUtil.GetEnvironmentVariableForDirectory( "FSL_GRAPHICS_INTERNAL") basicConfig = BasicConfig(log) localToolConfig = LowLevelToolConfig(log.Verbosity, False, False, False, False, currentDir) projectRootConfig = ToolAppMain.GetProjectRootConfig( localToolConfig, basicConfig, currentDir) buildPlatformType = PlatformUtil.DetectBuildPlatformType() toolConfig = ToolConfig(localToolConfig, buildPlatformType, Version(1, 3, 3, 7), basicConfig, projectRootConfig.ToolConfigFile, projectRootConfig) config = Config(log, toolConfig, PluginSharedValues.TYPE_UNIT_TEST, None, True) config.ForceDisableAllWrite() if enableTestMode: config.SetTestMode() if customUnitTestRoots is not None: TEST_AddPackageRoots(config, customUnitTestRoots, True) return config
def GetDirectDependencies(self, platformName: str) -> List[XmlGenFileDependency]: directDependencies = self.GenFile.DirectDependencies if (self.Type == PackageType.ExternalLibrary and platformName == PlatformNameString.ANDROID and PlatformUtil.DetectBuildPlatformType() == BuildPlatformType.Windows and self.__TryGetExperimentaleRecipe(platformName) is not None): directDependencies += [ FakeXmlGenFileDependency(self._BasicConfig, "Recipe.BuildTool.ninja", AccessType.Public) ] if not platformName in self.Platforms: return directDependencies for basePackage in self.ProjectContext.BasePackages: if self.Name != basePackage.Name and not self.__ContainsDependency( directDependencies, basePackage.Name) and self.Type != PackageType.ToolRecipe: directDependencies += [ FakeXmlGenFileDependency(self._BasicConfig, basePackage.Name, AccessType.Public) ] return directDependencies + self.Platforms[ platformName].DirectDependencies
def GetSDKNDKId() -> str: sdkVersion = AndroidUtil.GetSDKVersion().replace('.', '_') ndkVersion = AndroidUtil.GetNDKVersion().replace('.', '_') hostType = "Win" if PlatformUtil.DetectBuildPlatformType( ) == BuildPlatformType.Windows else "Unix" return "S{0}N{1}{2}".format(sdkVersion, ndkVersion, hostType)
def Process(self, currentDirPath: str, toolConfig: ToolConfig, localToolConfig: LocalToolConfig) -> None: config = Config(self.Log, toolConfig, 'sdk', localToolConfig.BuildVariantsDict, localToolConfig.AllowDevelopmentPlugins) if localToolConfig.DryRun: config.ForceDisableAllWrite() if localToolConfig.ToCDepth < 1: localToolConfig.ToCDepth = 1 elif localToolConfig.ToCDepth > 4: localToolConfig.ToCDepth = 4 config.PrintTitle() # Get the platform and see if its supported platform = PluginConfig.GetGeneratorPluginById( localToolConfig.PlatformName, False) PlatformUtil.CheckBuildPlatform(platform.Name) config.LogPrint("Active platform: {0}".format(platform.Name)) packageFilters = localToolConfig.BuildPackageFilters theFiles = MainFlow.DoGetFiles(config, toolConfig.GetMinimalConfig(), currentDirPath, localToolConfig.Recursive) generatorContext = GeneratorContext(config, config.ToolConfig.Experimental, platform) packages = MainFlow.DoGetPackages(generatorContext, config, theFiles, packageFilters) #topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) #featureList = [entry.Name for entry in topLevelPackage.ResolvedAllUsedFeatures] for rootDir in config.ToolConfig.RootDirectories: readmePath = IOUtil.Join(rootDir.ResolvedPath, "README.md") packageReadMeLines = TryLoadReadMe(config, readmePath) result = ProcessPackages(self.ToolAppContext, config, packages, rootDir, localToolConfig.ExtractArguments, toolConfig.BuildDocConfiguration) if packageReadMeLines is not None: packageReadMeLinesNew = TryReplaceSection( config, packageReadMeLines, "AG_DEMOAPPS", result, readmePath) if packageReadMeLinesNew is not None: packageReadMeLines = packageReadMeLinesNew packageReadMeLinesNew = TryInsertTableOfContents( config, packageReadMeLines, localToolConfig.ToCDepth, readmePath) if packageReadMeLinesNew is not None: packageReadMeLines = packageReadMeLinesNew SaveReadMe(config, readmePath, packageReadMeLines) elif config.Verbosity > 2: config.LogPrintWarning("No README.md found in {0}".format( rootDir.ResolvedPath))
def __ValidateFindExecutableFileInPath(self, rErrorRecordList: List[ErrorRecord], installationPath: Optional[str], command: XmlRecipeValidateCommandFindExecutableFileInPath, packageRecipeResult: PackageRecipeResult) -> bool: # Patch filename with the platform dependent name alternatives = [command.Name] if len(command.Alternatives) > 0: alternatives += command.Alternatives retry = True currentCommandName = "" newErrors = [] # type: List[ErrorRecord] while retry and len(alternatives) > 0: currentCommandName = alternatives[0] retry = False platformFilename = PlatformUtil.GetPlatformDependentExecuteableName(currentCommandName, PlatformUtil.DetectBuildPlatformType()) result, value = self.__TryFindFileInPath(newErrors, installationPath, platformFilename, command.ExpectedPath) foundVersion = [0] if result and value is not None and command.VersionCommand is not None: if command.VersionCommand is None or command.VersionRegEx is None: raise Exception("Internal error") foundVersion = self.__TryValidateCommandVersion(value, command.VersionCommand, command.VersionRegEx, command.MinVersion, command.AddOnErrorWarning) result = len(foundVersion) > 0 # Cache information about what we discovered if result and value is not None: exeRecord = PackageRecipeResultFoundExecutable(command.Name, currentCommandName, value, self.__ToVersion(foundVersion)) packageRecipeResult.AddFoundExecutable(exeRecord) elif len(alternatives) > 0: alternatives = alternatives[1:] retry = True if self.__BasicConfig.Verbosity >= 1: # On failure we show the 'most' common name if result or (len(command.Alternatives) < 0): if command.ExpectedPath is None: self.__BasicConfig.LogPrint("Validating executable file '{0}' is in path: {1}".format(currentCommandName, result)) else: self.__BasicConfig.LogPrint("Validating executable file '{0}' is in path at '{1}': {2}".format(currentCommandName, command.ExpectedPath, result)) else: allAlternatives = [command.Name] if command.Alternatives is not None: allAlternatives += command.Alternatives if command.ExpectedPath is None: self.__BasicConfig.LogPrint("Validating one of these executable files '{0}' is in path: {1}".format(", ".join(allAlternatives), result)) else: self.__BasicConfig.LogPrint("Validating one of these executable files '{0}' is in path at '{1}': {2}".format(", ".join(allAlternatives), command.ExpectedPath, result)) if not value is None and self.__BasicConfig.Verbosity >= 2: self.__BasicConfig.LogPrint(" '{0}'".format(value)) if not result: rErrorRecordList += newErrors return result
def Process(self, currentDirPath: str, toolConfig: ToolConfig, localToolConfig: LocalToolConfig) -> None: config = Config(self.Log, toolConfig, 'sdk', localToolConfig.BuildVariantsDict, localToolConfig.AllowDevelopmentPlugins) if localToolConfig.DryRun: config.ForceDisableAllWrite() if localToolConfig.ToCDepth < 1: localToolConfig.ToCDepth = 1 elif localToolConfig.ToCDepth > 4: localToolConfig.ToCDepth = 4 config.PrintTitle() # Get the generator and see if its supported buildVariantConfig = BuildVariantConfigUtil.GetBuildVariantConfig(localToolConfig.BuildVariantsDict) generator = self.ToolAppContext.PluginConfigContext.GetGeneratorPluginById(localToolConfig.PlatformName, localToolConfig.Generator, buildVariantConfig, False, config.ToolConfig.CMakeConfiguration, localToolConfig.GetUserCMakeConfig()) PlatformUtil.CheckBuildPlatform(generator.PlatformName) config.LogPrint("Active platform: {0}".format(generator.PlatformName)) packageFilters = localToolConfig.BuildPackageFilters theFiles = MainFlow.DoGetFiles(config, toolConfig.GetMinimalConfig(), currentDirPath, localToolConfig.Recursive) generatorContext = GeneratorContext(config, self.ErrorHelpManager, packageFilters.RecipeFilterManager, config.ToolConfig.Experimental, generator) packages = MainFlow.DoGetPackages(generatorContext, config, theFiles, packageFilters) #topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) #featureList = [entry.Name for entry in topLevelPackage.ResolvedAllUsedFeatures] for projectContext in config.ToolConfig.ProjectInfo.Contexts: rootDir = self.__TryLocateRootDirectory(config.ToolConfig.RootDirectories, projectContext.Location) if rootDir is None: raise Exception("Root directory not found for location {0}".format(projectContext.Location)) readmePath = IOUtil.Join(rootDir.ResolvedPath, "README.md") packageReadMeLines = TryLoadReadMe(config, readmePath) result = ProcessPackages(self.ToolAppContext, config, packages, rootDir, localToolConfig.ExtractArguments, toolConfig.BuildDocConfiguration, currentDirPath) if packageReadMeLines is not None: projectCaption = "# {0} {1}".format(projectContext.ProjectName, projectContext.ProjectVersion) packageReadMeLinesNew = TryReplaceSection(config, packageReadMeLines, "AG_PROJECT_CAPTION", [projectCaption], readmePath) if packageReadMeLinesNew is not None: packageReadMeLines = packageReadMeLinesNew packageReadMeLinesNew = TryReplaceSection(config, packageReadMeLines, "AG_DEMOAPPS", result, readmePath) if packageReadMeLinesNew is not None: packageReadMeLines = packageReadMeLinesNew packageReadMeLinesNew = TryInsertTableOfContents(config, packageReadMeLines, localToolConfig.ToCDepth, readmePath) if packageReadMeLinesNew is not None: packageReadMeLines = packageReadMeLinesNew SaveReadMe(config, readmePath, packageReadMeLines) elif config.Verbosity > 2: config.LogPrintWarning("No README.md found in {0}".format(rootDir.ResolvedPath))
def __DetermineBuilder(self, generatorName: str, generatorContext: GeneratorContext, buildThreads: int) -> CMakeBuilder: if generatorName == CMakeTypes.CMakeGeneratorName.Android: if PlatformUtil.DetectBuildPlatformType() == BuildPlatformType.Windows: return CMakeBuilderNinja(generatorContext, buildThreads) return CMakeBuilderMake(generatorContext, buildThreads) if generatorContext.CMakeConfig.CMakeVersion < CMakeBuilderGeneric.MINIMUM_VERSION: if generatorName == CMakeTypes.CMakeGeneratorName.Ninja: return CMakeBuilderNinja(generatorContext, buildThreads, False) if generatorName == CMakeTypes.CMakeGeneratorName.UnixMakeFile: return CMakeBuilderMake(generatorContext, buildThreads) if generatorName == CMakeTypes.CMakeGeneratorName.VisualStudio2015_X64 or generatorName == CMakeTypes.CMakeGeneratorName.VisualStudio2017_X64 or generatorName == CMakeTypes.CMakeGeneratorName.VisualStudio2019_X64: return CMakeBuilderMSBuild(generatorContext, buildThreads) return CMakeBuilderGeneric(generatorContext, buildThreads)
def GetVersion() -> CMakeVersion: exeName = PlatformUtil.GetPlatformDependentExecuteableName( "cmake", PlatformUtil.DetectBuildPlatformType()) path = IOUtil.TryFindExecutable(exeName) if path is None: raise Exception("Could not locate cmake in path") cmd = [path, "--version"] version = RunCommand(cmd) versionString = "cmake version " if not version.startswith(versionString): raise Exception( "Failed to parse cmake version string '{0}'".format( versionString)) version = version[len(versionString):] indexEnd = version.find('\n') indexEnd = indexEnd if indexEnd >= 0 else len(version) version = version[0:indexEnd] indexEndMajor = version.index('.') indexEndMinor = version.index('.', indexEndMajor + 1) versionMajor = version[0:indexEndMajor] versionMinor = version[indexEndMajor + 1:indexEndMinor] return CMakeVersion(int(versionMajor), int(versionMinor))
def __DetermineBuilder(self, generatorName: str, generatorContext: GeneratorContext, buildThreads: int) -> CMakeBuilder: if generatorName == CMakeTypes.CMakeGeneratorName.UnixMakeFile: return CMakeBuilderMake(generatorContext, buildThreads) elif generatorName == CMakeTypes.CMakeGeneratorName.VisualStudio2015_X64 or generatorName == CMakeTypes.CMakeGeneratorName.VisualStudio2017_X64: return CMakeBuilderMSBuild(generatorContext, buildThreads) elif generatorName == CMakeTypes.CMakeGeneratorName.Android: if PlatformUtil.DetectBuildPlatformType( ) == BuildPlatformType.Windows: return CMakeBuilderNinja(generatorContext, buildThreads) else: return CMakeBuilderMake(generatorContext, buildThreads) raise Exception( "No Builder defined for the cmake generator '{0}' on platform '{1}'" .format(generatorName, generatorContext.PlatformName))
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 platformGeneratorPlugin = PluginConfig.GetGeneratorPluginById(localToolConfig.PlatformName, localToolConfig.Generator, False, config.ToolConfig.CMakeConfiguration, localToolConfig.GetUserCMakeConfig()) PlatformUtil.CheckBuildPlatform(platformGeneratorPlugin.PlatformName) config.LogPrint("Active platform: {0}".format(platformGeneratorPlugin.PlatformName)) theFiles = MainFlow.DoGetFiles(config, toolConfig.GetMinimalConfig(), currentDirPath, localToolConfig.Recursive) generatorContext = GeneratorContext(config, localToolConfig.BuildPackageFilters.RecipeFilterManager, config.ToolConfig.Experimental, platformGeneratorPlugin) PluginConfig.SetLegacyGeneratorType(localToolConfig.GenType) packageFilters = localToolConfig.BuildPackageFilters packages = MainFlow.DoGenerateBuildFilesNoAll(config, 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, config, 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, config, topLevelPackage, requestedFiles) else: if localToolConfig.BuildPackageFilters is None or localToolConfig.BuildPackageFilters.ExtensionNameList is None: raise Exception("localToolConfig.BuildPackageFilters.ExtensionNameList not set") Builder.BuildPackages(generatorContext, config, packages, localToolConfig.BuildVariantsDict, localToolConfig.RemainingArgs, localToolConfig.ForAllExe, platformGeneratorPlugin, localToolConfig.EnableContentBuilder, localToolConfig.ForceClaimInstallArea, localToolConfig.BuildThreads, localToolConfig.Command)
def __init__(self, log: Log, toolConfig: ToolConfig, srcType: str, variantsDict: Optional[Dict[str, str]], allowDevelopmentPlugins: bool) -> None: super().__init__(log, toolConfig) self.IsTestMode = False self.Type = srcType #self.SDKConfigPath = IOUtil.Join(sdkPath, ".Config") self.IsQuery = True if srcType == 'query' else False # type: bool self.IsSDKBuild = True if srcType == 'sdk' or self.IsQuery else False # type: bool self.TestPath = toolConfig.UnitTestPath self.DisableWrite = self.IsQuery self.DisableQueryWrite = False # type: bool self.SubPackageSupport = SubPackageSupport.Enabled #SubPackageSupport.ExecutableOnly if toolConfig.DefaultPackageLanguage != PackageLanguage.CSharp else SubPackageSupport.Enabled self.GroupException = True # type: bool # Variant extension is getting closer to working, so lets enable it self.AllowVariantExtension = True # type: bool self.GenFileName = toolConfig.GenFileName self.AllowDevelopmentPlugins = allowDevelopmentPlugins self.DisableIncludeDirCheck = False # type: bool self.DisableSourceDirCheck = False # type: bool self.IgnoreNotSupported = False # type: bool self.IsDryRun = False # type: bool self.VariantsDict = variantsDict if variantsDict else {} if self.IsQuery: self.Type = "sdk" #if not os.path.isdir(self.SDKConfigPath): # raise EnvironmentError("Config path '%s' does not point to a directory" % (self.SDKConfigPath)) buildPlatformType = PlatformUtil.DetectBuildPlatformType() if buildPlatformType == BuildPlatformType.Windows: self.__ResolvedLegacyToCurrentOSPathMethod = self.TryLegacyToDosPath self.__ResolvedLegacyToCurrentOSPathDirectConversionMethod = self.TryLegacyToDosPathDirectConversion self.__ResolvedToCurrentOSPathMethod = self.ToDosPath self.__ResolvedToCurrentOSPathDirectConversionMethod = self.ToDosPathDirectConversion else: self.__ResolvedLegacyToCurrentOSPathMethod = self.TryLegacyToBashPath self.__ResolvedLegacyToCurrentOSPathDirectConversionMethod = self.TryLegacyToBashPathDirectConversion self.__ResolvedToCurrentOSPathMethod = self.ToBashPath self.__ResolvedToCurrentOSPathDirectConversionMethod = self.ToBashPathDirectConversion
def Run(log: Log, createInfo: OpenProjectCreateInfo) -> None: log.LogPrintVerbose( 1, "Configuring and launching Visual Studio Code for path '{0}'". format(createInfo.SourcePath)) buildPlatformType = PlatformUtil.DetectBuildPlatformType() vsCodeConfigPath = IOUtil.Join(createInfo.SourcePath, ".vscode") launchFilePath = IOUtil.Join(vsCodeConfigPath, "launch.json") settingsFilePath = IOUtil.Join(vsCodeConfigPath, "settings.json") IOUtil.SafeMakeDirs(vsCodeConfigPath) log.LogPrintVerbose( 1, "- Patching settings at '{0}'".format(settingsFilePath)) log.PushIndent() try: VSCodeSettingsJsonUtil.Patch(log, settingsFilePath, createInfo.CMakeInfo) finally: log.PopIndent() exeInfo = createInfo.ExeInfo if exeInfo is not None: if log.Verbosity >= 1: log.LogPrint("- Patching launch settings at '{0}'".format( launchFilePath)) log.LogPrint(" - Exe: '{0}'".format(exeInfo.Executable)) log.LogPrint(" - Cwd: '{0}'".format( exeInfo.CurrentWorkingDirectory)) if not VSCodeLaunchJsonUtil.TryPatch( launchFilePath, buildPlatformType, exeInfo.Executable, exeInfo.CurrentWorkingDirectory): log.LogPrintVerbose( 1, "WARNING Failed to patch launch file '{0}'".format( launchFilePath)) else: log.LogPrintVerbose(1, "- Launch: No executable information found") log.PushIndent() try: OpenProjectUtil.__RunVSCode(log, buildPlatformType, createInfo.SourcePath) finally: log.PopIndent()
def BuildPackages(log: Log, configSDKPath: str, configIsDryRun: bool, toolConfig: ToolConfig, generatorContext: GeneratorContext, builderConfig: BuilderConfig, packages: List[Package], packageRecipeResultManager: Optional[PackageRecipeResultManager] = None) -> None: if packageRecipeResultManager is None: packageRecipeResultManager = PackageRecipeResultManager(log) PlatformUtil.CheckBuildPlatform(generatorContext.Platform.PlatformName) topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) buildConfig = BuildConfigRecord(toolConfig.ToolVersion, generatorContext.Platform.PlatformName, {}, CommandType.Build, [], None, None, 0) try: log.LogPrint("- Building recipe packages") log.PushIndent() __BuildNow(log, configSDKPath, configIsDryRun, generatorContext, builderConfig, topLevelPackage, buildConfig, packageRecipeResultManager) finally: log.PopIndent()
def BuildPackages(generatorContext: GeneratorContext, config: Config, packages: List[Package], variantSettingsDict: Dict[str, str], buildArgs: List[str], buildForAllExe: Optional[str], generator: GeneratorPluginBase2, enableContentBuilder: bool, forceClaimInstallArea: bool, buildThreads: int, buildCommand: int) -> None: PlatformUtil.CheckBuildPlatform(generatorContext.PlatformName) topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) BuildVariantUtil.ValidateUserVariantSettings(config, topLevelPackage, variantSettingsDict) BuildVariantUtil.LogVariantSettings(config, variantSettingsDict) buildConfig = BuildConfigRecord(generatorContext.PlatformName, variantSettingsDict, buildCommand, buildArgs, buildForAllExe, generator, buildThreads) Builder(generatorContext, config, topLevelPackage, buildConfig, enableContentBuilder, forceClaimInstallArea)
def BuildPackages(generatorContext: GeneratorContext, config: Config, packages: List[Package], variantSettingsDict: Dict[str, str], buildArgs: List[str], buildForAllExe: Optional[str], generator: GeneratorPluginBase2, enableContentBuilder: bool, forceClaimInstallArea: bool, buildThreads: int, buildCommand: CommandType, printPathIfCMake: bool = False) -> None: PlatformUtil.CheckBuildPlatform(generatorContext.PlatformName) topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) BuildVariantUtil.ValidateUserVariantSettings(config, topLevelPackage, variantSettingsDict) BuildVariantUtil.LogVariantSettings(config, variantSettingsDict) buildConfig = BuildConfigRecord(config.ToolConfig.ToolVersion, generatorContext.PlatformName, variantSettingsDict, buildCommand, buildArgs, buildForAllExe, generator, buildThreads) builder = Builder(generatorContext, config, topLevelPackage, buildConfig, enableContentBuilder, forceClaimInstallArea) # Print executable paths if enabled and its a cmake type build if printPathIfCMake and generatorContext.Generator.IsCMake and buildCommand == CommandType.Build and topLevelPackage is not None: for depPackage in topLevelPackage.ResolvedAllDependencies: package = depPackage.Package if package.Type == PackageType.Executable and builder.UsedBuildContext is not None and builder.UsedGeneratorConfig is not None: if not package.ResolvedPlatformNotSupported: runCommand = builder.TryGenerateRunCommandForExecutable( builder.UsedBuildContext, package, buildConfig, ["(EXE)"], builder.UsedGeneratorConfig) if runCommand is not None: config.DoPrint("Executable at: '{0}'".format( runCommand[0])) else: config.LogPrint( "Package '{0}' was not supported on this platform". format(package.Name))
def DetectBuildPlatform() -> str: return PlatformUtil.DetectBuildPlatform().lower()
def Process(self, currentDirPath: str, toolConfig: ToolConfig, localToolConfig: LocalToolConfig) -> None: config = Config(self.Log, toolConfig, localToolConfig.PackageConfigurationType, localToolConfig.BuildVariantsDict, localToolConfig.AllowDevelopmentPlugins) # create a config we control and that can be used to just build the tool recipe's configToolCheck = Config(self.Log, toolConfig, PluginSharedValues.TYPE_DEFAULT, localToolConfig.BuildVariantsDict, localToolConfig.AllowDevelopmentPlugins) if localToolConfig.DryRun: config.ForceDisableAllWrite() configToolCheck.ForceDisableAllWrite() self.__CheckUserArgs(localToolConfig.ClangFormatArgs, "formatArgs") self.__CheckUserArgs(localToolConfig.ClangTidyArgs, "tidyArgs") self.__CheckUserArgs(localToolConfig.ClangTidyPostfixArgs, "tidyPostfixArgs") applyClangFormat = toolConfig.ClangFormatConfiguration is not None and localToolConfig.ClangFormat applyClangTidy = toolConfig.ClangTidyConfiguration is not None and localToolConfig.ClangTidy if localToolConfig.IgnoreNotSupported or ( (localToolConfig.ScanSource or applyClangFormat) and not applyClangTidy): config.IgnoreNotSupported = True configToolCheck.IgnoreNotSupported = True packageFilters = localToolConfig.BuildPackageFilters # Get the platform and see if its supported platform = PluginConfig.GetGeneratorPluginById( localToolConfig.PlatformName, False) PlatformUtil.CheckBuildPlatform(platform.Name) generatorContext = GeneratorContext(config, config.ToolConfig.Experimental, platform) config.LogPrint("Active platform: {0}".format(platform.Name)) packageRecipeResultManager = None # type: Optional[PackageRecipeResultManager] toolPackageNames = [] if applyClangFormat or applyClangTidy: if applyClangFormat: if toolConfig.ClangFormatConfiguration is None: raise Exception("internal error") toolPackageNames.append( toolConfig.ClangFormatConfiguration.RecipePackageName) if applyClangTidy: if toolConfig.ClangTidyConfiguration is None: raise Exception("internal error") toolPackageNames.append( toolConfig.ClangTidyConfiguration.RecipePackageName) packageRecipeResultManager = ForceCheckBuildTools( configToolCheck, generatorContext, toolPackageNames) searchDir = currentDirPath if localToolConfig.File is not None and IOUtil.IsAbsolutePath( localToolConfig.File): searchDir = IOUtil.GetDirectoryName(localToolConfig.File) closestGenFilePath = FileFinder.TryFindClosestFileInRoot( config, toolConfig, searchDir, config.GenFileName) if closestGenFilePath is None: closestGenFilePath = searchDir if (self.Log.Verbosity >= 4): self.Log.LogPrint("Closest '{0}' file path: '{1}'".format( toolConfig.GenFileName, closestGenFilePath)) packageProcess = None # type: Optional[MainFlow.PackageLoadAndResolveProcess] packages = None discoverFeatureList = '*' in packageFilters.FeatureNameList if discoverFeatureList or localToolConfig.Project is None or localToolConfig.ScanSource or applyClangFormat or applyClangTidy: if discoverFeatureList: config.LogPrint( "No features specified, so using package to determine them" ) if localToolConfig.ScanSource or applyClangFormat or applyClangTidy or discoverFeatureList: packageProcess = self.__CreatePackageProcess( config, toolConfig.GetMinimalConfig(), closestGenFilePath, localToolConfig.Recursive, generatorContext.Platform, toolPackageNames) packageProcess.Resolve(generatorContext, packageFilters, applyClangTidy, False) packages = packageProcess.Packages topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) if discoverFeatureList: packageFilters.FeatureNameList = [ entry.Name for entry in topLevelPackage.ResolvedAllUsedFeatures ] customPackageFileFilter = None # type: Optional[CustomPackageFileFilter] if not localToolConfig.ScanSource and not applyClangFormat and not applyClangTidy: Validate.ValidatePlatform(config, localToolConfig.PlatformName, packageFilters.FeatureNameList) if packageProcess is None: packageProcess = self.__CreatePackageProcess( config, toolConfig.GetMinimalConfig(), closestGenFilePath, localToolConfig.Recursive, generatorContext.Platform, toolPackageNames) if not packageProcess.IsFullResolve or packages is None: # For now this requires a full resolve (but basically it only requires basic + files) packages = packageProcess.Resolve(generatorContext, packageFilters, applyClangTidy, True) topLevelPackage = PackageListUtil.GetTopLevelPackage(packages) RecipeBuilder.ValidateInstallationForPackages( config, generatorContext, topLevelPackage.ResolvedBuildOrder) else: if localToolConfig.File is not None: # Delay extension validation customPackageFileFilter = CustomPackageFileFilter( localToolConfig.File) theTopLevelPackage = None # type: Optional[Package] filteredPackageList = [] # type: List[Package] if applyClangTidy or applyClangFormat or localToolConfig.ScanSource: addExternals = applyClangTidy filteredPackageList, theTopLevelPackage = self.__PreparePackages( self.Log, localToolConfig, packageProcess, generatorContext, packageFilters, addExternals, packages, config.IsSDKBuild, applyClangTidy, config) if len(filteredPackageList) <= 0: self.Log.DoPrint("No supported packages left to process") return if applyClangTidy: self.__ApplyClangTidy(self.Log, toolConfig, localToolConfig, packageRecipeResultManager, theTopLevelPackage, filteredPackageList, platform, config, generatorContext, customPackageFileFilter) if applyClangFormat: self.__ApplyClangFormat(self.Log, toolConfig, localToolConfig, packageRecipeResultManager, filteredPackageList, customPackageFileFilter) # Scan source after 'format' to ensure we dont warn about stuff that has been fixed if localToolConfig.ScanSource: self.__ApplyScanSource(self.Log, localToolConfig, config.IsSDKBuild, config.DisableWrite, filteredPackageList, customPackageFileFilter)
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: PluginConfig.EnableGraph() theFiles = MainFlow.DoGetFiles(config, toolConfig.GetMinimalConfig(), currentDirPath, localToolConfig.Recursive) PluginConfig.SetGeneratorType(localToolConfig.GenType) platformGeneratorPlugin = PluginConfig.GetGeneratorPluginById( localToolConfig.PlatformName, True) generatorContext = GeneratorContext(config, config.ToolConfig.Experimental, platformGeneratorPlugin) packages = MainFlow.DoGenerateBuildFiles( config, theFiles, platformGeneratorPlugin, localToolConfig.BuildPackageFilters) # 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: if not isinstance(packages, dict): self.__DoBuildRecipes(config, generatorContext, packages, localToolConfig.ForceClaimInstallArea, localToolConfig.BuildThreads) else: for platformName, platformResult in packages.items(): platformPackageList = platformResult[0] if len(platformPackageList ) > 0 and PlatformUtil.TryCheckBuildPlatform( platformName): self.Log.DoPrint("Generator: {0}".format(platformName)) tempPlatformGeneratorPlugin = PluginConfig.GetGeneratorPluginById( platformName, True) tempGeneratorContext = GeneratorContext( config, config.ToolConfig.Experimental, tempPlatformGeneratorPlugin) try: self.Log.PushIndent() self.__DoBuildRecipes( config, tempGeneratorContext, platformPackageList, localToolConfig.ForceClaimInstallArea, localToolConfig.BuildThreads) finally: self.Log.PopIndent()
def DetermineFinalCMakeGenerator(generatorName: str) -> str: if generatorName != CMakeGeneratorName.Android: return generatorName if PlatformUtil.DetectBuildPlatformType() == BuildPlatformType.Windows: return CMakeGeneratorName.Ninja return CMakeGeneratorName.UnixMakeFile
def __DetermineHostPlatformName(self, platformName: str) -> str: if platformName != PlatformNameString.ANDROID: return platformName if PlatformUtil.DetectBuildPlatformType() == BuildPlatformType.Windows: return PlatformNameString.WINDOWS return PlatformNameString.UBUNTU
def __Run(appFlowFactory: AToolAppFlowFactory, strToolAppTitle: str, toolCommonArgConfig: ToolCommonArgConfig, lowLevelToolConfig: LowLevelToolConfig, allowStandaloneMode: bool) -> None: log = Log(strToolAppTitle, lowLevelToolConfig.VerbosityLevel, showAppTitleIfVerbose=True) pluginConfigContext = PluginConfig.InitPluginConfigContext( log, CurrentVersion, lowLevelToolConfig.AllowDevelopmentPlugins) generatorIds = __PrepareGeneratorPlugins(pluginConfigContext, lowLevelToolConfig, toolCommonArgConfig) try: defaultPlatform = DetectBuildPlatform() except (Exception) as ex: print("ERROR: {0}".format(ex)) if lowLevelToolConfig.DebugEnabled: raise sys.exit(1) ### Do the actual command line parsing parser = __CreateParser(toolCommonArgConfig, allowStandaloneMode) if toolCommonArgConfig.AddPlatformArg: parser.add_argument('-p', '--platform', default=defaultPlatform, help='Select build platform: {0}'.format( ", ".join(generatorIds))) if toolCommonArgConfig.AllowForceClaimInstallArea: parser.add_argument( '--ForceClaimInstallArea', action='store_true', help= 'Override the security checks on the install area allowing us to use it even though its not empty. This means the existing content can be lost.' ) #parser.add_argument('--NativeGen', action='store_true', help='Force use the native build generator') toolConfig = None baseConfig = None try: basicConfig = BasicConfig(log) currentDir = lowLevelToolConfig.CurrentDir # Try to locate a project root configuration file projectRootConfig = GetProjectRootConfig(lowLevelToolConfig, basicConfig, currentDir) toolConfigFile = projectRootConfig.ToolConfigFile # Get the path to the toolconfig file if necessary and load the tool config file buildPlatformType = PlatformUtil.DetectBuildPlatformType() toolConfigPath = __GetToolConfigPath(toolConfigFile) toolConfig = ToolConfig(lowLevelToolConfig, buildPlatformType, CurrentVersion, basicConfig, toolConfigPath, projectRootConfig) baseConfig = BaseConfig(log, toolConfig) except (Exception) as ex: print("ERROR: {0}".format(ex)) if lowLevelToolConfig.DebugEnabled: raise sys.exit(1) buildTiming = None errorHelpManager = ErrorHelpManager() try: defaultVSVersion = toolConfig.GetVisualStudioDefaultVersion() #if toolCommonArgConfig.AllowVSVersion: parser.add_argument( '--VSVersion', default=str(defaultVSVersion), help= 'Choose a specific visual studio version (2015,2017), This project defaults to: {0}' .format(defaultVSVersion)) userTag = appFlowFactory.CreateUserTag(baseConfig) appFlowFactory.AddCustomArguments(parser, toolConfig, userTag) args = parser.parse_args() #if toolCommonArgConfig.AllowVSVersion: pluginConfigContext.SetVSVersion(args.VSVersion) #if toolCommonArgConfig.AddPlatformArg and args.platform.lower() != PluginSharedValues.PLATFORM_ID_ALL: #PluginConfig.SetForceUseNativeGenerator(True) #PluginConfig.SetForceUseNativeGenerator(args.NativeGen) if toolCommonArgConfig.ProcessRemainingArgs: args.RemainingArgs = __ProcessRemainingArgs(args.RemainingArgs) if toolCommonArgConfig.SupportBuildTime and args.BuildTime: buildTiming = BuildTimer() if toolCommonArgConfig.AddBuildFiltering and args.Recipes == DefaultValue.Recipes: if projectRootConfig.XmlExperimental is not None: tmpResult = projectRootConfig.XmlExperimental.TryGetRecipesDefaultValue( defaultPlatform) if tmpResult is not None: args.Recipes = "[{0}]".format(tmpResult) toolAppConfig = __CreateToolAppConfig(args, defaultPlatform, toolCommonArgConfig, defaultVSVersion) toolAppContext = ToolAppContext(log, errorHelpManager, lowLevelToolConfig, toolAppConfig, pluginConfigContext) toolAppFlow = appFlowFactory.Create(toolAppContext) toolAppFlow.ProcessFromCommandLine(args, currentDir, toolConfig, userTag) if buildTiming: PrintBuildTiming(buildTiming) except GroupedException as ex: __OnErrorInfo(buildTiming, errorHelpManager) for entry in ex.ExceptionList: print("ERROR: {0}".format(entry)) if lowLevelToolConfig.DebugEnabled: raise for entry in ex.ExceptionList: if isinstance(entry, ExitException): sys.exit(entry.ExitCode) sys.exit(1) except AggregateException as ex: __OnErrorInfo(buildTiming, errorHelpManager) for entry in ex.ExceptionList: print("ERROR: {0}".format(entry)) if lowLevelToolConfig.DebugEnabled: if len(ex.ExceptionList) > 0: raise ex.ExceptionList[0] raise for entry in ex.ExceptionList: if isinstance(entry, ExitException): sys.exit(entry.ExitCode) sys.exit(1) except ExitException as ex: __OnErrorInfo(buildTiming, errorHelpManager) sys.exit(ex.ExitCode) except Exception as ex: __OnErrorInfo(buildTiming, errorHelpManager) print("ERROR: {0}".format(ex)) if lowLevelToolConfig.DebugEnabled: raise sys.exit(1)
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)
def DetermineCMakeCommand(platformName: str) -> str: return PlatformUtil.GetExecutableName('cmake', platformName)