From f534fe9bcd692c4df97e644d34c5bd8acede01eb Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Fri, 29 Dec 2023 13:56:07 +0100 Subject: [PATCH] qt6: don't copy entire build tree to dist, use select set of include patterns. --- pythonforandroid/bootstraps/qt6/__init__.py | 27 ++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/pythonforandroid/bootstraps/qt6/__init__.py b/pythonforandroid/bootstraps/qt6/__init__.py index 7b435cc713..cc7c88da63 100644 --- a/pythonforandroid/bootstraps/qt6/__init__.py +++ b/pythonforandroid/bootstraps/qt6/__init__.py @@ -24,14 +24,35 @@ def assemble_distribution(self): info_main('# Creating Android project from build and {} bootstrap'.format( self.name)) - info('This currently just copies the build stuff straight from the build dir.') shprint(sh.rm, '-rf', self.dist_dir) - shprint(sh.cp, '-r', self.build_dir, self.dist_dir) + shprint(sh.mkdir, '-p', self.dist_dir) + + file_include_patterns = [ + ('*', False), + ('jni/*', False), + ('jni/application/**', True), + ('src/**', True), + ('templates/**', True), + ('gradle/**', True), + ('**/*.so', True), + ('**/qmldir', True), + ] + + with current_directory(self.dist_dir): + with open('bootstrap_distfiles.txt', 'w') as fileh: + for pattern, recurse in file_include_patterns: + filenames = glob.glob(pattern, root_dir=self.build_dir, recursive=recurse) + for filename in filenames: + fileh.write(f'{filename}\n') + info(f'pattern {pattern}, recurse={recurse} yielded {len(filenames)} items') + + shprint(sh.rsync, '--files-from=bootstrap_distfiles.txt', + self.build_dir, '.') + with current_directory(self.dist_dir): with open('local.properties', 'w') as fileh: fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir)) - with current_directory(self.dist_dir): info('Copying python distribution') # self.distribute_aars(arch)