def __modify_other_modules_r(self, package_name, finder=None): if not finder: finder = self._finder r_path = android_tools.find_r_file(finder.get_dst_r_dir(), package_name=package_name) if r_path and os.path.exists(r_path): target_dir = os.path.join(self.__get_freeline_backup_r_dir(), package_name.replace('.', os.sep)) if not os.path.exists(target_dir): os.makedirs(target_dir) target_path = os.path.join(target_dir, 'R.java') if not os.path.exists(target_path): self.debug('copy {} to {}'.format(r_path, target_path)) shutil.copy(r_path, target_path) content = get_file_content(target_path) content = GradleIncBuildInvoker.remove_final_tag(content) content = GradleIncBuildInvoker.extend_main_r( content, self._config['package']) content = android_tools.fix_unicode_parse_error( content, target_path) write_file_content(target_path, content) return target_path
def get_dst_r_path(self, config=None): if config is not None: if 'main_project_name' in config and self._module_name == config['main_project_name']: if 'main_r_path' in config: path = config['main_r_path'].strip() if os.path.isfile(path): return path return android_tools.find_r_file(self.get_dst_r_dir(), package_name=self._package_name)
def get_dst_r_path(self, config=None): if config is not None: if 'main_project_name' in config and self._module_name == config['main_project_name']: if 'main_r_path' in config: path = config['main_r_path'].strip() if os.path.isfile(path): return path return android_tools.find_r_file(self.get_dst_r_dir(), package_name=self._package_name)
def __modify_other_modules_r(self, package_name, finder=None): if not finder: finder = self._finder r_path = android_tools.find_r_file(finder.get_dst_r_dir(), package_name=package_name) if os.path.exists(r_path): target_dir = os.path.join(self.__get_freeline_backup_r_dir(), package_name.replace('.', os.sep)) if not os.path.exists(target_dir): os.makedirs(target_dir) target_path = os.path.join(target_dir, 'R.java') if not os.path.exists(target_path): self.debug('copy {} to {}'.format(r_path, target_path)) shutil.copy(r_path, target_path) content = get_file_content(target_path) content = GradleIncBuildInvoker.remove_final_tag(content) content = GradleIncBuildInvoker.extend_main_r(content, self._config['package']) content = self.__fix_unicode_parse_error(content, target_path) write_file_content(target_path, content) return target_path