Example #1
0
 def get_adb(config):
     sdk_dir = Builder.get_android_sdk_dir(config)
     adb_exe_name = os.name == "nt" and "adb.exe" or "adb"
     if os.path.isdir(sdk_dir) and is_exe(os.path.join(sdk_dir, "platform-tools", adb_exe_name)):
         return os.path.join(sdk_dir, "platform-tools", adb_exe_name)
     Logger.debug("[ERROR] Builder.get_adb() return None.")
     return None
Example #2
0
 def get_adb(config):
     sdk_dir = Builder.get_android_sdk_dir(config)
     adb_exe_name = os.name == 'nt' and 'adb.exe' or 'adb'
     if os.path.isdir(sdk_dir) and is_exe(os.path.join(sdk_dir, 'platform-tools', adb_exe_name)):
         return os.path.join(sdk_dir, 'platform-tools', adb_exe_name)
     Logger.debug('[ERROR] Builder.get_adb() return None.')
     return None
Example #3
0
    def __init__(self,
                 command,
                 logger=None,
                 main_class=None,
                 java=None,
                 jar=None,
                 java_opts=None,
                 classpath=None):

        if not java:
            java = self.FindJava(logger)
            if not java:
                raise Exception("Cannot find Java")

        if not is_exe(java):
            raise Exception("{} is not executable file".format(java))

        logger.debug("Java = {}".format(java))

        java_command = [java]
        if java_opts:
            java_command.extend(java_opts)
        if classpath:
            java_command.append('-classpath')
            java_command.append(classpath)
        if jar:
            java_command.append('-jar')
            java_command.append(jar)
        if main_class:
            java_command.append(main_class)
        java_command.extend(command)
        logger.debug("Java command: {}".format(java_command))

        super().__init__(java_command, logger=logger)
Example #4
0
 def get_dx(config):
     if is_windows_system():
         if 'build_tools_directory' in config and os.path.exists(config['build_tools_directory']):
             path = os.path.join(config['build_tools_directory'], 'dx.bat')
             if is_exe(path):
                 return path
     else:
         return os.path.join('freeline', 'release-tools', 'dx')
Example #5
0
 def get_javac(config=None):
     path = os.getenv('JAVA_HOME')
     if config is not None and 'java_home' in config:
         path = config['java_home']
     exec_name = 'javac.exe' if is_windows_system() else 'javac'
     if path and is_exe(os.path.join(path, 'bin', exec_name)):
         return os.path.join(path, 'bin', exec_name)
     return None
Example #6
0
 def get_dx(config):
     if is_windows_system():
         if "build_tools_directory" in config and os.path.exists(config["build_tools_directory"]):
             path = os.path.join(config["build_tools_directory"], "dx.bat")
             if is_exe(path):
                 return path
     else:
         return os.path.join("freeline", "release-tools", "dx")
 def get_java(config=None):
     path = os.getenv('JAVA_HOME')
     if config is not None and 'java_home' in config:
         path = config['java_home']
     exec_name = 'java.exe' if is_windows_system() else 'java'
     if path and is_exe(os.path.join(path, 'bin', exec_name)):
         return os.path.join(path, 'bin', exec_name)
     Logger.debug('[ERROR] Builder.get_java() return None.')
     return None
Example #8
0
 def get_java(config=None):
     path = os.getenv('JAVA_HOME')
     if config is not None and 'java_home' in config:
         path = config['java_home']
     exec_name = 'java.exe' if is_windows_system() else 'java'
     if path and is_exe(os.path.join(path, 'bin', exec_name)):
         return os.path.join(path, 'bin', exec_name)
     Logger.debug('[ERROR] Builder.get_java() return None.')
     return None
Example #9
0
 def get_java(config=None):
     path = os.getenv("JAVA_HOME")
     if config is not None and "java_home" in config:
         path = config["java_home"]
     exec_name = "java.exe" if is_windows_system() else "java"
     if path and is_exe(os.path.join(path, "bin", exec_name)):
         return os.path.join(path, "bin", exec_name)
     Logger.debug("[ERROR] Builder.get_java() return None.")
     return None
