summaryrefslogtreecommitdiff
path: root/tools/warn/java_warn_patterns.py
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2020-06-22 17:30:57 +0900
committer Jiyong Park <jiyong@google.com> 2020-06-30 18:44:01 +0900
commitd721e870bcc3caf2219adaa4716a3193d3c479d0 (patch)
treedd128fdecc309e8da125b5cc7f9022ccfc429612 /tools/warn/java_warn_patterns.py
parent4d1284c0b783ffef3f416361cbbf41bc1f3c23d7 (diff)
Support optional prop assignments
This CL adds a number of changes to make the assignment of system properties to be less confusing. 1. Added `a ?= b` syntax, which is called optional prop assignments. The prop `a` gets the value `b` only when there is no non-optional prop assignment for `a` such as `a = c`. This is useful for props that provide some reasonable default values as fallback. 2. With the introduction of the optional prop assignment syntax, duplicated non-optional assignments is prohibited; e.g., the follwing now triggers a build-time error: a = b a = c , but the following doesn't: a ?= b a = c Note that the textual order between the optional and non-optional assignments doesn't matter. The non-optional assignment eclipses the optional assignment even when the former appears 'before' the latter. a = c a ?= b In the above, `a` gets the value `c` When there are multiple optional assignments without a non-optional assignments as shown below, the last one wins: a ?= b a ?= c `a` becomes `c`. Specifically, the former assignment is commented out and the latter is converted to a non-optional assignment. 3. post_process_props.py is modified so that when a prop assignment is deleted, changed, or added, the changes are recorded as comments. This is to aid debugging. Previously, it was often difficult to find out why a certain sysprop assignment is missing or is added. 4. post_process_prop.py now has a unittest Bug: 117892318 Bug: 158735147 Test: atest --host post_process_prop_unittest Exempt-From-Owner-Approval: cherry-pick from master Merged-In: I9c073a21c8257987cf2378012cadaeeeb698a4fb (cherry picked from commit 7aeb8de74e08eb2d305686aa8eff45353973e7d7) Change-Id: I9c073a21c8257987cf2378012cadaeeeb698a4fb
Diffstat (limited to 'tools/warn/java_warn_patterns.py')
0 files changed, 0 insertions, 0 deletions