示例#1
0
 def __ToVersion(self, foundVersion: List[int]) -> Version:
     if len(foundVersion) >= 4:
         return Version(foundVersion[0], foundVersion[1], foundVersion[2], foundVersion[3])
     if len(foundVersion) >= 3:
         return Version(foundVersion[0], foundVersion[1], foundVersion[2])
     if len(foundVersion) >= 2:
         return Version(foundVersion[0], foundVersion[1])
     return Version(foundVersion[0])
示例#2
0
def GetDefaultConfigForTest(
        enableTestMode: bool = False,
        customUnitTestRoots: Optional[List[str]] = None) -> Config:
    strToolAppTitle = "UnitTest"
    log = Log(strToolAppTitle, 0)
    currentDir = IOUtil.GetEnvironmentVariableForDirectory(
        "FSL_GRAPHICS_INTERNAL")
    basicConfig = BasicConfig(log)
    localToolConfig = LowLevelToolConfig(log.Verbosity, False, False, False,
                                         False, currentDir)
    projectRootConfig = ToolAppMain.GetProjectRootConfig(
        localToolConfig, basicConfig, currentDir)
    buildPlatformType = PlatformUtil.DetectBuildPlatformType()
    toolConfig = ToolConfig(localToolConfig, buildPlatformType,
                            Version(1, 3, 3, 7), basicConfig,
                            projectRootConfig.ToolConfigFile,
                            projectRootConfig)
    config = Config(log, toolConfig, PluginSharedValues.TYPE_UNIT_TEST, None,
                    True)
    config.ForceDisableAllWrite()
    if enableTestMode:
        config.SetTestMode()
    if customUnitTestRoots is not None:
        TEST_AddPackageRoots(config, customUnitTestRoots, True)
    return config
示例#3
0
 def _TryReadAttribAsVersion(
         self,
         xmlElement: ET.Element,
         attribName: str,
         defaultValue: Optional[Version] = None) -> Optional[Version]:
     """ Read the attrib if its available, else return defaultValue """
     strValue = self._TryReadAttrib(xmlElement, attribName, None)
     if strValue is not None:
         res = Version.TryFromString(strValue)
         if res is None:
             raise XmlFormatException(
                 "{0} expects a value in the format 'major[.minor[.patch[.tweak]]]' not '{1}'"
                 .format(attribName, strValue))
         return res
     return defaultValue
示例#4
0
from FslBuildGen.Exceptions import GroupedException
from FslBuildGen.Generator import PluginConfig
from FslBuildGen.Generator.PluginConfigContext import PluginConfigContext
from FslBuildGen.Log import Log
from FslBuildGen.Version import Version
from FslBuildGen.PlatformUtil import PlatformUtil
from FslBuildGen.ToolConfig import ToolConfig
from FslBuildGen.Tool.AToolAppFlowFactory import AToolAppFlowFactory
from FslBuildGen.Tool.LowLevelToolConfig import LowLevelToolConfig
from FslBuildGen.Tool.ToolAppConfig import DefaultValue
from FslBuildGen.Tool.ToolAppConfig import ToolAppConfig
from FslBuildGen.Tool.ToolAppContext import ToolAppContext
from FslBuildGen.Tool.ToolCommonArgConfig import ToolCommonArgConfig
from FslBuildGen.Xml.Project.XmlProjectRootConfigFile import XmlProjectRootConfigFile

CurrentVersion = Version(3, 3, 2, 1)


def __AddDefaultOptions(parser: argparse.ArgumentParser,
                        allowStandaloneMode: bool) -> None:
    parser.add_argument('-v',
                        '--verbosity',
                        action='count',
                        default=0,
                        help='Set verbosity level')
    parser.add_argument('--debug',
                        action='store_true',
                        help='Enable script debugging')
    parser.add_argument('--dev',
                        action='store_true',
                        help='Allow plugins in development')
