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)
Ejemplo n.º 2
0
def main():

    #Try is just for catching KeyboardInterrupt
    try:
        #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)

        #### COMMENTED to allow building other gn targets.
        #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 uploadbackup is selected start the authentication process first, because user action is required.
        if ACTION_UPLOAD_BACKUP in Settings.actions:
            UploadBackup.init()

        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_RELEASE_NOTES in Settings.actions:
            actionReleaseNotes()

        if ACTION_CREATE_NUGET in Settings.actions:
            actionCreateNuget()

        if ACTION_UPLOAD_BACKUP in Settings.actions:
            actionUploadBackup()

        if Settings.runSetNugetKey is True:
            actionSetNugetKey()

        if ACTION_PUBLISH_NUGET in Settings.actions:
            actionPublishNuget()

        if ACTION_UPDATE_SAMPLE in Settings.actions:
            actionUpdatePublishedSample()

        if ACTION_RUN_UNITTESTS in Settings.actions:
            actionRunUnitTests()

        #Show a message if NuGet source needs to be set manually
        if NugetUtility.setNugetSourceManualy:
            Logger.printColorMessage(
                NugetUtility.set_source_instruction +
                NugetUtility.setNugetSourceManualy, ColoredFormatter.YELLOW)

    except KeyboardInterrupt:
        handleKeyboardInterupt()

    if Settings.setservernoteversion is True:
        ReleaseNotes.set_note_version_server()

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