Commit graph

15 commits

Author SHA1 Message Date
Sam Delmerico
1e3f78f866 add jacocoagent by default to Java modules
On coverage builds, R8 will fail to properly optimize and fail the build
if ignore_warnings: false, because jacoco injects dependencies on
jacocoagent classes, but the jacocoagent library is not part of the
classpath libraries passed in to R8 in its arguments.

Instead we can add jacocoagent as a libs dependency for these modules so
that it will get pulled into the r8 flags.

Bug: 243903417
Test: m
Change-Id: Icc24cc260b896fc800125a0318308d823ccf7a83
2022-09-09 16:50:38 -04:00
Maxim Pleshivenkov
9d773841c9 Added quotes to protect wildcard
When generating zip archive with zip2zip wildcard mask is specified.
Bash attempts to resolve wildcard **/*.class. If android build
top directory containts subfolder(s) with .class, bash wildcard
resolution  succeeds. Bash passes list of files to zip2zip instead
of actual wildcard. Created archive doesn't contain required files.

Adding quotes to wildcard to prvent that.

Bug: NA
Test: manual - build with coverage enabled
Change-Id: Iebdaa32693fe820f0f79588d61cb89660ea2b611
2021-06-30 14:29:49 -04:00
Chris Gross
2f748692dd Use a default exclude filter for JaCoCo in Soong.
Instrumented builds should exclude certain classes from instrumenation
by default. (e.g. JaCoCo itself) Leverage the existing
DefaultJacocoExclusionFilter to do this.

Note: Two different default filters exist now (one for Make and one for
Soong), as they have different wildcard rules.

Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true m -j32
TeleService and inspected the resulting temporary jar that was
instrumented to confirm that anything from org/jacoco was excluded.
Bug: 159748844

Change-Id: I5466b0a03957edfbe53971d5d1a7729fdb8337db
2020-06-25 16:45:44 +00:00
Sasha Smundak
26c6d9e9fb Tune JVM, print full diagnostics on crash.
JVM occasionally (0.5% time) crashes on entering a method with SIGSEGV.
It might be due to excessive load on the host machine. Reduce the number
of the compiler threads to 6, and do not start all the GC threads
immediately. If JVM crashes, copy full diagnostics to stderr.

Bug: 132766811
Test: treehugger
Change-Id: Ib7bfd568f6d32456bf623cbb615ffc990c326a34
2019-06-11 13:30:13 -07:00
Jimmy Chen
e88eaa7db7 Revert "Revert "Revert "Print full diagnostics file when Java process crashes."""
This reverts commit b4be092855.

Reason for revert: break build

Change-Id: I11fc5eb5f635a5d99eba962f5817851629e50ab2
2019-06-05 06:47:11 +00:00
Alexander Smundak
b4be092855 Revert "Revert "Print full diagnostics file when Java process crashes.""
This reverts commit d71dc6b5e0.

Reason for revert: ag/974065 fixes the problem that caused the revert

Change-Id: I3ba9eecdab34602aaf19fa518520ac932c9b97af
2019-06-03 16:53:22 +00:00
Alexander Smundak
d71dc6b5e0 Revert "Print full diagnostics file when Java process crashes."
This reverts commit 9d6df2246c.

Reason for revert: This change set the value of JAVA make variable to a string containing "foo bar". When soong_ui is asked to evaluate such string, it drops the quotes, causing bash to treat 'foo' and 'bar' as separate command line arguments.

Change-Id: If4e3c4c950c305bb67a572de3d86119c2da81dc1
2019-05-31 03:15:55 +00:00
Sasha Smundak
9d6df2246c Print full diagnostics file when Java process crashes.
Bug: 132766811
Test: treehugger
Change-Id: I8cca2486f2194a8643007a53e4a695d2a18abbf8
2019-05-29 17:46:22 -07:00
Colin Cross
0b9f31fb08 Replace *Escape with *EscapeList
Follow the change to blueprint to make *Escape take and return a string
and add *EscapeList that take and return slices of strings.  Fix up
a few places that were unnecessarily converting a string to a slice
and back to a string.

Test: m nothing
Change-Id: I3fa87de175522205f36544ef76aa2f04aef1b936
2019-03-04 18:11:53 +00:00
Nan Zhang
ffe2c1c369 Change syntax for jacoco filter wildcard params.
originally:
.* -> /**/*.class
now:
.* -> /*.class
.** -> /**/*.class

Also add NinjaAndShellEscape to allow filtering inner classes with $ in
the name.

Test: unittests.
Bug: b/71889972
Merged-In: Ifb8d7daa22bee02346885171edb15180af18f0de
Change-Id: Ifb8d7daa22bee02346885171edb15180af18f0de
(cherry picked from commit c61066684d5c8ddf600af602852c32fce6e6c6f4)
2018-01-29 12:46:26 -08:00
Colin Cross
84c3882e64 Fix jacoco_cli invocation
jacoco_cli --dest takes a directory, not a jar name, and assumes
an output file with the same name as the input jar in that
directory.  Rename jacoco-report-classes.jar to
jacoco-report-classes/modulename.jar, and generate to
jacoco/tmp/modulename.jar before combining to the final output file
at jacoco/modulename.jar.

Bug: 69669951
Test: m EMMA_INSTRUMENT=true
Change-Id: Ia7dd881d2819ae09dfb60a00b4c1b8396629cd9a
2018-01-03 16:02:47 -08:00
Colin Cross
6abc973a9c Update jacoco command line flags for latest version
jacoco_cli wants --quiet and --dest instead of -quiet and -dest.

Bug: 69669951
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false tests
Change-Id: I72b3d0a21c5fa02a58914953d3d794065f59bd18
2017-12-21 14:29:56 -08:00
Colin Cross
d7deceb8fa Fix jacoco filters
Add space after -x argument for jacoco excludes.
Add .class to end of file name for jacoco includes.

Bug: 64836607
Test: jacoco_test.go
Change-Id: I4c1024755882c976f7326f7382c4f2e99a20233d
2017-12-21 04:34:46 +00:00
Colin Cross
7a3139e05d Add jacoco filter tests
Add tests for converting jacoco filters to command line arguments
to soong_zip.

Bug: 64836607
Test: jacoco_test.go
Change-Id: I969fa877e4be19bb92dcab5a796a4e4ec3fc166a
2017-12-21 04:34:26 +00:00
Colin Cross
cb9335932f Add Jacoco support
Add support for instrumenting jars with jacoco.  Unlike in Make,
Jacoco in Soong is done entirely using jars.

Instrumentation is enabled by EMMA_INSTRUMENT=true, and affects
all apps.  If EMMA_INSTRUMENT_FRAMEWORK=true then it also affects
any java libraries listed in InstrumentFrameworkModules.

Bug: 69629238
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false
Change-Id: If699715b277529cd7322ffca67c23b0746e1cccd
2017-11-22 16:08:53 -08:00