示例#5
0
    def __init__(self, toolVersion: Version, platformName: str,
                 buildVariantConfig: BuildVariantConfig, buildDir: str,
                 buildDirSetByUser: bool, checkDir: str, generatorName: str,
                 installPrefix: Optional[str], cmakeVersion: CMakeVersion,
                 additionalGlobalConfigArguments: List[str],
                 additionalAppConfigArguments: List[str],
                 allowFindPackage: bool) -> None:
        super().__init__()

        PathUtil.ValidateIsNormalizedPath(buildDir, "BuildDir")
        if installPrefix is not None:
            PathUtil.ValidateIsNormalizedPath(installPrefix,
                                              "DefaultInstallPrefix")

        finalGeneratorName = CMakeHelper.DetermineFinalCMakeGenerator(
            generatorName)
        # its important that we use the  generatorName for the GetCompilerShortIdFromGeneratorName to get the proper android name
        generatorShortName = CMakeHelper.GetCompilerShortIdFromGeneratorName(
            generatorName)

        # Check if we should use a 'build variant temp dir'
        if not buildDirSetByUser:
            buildDir = IOUtil.Join(buildDir, generatorShortName)
            if CMakeHelper.GetGeneratorMultiConfigCapabilities(
                    finalGeneratorName
            ) == CMakeGeneratorMultiConfigCapability.No:
                buildDir = IOUtil.Join(
                    buildDir, BuildVariantConfig.ToString(buildVariantConfig))

        self.ToolVersion = toolVersion
        self.PlatformName = platformName
        self.BuildDir = buildDir
        self.CacheDir = IOUtil.Join(buildDir, '_fsl')
        # If this is true the user specified the directory
        self.BuildDirSetByUser = buildDirSetByUser
        self.CheckDir = checkDir

        # the active build variant
        self.BuildVariantConfig = buildVariantConfig
        self.GeneratorName = generatorName
        self.InstallPrefix = installPrefix
        self.CMakeVersion = cmakeVersion

        self.CMakeCommand = CMakeHelper.DetermineCMakeCommand(platformName)
        # The tool arguments
        self.CMakeInternalArguments = CMakeHelper.DetermineGeneratorArguments(
            finalGeneratorName, platformName)

        # This contains only the user arguments for both recipe and apps
        self.CMakeConfigUserGlobalArguments = additionalGlobalConfigArguments
        self.CMakeConfigUserAppArguments = additionalAppConfigArguments

        # The combined arguments that should be supplied to cmake
        self.CMakeConfigRecipeArguments = self.CMakeInternalArguments + additionalGlobalConfigArguments

        # The combined arguments that should be supplied to cmake
        self.CMakeConfigAppArguments = self.CMakeInternalArguments + additionalGlobalConfigArguments + additionalAppConfigArguments

        self.CMakeFinalGeneratorName = finalGeneratorName
        self.GeneratorShortName = generatorShortName
        self.GeneratorRecipeShortName = "{0}_{1}".format(
            generatorShortName,
            toolVersion.ToMajorMinorString().replace('.', '_'))
        self.AllowFindPackage = allowFindPackage
示例#6
0
from FslBuildGen.Exceptions import GroupedException
from FslBuildGen.Generator import PluginConfig
from FslBuildGen.Generator.PluginConfigContext import PluginConfigContext
from FslBuildGen.Log import Log
from FslBuildGen.Version import Version
from FslBuildGen.PlatformUtil import PlatformUtil
from FslBuildGen.ToolConfig import ToolConfig
from FslBuildGen.Tool.AToolAppFlowFactory import AToolAppFlowFactory
from FslBuildGen.Tool.LowLevelToolConfig import LowLevelToolConfig
from FslBuildGen.Tool.ToolAppConfig import DefaultValue
from FslBuildGen.Tool.ToolAppConfig import ToolAppConfig
from FslBuildGen.Tool.ToolAppContext import ToolAppContext
from FslBuildGen.Tool.ToolCommonArgConfig import ToolCommonArgConfig
from FslBuildGen.Xml.Project.XmlProjectRootConfigFile import XmlProjectRootConfigFile

CurrentVersion = Version(3, 1, 7, 1)


def __AddDefaultOptions(parser: argparse.ArgumentParser,
                        allowStandaloneMode: bool) -> None:
    parser.add_argument('-v',
                        '--verbosity',
                        action='count',
                        default=0,
                        help='Set verbosity level')
    parser.add_argument('--debug',
                        action='store_true',
                        help='Enable script debugging')
    parser.add_argument('--dev',
                        action='store_true',
                        help='Allow plugins in development')