Commit graph

25 commits

Author SHA1 Message Date
Colin Cross
454c087be6 Add CopyOf utility method
Add a utility method that returns a copy of a slice of strings.
This is primarily useful when appending to a string slice to avoid
accidentally reusing the backing array.

Test: util_test.go
Change-Id: I7801fc7ca19e27ddc9f1b1b452788b723c7f619c
2019-02-19 11:19:09 -08:00
Colin Cross
800fe13146 Move dexpreopting of boot jars into Soong
Implement the dexpreopting of boot jars in singleton rules in
Soong.

Test: m checkbuild
Change-Id: Ic02ce941fa5e238b839b3eb4c06a3e10c62d98ff
2019-02-15 16:16:25 -08:00
Colin Cross
25397f52ff Fix dependencies in strip.sh
strip.sh was including the dependencies of dexpreoptRule instead
of stripRule, resulting in incorrect rebuilds.

Bug: 124529711
Test: m && m
Change-Id: I4b40f7c040442a03918c16a46ecf777f5cc30130
2019-02-15 16:16:25 -08:00
Colin Cross
deabb94380 Add RuleBuilder.Installs().String()
Add a RuleBuilderInstalls type for a slice of RuleBuilderInstalls,
and give it a String() method that returns the list of installs
in the format that is convenient for passing to Make.

Test: rule_builder_test.go
Change-Id: I2e9cd9abf4dfb0ad312d0a6662f1567baf9cd222
2019-02-13 08:03:29 -08:00
Nicolas Geoffray
fa6e9ec003 Revert "Revert "Never strip and store dex files uncompressed when they are preopted on system.""
This reverts commit 67e8ec1973.

Test: build && atest android.text.cts.EmojiTest#testEmojiGlyphWebView on Cuttlefish
Exempt-From-Owner-Approval: Got +2 from Colin, latest PS is a rebase across conflicts.

Change-Id: I99faf0f2ec698d70c107516bd43756b9ddcb90d0
2019-02-13 11:59:20 +00:00
Colin Cross
74ba962d29 Use ArchType in dexpreopt config
Make ArchType implement the encoding.TextMarshaller and
encoding.TextUnmarshaller interfaces so that it can be used
as a value in the dexpreopt config structs that are passed
through JSON files.

Test: m checkbuild
Change-Id: Ie4c12443e7ee5fe43f42d5403bcde12d62f617e2
2019-02-12 17:05:47 -08:00
Colin Cross
c7e40aa578 Move dexpreopt image selection out of dexpreopt package
Instead of passing both the module and global dexpreopt image
selection into the dexpreopt package, determine the correct
dexpreopt image in the java package.

Also stop using the boot image "location" as an input, only
track the real path, and then convert it to the "location"
that dex2oat expects when constructing the command line.

Test: m checkbuild
Change-Id: I2be2b5917e09fd57428dab27849c0153fdc75722
2019-02-11 15:29:51 -08:00
Colin Cross
09a65ab6ca Remove unused dexpreopt UseEmbeddedDex
dexpreopt doesn't need to know about UseEmbeddedDex, it has
already been taken into account for UncompressedDex.

Test: m checkbuild
Change-Id: I5508aa43bb8bdb06e20cf93bc5171a5e78833983
2019-02-08 02:27:59 +00:00
Colin Cross
758290d7ff Improve RuleBuilder documentation and methods
Add a few convenience methods, document all the methods and add
examples that would show up in the godoc if we were to actually
generate it.

Test: rule_builder_test.go
Change-Id: I270fed605ffec34e6f5b36fde0dc9ca52694b741
2019-02-05 13:28:43 -08:00
Colin Cross
feec25b084 Move dexpreopt.Script to android.RuleBuilder
Move dexpreopt.Script to android.RuleBuilder so that the builder
style can be used in more places.  Also add tests for it.

