Exemplo n.º 1
0
def __CreateToolAppConfig(args: Any, defaultPlatform: str, toolCommonArgConfig: ToolCommonArgConfig, defaultVSVersion: int) -> ToolAppConfig:
    # Configure the ToolAppConfig part
    toolAppConfig = ToolAppConfig()
    toolAppConfig.DefaultPlatformName = defaultPlatform

    toolAppConfig.AllowDevelopmentPlugins = True if args.dev else False
    if toolCommonArgConfig.AddPlatformArg:
        toolAppConfig.PlatformName = args.platform
    else:
        toolAppConfig.PlatformName = defaultPlatform

    if toolCommonArgConfig.ProcessRemainingArgs:
        toolAppConfig.RemainingArgs = args.RemainingArgs
    if toolCommonArgConfig.AllowForceClaimInstallArea:
        toolAppConfig.ForceClaimInstallArea = args.ForceClaimInstallArea
    toolAppConfig.VSVersion = int(args.VSVersion) #if toolCommonArgConfig.AllowVSVersion else defaultVSVersion

    if toolCommonArgConfig.AddBuildFiltering or toolCommonArgConfig.AddUseFeatures:
        toolAppConfig.BuildPackageFilters.FeatureNameList = ParseUtil.ParseFeatureList(args.UseFeatures)

    if toolCommonArgConfig.AddBuildFiltering:
        toolAppConfig.BuildPackageFilters.RequiredFeatureNameList = ParseUtil.ParseFeatureList(args.RequireFeatures)
        toolAppConfig.BuildPackageFilters.ExtensionNameList = ParseUtil.ParseExtensionList(args.UseExtensions)

    if toolCommonArgConfig.AddBuildVariants:
        toolAppConfig.BuildVariantsDict = ParseUtil.ParseVariantDict(args.Variants)

    if toolCommonArgConfig.AddBuildThreads:
        toolAppConfig.BuildThreads = BuildThreads.FromString(args.BuildThreads)

    if toolCommonArgConfig.AllowRecursive:
        toolAppConfig.Recursive = args.recursive

    return toolAppConfig
def __CreateToolAppConfig(args: Any, defaultPlatform: str,
                          toolCommonArgConfig: ToolCommonArgConfig,
                          defaultVSVersion: int) -> ToolAppConfig:
    # Configure the ToolAppConfig part
    toolAppConfig = ToolAppConfig()
    toolAppConfig.DefaultPlatformName = defaultPlatform

    toolAppConfig.AllowDevelopmentPlugins = True if args.dev else False
    if toolCommonArgConfig.AddPlatformArg:
        toolAppConfig.PlatformName = args.platform
    else:
        toolAppConfig.PlatformName = defaultPlatform

    if toolCommonArgConfig.ProcessRemainingArgs:
        toolAppConfig.RemainingArgs = args.RemainingArgs
    if toolCommonArgConfig.AllowForceClaimInstallArea:
        toolAppConfig.ForceClaimInstallArea = args.ForceClaimInstallArea

    toolAppConfig.VSVersion = int(args.VSVersion) if hasattr(
        args, 'VSVersion') else defaultVSVersion

    if toolCommonArgConfig.AddBuildFiltering or toolCommonArgConfig.AddUseFeatures:
        toolAppConfig.BuildPackageFilters.FeatureNameList = ParseUtil.ParseFeatureList(
            args.UseFeatures)

    if toolCommonArgConfig.AddBuildFiltering:
        toolAppConfig.BuildPackageFilters.RequiredFeatureNameList = ParseUtil.ParseFeatureList(
            args.RequireFeatures)
        toolAppConfig.BuildPackageFilters.ExtensionNameList = ParseUtil.ParseExtensionList(
            args.UseExtensions)
        toolAppConfig.BuildPackageFilters.RecipeFilterManager = ParseUtil.ParseRecipeList(
            args.Recipes)

    if toolCommonArgConfig.AddBuildVariants:
        toolAppConfig.BuildVariantsDict = ParseUtil.ParseVariantDict(
            args.Variants)

    if toolCommonArgConfig.AddBuildThreads:
        toolAppConfig.BuildThreads = BuildThreads.FromString(args.BuildThreads)

    if toolCommonArgConfig.AllowRecursive:
        toolAppConfig.Recursive = args.recursive

    if hasattr(args, 'Generator'):
        # Convert to the internal value instead of string
        toolAppConfig.Generator = GeneratorType.FromString(args.Generator)

    # Handle the CMake parameters
    if hasattr(args, 'CMakeBuildDir'):
        toolAppConfig.CMakeBuildDir = None if args.CMakeBuildDir is None else IOUtil.NormalizePath(
            args.CMakeBuildDir)
    if hasattr(args, 'CMakeInstallPrefix'):
        toolAppConfig.CMakeInstallPrefix = None if args.CMakeInstallPrefix is None else IOUtil.NormalizePath(
            args.CMakeInstallPrefix)
    if hasattr(args, 'CMakeGeneratorName'):
        toolAppConfig.CMakeGeneratorName = args.CMakeGeneratorName

    return toolAppConfig