Beispiel #1
0
    def run_javac_task(self):
        if self._is_only_r_changed(
        ) and not self._is_other_modules_has_src_changed:
            self._is_need_javac = False
            android_tools.clean_src_changed_flag(self._cache_dir)
            self.debug(
                'apt process do not generate new files, ignore javac task.')
            return

        extra_javac_args_enabled = not (self._is_databinding_enabled
                                        and self._should_run_databinding_apt())
        javacargs = self._generate_java_compile_args(
            extra_javac_args_enabled=extra_javac_args_enabled)

        self.debug('javac exec: ' + ' '.join(javacargs))
        output, err, code = cexec(javacargs, callback=None)

        if code != 0:
            raise FreelineException('incremental javac compile failed.',
                                    '{}\n{}'.format(output, err))
        else:
            if self._is_r_file_changed:
                old_r_file = self._finder.get_dst_r_path(config=self._config)
                new_r_file = android_tools.DirectoryFinder.get_r_file_path(
                    self._finder.get_backup_dir())
                if old_r_file and new_r_file:
                    shutil.copyfile(new_r_file, old_r_file)
                    self.debug('copy {} to {}'.format(new_r_file, old_r_file))
Beispiel #2
0
    def execute(self):
        android_tools.clean_src_changed_flag(self._cache_dir)
        android_tools.clean_res_changed_flag(self._cache_dir)
        for dirpath, dirnames, files in os.walk(self._cache_dir):
            for fn in files:
                if fn.endswith('.sync'):
                    os.remove(os.path.join(dirpath, fn))
                    module = fn[:fn.rfind('.')]
                    self._refresh_public_files(module)

                if fn.endswith('increment.dex') or fn.endswith('.rflag') or fn.endswith('.restart'):
                    os.remove(os.path.join(dirpath, fn))
Beispiel #3
0
    def execute(self):
        android_tools.clean_src_changed_flag(self._cache_dir)
        android_tools.clean_res_changed_flag(self._cache_dir)
        for dirpath, dirnames, files in os.walk(self._cache_dir):
            for fn in files:
                if fn.endswith('.sync'):
                    os.remove(os.path.join(dirpath, fn))
                    module = fn.split('.')[0]
                    self._refresh_public_files(module)

                if fn.endswith('increment.dex') or fn.endswith('.rflag') or fn.endswith('.restart'):
                    os.remove(os.path.join(dirpath, fn))
Beispiel #4
0
    def execute(self):
        android_tools.clean_src_changed_flag(self._cache_dir)
        android_tools.clean_res_changed_flag(self._cache_dir)
        for dirpath, dirnames, files in os.walk(self._cache_dir):
            for fn in files:
                if fn.endswith('.sync'):
                    os.remove(os.path.join(dirpath, fn))
                    module = fn[:fn.rfind('.')]
                    self._refresh_public_files(module)

                if fn.endswith('increment.dex') or fn.endswith('.rflag') or fn.endswith('.restart') or fn.endswith(
                        'natives.zip'):
                    fpath = os.path.join(dirpath, fn)
                    self.debug("remove cache: {}".format(fpath))
                    os.remove(fpath)
Beispiel #5
0
    def execute(self):
        android_tools.clean_src_changed_flag(self._cache_dir)
        android_tools.clean_res_changed_flag(self._cache_dir)
        for dirpath, dirnames, files in os.walk(self._cache_dir):
            for fn in files:
                if fn.endswith('.sync'):
                    os.remove(os.path.join(dirpath, fn))
                    module = fn[:fn.rfind('.')]
                    self._refresh_public_files(module)

                if fn.endswith('merged.dex') or fn.endswith(
                        '.rflag') or fn.endswith('.restart') or fn.endswith(
                            'natives.zip') or fn.endswith('-classes.dex'):
                    fpath = os.path.join(dirpath, fn)
                    self.debug("remove cache: {}".format(fpath))
                    os.remove(fpath)
Beispiel #6
0
    def run_kotlinc_task(self):
        # todo 检查R的变化
        if self._is_only_r_changed() and not self._is_other_modules_has_src_changed:
            self._is_need_javac = False
            # self._is_need_kotlinc = False
            android_tools.clean_src_changed_flag(self._cache_dir)
            self.debug('apt process do not generate new files, ignore javac task.')
            return
        kotlincargs = self._generate_kotlin_compile_args()
        self.debug('kotlinc exec: ' + ' '.join(kotlincargs))
        output, err, code = cexec(kotlincargs, callback=None)

        if code != 0:
            raise FreelineException('incremental kotlinc compile failed.', '{}\n{}'.format(output, err))
        else:
            # todo 这个应该是和kotlin没有关系 拷贝R类用的
            if self._is_r_file_changed:
                old_r_file = self._finder.get_dst_r_path(config=self._config)
                new_r_file = android_tools.DirectoryFinder.get_r_file_path(self._finder.get_backup_dir())
                if old_r_file and new_r_file:
                    shutil.copyfile(new_r_file, old_r_file)
                    self.debug('copy {} to {}'.format(new_r_file, old_r_file))
Beispiel #7
0
    def run_javac_task(self):
        if self._is_only_r_changed() and not self._is_other_modules_has_src_changed:
            self._is_need_javac = False
            android_tools.clean_src_changed_flag(self._cache_dir)
            self.debug('apt process do not generate new files, ignore javac task.')
            return

        extra_javac_args_enabled = not (self._is_databinding_enabled and self._should_run_databinding_apt())
        javacargs = self._generate_java_compile_args(extra_javac_args_enabled=extra_javac_args_enabled)

        self.debug('javac exec: ' + ' '.join(javacargs))
        output, err, code = cexec(javacargs, callback=None)

        if code != 0:
            raise FreelineException('incremental javac compile failed.', '{}\n{}'.format(output, err))
        else:
            if self._is_r_file_changed:
                old_r_file = self._finder.get_dst_r_path(config=self._config)
                new_r_file = android_tools.DirectoryFinder.get_r_file_path(self._finder.get_backup_dir())
                if old_r_file and new_r_file:
                    shutil.copyfile(new_r_file, old_r_file)
                    self.debug('copy {} to {}'.format(new_r_file, old_r_file))