Commit Graph

459 Commits

Author SHA1 Message Date
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
Treehugger Robot
4aa6d94b08 Merge "Remove native_heapdump_viewer." 2021-06-24 23:47:46 +00:00
Elliott Hughes
09117f6915 Remove native_heapdump_viewer.
We recommend Perfetto instead.

Bug: https://github.com/android/ndk/issues/435
Test: treehugger
Change-Id: I879f7777dfb06e669aefd804bc202291a18e90fd
2021-06-24 15:44:49 -07:00
Pirama Arumuga Nainar
5fc3b704c6 Merge "[scripts] Switch symbol.py to clang-r416183b1" 2021-06-24 21:36:40 +00:00
Pirama Arumuga Nainar
6ef65993e0 [scripts] Switch symbol.py to clang-r416183b1
Bug: http://b/189328402

Test: presubmit
Change-Id: I9cc12dc8e213b755745e81b93d21c88c8ac437b2
2021-06-24 09:19:52 -07:00
Elliott Hughes
17de6ce9ce Fix gdbclient to work with Python 3.
Test: gdbclient.py -r date
Change-Id: I10616c197dd50fe653e56c2e4c39e2371445c72b
2021-06-23 18:04:27 -07:00
Joel Galenson
089f93dcec Merge "Allow adding blocks of texts to the Android.bp file." 2021-06-21 15:22:02 +00:00
Pirama Arumuga Nainar
7370ac9126 Merge "Revert "[scripts/symbol] Switch to clang-r416183d"" 2021-06-16 20:00:18 +00:00
Pirama Arumuga Nainar
e804a70bbf Revert "[scripts/symbol] Switch to clang-r416183d"
Revert "Switch to clang-r416183d"

Revert submission 1737013-switch-to-clang-r416183d

Bug: http://b/191276541
Bug: http://b/189328402

Reason for revert: Breaks renderscript_mac build
Reverted Changes:
I25142ddaa:[scripts/symbol] Switch to clang-r416183d
If11e59638:Switch to clang-r416183d

Change-Id: I7961a8d2ed933f39308b80e39833fbcb1acc77e2
2021-06-16 18:26:49 +00:00
Treehugger Robot
39fe25f1f2 Merge "[scripts/symbol] Switch to clang-r416183d" 2021-06-16 17:46:24 +00:00
Pirama Arumuga Nainar
8b3774e428 [scripts/symbol] Switch to clang-r416183d
Test: presubmit
Change-Id: I25142ddaa46446b8521382bfffd3cf12ff00bb86
2021-06-14 14:23:15 -07:00
Joel Galenson
5664f2af26 Allow adding blocks of texts to the Android.bp file.
You can either add the blocks to the toplevel of the file or into the
main module.  The blocks are given in separate files.

Test: Use both for some crates.
Change-Id: I74204867d4e348c83c7adc2a833be166956bfb7e
2021-06-14 13:44:58 -07:00
Treehugger Robot
53f2408738 Merge changes Ice2c3a8a,I5c4f16af
* changes:
  update_crate_tests: Add documentation
  update_crate_tests: Remove cwd
2021-06-14 07:43:09 +00:00
Treehugger Robot
acec66d1b0 Merge "update_crate_tests: Clean up" 2021-06-14 07:43:05 +00:00
Treehugger Robot
4d9029f5d4 Merge "update_crate_tests: Generate Bazel files" 2021-06-14 07:43:02 +00:00
Treehugger Robot
eccee76591 Merge changes I6080fa7f,I3c0477cf,I0beac6e7
* changes:
  update_crate_tests: Add init exceptions
  update_crate_tests: Use prebuilt bazel
  update_crate_tests: Use subprocess.DEVNULL
2021-06-14 07:42:54 +00:00
Thiébaud Weksteen
3604b75456 update_crate_tests: Add documentation
Test: pydoc update_crate_tests
Change-Id: Ice2c3a8ab901e38b2cf77433ec1ba6aac2360236
2021-06-10 14:27:16 +02:00
Thiébaud Weksteen
fc485b2384 update_crate_tests: Remove cwd
Env.cwd is misleading as it captures the location of the crate/package
being updated. Move the detection logic to the Package class and rename
the attribute.

There is the expectation that before running soong_ui, cwd is set to
ANDROID_BUILD_TOP; and before running write_mapping, that cwd is set to
the package directory. Add comments to capture this.

Test: update_crate_tests.py in external/rust/crates/libc
Change-Id: I5c4f16afe0b92b7c85173e4149ee17dd39c773c2
2021-06-10 14:27:10 +02:00
Thiébaud Weksteen
2e532bb1c1 update_crate_tests: Clean up
Rename the Crate class to Package as this script may also be used to
update TEST_MAPPING for the prebuilts/rust toolchain.

Inline get_tests function as one branch was never used.

Rename `create_test_mapping` to `create` as it is already a method of
TestMapping.

Test: update_crate_tests.py in external/rust/crates/libc
Test: update_crate_tests.py in prebuilts/rust
Change-Id: I06bd6d4f93223bb50fdb898980bd25fa3cea9019
2021-06-10 10:56:24 +02:00
Thiébaud Weksteen
df132d6056 update_crate_tests: Generate Bazel files
Bug: 190582745
Test: update_crate_tests.py in external/rust/crates/libc
Change-Id: If61239c5fe9ae3f8fc568eec906bf73baf603105
2021-06-10 10:56:13 +02:00