Commit Graph

478 Commits

Author SHA1 Message Date
Joel Galenson
94b8a8d40c Do not generate cargo_pkg_version when --no-pkg-vers is passed
If you passed --no-pkg-vers to cargo2android.py, it would still
generate cargo_pkg_version with an empty string.  Instead, simply
don't generate anything.

Test: Use with and without argument.
Change-Id: I544e4789312ccc3481da73c78f0f2cae2ad6619c
2021-09-28 11:53:51 -07:00
Elliott Hughes
b4e31bbdd2 Merge "stack: add support for a .zip of symbols." 2021-09-13 21:14:57 +00:00
Christopher Ferris
1f2051de9a Modify the library fix up code.
Modify the library lookup code to try and find the various places
that a library might really exist in the symbols directory. This
is for atest which can run executables in different locations
than the actual where the symbolized file exists.

Test: Ran using /data/local/tmp, /data/local/tests,
Test: /data/local/tests/vendor, /data/local/tests/unrestricted and
Test: verified the correct library was found.
Test: Used tombstones crash data and verified all libraries
Test: still found properly.
Test: Ran atest CtsBionicTestCases and verified the symbolized
Test: binary could be found using a real tombstone crash.
Test: Did the same as above, but changed the path in the tombstone
Test: crash data from /data/local/tmp to /data/local/tests and
Test: /data/local/tests/unrestricted.
Change-Id: Iaa121823ef6142eaf9f7de3232b147bd7389bea5
2021-09-10 15:28:51 -07:00
Elliott Hughes
409282b77f stack: add support for a .zip of symbols.
This is the one remaining feature in vendor/google/tools/stack that
isn't in the "One True" stack script.

Bug: http://b/199390145
Test: manual
Change-Id: I9dd832f6fb5767c3ad3263c1ffc7dfdb0103e535
2021-09-10 13:19:53 -07:00
Jason Macnak
7b3f02465b Merge "Suffix libash with _rust to avoid name conflict" 2021-09-08 16:43:34 +00:00
Lukacs T. Berki
9206f1c08b Update the way one generates the Bazel workspace.
Test: Presubmits.
Change-Id: I0edfe61e78d04fcb468c68136ba1da3ee6e3fd1c
2021-09-06 11:36:59 +02:00
Jason Macnak
051340de9e Suffix libash with _rust to avoid name conflict
Bug: b/189133061
Test: presubmit with attached topic
Change-Id: I6619857a7f632fe7ab0576dd0dd0fe4dacf677b1
2021-09-04 11:04:26 -07:00
Joel Galenson
b06c42a03c Generate cargo_pkg_version and cargo_env_compat for defaults.
The existing code only adds it to things without defaults.  This adds
it to the defaults module itself, which should not overlap the
existing code.

Test: Run and see new entries.
Change-Id: Iaf3d0b47193bb1f54cdc605c88c2cd68034d963a
2021-08-31 14:28:48 -07:00
Joel Galenson
bdf3ab4d8e Let the test mapping updater handle newly-added files.
The previous commit to this file allowed it to create and upload a
commit when a TEST_MAPPING file changed.  But it did not handle the
case where the TEST_MAPPING file did not previously exist.  This fixes
that.

Test: Run script.
Change-Id: Id7b9e778c2b084f7ea2e4005a173c1fedeccd6c7
2021-08-30 08:59:47 -07:00
Joel Galenson
4a2a3a8211 Let the test mapping updater make commits and upload changes.
This will make it easier to run it on many crates and upload all of
the changes.  It puts the uploaded CLs in a topic to save resources.
If the script does not change a TEST_MAPPING, it does not upload
anything.

Test: Run on a subset of crates.
Change-Id: I47b4756d968c54d7d810c8a19a8a7419aebc6e15
2021-08-20 12:26:37 -07:00
Joel Galenson
08352445c8 Allow passing globs to update_crate_tests.py.
This makes it easier to run it on multiple directories.

