BCL: Remove pdb files and aot modules

We don't need to ship with them so we can save some space this way.
We added an option in case someone wants to keep the pdb files:
	`--remove-pdb=False`
This commit is contained in:
Ignacio Etcheverry 2019-12-19 17:19:49 +01:00
parent ee54822600
commit 710b275fbf
2 changed files with 14 additions and 4 deletions

14
bcl.py
View File

@ -109,12 +109,18 @@ def make_product(opts: BclOpts, product: str):
for profile in profiles:
copy_tree('%s/mcs/class/lib/%s' % (opts.mono_source_root, profile), '%s/%s' % (install_dir, profile))
# Recursively remove hidden files we shoudln't have copied (e.g.: .stamp)
# Remove unneeded files
import glob
hidden_file_pattern = '%s/**/.*' % install_dir
file_patterns = []
file_patterns += ['.*'] # Recursively remove hidden files we shoudln't have copied (e.g.: .stamp)
file_patterns += ['*.dll.so', '*.exe.so'] # Remove pre-built AOT modules. We don't need them and they take a lot of space.
file_patterns += ['*.pdb'] if opts.remove_pdb else []
for profile in profiles:
[rm_rf(x) for x in glob.iglob(hidden_file_pattern, recursive=True)]
for file_pattern in file_patterns:
file_pattern_recursive = '%s/**/%s' % (install_dir, file_pattern)
[rm_rf(x) for x in glob.iglob(file_pattern_recursive, recursive=True)]
# godot_android_ext profile (custom 'Mono.Android.dll')
if product == 'android':
this_script_dir = os.path.dirname(os.path.realpath(__file__))
monodroid_profile_dir = '%s/%s' % (install_dir, 'monodroid')
@ -142,6 +148,7 @@ def clean_product(opts: BclOpts, product: str):
def main(raw_args):
import cmd_utils
from cmd_utils import custom_bool
actions = {
'make': make_product,
@ -155,6 +162,7 @@ def main(raw_args):
parser.add_argument('action', choices=actions.keys())
parser.add_argument('--product', choices=product_values, action='append', required=True)
parser.add_argument('--tests', action='store_true', default=False, help=default_help)
parser.add_argument('--remove-pdb', type=custom_bool, default=True, help=default_help)
cmd_utils.add_base_arguments(parser, default_help)

View File

@ -39,6 +39,7 @@ class DesktopOpts(RuntimeOpts):
@dataclass
class BclOpts(BaseOpts):
tests: bool
remove_pdb: bool
# Need to make paths absolute as we change cwd
@ -80,7 +81,8 @@ def android_opts_from_args(args):
def bcl_opts_from_args(args):
return BclOpts(
**vars(base_opts_from_args(args)),
tests = args.tests
tests = args.tests,
remove_pdb = args.remove_pdb
)