Example #10
0
    def __init__(self,
                 command,
                 logger=None,
                 main_class=None,
                 java=None,
                 jar=None,
                 java_opts=None,
                 classpath=None,
                 env_vars=None,
                 redirect_stderr=True):

        if not java:
            java = self.FindJava(logger)
            if not java:
                raise Exception("Cannot find Java")

        if not is_exe(java):
            raise Exception("{} is not executable file".format(java))

        logger.debug("Java = {}".format(java))

        java_command = [java]
        if java_opts:
            java_command.extend(java_opts)
        if classpath:
            java_command.append('-classpath')
            java_command.append(classpath)
        if jar:
            java_command.append('-jar')
            java_command.append(jar)
        if main_class:
            java_command.append(main_class)
        env = None
        if env_vars:
            env = {}
            for spec in env_vars:
                if spec.find('=') != -1:
                    name, value = spec.split('=')
                    env[name] = value

        java_command.extend(command)
        logger.debug("Java command: {}".format(java_command))

        super().__init__(java_command,
                         logger=logger,
                         env_vars=env,
                         redirect_stderr=redirect_stderr)
Example #11
0
 def get_mvn():
     mvn_exe_name = os.name == 'nt' and 'mvn.bat' or 'mvn'
     path = Builder.get_maven_home_dir()
     if os.path.isdir(path) and os.path.isdir(os.path.join(path, 'bin')):
         mvn_exe_path = os.path.join(path, 'bin', mvn_exe_name)
         return mvn_exe_path if is_exe(mvn_exe_path) else None
Example #12
0
                logger.error("Not a directory: {}".format(hookdir))
                sys.exit(1)

            for hookname in hooks:
                if hookname == "pre":
                    prehook = hookpath = os.path.join(hookdir, hooks['pre'])
                    logger.debug("pre-hook = {}".format(prehook))
                elif hookname == "post":
                    posthook = hookpath = os.path.join(hookdir, hooks['post'])
                    logger.debug("post-hook = {}".format(posthook))
                else:
                    logger.error("Unknown hook name {} for project {}".
                                 format(hookname, args.project))
                    sys.exit(1)

                if not is_exe(hookpath):
                    logger.error("hook file {} does not exist or not "
                                 "executable".format(hookpath))
                    sys.exit(1)

        if project_config.get('proxy'):
            if not config.get('proxy'):
                logger.error("global proxy setting is needed in order to"
                             "have per-project proxy")
                sys.exit(1)

            logger.debug("will use proxy")
            use_proxy = True

    # Log messages to dedicated log file if running in batch mode.
    if args.batch:
Example #13
0
 def get_javac():
     exec_name = 'javac.exe' if is_windows_system() else 'javac'
     path = os.getenv('JAVA_HOME')
     if path and is_exe(os.path.join(path, 'bin', exec_name)):
         return os.path.join(path, 'bin', exec_name)
     return None
Example #14
0
                logger.error("Not a directory: {}".format(hookdir))
                sys.exit(1)

            for hookname in hooks:
                if hookname == "pre":
                    prehook = hookpath = os.path.join(hookdir, hooks['pre'])
                    logger.debug("pre-hook = {}".format(prehook))
                elif hookname == "post":
                    posthook = hookpath = os.path.join(hookdir, hooks['post'])
                    logger.debug("post-hook = {}".format(posthook))
                else:
                    logger.error("Unknown hook name {} for project {}".
                                 format(hookname, args.project))
                    sys.exit(1)

                if not is_exe(hookpath):
                    logger.error("hook file {} does not exist or not "
                                 "executable".format(hookpath))
                    sys.exit(1)

        if project_config.get('proxy'):
            if not config.get('proxy'):
                logger.error("global proxy setting is needed in order to"
                             "have per-project proxy")
                sys.exit(1)

            logger.debug("will use proxy")
            use_proxy = True

    # Log messages to dedicated log file if running in batch mode.
    if args.batch:
Example #15
0
 def get_mvn():
     mvn_exe_name = os.name == "nt" and "mvn.bat" or "mvn"
     path = Builder.get_maven_home_dir()
     if os.path.isdir(path) and os.path.isdir(os.path.join(path, "bin")):
         mvn_exe_path = os.path.join(path, "bin", mvn_exe_name)
         return mvn_exe_path if is_exe(mvn_exe_path) else None