aboutsummaryrefslogtreecommitdiffstats
path: root/python
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Fix package path of android/soong/android pctx" into qt-devTreeHugger Robot2019-04-121-1/+1
|\
| * Fix package path of android/soong/android pctxColin Cross2019-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | android/soong/common was renamed to android/soong/android long ago, but the pctx package path was still "android/soong/common". This required all users of rules defined in android/soong/android to import "android/soong/android" and then pctx.Import("android/soong/common"). Bug: 130298888 Test: m checkbuild Change-Id: I20d096522760538f7cfc2bec3d4bfeba99b275d4
* | Fix python proto srczip argument orderColin Cross2019-04-111-3/+3
|/ | | | | | | | | | | -P has to come before -D to have an effect on the files read from the directory. Fixes: 130160833 Test: atest acloud_test Change-Id: I62a998f1ad1e3b45f590babbf39330955d368373 Merged-In: I62a998f1ad1e3b45f590babbf39330955d368373 (cherry picked from commit 09364fd955c38983f8cd05133e9685e2502f0d09)
* Add support for protoc pluginsColin Cross2019-04-022-1/+3
| | | | | | | | | Add a proto.plugin property to allow specifying a custom protoc plugin to generate the code. Fixes: 70706119 Test: m am StreamingProtoTest Change-Id: I1ecdd346284b42bbcc8297019d98d2cd564eb94c
* Move proto compilation to RuleBuilderColin Cross2019-04-022-46/+25
| | | | | | | | | | | | | | Using blueprint.Rule for protoc commands was causing code duplication because there was no good way to run the same protoc for cc, java and python but then run custom source packaging steps for java and python. Move most of the code into a common function that returns a RuleBuilder, and then let java and python add their own commands at the end of the rule. Bug: 70706119 Test: All Soong tests Test: m checkbuild Change-Id: Ic692136775d273bcc4f4de99620ab4878667c83a
* Replace ctx.ExpandSources with android.PathsForModuleSrcColin Cross2019-03-201-2/+2
| | | | | | | | | | | Move the logic from ctx.ExpandSources into android.PathsForModuleSrc and ctx.ExpandSource into android.PathForModuleSrc, and deprecate them. When combined with the pathDepsMutator this will let all properties that take source paths also take filegroups or genrule outputs, as long as they are tagged with `android:"path"`. Test: All soong tests Change-Id: I01625e76b5da19240e9649bf26a014eeeafcab8f
* Annotate paths and deprecate ExtractSource(s)DepsColin Cross2019-03-071-19/+5
| | | | | | | | | Add `android:"path"` to all properties that take paths to source files, and remove the calls to ExtractSource(s)Deps, the pathsDepsMutator will add the necessary SourceDepTag dependency. Test: All soong tests Change-Id: I488ba1a5d680aaa50b04fc38acf693e23c6d4d6d
* [SOONG] Not auto-generate test config if test_suite is ctsyangbill2019-02-191-1/+1
| | | | | | | | | | | | Current soong use source code's under cts as the rule for judgement. Should change to use test_suites define instead. Bug: 124313692 Test: m hello_world_test, make sure test config be auog-enerated. Modified platform_testing/tests/example/native/Android.bp m hello_world_test, make sure test config not be auto-generatetd. Change-Id: I1bc5216f73329d2a82d9ff29ccbede436dd2976c
* Support building a par file that does not automatically runDan Willemsen2019-02-173-15/+59
| | | | | | | | | | Mainly so that we can build a `python` prebuilt that acts like the normal python install, though you could also build different ones with more packages pre-installed. Bug: 117811537 Test: move built py2-cmd into prebuilts/build-tools/path/linux-x86/python and build Change-Id: I21215f6fd3754d89f8c65e1dfeb3f2deea23239f
* Simplify python launcher, use __main__.pyDan Willemsen2019-02-152-15/+22
| | | | | | | Uses more python rather than C++, and skips less of Py_Main. Test: build/soong/python/tests/runtests.sh Change-Id: I03997d88e2e16047c96bb4e00e530229c42b3325
* Add par_testDan Willemsen2019-02-144-0/+158
| | | | | | | | This test adds a number of checks for the visible python state inside a hermetic par file. Test: build/soong/python/tests/runtests.sh Change-Id: I7188d862a309a09623169e1f967bde86707d41af
* Remove empty DepsMutator methodsColin Cross2019-02-011-3/+0
| | | | | | | | Add an empty DepsMutator to ModuleBase so it doesn't have to be implemented on every module that doesn't need it. Test: all soong tests Change-Id: I545a832a0dbf27386d3080377a75ea482cd9ce59
* Add missing dependencies for python_testLogan Chien2019-01-293-14/+47
| | | | | | | | | This commit adds missing shared lib dependencies for `python_test` modules with embedded launcher. Bug: 119086738 Test: CHECK_ELF_FIELS=true make check-elf-files Change-Id: I26f8e1eb9086930093f60c7daa54469850fab32d
* Autogen python test config.yelinhsieh2019-01-142-0/+15
| | | | | | | | | | | | | Feature request from developer, autogen python test config. Bug:118442443 Test: $source build/envsetup.sh ; lunch $sed -i '/test_config/d' tools/acloud/Android.bp $make acloud_test $[ -f $ANDROID_HOST_OUT_TESTCASES/acloud_test/acloud_test.config ] && echo "Found" || echo "Not found" Change-Id: I196230581b456afe03e67f9cd84c028d18ba08d9
* Pass -S option to wrapper for python binary.yangbill2019-01-041-1/+4
| | | | | | | | | | | | | | Prevent problem for some users using PAR file built by android's build system which cause by the different site package of python installed by user themselves. Bug: 120469915 Test: 1. m atest atest --help 2. apply aosp/861470 full build Change-Id: I72c83f9397f0e88eecfcd32806f1746520299447
* Fix mac build w/echo -nDan Willemsen2018-12-041-2/+4
| | | | | | | | | | | | | Soong doesn't wrap everything in bash, but relies on the ninja default of /bin/sh. We should probably improve that in the future, but for now, just fix the build. On Mac, /bin/sh and /bin/bash are both bash, but /bin/sh implies `set -o posix`, and ignores the `-n` flag. Test: treehugger Test: build on a mac Change-Id: Icf41b1c5a1ce9eb0a56e39e68c433fc80b53620f
* python par: trim and convert the entry point at build timeDan Willemsen2018-12-031-2/+3
| | | | | | | | | Instead of doing these string operations in the C++ code at every startup of an embedded par, trim and convert the entry point file to a python module path at build time. Test: m Change-Id: I04a6459a80c84a704b8a25a144ab1e19622d6cc3
* Fix par file zip offsetsDan Willemsen2018-12-031-16/+12
| | | | | | | | | | | | | | | | The zip file format does support scripts/programs prefixed to the archive, though many of the offsets are supposed to start from the beginning of the file. Some tools (python and zipinfo) are able to read zip files with arbitrary prefixes, but others (libziparchive and zipdetails) fail. So pass the file to prefix onto the zip file into merge_zips so that we can set the offsets from the real start of the file. Test: m sepolicy_tests (runs the embedded python interpreter) Test: zipinfo out/host/linux-x86/bin/sepolicy_tests Test: zipdetails out/host/linux-x86/bin/sepolicy_tests Change-Id: If73d4c2465581f7de5aa47959284ecf2059df091
* Define runfiles_path before try so that finally can use it.Nicolas Geoffray2018-10-111-1/+3
| | | | | | | | Otherwise, python will complain the variable has not been initialized, in case ExtractRunFiles throws an exception. Test: m Change-Id: I3d9e3cda5e558436ee4182c44e4345151c031e41
* Fix invalid memory error for python binary buildNan Zhang2018-09-262-6/+6
| | | | | | | | | | | | | | The root cause is we didn't check if the optionalpath is valid or not, the registerbuildation function directly invoke the path var and cause the invalid memory error. We just return if the launcher doesn't exist. The ctx.VisitDirectDepsWithTag() also handles allowmissingdependency so we are ok if launcher doesn't exist. Test: N/A Bug: b/116698229, b/67510844 Change-Id: I40941079a64d7797ab879fc5edaa29e835b493a0
* Support 'test_config' into soong modulesJulien Desprez2018-08-072-0/+17
| | | | | | Test: make general-tests Bug: 110982517 Change-Id: Ib2eab2653fdfce6f699b85c9fbc64558b6d40363
* Fix `go vet` issuesDan Willemsen2018-07-221-1/+1
| | | | | Test: go vet ./... Change-Id: Ifb936ccc5e2b5a2c3fcbbbcb54f680e2973ea1b3
* Use WalkDeps instead of VisitDepsDepthFirstColin Cross2018-06-221-8/+15
| | | | | | | | | | | | VisitDepsDepthFirst is almost never correct, as it can't query dependency tags of multiple dependencies between the same two modules. Replace VisitDepsDepthFirst with WalkDeps in sanitize.go and python.go. Also verify the dependency tag before continuing to recurse to ensure that they don't recurse through genrules and into unrelated modules. Test: m checkbuild Change-Id: I2f7560126f56b51a40ec39dfbdcc18b5891489f7
* Fix embedded_launcher can't find filesNan Zhang2018-06-044-33/+15
| | | | | | | | | | | The problem came from Python libraries doesn't know the information that we enabled embedded_launcher (only Python binary knows about that). And we can't simply remove runfiles dir for Python libraries since host Python mode need this. Bug: b/80441699 Test: m perf_profo_flames Change-Id: I73ffc4d7504f95a708ae7cca47bc6c15a673aa31
* Revert "Revert "Revert "Revert "Add path interposer""""Dan Willemsen2018-05-311-2/+0
| | | | | | | | | | | | | | | | | | This reverts commit 09f4540d667a98e548bf5dfc94784382ebedc963. Fixes the raw call to net.Listen in the tests to go through the listen() helper and use the long socket path fallbacks. Removes the use of timeouts from the tests -- the behaviors being tested did not rely on timeouts, so removing them will reduce the flakiness if the build is heavily loading the machine at the same time the test is running. Also fixes some potential nil pointer dereferences. Test: OUT_DIR=<really long> m blueprint_tools Test: `while .../soong-ui-build-paths/test/test; do sleep 0.01; done` with a build running Change-Id: I16d44be7517bc415f1c808284088f4ba40df3bfa
* Revert "Revert "Revert "Add path interposer"""Dan Willemsen2018-05-251-0/+2
| | | | | | | | | | This reverts commit c59a92cb1a73468a0e2af7102632dda48d811f5b. Reason for revert: tests are broken with long OUT_DIRs They're directly calling net.Listen, and not using the fallback for long socket names. Change-Id: Id14cbd499fd9b36c6926b7552d3554340cb0916c
* Revert "Revert "Add path interposer""Dan Willemsen2018-05-251-2/+0
| | | | | | | | | | | | | | | | | | | This reverts commit 96c957ae20d8418f85cf10b4ee06ce9781d86c47. Fixes issues on some machines where the socket in TMPDIR ended up with a unix domain socket pathname over 107 characters long, which Go will reject due to underlying limitations in the system calls. If this happens, we'll fall back to opening the directory, then using /proc/self/fd/#/<file>, or manually creating a similar symlink in /tmp. Also fixes some issues on Mac where os.Executable returns the symlink instead of the underlying file, sending a message over a unix domain socket will block if the reader isn't reading, and sandboxing was preventing us from running `ps`. Test: m blueprint_tools Test: m blueprint_tools on mac Change-Id: Ib19ccfe10cb0a79f1476fb1d5cd20ed0495be367
* Merge "Allow "-" to be part of Python file names"Treehugger Robot2018-05-241-1/+1
|\
| * Allow "-" to be part of Python file namesNan Zhang2018-05-231-1/+1
| | | | | | | | | | | | | | Test: m -j py-setuptools Bug: b/79751992 Change-Id: I4cd0cf8671a9bb912a8ba819265274ab0c9e0074
* | Revert "Revert "Add libc++.so as install dependencies for hermetic Python.""Nan Zhang2018-05-231-0/+1
|/ | | | | | | | | | This reverts commit bfb0aed2dd78ee1850e54928ed02614beaf943a7. Reason for revert: <LOCAL_REQUIRED_MODULES overrides the "required:" property in Android.bp> Test: m -j sepolicy_tests Bug: b/80140289 Change-Id: I4e51007a7d4dda69cbf4f31253e9a56d3f5e35c7
* Merge "Fix Protobuf importing issue for embedded Python"Treehugger Robot2018-05-232-10/+20
|\
| * Fix Protobuf importing issue for embedded PythonNan Zhang2018-05-232-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As I mentioned in b/79751992 #4, when launcher loads __main__ as entry point, the module dict got set using absolute pkg path which was runfiles.google.protobuf which caused the type checking failed (expected: google.protobuf for type()). After then, starting with non entrypoint python files, the importing module dict would be set with from...import... So remove dir:runfiles/ from zip section so that during entrypoint Python file importing the proto files using from...import..., the type checking can be passed. Bug: b/79751992 Test: m clean && m out/host/linux-x86/bin/perf_proto_stack; And execute it: usage: perf_proto_stack [-h] [--syms SYMS] [--json-out JSON_OUT] [--print-samples] [--skip-kernel-syms] [--print-pid-histogram] [--print-sym-histogram] [--print-dso-histogram] [--parallel PARALLEL] file [file ...] perf_proto_stack: error: too few arguments Change-Id: I95a4a9ee95ce7f90d893ea0529c384d7b944abe4
* | Revert "Add libc++.so as install dependencies for hermetic Python."Artem Iglikov2018-05-231-2/+0
|/ | | | | | | | This reverts commit ff7d3972189d0f0b5c678b2b4673a78f017dd55f. Reason for revert: breaks a few targets Change-Id: I3f26bfda9e276730accff558333f910a1dc017e8
* Add libc++.so as install dependencies for hermetic Python.Nan Zhang2018-05-221-0/+2
| | | | | | Bug: b/80140289 Test: m clean && m test_me Change-Id: I3acbf1bac3b866b37f9ec69584dc9be7a5ad1d89
* Add a dependency fixer for proto depsDan Willemsen2018-05-071-1/+3
| | | | | | | | | | | | | | | | | | | | | protoc dependency files, at least for C++ outputs, uses the form of: a/b.c \ a/b.h: <dep1> <dep2>... Ninja will fail the command when it parses a dep file and there's more than one output file (even though it doesn't care what the output file name is). So this tool will parse the original file, and output a version with only a single output file. Bug: 67329638 Test: NINJA_ARGS="-t deps ...pb.c" m Test: NINJA_ARGS="-t deps ...srcjar" m Test: NINJA_ARGS="-t deps ...srcszip" m Test: Run dep_fixer across all of taimen's dep files, no failures. Test: Run dep_fixer against the processed files, no changes. Test: Run androidmk across all of our Android.mk files, inspect the diffs Change-Id: I4263b7d5faea37285afa6b24dedf5964aa7d19dc
* Consistently use Bool instead of proptools.BoolColin Cross2018-04-101-2/+2
| | | | | | | Use Bool instead of proptools.Bool and String instead of proptools.String. Test: m checkbuild Change-Id: I32d84add9f27128c7a65413e9612fd920613584f
* Add Python protobuf support.Nan Zhang2018-03-224-56/+185
| | | | | | | | Python protobuf std libs will be wrapped in final binary/test par file. Bug: b/70568913 Test: manually create real examples. Change-Id: I7376ec9175f3e03d1adbd20858a7f74e826387ad
* Extract failIfErrored() to android/testing.goLogan Chien2018-03-151-11/+2
| | | | | | Bug: 74506774 Test: lunch aosp_walleye-userdebug && make # runs unit tests Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
* Remove timestamp based filelist file for tracking Python dependenciesNan Zhang2018-03-094-284/+133
| | | | | | | | | | | Each Python module will generate a zip file containing source & data files. The Python binary will collect all its dependencies and use merge_zips to merge each zip file to create a final .par file. Test: m -j checkbuild && real examples: Bug: b/70568913 Change-Id: I9ff232d461d33e1c06026e7dcb5b124bf02c3ce5
* Revert "Revert "Support filegroup in exclude_srcs""Nan Zhang2018-02-151-0/+3
| | | | | | | | | This reverts commit 606e9de344fae07473dd79e5ac556886a72035de. Reason for revert: <try to fix the broken build yesterday> Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5 Test: unittest
* Revert "Support filegroup in exclude_srcs"Tobias Thierer2018-02-091-3/+0
| | | | | | | | | | This reverts commit f36a3d9b6da654bf8bd7a49315b1625cf0e774ce. Reason for revert: Broke several builds. I'm acting build cop, reverting. Bug: 70351683 Change-Id: I775ada4e9cb6473519d51420b41b818af163da44
* Support filegroup in exclude_srcsNan Zhang2018-02-071-0/+3
| | | | | | Test: add unit-test, m -j32 Bug: b/70351683 Change-Id: Iff83c56d45dd668d9df6131c7df2e23e5c73a21b
* Add VisitDirectDepsWithTagColin Cross2018-01-021-4/+1
| | | | | | | | Add a method on ModuleContext and TopDownMutatorContext to visit direct dependencies that have a given dependency tag. Test: m checkbuild Change-Id: Ib875563091dcae6b7282b3e3427d0eb07d8c8af5
* Add HostToolPath() for Python binaryNan Zhang2017-12-061-0/+8
| | | | | | | So in the genrule, Python binary module can be used as tool. Test: manually write a test genrule. Change-Id: Idfd3af4c1002dd608e1bdffa203e01c802f1bf21
* Revert "Revert "Change Python in Soong to support device side build.""Nan Zhang2017-12-016-16/+57
| | | | | | | | This reverts commit 0a32e5936b4c87bc705d06fa2d4f6fed1f58d602. Reason for revert: <libsqlite was missing for darwin_x86_64 before> Change-Id: I2e13e849a503a705ffad425df292380f2f73954e
* Revert "Change Python in Soong to support device side build."Nan Zhang2017-12-016-57/+16
| | | | | | | | This reverts commit 3bba05962dc4329c6e3d28544775db591574ba7b. Reason for revert: <revert mac builds> Change-Id: I25f1380573d69f7e111287624a2d4a3d95fdd86b
* Change Python in Soong to support device side build.Nan Zhang2017-11-306-16/+57
| | | | | | | | | | | | | | | | | | Add python_test to generate executables for both host and device side. And change python_library_host to python_library. installation for python device test will be under target/product/generic_arm[64]/data/nativetest[64]. Bug: b/69114465 Test: m clean && m -j Device Test: adb root; adb push nan_devicetest /data; adb shell; ./nan_devicetest print(sys.path) ['/data/nan_devicetest/runfiles', '/data/nan_devicetest', '/data/nan_devicetest/internal', '/data/nan_devicetest/internal/stdlib'] Change-Id: If8317070a3aa1b6dab2e84b8df2d037f495d7247
* Change bool, and string properties to *bool, and *string for java,Nan Zhang2017-11-082-12/+15
| | | | | | | | python, and genrule. Test: m -j checkbuild Bug: b/68853585 Change-Id: Ic9a8083818e920dc399a4b00841e2aa496f70faa
* Add support for test_suites for python_binary_host and python_test_hostNan Zhang2017-11-072-0/+18
| | | | | | Test: manually add this property, and then check Android-aosp_arm.mk Bug: b/35394669 Change-Id: Iddaf677839714daf4f8913ff4bf9e944d38c18db
* Convert Visit*Deps from blueprint.Module to android.ModuleColin Cross2017-10-242-4/+2
| | | | | | | | Also adds checks that the dependencies are android.Modules and are not disabled. Test: m checkbuild Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2