Test: Call with various globs.
Change-Id: I0564369e4e8b9d62482fb2162a16d0e588f94e57
2021-08-20 11:39:48 -07:00
Joel Galenson
c3bfaf8a1e Fully remove deprecated --no-test-mapping argument.
This argument has already been deprecated, but now there should be no
more uses of it.  Let's remove it and the remaining logic.

Test: Run the updater.
Change-Id: I8ab6f6fadba3b462567237d18ddc02cc4c22e62f
2021-08-18 09:39:36 -07:00
Joel Galenson
a4648dfcba Merge "Do not dump the --config argument." 2021-08-18 15:04:38 +00:00
Joel Galenson
9a82ad9d47 Do not dump the --config argument.
When generating a config file from a commandline, cargo2android.py
should not dump the --config argument, as the point of the dump is to
generate a config file to use.  This would not normally matter, but it
could help in scripts.

Test: Run and do not see --config in the dumped file.
Change-Id: Idc2911ba674e67272c9cf836c89607e10ca0dddd
2021-08-17 17:52:04 -07:00
Matthew Maurer
70182e44f0 cargo2android: Don't emit image support for tests
Image support doesn't make sense for test modules.

Bug: 178565008
Test: Generate rustc-demangle-capi
Change-Id: Ie5a1d85f9828e0c105c3a3e994b22ef7664fe1db
2021-08-17 15:36:38 -07:00
Matthew Maurer
062709c3b3 cargo2android: Support exported C headers
staticlib and cdylib crate types generally want to export header files
for use by C code. Allow the location of these headers to be provided to
c2a for inclusion in blueprint.

Bug: 178565008
Test: Generate rustc-demangle-capi
Change-Id: I0aa9acfb081ea39a7e13315bfc8029d06b8f55d3
2021-08-17 15:06:34 -07:00
Matthew Maurer
9e4b781de9 cargo2android: Emit apex_available + min_sdk_version for native libs
Previously, we only emitted apex_available + min_sdk_version for 'lib'
type crates. That ignored:
* Explicit rlib
* Explicit dylib
* cdylib
* staticlib

Bug: 178565008
Test: Generated Android.bp for rustc-demangle-capi
Change-Id: I19f0abe385b9c13ac731b7f2c978052ffa6b92f7
2021-08-17 15:06:34 -07:00
Matthew Maurer
ac67725422 cargo2android: Add support for various image types
Test: Generated rustc-demangle's Android.bp with it
Bug: 178565008
Change-Id: I0877e2d7d9e309105610b4d87f2a6d45ef67903f
2021-08-17 15:06:34 -07:00
Joel Galenson
833848cea6 Deprecate the --dependencies argument.
We no longer use the --dependencies argument, but it is still used in
a number of places.  Let's remove its functionality but keep the
command-line option as a no-op so we can remove the uses over time.

Test: Run on crate that uses the option.
Change-Id: I954f68faf11d1a926f0ccf070afa8332385e3671
2021-08-17 10:50:42 -07:00
Joel Galenson
69ba807921 Improve package version logic
Only run cargo metadata on the main crate, not all of its dependencies.

Pass it the --format-version argument to avoid a warning and be
future-proof.

Test: Run.
Change-Id: Icdf88bc3b633d18266772ae813fc04b529b95765
2021-08-16 11:31:29 -07:00
Joel Galenson
c51865074b Fixes for getting package version
Older versions of Python's subprocess do not have capture_output, so
just get stdout directly.

Also pass the full path to cargo in case it is not on PATH.

Test: Run
Change-Id: I368e905a93b344bca6635c6ab7a60def809e88d5
2021-08-16 11:22:47 -07:00
Ivan Lozano
26aa1c30d2 cargo2android: Improve package version logic
If there are multiple packages present in the workspace, attempt
to determine what the current package is by checking the emitted
crate_name value against the package name. If this still fails, a new
`--no-pkg-vers` flag is added to skip this behavior.

Bug: 196803495
Test: New logic finds package if package.name is used for crate_name
Test: New flag prevents emitting the pkg version.
Change-Id: I152e94a0520f09f37622a6cec340ae35842d56ea
2021-08-16 11:37:28 -04:00
Ivan Lozano
cc660f1d75 cargo2android.py: Support cargo_pkg_version flag.
This parses a module's Cargo.toml file for package version number,
setting it to cargo_pkg_version. Also sets cargo_env_compat true by
default.

