Ejemplo n.º 1
0
    def execute(self):
        if self._is_append:  # reload config while append mode
            self.debug('generate_file_stat_task in append mode')
            from dispatcher import read_freeline_config
            self._config = read_freeline_config()
            self._stat_cache = load_json_cache(self._cache_path)

        if 'modules' in self._config:
            all_modules = self._config['modules']
        else:
            all_modules = get_all_modules(os.getcwd())

        if self._is_append and os.path.exists(self._cache_path):
            old_modules = self._stat_cache.keys()
            match_arr = [m['name'] for m in all_modules]
            match_map = {m['name']: m for m in all_modules}
            new_modules = []
            for m in match_arr:
                if m not in old_modules:
                    self.debug('find new module: {}'.format(m))
                    new_modules.append(match_map[m])

            if len(new_modules) > 0:
                self._fill_cache_map(new_modules)
                self._save_cache()
            else:
                self.debug('no new modules found.')
        else:
            self._fill_cache_map(all_modules)
            self._save_cache()
Ejemplo n.º 2
0
    def execute(self):
        # reload project info
        from dispatcher import read_freeline_config
        config = read_freeline_config()

        write_json_cache(os.path.join(config['build_cache_dir'], 'project_info_cache.json'),
                         get_project_info(config))
Ejemplo n.º 3
0
    def execute(self):
        # reload project info
        from dispatcher import read_freeline_config
        config = read_freeline_config()

        write_json_cache(os.path.join(config['build_cache_dir'], 'project_info_cache.json'),
                         get_project_info(config))
Ejemplo n.º 4
0
    def execute(self):
        if self._is_append:  # reload config while append mode
            self.debug('generate_file_stat_task in append mode')
            from dispatcher import read_freeline_config
            self._config = read_freeline_config()
            self._stat_cache = load_json_cache(self._cache_path)

        if 'modules' in self._config:
            all_modules = self._config['modules']
        else:
            all_modules = get_all_modules(os.getcwd())

        if self._is_append and os.path.exists(self._cache_path):
            old_modules = self._stat_cache.keys()
            match_arr = [m['name'] for m in all_modules]
            match_map = {m['name']: m for m in all_modules}
            new_modules = []
            for m in match_arr:
                if m not in old_modules:
                    self.debug('find new module: {}'.format(m))
                    new_modules.append(match_map[m])

            if len(new_modules) > 0:
                self._fill_cache_map(new_modules)
                self._save_cache()
            else:
                self.debug('no new modules found.')
        else:
            self._fill_cache_map(all_modules)
            self._save_cache()
Ejemplo n.º 5
0
 def __init__(self, adb, config):
     Task.__init__(self, 'install_apk_task')
     # reload freeline config
     from dispatcher import read_freeline_config
     self._config = read_freeline_config()
     self._adb = adb
     self._apk_path = self._config['apk_path']
     self._package = self._config['package']
     self._launcher = self._config['launcher']
     self._cache_dir = self._config['build_cache_dir']
Ejemplo n.º 6
0
 def __init_attributes(self):
     # reload freeline config
     from dispatcher import read_freeline_config
     self._config = read_freeline_config()
     self._apk_path = self._config['apk_path']
     self._launcher = self._config['launcher']
     self._cache_dir = self._config['build_cache_dir']
     self._package = self._config['package']
     if 'debug_package' in self._config:
         # support applicationIdSuffix attribute
         self._package = self._config['debug_package']
Ejemplo n.º 7
0
 def __init_attributes(self):
     # reload freeline config
     from dispatcher import read_freeline_config
     self._config = read_freeline_config()
     self._apk_path = self._config['apk_path']
     self._launcher = self._config['launcher']
     self._cache_dir = self._config['build_cache_dir']
     self._package = self._config['package']
     if 'debug_package' in self._config:
         # support applicationIdSuffix attribute
         self._package = self._config['debug_package']
