Exemple #1
0
 def __BuildAddSubDirectoriesForDirectDependencies(
         self, config: Config, package: Package,
         template: CMakeGeneratorUtil.CodeTemplateCMake) -> str:
     if len(package.ResolvedBuildOrder) <= 0:
         return ""
     if package.AbsolutePath is None:
         raise Exception("Invalid package")
     content = ""
     for entry in package.ResolvedBuildOrder:
         if entry != package and entry.Type != PackageType.ToolRecipe:
             if entry.AbsolutePath is None:
                 raise Exception("Invalid package")
             path = CMakeGeneratorUtil.GetRelativePath(
                 config, package.AbsolutePath, entry.AbsolutePath)
             content += template.PackageDependencyAddSubdirectories.replace(
                 "##PACKAGE_PATH##", path)
     return content
 def __BuildAddSubDirectoriesForTopLevelDirectDependencies(
         self, config: Config, package: Package, projectAbsolutePath: str,
         template: CMakeGeneratorUtil.CodeTemplateCMake) -> str:
     if package.Type != PackageType.TopLevel:
         return ""
     if len(package.ResolvedBuildOrder) <= 0:
         return ""
     content = ""
     dependencies = list(package.ResolvedBuildOrder)
     dependencies.sort(key=lambda s: s.AbsolutePath.lower()
                       if s.AbsolutePath is not None else s.Name)
     projectAbsolutePathEx = projectAbsolutePath + '/'
     for entry in dependencies:
         if entry != package and entry.Type != PackageType.ToolRecipe:
             if entry.AbsolutePath is None:
                 raise Exception("Invalid package")
             if entry.AbsolutePath.startswith(projectAbsolutePathEx):
                 path = CMakeGeneratorUtil.GetRelativePath(
                     config, projectAbsolutePath, entry.AbsolutePath)
                 content += template.PackageDependencyAddSubdirectories.replace(
                     "##PACKAGE_PATH##", path)
     return content