Added --no-std and --alloc flags.
These allow most no_std crates to be supported without extra patches. Bug: 279614907 Test: Ran on external/rust/crates/half Change-Id: I1a69ff7950fb63320ef7c87d6cd45b20915df801
This commit is contained in:
@@ -734,6 +734,15 @@ class Crate(object):
|
|||||||
self.write(' "%s",' % apex)
|
self.write(' "%s",' % apex)
|
||||||
self.write(' ],')
|
self.write(' ],')
|
||||||
if crate_type != 'test':
|
if crate_type != 'test':
|
||||||
|
if self.runner.variant_args.no_std:
|
||||||
|
self.write(' prefer_rlib: true,')
|
||||||
|
self.write(' no_stdlibs: true,')
|
||||||
|
self.write(' stdlibs: [')
|
||||||
|
if self.runner.variant_args.alloc:
|
||||||
|
self.write(' "liballoc.rust_sysroot",')
|
||||||
|
self.write(' "libcompiler_builtins.rust_sysroot",')
|
||||||
|
self.write(' "libcore.rust_sysroot",')
|
||||||
|
self.write(' ],')
|
||||||
if self.runner.variant_args.native_bridge_supported:
|
if self.runner.variant_args.native_bridge_supported:
|
||||||
self.write(' native_bridge_supported: true,')
|
self.write(' native_bridge_supported: true,')
|
||||||
if self.runner.variant_args.product_available:
|
if self.runner.variant_args.product_available:
|
||||||
@@ -1852,6 +1861,16 @@ def get_parser():
|
|||||||
type=str,
|
type=str,
|
||||||
help=('Add the contents of the given file to the main module. '+
|
help=('Add the contents of the given file to the main module. '+
|
||||||
'The filename should start with cargo2android to work with the updater.'))
|
'The filename should start with cargo2android to work with the updater.'))
|
||||||
|
parser.add_argument(
|
||||||
|
'--no-std',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help='Don\'t link against std.')
|
||||||
|
parser.add_argument(
|
||||||
|
'--alloc',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help='Link against alloc. Only valid if --no-std is also passed.')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--verbose',
|
'--verbose',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|||||||
Reference in New Issue
Block a user