Exemplo n.º 1
0
    def Process(log: Log, toolConfig: ToolConfig, customPackageFileFilter: Optional[CustomPackageFileFilter],
                clangFormatConfiguration: ClangFormatConfiguration, cmakeConfig: GeneratorCMakeConfig,
                clangFormatExeInfo: ClangExeInfo, ninjaExeInfo: ClangExeInfo, sortedPackageList: List[Package],
                repairEnabled: bool, numBuildThreads: int) -> int:
        totalProcessedCount = 0

        logOutput = False
        currentWorkingDirectory = BuildUtil.GetBuildDir(log, toolConfig, cmakeConfig.CheckDir)
        currentWorkingDirectory = IOUtil.Join(currentWorkingDirectory, "format")
        ninjaOutputFile =  IOUtil.Join(currentWorkingDirectory, "build.ninja")
        toolVersionOutputFile =  IOUtil.Join(currentWorkingDirectory, "ToolVersions.txt")
        IOUtil.SafeMakeDirs(currentWorkingDirectory)

        log.LogPrint("Using path: '{0}'".format(currentWorkingDirectory))

        log.LogPrint("Storing tool versions.")
        PerformClangFormatHelper2.WriteToolVersionFile(log, toolVersionOutputFile, clangFormatExeInfo, ninjaExeInfo)

        log.LogPrint("Generating ninja format file.")
        #foundFixes = PerformClangTidyHelper2.FindFixes(log, clangTidyFixOutputFolder)
        #if len(foundFixes) > 0:
        #    PerformClangTidyHelper2.DeleteFixes(log, clangTidyFixOutputFolder, foundFixes)

        totalProcessedCount = PerformClangFormatHelper2.GenerateNinjaTidyFile(log, toolConfig, ninjaOutputFile, currentWorkingDirectory,
                                                                              toolVersionOutputFile, clangFormatExeInfo, customPackageFileFilter,
                                                                              clangFormatConfiguration, sortedPackageList, repairEnabled)
        log.LogPrint("Executing ninja format file.")

        RunHelper.RunNinja(log, ninjaExeInfo, ninjaOutputFile, currentWorkingDirectory, numBuildThreads, logOutput)

        return totalProcessedCount
Exemplo n.º 2
0
    def _DoTryGenerateConfigReport(
            self, log: Log, generatorConfig: GeneratorConfig,
            topLevelPackage: Package
    ) -> Optional[PackageGeneratorConfigReport]:
        if self.CMakeConfig is None:
            raise Exception("internal error generator not configured")

        configVariant = self.GeneratorVariants[ToolAddedVariant.CONFIG]
        cmakeBuildPackageDir = BuildUtil.GetBuildDir(
            generatorConfig.ToolConfig.ProjectInfo, self.CMakeConfig.CacheDir)

        return GeneratorCMake.GenerateGeneratorBuildConfigReport(
            log, generatorConfig, self.CMakeConfig, cmakeBuildPackageDir,
            topLevelPackage, configVariant.Options)
Exemplo n.º 3
0
    def DoGenerate(self, platformContext: PlatformContext, config: Config,
                   packages: List[Package]) -> List[Package]:
        if self.CMakeConfig is None:
            raise Exception("Internal error no CMakeConfig set")

        log = config  # type: Log
        toolConfig = config.ToolConfig
        cmakeBuildPackageDir = BuildUtil.GetBuildDir(toolConfig.ProjectInfo,
                                                     self.CMakeConfig.CacheDir)

        generator = GeneratorCMake(
            log, toolConfig, packages, self.PlatformName,
            self.__CMakeTemplateName, self.__CMakeOverrideTemplateName,
            cmakeBuildPackageDir, config.SDKConfigTemplatePath,
            config.DisableWrite, self.__CMakeGeneratorMode)
        return self.GenerateDone(config, packages, self.PlatformName,
                                 generator)
Exemplo n.º 4
0
    def _DoGenerateReport(
            self, log: Log, generatorConfig: GeneratorConfig,
            packageList: List[Package]) -> TheGeneratorBuildReport:
        if self.CMakeConfig is None:
            raise Exception("internal error generator not configured")

        cmakeBuildPackageDir = BuildUtil.GetBuildDir(
            generatorConfig.ToolConfig.ProjectInfo, self.CMakeConfig.CacheDir)

        configVariant = self.GeneratorVariants[ToolAddedVariant.CONFIG]
        resultDict = {}  # type: Dict[Package, PackageGeneratorReport]
        for package in packageList:
            buildReport = GeneratorCMake.TryGenerateGeneratorPackageReport(
                log, generatorConfig, self.CMakeConfig, cmakeBuildPackageDir,
                package, configVariant.Options)
            if buildReport is not None:
                resultDict[package] = buildReport
        return TheGeneratorBuildReport(resultDict)
Exemplo n.º 5
0
 def GetIgnoreDirs(projectInfo: ToolConfigProjectInfo, cmakeConfig: GeneratorCMakeConfig, defaultBuildDir: str) -> List[str]:
     return [BuildUtil.GetBuildDir(projectInfo, defaultBuildDir), BuildUtil.GetBuildDir(projectInfo, cmakeConfig.BuildDir),
             BuildUtil.GetBuildDir(projectInfo, cmakeConfig.CacheDir), BuildUtil.GetBuildDir(projectInfo, cmakeConfig.CheckDir)]