Commit graph

15 commits

Author SHA1 Message Date
android-build-prod (mdb)
720f04b964 Merge changes I52f88bfd,I4263b7d5
* changes:
  Fix usage of bytes.NewBuffer in bpfix
  Add a dependency fixer for proto deps
2018-05-08 01:05:10 +00:00
Dan Willemsen
d6989f2e52 Fix usage of bytes.NewBuffer in bpfix
According to the documentation: "NewBuffer creates and initializes a new
Buffer using buf as its initial contents. The new Buffer takes ownership
of buf, and the caller should not use buf after this call."

Test: Run bpfix twice, only wrote the first time.
Change-Id: I52f88bfd9247240436b46f396c9196157774615b
2018-05-07 16:22:22 -07:00
Dan Willemsen
dde8cb9615 bpfix: Remove local_include_dirs if we remove the last entry
This still leaves a blank line in it's place, but that's a more general
problem.

Test: m blueprint_tools
Test: Run bpfix over AOSP, diff.
Change-Id: I55c1d1c183cfa49beeca07abd539348bc2524c5a
2018-05-07 13:32:09 -07:00
Dan Willemsen
75dec2291b Fix androidmk converting cc libraries
The java library rewrites should only happen for java modules, not cc
modules.

Test: Ran androidmk on a number of Android.mk files
Change-Id: Ife2cfb5a69d7db37216671f08317033b99fcd3a1
2018-05-05 13:06:40 -07:00
Colin Cross
2dee86d69c Add more androidmk translations for android libraries
Add support for translating LOCAL_MANIFEST_FILE, LOCAL_RESOURCE_DIR
LOCAL_SHARED_ANDROID_LIBRARIES, and LOCAL_STATIC_ANDROID_LIBRARIES.

Use the presence of non-empty LOCAL_RESOURCE_DIR,
LOCAL_SHARED_ANDROID_LIBRARIES or LOCAL_STATIC_ANDROID_LIBRARIES
to convert a java_library_static into an android_library module,
and then squash LOCAL_SHARED_ANDROID_LIBRARIES into
LOCAL_SHARED_LIBRARIES and LOCAL_STATIC_ANDROID_LIBRARIES into
LOCAL_STATIC_LIBRARIES.

Test: androidmk_test.go
Change-Id: I3ad2a3561f69ebd097eca97cb170754d64e06123
2018-04-16 17:32:23 +00:00
Colin Cross
9c55d237f6 Merge matching properties in bpfix
androidmk will start to generate multiple static_libs: properties
in a single module, add a pass in bpfix to fix them up into a
single property.

Test: bpfix_test.go
Change-Id: I30955b6efbb767c02ba77f2f18d44951ef094bad
2018-04-16 17:32:16 +00:00
Colin Cross
adee968a4b Make bpfix not modify the input tree
Make a new object called Fixer to hold the state of the tree, and
make a copy of the input tree so the original doesn't get modified.

Test: bpfix_test.go
Change-Id: I1dc6fd99158c8b0e1db029df99e6cf72699a5e63
2018-04-16 17:32:08 +00:00
Colin Cross
f46e37f5f7 Fix format string issues
Fix issues caught by go vet.

Test: m checkbuild
Change-Id: Ib8d740457c15432dabe1575a6707726ddaf93084
2018-03-28 15:54:52 -07:00
Jeff Gaston
f7542544d2 Remove unused property
Bug: 72552085
Test: androidmk prebuilts/sdk/current/support/Android.mk \
      | grep LOCAL_UNINSTALLABLE_MODULE && echo failed

Change-Id: Idcdd571812594599267985dfef2cc2fc6efbb5ba
2018-02-28 15:00:15 -05:00
Colin Cross
336ad7a667 Fix java_import and android_library_import conversions
java_import and android_library_import modules can't be handled
directly in androidmk because the results may depend on properties
that haven't been parsed yet.  Add a bpfix pass (which is
automatically included at the end of androidmk) to select
android_library_import vs. java_import based on the extension
of the prebuilt file, and convert the srcs property to jars or aars
as appropriate.

Bug: 73724997
Test: androidmk_test.go
Change-Id: I1024742e9e96d5e1e88c3cc139eeb0d5a2f6849b
2018-02-22 14:54:47 -08:00
Colin Cross
3fad895e75 Don't pretend *parser.List is immutable
The functions in bpfix that take a *parser.List and return a
modified *parser.List are always returning the same pointer
and mutating the target of the pointer.  Remove the extra
unnecessary return value.

Also extract the getLiteralListProperty function.

Test: androidmk_test.go
Change-Id: I08d8aff955c72b7916741cda8083974a49af4d6f
2018-02-22 14:54:47 -08:00
Jeff Gaston
3a7822c571 Have bpfix not remove empty lists
Since in some cases they're not the default value.

Test: echo "cc_defaults{ system_shared_libs:[] }" | bpfix | grep system_shared_libs > /dev/null && echo ok
Bug: 66979076
Change-Id: I760b34f980281b955972819676bd62154a6c73f5
2017-10-05 18:17:53 -07:00
Jeff Gaston
aff66e55a9 Revert "Revert "Initial implementation of bpfix""
Bug: 38351765
Test: bpfix Android.bp

This reverts commit a8cc9c53fa.

Change-Id: I60f02a8dd920346aa17b9044f834ffe94fa693c6
2017-06-19 15:52:15 -07:00
Jeff Gaston
a8cc9c53fa Revert "Initial implementation of bpfix"
This reverts commit de4b0463f2.

Reason for revert: postsubmit build broken

Change-Id: If68a4af22e517b7be0876343a81c1319fa4d7046
2017-05-26 00:29:26 +00:00
Jeff Gaston
de4b0463f2 Initial implementation of bpfix
Bug: 38351765
Test: bpfix Android.bp

Change-Id: Ia94602f93bc40db3d006174c39102ac5fd29a64c
2017-05-24 13:06:35 -07:00