aboutsummaryrefslogtreecommitdiff
path: root/python
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Fix non-deterministic python compilation" into mainAnas Sulaiman2024-02-081-9/+12
|\
| * Fix non-deterministic python compilationAnas Sulaiman2024-02-071-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | This CL fixes timestamps for zip entries to a hardcoded value to ensure deterministic zip archives across checkouts, not just for incremental builds. The value chosen for the fixed date is the same as the one used by soong_zip. Bug: b/322788229 Test: Ran a few builds and verified that mdate for zipped files are fixed as well as the generated zip files have identical hashes. Change-Id: I3cd6fcf559d4d83d8813c93319b46e267ae64a2b
* | Merge "Generate ATS 2.0 config for Mobly test." into mainZiwei Zhang2024-02-071-26/+22
|\ \ | |/ |/|
| * Generate ATS 2.0 config for Mobly test.Ziwei Zhang2024-02-071-26/+22
| | | | | | | | | | | | | | | | | | | | | | - Support test_config and test_config_template - The `config` file extension is widly used by TF. Use `configv2` for ATS 2.0 tests to avoid configuration errors in TF. - Add `mobly` tag to support atest Test: m CtsBluetoothMultiDevicesTestCases (with `runner = "mobly"`) Bug: 299850687 Change-Id: Idbed90ab30e35aeed8cdeeb0aa0aa7adb75a3cd9
* | Fix non-deterministic python compilationAnas Sulaiman2024-02-011-9/+19
|/ | | | | | | | Timestamps in pyc files and zip archives were causing cache misses in RBE. Bug: b/322788229 Test: Ran a few local builds and verified improved cache hit rate for metalava actions. Change-Id: I9375694d26a107f5c0c43bbd685bd8e86349d187
* Propagate aconfig providers for more modules.LaMont Jones2024-01-102-0/+7
| | | | | | Bug: 308625757 Test: manual Change-Id: Iaf6d45a4259f1c6c34476c34c431344283ae2830
* Convert SetProvider to generic providers APIColin Cross2023-12-142-2/+2
| | | | | | | | | Convert all of the callers of SetProvider to use the type-safe android.SetProvider API. Bug: 316410648 Test: builds Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
* Remove ConvertWithBp2build implementationsColin Cross2023-12-085-253/+0
| | | | | | | | | Remove the ConvertWithBp2build implementations from all the module types, along with the related code. Bug: 315353489 Test: m blueprint_tests Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
* Add source file provider for genrule/srcs, python libraries and rust libraries.Aditya Choudhary2023-12-051-0/+1
| | | | Change-Id: I2d7d4684a10c15aeecc27b8db800ab27a807d2e2
* Move test data installation to SoongColin Cross2023-11-301-4/+5
| | | | | | | | | | | | | | | | | To generate module-info.json in Soong for b/309006256 Soong needs to know the test data paths. Moving test data installation into Soong will also help later for test suite packaging. Add ModuleContext.InstallTestData that installs the files listed in a []DataPath alongside the test. The files will also be passed to Make to allow it to continue packaging them into the test suites for now. Update the module types that are producing LOCAL_TEST_DATA entries in their Android.mk files to go through InstallTestData instead. Bug: 311428265 Test: atest --host toybox-gtests --test-timeout=120000 Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead
* Add proto for Test ownership metadata.Aditya Choudhary2023-11-152-0/+3
| | | | | | | | | | This Cl adds a new rule to Soong to generate test spec metadata. Also, this CL adds a provider in various test module to provide test spec related data to the Soong rule. Will add providers and test code to other Module in the future changes. Provider added for the following test modules in this change: android_robolectric_test, android_test, bootclasspath_fragment_test, java_test, java_test_host, python_test, python_test_host, sh_test,and sh_test_host. Bug: 296873595 Change-Id: I5f89f72d5874bb7838ae357efdb8c6ca208e18a7
* Have ConvertWBp2build use Bp2buildMutatorContextChris Parsons2023-09-201-6/+6
| | | | | | | | | | | | | This no-op refactoring facilitates some upcoming functional changes for "bp2build allowlist v2". The work requires that the bp2build conversion mutator be changed from a TopDown mutator to a BottomUp mutator. Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext makes it easier to make this functional change without touching tens of files and multiple projects. Bug: 285631638 Test: m bp2build Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
* Merge "Revert "Temporarily disable python precompilation for py3.11"" into mainDan Willemsen2023-08-311-2/+1
|\
| * Revert "Temporarily disable python precompilation for py3.11"Dan Willemsen2023-08-241-2/+1
| | | | | | | | | | | | | | | | | | This reverts commit b1094d602bbd1fc6d4d60ace63ff82a92b479b23. Reason for revert: prebuilts updated in aosp/2726579 Bug: 278602456 Change-Id: I750b0f7e4dd94329a4455499f869a1823e660d77
* | Merge changes from topic "java-proto-include-dir" into mainTreehugger Robot2023-08-281-0/+8
|\ \ | | | | | | | | | | | | | | | * changes: Handle proto.include_dirs for java Translate python_libray.pkg_path to proto.import_prefix
| * | Translate python_libray.pkg_path to proto.import_prefixSpandan Das2023-08-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a python_library uses a pkg_path foo/bar, then the proto srcs in that libray need to import the dep .proto as foo/bar/proto.proto. This behavior is restricted to python modules. To implement this is in bp2build, this CL creates a new interface with a single method `PkgPath`. Only python module structs implement this interface, and this method is only available during bp2build Test: Added a bp2build unit test Test: TH Change-Id: If8d207c0b321f75337a053795826b283a5eaaf46
* | | Merge changes from topic "proto-include-dir-py" into mainSpandan Das2023-08-241-1/+8
|\| | | | | | | | | | | | | | | | | | | | * changes: Handle proto.include_dirs in bp2build for py Add proto.local_include_dirs support in bp2build Add manual tag to proto_library at the root package
| * | Handle proto.include_dirs in bp2build for pySpandan Das2023-08-241-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Followup to aosp/2711114 which added proto.include_dirs support for cc Test: go test ./bp2build Test: Added an integration test in build/bazel/examples Bug: 285140726 Change-Id: Ic78dacbe46d9ea67e9441948852a3f94dabbb35e
* | | Merge "Temporarily disable python precompilation for py3.11" into mainJames Farrell2023-08-241-1/+2
|\ \ \ | |/ / |/| / | |/
| * Temporarily disable python precompilation for py3.11Dan Willemsen2023-08-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | The precompilation logic assumes that the source tree matches the python prebuilts, which is not necessarily true. This very much breaks during major version upgrades, so just disable precompilation temporarily while we generate new prebuilts. Bug: 278602456 Test: treehugger Change-Id: Idb206bb1d971e8c0fa556c75419623c3bc457898
* | Skip py2-cmd tests on MacDan Willemsen2023-08-221-4/+13
|/ | | | | | | Mac no longer builds python2 Test: prebuilt/build-tools/build-prebuilts.sh on Mac Change-Id: I5857ba7ec023021e660e86df3573e4b6e3d1902b
* Merge "Prepare soong for python 3.11" into mainDan Willemsen2023-08-174-17/+48
|\
| * Prepare soong for python 3.11Dan Willemsen2023-08-164-17/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to upstream changes in python path calculations, I'm simplifying the python launcher to work more like a standard python distribution. This is effectively changing the stdlib path from `internal/stdlib` to `internal/python3.10` (or `3.11`, etc). This allows us to specify the zip file as PYTHONHOME, set PYTHONPLATLIBDIR to `internal` and use the default detection after that. That does mean during upgrades that the stdlib pkg path will change, so move the source vs prebuilt calculation from the Android.bp into Soong to choose which stdlib module to pick up (with the corresponding `pkg_path`) Bug: 278602456 Test: treehugger with python3.10 Test: a python3.11 source + 3.10 prebuilt build Test: a python3.11 source+prebuilt build Change-Id: I8b02e7b22a1f1d1e02819ae1a31a99cdc985542c
* | Use relative path instead of base for python protoTrevor Radcliffe2023-08-151-1/+2
|/ | | | | | | | | | We encountered a duplicate sources bug in python proto generation because we're only using the base name. This CL makes it use the entire path to avoid this. Fixes: 295333879 Test: Presubmits Change-Id: I4ab821508cd5979bd595e327c1ccd3d68110fba6
* Merge changes I8ca452aa,I437fc890,If9446700 into mainSpandan Das2023-08-081-2/+1
|\ | | | | | | | | | | | | * changes: Handle .proto files in different package for filegroups Handle .proto files that end up in a different package Allow creation of BazelTargets in a different directory
| * Handle .proto files that end up in a different packageSpandan Das2023-08-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bazel poses a strict requirement that .proto files and proto_library must be in the same package. This CL handles this automatically by creating the proto_library in a separate dir/package if necessary Implementation details - Partition the `srcs` by package. `srcs` has been computed using `transformSubpackagePath`, so the information about packages is available at this point - Create a proto_library in each package by using `CommonAttributes.Dir`. Collect all these additional libraries and put them in `info.Proto_libraries` so that they get added as deps of (cc|python|...)_proto_library - Add an import_prefix to the proto_library in subpackages relative to the current directory. This relies on the assumption that every src is beneath the current directory (Soong will complain if a path in Android.bp contains ../) filegroup module type uses a separate code-path to create proto_library. This will be handled in the next CL in stack. Test: bp2build unit tests Test: TH Test: Built the failing internal module mentioned in b/292583584#comment1 Bug: 292583584 Change-Id: I437fc89092321b26c5f0511387cde9e84084d6f9
* | Convert merge_annotation_zips_test to b testyike2023-08-011-1/+2
|/ | | | | | Test: b test //frameworks/base/api:merge_annotation_zips_test Bug: 293225210 Change-Id: Ia53b4168894b5c70c843ca315d963fa905ef582f
* Add data_device_bins_both properties for python_test_hostZi Wang2023-05-191-1/+47
| | | | | | | Test: presubmits and manual verification Bug: 274930471 Change-Id: Iafc85526afdb8264526e8a5a33319fa33a23c66b
* Enable host cross python test buildsColin Cross2023-05-181-2/+2
| | | | | | | | | | | | | | Ic37c8db918873ddf324c86b12b5412952b0f2be2 converted python_binary_host and python_library_host from HostSupportedNoCross to HostSupported, but left python_test_host. Do the same for python_test_host. Fixes dependencies between java_test_host modules that create host cross variants and python_test_host modules that were missing host cross variants. Bug: 282918027 Test: builds Change-Id: Iae687aa3aa0f0b005f2dd27469f631145247a008
* Delete Python 2 embedded launcher test.Krzysztof Kosiński2023-05-045-38/+3
| | | | | | | | | There are no remaining Python 2 binaries using an embedded launcher in Android. Bug: 245854393 Test: m par_test py2-cmd py3-cmd && build/soong/python/tests/runtest.sh Change-Id: I241bbaa417060b51b4d2883011ccb43e22ace4c8
* bp2build support for python_test(_host)Cole Faust2023-04-133-55/+63
| | | | | | | | | | There was a request for using b with python tests. bp2build python tests exactly the same way as python binaries so that they can be used with `b`. Bug: None Test: go test Change-Id: Id68a6a73572745a4885b3e5bb1b8452e36baa982
* stub_template_host redirect SIGINT and SIGTERM to subprocessQiao Yang2023-03-221-1/+13
| | | | | Test: manual Change-Id: I561f581f7413dc18b2d449f4ef338db3b6b9ca47
* Merge "Add python template for mobly tests."Ziwei Zhang2023-03-201-9/+53
|\
| * Add python template for mobly tests.Ziwei Zhang2023-03-081-9/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mobly is a Python-based test framework that specializes in supporting test cases that require multiple devices. There are some Mobly based Android tests, but these tests cannot be added to xTS since they are not using TF. Currently TF provides a 2-device Mobly test runner. This change is a short-term solution to help teams (eg. bluetooth) to add their multi-device Mobly tests to xTS without writing TF configs. For long-term, device infra team and xTS infra team will provide a solution for more complex multi-device tests in xTS and deprecate this TF template. Test: manually check the generated mobly xml config Bug: 272239365 Change-Id: I252cc774094eebbd9264243d30023ace4839c2cd
* | Make using python 2 an errorCole Faust2023-03-091-0/+6
|/ | | | | | | | | Except if BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES is set, and except for some core py2 modules that can't be removed until python2 is fully gone. Bug: 203436762 Test: m nothing Change-Id: I62ccb6f5687eab1e79c372ffc234a90ca5b566ac
* Replace SortedStringKeys with SortedKeysCole Faust2023-02-281-1/+1
| | | | | | | | Now that we have generics. Bug: 193460475 Test: presubmits Change-Id: I1594fd8feb505175d5c09c03ef397e5ffd5b09cb
* Revert "Dynamically assemble the list of python launcher shared libs for ↵Cole Faust2023-02-132-45/+58
| | | | | | | | | | precompiling" This reverts commit aa5b377ee956f2e7ff2e0fb6630f636ecfe15b84. Reason for revert: this broke musl builds by removing the install dependency from python binaries to the launcher shared libraries: https://android-build.googleplex.com/builds/submitted/9600042/unit_tests_x86_64_musl/latest/view/logs/build_error.log Change-Id: I4e13f333f287831ba13724f13ab2be789a92b476
* Dynamically assemble the list of python launcher shared libs for precompilingCole Faust2023-02-022-58/+45
| | | | | | | | | Still fall back to the hardcoded list for what to put in LOCAL_SHARED_LIBRARIES, because I couldn't figure out a good way to get those modules at the moment. Bug: 259718110 Test: Presubmits Change-Id: Ia992ffea8819d8c67280b08bc45505f77af09de0
* Precompile python sourcesCole Faust2023-01-278-88/+284
| | | | | | | | | | | This signifigantly improves the startup time of soong-built python binaries. For example, running `m apexer && time out/host/linux-x86/bin/apexer` gives 0.734s before this cl, and 0.094s after. Fixes: 259718110 Test: Presubmits Change-Id: Ib19e83e2c60c39a849525be117279c318de3afa7
* Refactor python rulesCole Faust2023-01-259-685/+522
| | | | | | | | | | | | The goal of this cl is to simplify the python rules, mostly by removing the "decorator" pattern that they currently use, and instead making separate module types for libraries, binaries, and tests that inherit from each other. Bug: 259718110 Test: Verified ninja files are unchanged (they only change in the list of soong sources because I added/deleted files) Change-Id: I1e836e2cc4782c7818f91db7df7895de3b8db7ca
* Allow adding extra tradefed options in the Android.bp fileCole Faust2023-01-031-3/+8
| | | | | | | | | | | | Some tests need to add custom tradefed options, but still want to keep most of the soong autogenerated tradefed xml file. Expose a test_options: { tradefed_options: [...] } property that will allow tests to add more options to the autogenerated xml file. Fixes: 184895128 Test: go test, and verified that the ninja files did not change for aosp_arm64 Change-Id: I50d4ad139322e9e207202f1e1a50f5bbb424aa6f
* Revert "Allow adding extra tradefed options in the Android.bp file"Tahsin Loqman2022-12-191-8/+3
| | | | | | | | This reverts commit 8ec823cba166a41eb0e9e5ff8fe679e691fec678. Reason for revert: DroidMonitor: Potential culprit for Bug b/262965953 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Change-Id: I236cc36981d8b30527ca286632727f8ca267e969
* Allow adding extra tradefed options in the Android.bp fileCole Faust2022-12-091-3/+8
| | | | | | | | | | | | Some tests need to add custom tradefed options, but still want to keep most of the soong autogenerated tradefed xml file. Expose a test_options: { tradefed_options: [...] } property that will allow tests to add more options to the autogenerated xml file. Fixes: 184895128 Test: go test, and verified that the ninja files did not change for aosp_arm64 Change-Id: I75f7eb002c8325ce7cdc76e12e76e16195320620
* Remove flags that enable the new python path behaviorCole Faust2022-10-219-109/+19
| | | | | | | | | The new behavior has been enabled by default, and these flags aren't necessary anymore. Fixes: 245583294 Test: m py_dont_import_folder_of_entrypoint_test && /ssd/aosp-master/out/host/linux-x86/testcases/py_dont_import_folder_of_entrypoint_test/x86_64/py_dont_import_folder_of_entrypoint_test Change-Id: I5b6f98da51791bc5d28662ef799a10c1bb6a35a0
* Merge "Fix some issues in bp2build converter for python_binary_host."Wei Li2022-10-132-15/+15
|\
| * Fix some issues in bp2build converter for python_binary_host.Wei Li2022-10-122-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | 1) Bp2build convert python_binary_host main attribute as LabelAttribute. Currently "main" attribute in python_binary_host is handled as string but for some modules (e.g certify_bootimg) the "main" attribute points to a file in its subpackage like "subpackage/file.py" and should be converted to "//.../subpackage:file.py". 2) Filter out duplicated labels in the merged list of "required" attributes of python_binary_host and its defaults. Test: b build //system/tools/mkbootimg:certify_bootimg Test: b build //build/make/tools/releasetools:check_target_files_signatures Bug: 253081249 Bug: 253101186 Change-Id: Ic2cb4cadec2c1348da70af9f0730da9914d3a8ca
* | Merge "Revert^2 "Enable new python path behavior by default""Cole Faust2022-10-112-4/+3
|\ \ | |/ |/|
| * Revert^2 "Enable new python path behavior by default"Cole Faust2022-10-112-4/+3
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 4d5cc709fa16f5dc78f690369e946fcf66156312. Reason for revert: Acloud issue was fixed in aosp/2243150, make sure the host unit tests are run on this cl via go/abtd before submitting Change-Id: Ie148430d331a01a9877adaf3cb88f1c57af136a0 Bug: 245583294 Bug: 247578564 Bug: 251688241
* | Merge "Revert "Enable new python path behavior by default""Lais Andrade2022-10-072-3/+4
|\|
| * Revert "Enable new python path behavior by default"Lais Andrade2022-10-072-3/+4
| | | | | | | | | | | | | | | | This reverts commit 5fe655d1c71ee079dd46e93c96b54aae39a10d16. Reason for revert: DroidMonitor: Potential culprit for Bug b/251688241 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Change-Id: I1ea4df27557fc891d8f0156ec5681f9b0c601c98