Ejemplo n.º 1
0
def main():

    #Save time when script is started to calculate total execution tima
    start_time = time.time()

    #Determine host OS, checks supported targets, update python and system paths.
    System.preInit()

    #Parse input parameters if any. This must be call after System.preInit, because it is required to determine host os first.
    Input.parseInput(sys.argv[1:])

    #Start message put here, so it is not shown when script help is being shown.
    Logger.printStartActionMessage('Script execution', ColoredFormatter.YELLOW)

    #Create userdef.py file if missing. Load settings. Create system logger. Download depot tools (gn and clang-format). -----Set working directory to rood sdk folder.
    System.setUp()

    #Create root logger
    mainLogger = Logger.getLogger('Main')
    mainLogger.info('Root logger is created')

    #Check if required tools are installed. Currently git (used for downloading iOS binaries) and perl(used in assembly builds)
    errorCode = System.checkTools()
    if errorCode != 0:
        System.stopExecution(errorCode)

    #Check if specified targets are supported
    if not System.checkIfTargetsAreSupported(Settings.targets):
        mainLogger.error('Target from the list ' + str(Settings.targets) +
                         ' is not supported')
        System.stopExecution(ERROR_TARGET_NOT_SUPPORTED)

    #Check if specified platforms are supported
    if not System.checkIfPlatformsAreSupported(Settings.targetPlatforms):
        mainLogger.error('Platform from the list ' +
                         str(Settings.targetPlatforms) + ' is not supported')
        System.stopExecution(ERROR_PLATFORM_NOT_SUPPORTED)

    #Start performing actions. Actions has to be executed in right order and that is the reason why it is handled this way
    if ACTION_CLEAN in Settings.actions:
        actionClean()

    if ACTION_CREATE_USERDEF in Settings.actions:
        actionCreateUserdef()

    if ACTION_PREPARE in Settings.actions:
        actionPrepare()

    if ACTION_BUILD in Settings.actions:
        actionBuild()

    if ACTION_BACKUP in Settings.actions:
        actionBackup()

    if ACTION_CREATE_NUGET in Settings.actions:
        actionCreateNuget()

    if ACTION_PUBLISH_NUGET in Settings.actions:
        actionPublishNuget()

    if ACTION_UPDATE_SAMPLE in Settings.actions:
        actionUpdatePublishedSample()

    end_time = time.time()
    Summary.printSummary(end_time - start_time)