Bug: 171011485
Test: generated Android.bp includes cargo_env_compat, cargo_pkg_version.
Change-Id: Ibb8021633719650e2021b90806374a5d3c6a161a
2021-08-12 13:04:25 -04:00
Treehugger Robot
39f573eb00 Merge changes from topic "soong-clang-version-fix"
* changes:
  [scripts] Get clang version from soong/scripts/get_clang_version.py
  [scripts] Adjust FindClangDir
2021-08-11 06:57:27 +00:00
Ivan Lozano
70c12c514e Specify branch in the add3prf.py generated OWNERS
The branch needs to be specified in our generated OWNERS file or some
tooling will fail to find the correct OWNERS file.

Bug: 191797059
Test: New OWNERS file works as expected.
Change-Id: I91f2af6c5f489daee859b66ae0bd3c19a0bc0a3b
2021-07-30 14:39:04 -04:00
Joel Galenson
e4f5388cf3 Let cargo2android.py generate data properties for tests.
Some tests load data from files.  These files thus need to be copied
to the correct location on the host/device so that the tests can
access them.  This adds an option to cargo2android.py so that it can
generate these data properties.

Bug: 171710847
Test: Use for a crate.
Change-Id: I14a1ad8aca4625cc5f09807d19ffd7499fcf3689
2021-07-19 12:18:21 -07:00
Ivan Lozano
9192086c9c cargo2android.py:vendor and vendor_ramdisk flags.
Adds flags to emit vendor_available and vendor_ramdisk_available flags
to generated modules.

Bug: 194078853
Test: Calling script with new flags generates intended properties.
Change-Id: I4f7a6870b4f210b6627054c98962f50e98bc3e03
2021-07-19 15:18:11 +00:00
Joel Galenson
14b71a757b Merge "When merging tests, prefer non-blocklisted ones." 2021-07-16 17:27:59 +00:00
Jooyung Han
a427c9b64f cargo2android: rename libxml to libxml_rust
Bug: 193808832
Test: m
Change-Id: Ib3acfdda03197e8b773cbec500cadcc94d1a52a3
2021-07-16 08:53:14 +09:00
Joel Galenson
57fa23a5db When merging tests, prefer non-blocklisted ones.
The test blocklist was failing when multiple tests were merged into
one.  To fix this, when merging tests we prefer ones that are not
blocklisted.

Fixes: 193790055
Test: Run on the previously failing crate and another.
Change-Id: I53d1179bebef824ce80ac4f977015b04a26f8607
2021-07-15 10:53:24 -07:00
Joel Galenson
1353136072 Merge "Rename rust_defaults that contain tests." 2021-07-14 16:14:48 +00:00
Joel Galenson
d37d7e6d2c Rename rust_defaults that contain tests.
This patch ensures that rust_defaults for tests have _tests in the
name.  This can make the Android.bp file a bit more readable.

Test: Run on a crate and build it.
Change-Id: I5d034c456052b892bd01c3c041b2572bc9364692
2021-07-13 09:03:01 -07:00
Joel Galenson
12467e54a7 Let cargo2android ensure some libraries are whole_static_libs.
Test: Use on a crate.
Change-Id: I1d6a3bdb47141d5d20af3c118fd7a05bef223a48
2021-07-13 08:55:17 -07:00
Joel Galenson
728af1ce8d Merge "Allow passing multiple crates to update_crate_tests.py" 2021-07-12 20:28:09 +00:00
Pirama Arumuga Nainar
f7f9544e36 [scripts] Get clang version from soong/scripts/get_clang_version.py
... instead of manually parsing soong/cc/config/global.go

Also hard-code clang_base in gdbclient.py to 'prebuilts/clang/host' as
it's unlikely to change in global.go.