Test: rule_builder_test.go
Change-Id: I92a963bd112bf033b08899e930094b908acfcdfd
2019-02-05 13:28:43 -08:00
Victor Hsieh
d181c8ba76 Rename preferCodeIntegrity to useEmbeddedDex
Test: build and run testing app
Bug: 112037137
Change-Id: Ia82c2c3ba7eb32117a4be078ac31ee2ba510f9eb
2019-01-29 13:09:10 -08:00
Vladimir Marko
e8b00d69c0 Preopt: Do not strip non-image boot class path jars.
Test: Pixel 2 XL boots.
Bug: 119868597
Change-Id: I7bd3b7655aecf1a8c26dd8d4d18d3eec685ece88
2019-01-11 10:26:17 +00:00
Colin Cross
8c6d250c0b Allow modules to disable stripping when dexpreopting
Add a no_stripping property and pass it to dexpreopt to disable
stripping for a module.

Bug: 122610462
Test: dexpreopt_test.go
Change-Id: I5a4b005633bb8b1ea373e9eeb420aa0999de17ab
2019-01-10 05:39:50 +00:00
Colin Cross
cbed657b74 Don't strip when dexpreopt is disabled
If dexpreopt is disabled for a module then classes.dex must not be
stripped.

Bug: 121377197
Test: m WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true
Change-Id: Icfa48804cf02291874ac6623c9b9297821ac8ce6
2019-01-09 19:47:47 +00:00
Vladimir Marko
d2ee532fc3 Preopt: Pass -Xbootclasspath: arg to dex2oat.
Test: Pixel 2 XL boots.
Bug: 119868597
Change-Id: Ibbff11d13a6d67034e783de2f7d8c930251bd899
2019-01-09 09:39:20 +00:00
Treehugger Robot
e2e13a5d99 Merge "Save invocation info of dex2oat runs." 2019-01-07 21:38:16 +00:00
Victor Hsieh
a2c16c1aa0 manifest_fixer: rename to --prefer-code-integrity
During code review, the name change was suggested.

Test: local CTS passed
Bug: 112037137
Change-Id: I7eb25210afb45c7477b0d606574048a15c9c721d
2019-01-03 09:51:11 -08:00
Alex Light
5de4196079 Save invocation info of dex2oat runs.
It is useful to have the exact dex2oat invocation used to generate
artifacts for some tests. This adds the --write-invocation-to= flag to
the build to save this information.

Test: m droid
Bug: 119332327
Change-Id: Id7664cf6d05bbb1c580f94584cdeb96084d5799c
2019-01-02 10:59:08 -08:00
Colin Cross
ed91ae94e2 Create dexpreopt install dir
If dexpreopt is disabled inside dexpreopt_gen there won't be any installed files and the install directory won't be created, causing soong_zip to fail.  Create the directory ahead of time.

Test: treehugger
Change-Id: Icf17d0bcd617eeeafdcd50ab56359fa8d6612822
2018-12-19 18:55:26 +00:00
Nicolas Geoffray
5be3d6b3f5 Merge "Fix build time preopt with shared library uses." 2018-12-19 08:37:01 +00:00
Nicolas Geoffray
64d7f87c56 Add an owners file for dexpreopt files.
Test: N/A
Change-Id: I3d14a3cb6f0f5f8f5c0a7266285d4b8917922240
2018-12-18 20:28:06 +00:00
Nicolas Geoffray
05aa7d2d13 Fix build time preopt with shared library uses.
- Handle hidl libraries.
- Handle new shared library encoding.

Test: no mismatch preopt during boot.
bug: 117845483
bug: 111174995
Change-Id: If93dee4a208f365a9ccbbb1f73899d245282bd5b
2018-12-18 17:26:49 +00:00
Colin Cross
43f08db29e Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules.  The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.

This relands Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb and
I462182638bd57b1367b5bfb0718e975c11ae66f7, along with multiple fixes
to depsfile generation in dexpreopt_gen that caused .odex files for
modules in defined make to be missing dependencies on boot.art, and
a fix to not dexpreopt and strip tests.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Test: OUT_DIR=$PWD/out m
Test: NINJA_ARGS="-t deps out/target/product/sailfish/obj/APPS/Contacts_intermediates/dexpreopt.zip" m
Change-Id: I6bb2c971cee65d2338839753aa0d84939f335b1b
2018-12-15 19:07:54 -08:00
Colin Cross
4ff85ebeb7 Revert "Dexpreopt soong modules inside soong"
This reverts commit 29ff88741e.

Test: none
Bug: 119412419
2018-12-14 11:49:58 -08:00
Colin Cross
29ff88741e Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules.  The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
2018-12-13 15:53:54 +00:00