Merge changes If5292d1d,Ib1a86d48
* changes: Stop cargo2android.py from printing the --cargo_bin argument. Revert "Enable LTO in cargo2android.py."
This commit is contained in:
@@ -354,14 +354,12 @@ class Crate(object):
|
|||||||
# 'prefer-dynamic' does not work with common flag -C lto
|
# 'prefer-dynamic' does not work with common flag -C lto
|
||||||
# 'embed-bitcode' is ignored; we might control LTO with other .bp flag
|
# 'embed-bitcode' is ignored; we might control LTO with other .bp flag
|
||||||
# 'codegen-units' is set in Android global config or by default
|
# 'codegen-units' is set in Android global config or by default
|
||||||
# 'lto' is used in Android, but it's set by the build system
|
|
||||||
if not (flag.startswith('codegen-units=') or
|
if not (flag.startswith('codegen-units=') or
|
||||||
flag.startswith('debuginfo=') or
|
flag.startswith('debuginfo=') or
|
||||||
flag.startswith('embed-bitcode=') or
|
flag.startswith('embed-bitcode=') or
|
||||||
flag.startswith('extra-filename=') or
|
flag.startswith('extra-filename=') or
|
||||||
flag.startswith('incremental=') or
|
flag.startswith('incremental=') or
|
||||||
flag.startswith('metadata=') or
|
flag.startswith('metadata=') or
|
||||||
flag.startswith('lto=') or
|
|
||||||
flag == 'prefer-dynamic'):
|
flag == 'prefer-dynamic'):
|
||||||
self.codegens.append(flag)
|
self.codegens.append(flag)
|
||||||
|
|
||||||
@@ -1283,7 +1281,11 @@ class Runner(object):
|
|||||||
self.bp_files.add(name)
|
self.bp_files.add(name)
|
||||||
license_section = self.read_license(name)
|
license_section = self.read_license(name)
|
||||||
with open(name, 'w') as outf:
|
with open(name, 'w') as outf:
|
||||||
outf.write(ANDROID_BP_HEADER.format(args=' '.join(sys.argv[1:])))
|
print_args = sys.argv[1:].copy()
|
||||||
|
if '--cargo_bin' in print_args:
|
||||||
|
index = print_args.index('--cargo_bin')
|
||||||
|
del print_args[index:index+2]
|
||||||
|
outf.write(ANDROID_BP_HEADER.format(args=' '.join(print_args)))
|
||||||
outf.write('\n')
|
outf.write('\n')
|
||||||
outf.write(license_section)
|
outf.write(license_section)
|
||||||
outf.write('\n')
|
outf.write('\n')
|
||||||
@@ -1347,9 +1349,6 @@ class Runner(object):
|
|||||||
# set up search PATH for cargo to find the correct rustc
|
# set up search PATH for cargo to find the correct rustc
|
||||||
saved_path = os.environ['PATH']
|
saved_path = os.environ['PATH']
|
||||||
os.environ['PATH'] = os.path.dirname(self.cargo_path) + ':' + saved_path
|
os.environ['PATH'] = os.path.dirname(self.cargo_path) + ':' + saved_path
|
||||||
# We need to enable lto since our test prebuilts use it
|
|
||||||
saved_rustflags = os.environ.get('RUSTFLAGS', '')
|
|
||||||
os.environ['RUSTFLAGS'] = '-C lto=thin -C embed-bitcode=yes ' + saved_rustflags
|
|
||||||
# Add [workspace] to Cargo.toml if it is not there.
|
# Add [workspace] to Cargo.toml if it is not there.
|
||||||
added_workspace = False
|
added_workspace = False
|
||||||
if self.args.add_workspace:
|
if self.args.add_workspace:
|
||||||
@@ -1375,7 +1374,7 @@ class Runner(object):
|
|||||||
cmd = self.cargo_path + cmd_v_flag
|
cmd = self.cargo_path + cmd_v_flag
|
||||||
cmd += c + features + cmd_tail_target + cmd_tail_redir
|
cmd += c + features + cmd_tail_target + cmd_tail_redir
|
||||||
if self.args.rustflags and c != 'clean':
|
if self.args.rustflags and c != 'clean':
|
||||||
cmd = 'RUSTFLAGS="' + os.environ['RUSTFLAGS'] + ' ' + self.args.rustflags + '" ' + cmd
|
cmd = 'RUSTFLAGS="' + self.args.rustflags + '" ' + cmd
|
||||||
self.run_cmd(cmd, cargo_out)
|
self.run_cmd(cmd, cargo_out)
|
||||||
if self.args.tests:
|
if self.args.tests:
|
||||||
cmd = self.cargo_path + ' test' + features + cmd_tail_target + ' -- --list' + cmd_tail_redir
|
cmd = self.cargo_path + ' test' + features + cmd_tail_target + ' -- --list' + cmd_tail_redir
|
||||||
@@ -1386,7 +1385,6 @@ class Runner(object):
|
|||||||
if self.args.verbose:
|
if self.args.verbose:
|
||||||
print('### INFO: restored original Cargo.toml')
|
print('### INFO: restored original Cargo.toml')
|
||||||
os.environ['PATH'] = saved_path
|
os.environ['PATH'] = saved_path
|
||||||
os.environ['RUSTFLAGS'] = saved_rustflags
|
|
||||||
if not self.dry_run:
|
if not self.dry_run:
|
||||||
if not had_cargo_lock: # restore to no Cargo.lock state
|
if not had_cargo_lock: # restore to no Cargo.lock state
|
||||||
os.remove(cargo_lock)
|
os.remove(cargo_lock)
|
||||||
@@ -1859,7 +1857,7 @@ def dump_config(parser, args):
|
|||||||
non_default_args = {}
|
non_default_args = {}
|
||||||
for arg in args_dict:
|
for arg in args_dict:
|
||||||
if (args_dict[arg] != parser.get_default(arg) and arg != 'dump_config_and_exit'
|
if (args_dict[arg] != parser.get_default(arg) and arg != 'dump_config_and_exit'
|
||||||
and arg != 'config'):
|
and arg != 'config' and arg != 'cargo_bin'):
|
||||||
non_default_args[arg.replace('_', '-')] = args_dict[arg]
|
non_default_args[arg.replace('_', '-')] = args_dict[arg]
|
||||||
# Write to the specified file.
|
# Write to the specified file.
|
||||||
with open(args.dump_config_and_exit, 'w') as f:
|
with open(args.dump_config_and_exit, 'w') as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user