Test: acov-llvm.py flush
Test: verify gdbclient.read_toolchain_config() in the interpreter
Change-Id: I28ed4416749edcd5d623598eb65eeb7891b657ae
2021-07-02 09:24:11 -07:00
Pirama Arumuga Nainar
a26dc346dd [scripts] Adjust FindClangDir
soong/scripts/get_clang_version.py now prints the whole prebuilt dir
(e.g. clang-r416183b1) instead of just the version number.

Test: invoke FindClangDir from the interpreter
Change-Id: I17363e6bc4a48fe6be345f87006baa4590371dc1
2021-07-02 09:24:07 -07:00
Treehugger Robot
5b65b9117d Merge "cargo2android.py: remove TEST_MAPPING generation" 2021-07-02 15:49:52 +00:00
Joel Galenson
177910448c Allow passing multiple crates to update_crate_tests.py
Currently the script can only run on a single crate at a time, and
each time it runs it re-initializes Bazel. By passing multiple crates
we can save time by only initializing Bazel once.

Test: Call with zero, one, and multiple crate arguments.
Change-Id: Ic83c16d87066a8555b736b35bc7971586ee26e16
2021-07-02 07:39:28 -07:00
Thiébaud Weksteen
198e93f61b cargo2android.py: remove TEST_MAPPING generation
Do not generate TEST_MAPPING when running cargo2android.py. Still accept
the command line argument so current users/wrappers continue working.

Bug: 192348260
Test: Run cargo2android.py manually on ahash
Change-Id: I1975119f8fdd3ae850649b105678dec92fa67518
2021-07-02 16:30:31 +02:00
Pirama Arumuga Nainar
05b20a7ebf [scripts] Fix clang path in symbol.py
Bug: http://b/187231324

Test: Verify directory returned by FindClangDir exists
Change-Id: I84d1a7b2194003409b8110772e450b1286a2ee0c
2021-06-29 13:06:03 -07:00
Pirama Arumuga Nainar
1438c6b0c3 Merge "[scripts] Remove hard-coded clang version" 2021-06-29 18:29:09 +00:00
Luke Huang
a1371afd29 Add name mapping for base64
Test: TH
Bug: 155855709
Change-Id: I1e411e2f831ede6f48822352774f6e44db5d409d
2021-06-29 18:57:33 +08:00
Elliott Hughes
a4d15f1960 Merge "Remove the shell gdbclient." 2021-06-28 22:42:00 +00:00
Elliott Hughes
75e4415780 Merge "Remove gdb-specific stuff from gdbclient.py (aka lldbclient.py)." 2021-06-28 22:41:50 +00:00
Elliott Hughes
e8f0dfb062 Merge "Remove an ART/dalvik gdb script." 2021-06-28 15:44:41 +00:00
Elliott Hughes
051439591a Remove the shell gdbclient.
Not to be confused with gdbclient.py, which lives on (albeit as a script
for running lldb rather than gdb).

Test: treehugger
Change-Id: I9d84d7c1d2f72dd6659d851b31f1ebd5f2a47384
2021-06-25 14:29:23 -07:00
Elliott Hughes
4c8e875d52 Remove gdb-specific stuff from gdbclient.py (aka lldbclient.py).
gdb is gone now.

Test: lldbclient.py -r date
Change-Id: I7fe15a43ff9144b07a1e8984b4b83477f76f06a9
2021-06-25 14:23:22 -07:00
Elliott Hughes
468c234e8a Remove an ART/dalvik gdb script.
gdb has been removed.

Test: N/A
Change-Id: I45c8e4d7a044bef64329f20ab670b5feb43ac661
2021-06-25 13:46:45 -07:00
Elliott Hughes
9059e9c9f3 Merge "Fix gdbclient to work with Python 3." 2021-06-25 20:39:38 +00:00
Pirama Arumuga Nainar
8e96f31b36 [scripts] Remove hard-coded clang version
Bug: http://b/187231324

Instead,
- For local development, invoke build/soong/scripts/get_clang_version.py
to find the current clang version.
- In CI, find llvm-cxxfilt using glob expansion.

Test: development/scripts/symbol.py unittest for local development
      python-stack_core_test on presubmit
Change-Id: Id4258dd791626508520b6a478b8a1b54495ebb11
2021-06-24 17:38:32 -07:00