def __init__(self, config: Config, platformName: str, generatorInfo: GeneratorInfo, genFiles: List[XmlGenFile], logVerbosity: int = 1) -> None: super().__init__() # create top level package and resolve build order config.LogPrintVerbose(logVerbosity, "Validating dependencies") packageManager = PackageManager(config, platformName, generatorInfo, genFiles) packages = packageManager.Packages # Build a graph containing all packages graph = DependencyGraph(None) #, True) for package in packages: graph.AddNode(package) graph.Finalize() # Extract the top level nodes nodes = graph.GetNodesWithNoIncomingDependencies() #useFallback = True if len(nodes) > 0: topLevelGenFile = XmlGenFile( config, config.ToolConfig.DefaultPackageLanguage) topLevelGenFile.Name = PackageNameMagicString.TopLevelName topLevelGenFile.SetType(PackageType.TopLevel) for entry in nodes: topLevelGenFile.DirectDependencies.append( FakeXmlGenFileDependency(config, entry.Name, AccessType.Public)) topLevelGenFile.DirectDependencies.sort( key=lambda s: s.Name.lower()) else: # We have circular dependencies and couldnt find any starting nodes # so generate a empty top level node and expect a circular dependency # error to be caught topLevelGenFile = XmlGenFile( config, config.ToolConfig.DefaultPackageLanguage) topLevelGenFile.Name = PackageNameMagicString.TopLevelName topLevelGenFile.SetType(PackageType.TopLevel) topLevelPackage = packageManager.CreatePackage(config, platformName, topLevelGenFile, True) graph.AddNodeAndEdges(topLevelPackage) # Since we need to resolve the build order we might as well verify dependencies at the same time self.__ValidateDependencies(config, packages) self.AllPackages = packages # type: List[Package] self.TopLevelPackage = topLevelPackage self.__ResolveAllPackageDependencies(config, topLevelPackage)
def __init__(self, genFileName: str, template: XmlNewTemplateFile, projectPath: str, projectName: str, packageName: str) -> None: self.Template = template self.ProjectName = projectName self.ProjectPath = projectPath self.PrefixedProjectName = template.Prefix + projectName self.PackageName = packageName self.PackageShortName, self.PackageNamespace = XmlGenFile.GetPackageNamesUtil(packageName) self.PackageTargetName = packageName self.ProjectPrefix = template.Prefix self.ProjectPathInclude = os.path.join(projectPath, g_projectInclude) self.ProjectPathSource = os.path.join(projectPath, g_projectSource) self.TemplatePathCode = os.path.join(template.Path, g_templatePathCode) self.TemplatePathFslGen = os.path.join(template.Path, g_templatePathFslGen) self.ConfigCode = ConfigCode(self.TemplatePathCode, projectPath, projectName, self.PrefixedProjectName) self.ConfigFslGen = ConfigFslGen(genFileName, self.TemplatePathFslGen, projectPath, projectName, self.PrefixedProjectName)
def _CreateXmlGenFile(config: Config, defaultPackageLanguage: int) -> XmlGenFile: return XmlGenFile(config, defaultPackageLanguage)
def _CreateXmlGenFile(log: Log, toolConfig: ToolConfig, defaultPackageLanguage: PackageLanguage) -> XmlGenFile: return XmlGenFile(log, toolConfig, defaultPackageLanguage)