示例#1
0
    def Execute(self, toolFinder: PackageToolFinder, path: str,
                target: CMakeTargetType, cmakeProjectName: str,
                configuration: BuildVariantConfig, buildEnv: Dict[str, str],
                parentPath: str) -> None:
        projectFile = "rules.ninja"

        if self.__UseRecipe:
            toolPackage = toolFinder.GetToolPackageByToolName('ninja')
            commandName = IOUtil.Join(toolPackage.AbsoluteToolPath,
                                      self.__CommandName)
        else:
            commandName = self.__CommandName

        self.Log.LogPrint(
            "* Running ninja at '{0}' for project '{1}' and configuration '{2}'"
            .format(path, projectFile,
                    BuildVariantConfig.ToString(configuration)))
        buildCommand = [commandName]
        if target == CMakeTargetType.Install:
            buildCommand.append('install')

        buildCommand += self.BuilderThreadArguments

        try:
            result = subprocess.call(buildCommand, cwd=path, env=buildEnv)
            if result != 0:
                raise Exception("ninja failed with {0} command {1}".format(
                    result, buildCommand))
        except Exception:
            self.Log.LogPrint("* ninja failed '{0}'".format(buildCommand))
            raise
 def DoExecute(self) -> None:
     sourcePackage = self.Info.SourcePackage
     recipeVariants = sourcePackage.ResolvedRecipeVariants
     packageToolFinder = PackageToolFinder(sourcePackage.ResolvedToolDependencyOrder)
     optionList = shlex.split(self.__SourceCommand.Options)
     optionList = self.__ApplyVariables(optionList)
     target = self.__SourceCommand.Target
     installPath = self.FinalDstPath
     sourcePath = self.Info.SrcRootPath
     if self.Source is not None:
         sourcePath = IOUtil.Join(sourcePath, self.Source)
     self.__RunCMakeAndBuild(sourcePackage, packageToolFinder, recipeVariants,
                             sourcePath, installPath, self.Info.DstRootPath, target,
                             self.__SourceCommand.Project, self.__SourceCommand.ConfigurationList, optionList,
                             self.AllowSkip)