Commit graph

11 commits

Author SHA1 Message Date
Devin Moore
753a555fdd bpmodify: Add a set-bool flag to set single boolean values
This is treated similar to other set commands, but add a single boolean
value to the property.

Test: bpmodify_test.go
Test: bpmodify -d -m android.hardware.drm -property frozen -set-bool
false Android.bp
Test: Same command above with "true" "misspelled" "1" for -set-bool
Bug: 231903487

Change-Id: I598da41a38409877af410f9715838d86b0873173
2022-10-28 18:46:51 +00:00
MarkDacek
2b70006b32 Edit bpmodify to check Android. files and use '=' as the separator for
replacements.
Test: go test -v and running bpmodify with the LSC tool

Change-Id: I63741cce66179962e454f9a002bf358bf054c267
2022-08-17 18:54:16 +00:00
Alix
30751b313c added tests for move-property in bpmodify
Test: m nothing
Signed-off-by: Alix <agespino@google.com>
Change-Id: Ib8f1e88f7587476845e64a9d9ff96afb2b8d2df8
2022-08-11 02:44:02 +00:00
MarkDacek
c93385a75a Add functionality for replacing string values.
Test: go test -v

Change-Id: I8e59bd1dc319d06c5645c6f288df46702901573b
2022-08-09 23:33:22 +00:00
MarkDacek
856507f4d2 Add multiple property and replace functionality to bpmodify.
Test: go run bpmodify.go -w -m=libcore-memory-metrics-tests -property=something,static_libs,deps,required,test_suites -replace-property=ahat:ahat_lib,general-tests:something -s ~/aosp-master-with-phones/libcore/metrictests/memory/host/Android.bp
go test -v

Change-Id: I005b6dd675beb205f544e89c729fe9191e6470c2
2022-08-08 17:58:11 +00:00
Jeongik Cha
5860caea33 bpmodify: remove-property
`r` option removes only item(s) in a list, so add `remove-property`
option to remove a property itself.

Bug: 146436251
Test: unittest
Change-Id: I0c838d31e72358f094cfb5fa9468dce07018e061
2022-02-11 05:54:33 +00:00
Jooyung Han
451dd63611 bpmodify: -add-literal to add a value to the list
-a works with only string values. When we need to add numbers, booleans,
or even structs, -add-literal can be used now.

  bpmodify -m foo -property list-of-ints -add-literal 123
  bpmodify -m foo -property list-of-structs \
    -add-literal "{key: \"value\"}"

Bug: 146436251
Test: go test ./bpmodify
Change-Id: I91d23d7bf89491643aa595f5ebccd9410a9cbb09
2022-02-09 11:16:02 +09:00
Colin Cross
b1abbada6a Add support for setting string property in bpmodify
Add a -str argument to set a property to a string value.

Bug: 186723288
Test: bpmodify_test.go
Change-Id: I490e3be182693c8720020814da579e6e788b3d9f
2021-05-04 08:02:13 -07:00
Colin Cross
5ef7b6608c Improve bpmodify_test.go
Make TestProcessModule use subtests, give the tests names, and
use named fields in the testcase struct.

Test: bpmodify_test.go
Change-Id: I85345bd419e4c3ccf0050b7efae0479dd03d8bea
2021-04-29 19:11:39 -07:00
Jooyung Han
53e92a0de6
bpmodify: support numerical sort (#332)
bpmodify sorts touched list respecting numbers embedded in strings. For
example, "foo-2" comes before "foo-10".

Test: bpmodify_test.go
Change-Id: If2fe9bc871a463a47dd3c0b52982b34c9fde05f0

Co-authored-by: Jooyung Han <jooyung@google.com>
2020-12-14 11:30:48 -08:00
Yo Chiang
b138d49adf bpmodify: handle nested properties
Add an option "-property", which is an alias to the option "-parameter".

For example if Android.bp contains:

  cc_foo {
    name: "foo",
  }

Then `bpmodify -m foo -a bar -property baz.buz Android.bp` outputs:

  cc_foo {
    name: "foo",
    baz: {
      buz: ["bar"],
    },
  }

Bug: 149715904
Test: go test -v
Change-Id: I9660cff1b5239ccf5aa9ef1a41835b8ac6cd4b9f
2020-04-03 02:16:55 +08:00