Ejemplo n.º 8
0
    def __init_attributes(self):
        # refresh config and project info
        from dispatcher import read_freeline_config
        self._config = read_freeline_config()
        self._project_info = get_project_info(self._config)

        # self._main_dir = self._config['main_project_dir']
        self._main_module_name = self._config['main_project_name']
        self._module_info = self._project_info[self._main_module_name]
        self._finder = GradleDirectoryFinder(self._main_module_name, self._project_info[self._main_module_name]['path'],
                                             self._config['build_cache_dir'], config=self._config,
                                             package_name=self._module_info['packagename'])
        self._public_xml_path = self._finder.get_public_xml_path()
        self._ids_xml_path = self._finder.get_ids_xml_path()
Ejemplo n.º 9
0
    def __init_attributes(self):
        # refresh config and project info
        from dispatcher import read_freeline_config
        self._config = read_freeline_config()
        self._project_info = get_project_info(self._config)

        # self._main_dir = self._config['main_project_dir']
        self._main_module_name = self._config['main_project_name']
        self._module_info = self._project_info[self._main_module_name]
        self._finder = GradleDirectoryFinder(self._main_module_name, self._project_info[self._main_module_name]['path'],
                                             self._config['build_cache_dir'], config=self._config,
                                             package_name=self._module_info['packagename'])
        self._public_xml_path = self._finder.get_public_xml_path()
        self._ids_xml_path = self._finder.get_ids_xml_path()
Ejemplo n.º 10
0
    def execute(self):
        # reload config
        from dispatcher import read_freeline_config
        self._config = read_freeline_config()

        cwd = self._config['build_script_work_directory'].strip()
        if not cwd or not os.path.isdir(cwd):
            cwd = None

        output, err, code = cexec(self._config['build_script'].split(' '), callback=None, cwd=cwd)
        self.debug(self._config['build_script'])
        self.debug("Gradle build task is running, please wait a minute...")
        if code != 0:
            from exceptions import FreelineException
            raise FreelineException('build failed with script: {}'.format(self._config['build_script']),
                                    '{}\n{}'.format(output, err))
Ejemplo n.º 11
0
    def execute(self):
        # reload config
        from dispatcher import read_freeline_config
        self._config = read_freeline_config()

        cwd = self._config['build_script_work_directory'].strip()
        if not cwd or not os.path.isdir(cwd):
            cwd = None

        command = self._config['build_script']
        command += ' --stacktrace'
        command += ' -P freelineBuild=true'
        self.debug(command)
        self.debug("Gradle build task is running, please wait a minute...")
        output, err, code = cexec(command.split(' '), callback=None, cwd=cwd)
        if code != 0:
            from exceptions import FreelineException
            raise FreelineException('build failed with script: {}'.format(self._config['build_script']),
                                    '{}\n{}'.format(output, err))
Ejemplo n.º 12
0
    def execute(self):
        # reload config
        from dispatcher import read_freeline_config
        self._config = read_freeline_config()

        cwd = self._config['build_script_work_directory'].strip()
        if not cwd or not os.path.isdir(cwd):
            cwd = None

        command = self._config['build_script']
        command += ' -P freelineBuild=true'
        if 'auto_dependency' in self._config and not self._config['auto_dependency']:
            command += ' -PdisableAutoDependency=true'
        if Logger.debuggable:
            command += ' --stacktrace'
        self.debug(command)
        self.debug("Gradle build task is running, please wait a minute...")
        output, err, code = cexec(command.split(' '), callback=None, cwd=cwd)
        if code != 0:
            from exceptions import FreelineException
            raise FreelineException('build failed with script: {}'.format(command), '{}\n{}'.format(output, err))
Ejemplo n.º 13
0
 def __init__(self, config):
     Task.__init__(self, 'generate_project_info_task')
     # reload project info
     from dispatcher import read_freeline_config
     self._config = read_freeline_config()