• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright (C) 2016 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17// Build jacoco-agent from sources for the platform
18//
19// Note: this is only intended to be used for the platform development. This is *not* intended
20// to be used in the SDK where apps can use the official jacoco release.
21java_library {
22    name: "jacocoagent",
23
24    srcs: [
25        "org.jacoco.core/src/**/*.java",
26        "org.jacoco.agent/src/**/*.java",
27        "org.jacoco.agent.rt/src/**/*.java",
28    ],
29
30    // Some Jacoco source files depend on classes that do not exist in Android.
31    // While these classes are not executed at runtime (because we use offline
32    // instrumentation), they will cause issues when compiling them with ART
33    // during dex pre-opting. Therefore, it would prevent from applying code
34    // coverage on classes in the bootclasspath (frameworks, services, ...) or
35    // system apps.
36    // Note: we still may need to update the source code to cut dependencies in
37    // mandatory jacoco classes.
38    exclude_srcs: [
39        "org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java",
40        "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/PreMain.java",
41        "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/CoverageTransformer.java",
42        "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/JmxRegistration.java",
43    ],
44
45    // In order to include Jacoco in core libraries, we cannot depend on
46    // anything in the bootclasspath (or we would create dependency cycle).
47    // Therefore we compile against the SDK android.jar which gives the same
48    // APIs Jacoco depends on.
49    sdk_version: "9",
50
51    // TODO(b/69671801): there's no bytecode on the device, so these shouldn't
52    // be necessary.
53    static_libs: [
54        "asm-6.0",
55        "asm-commons-6.0",
56        "asm-tree-6.0",
57    ],
58}
59
60// Build jacoco-cli from sources for the platform
61
62// TODO(jeffrygaston) it'd be nice to keep the build process and/or list of source files in sync with
63// what is defined in the pom.xml files, although it's probably much more trouble than it's worth
64java_library_host {
65    name: "jacoco-cli",
66
67    manifest: "org.jacoco.cli/src/MANIFEST.MF",
68
69    srcs: [
70        "org.jacoco.core/src/**/*.java",
71        "org.jacoco.report/src/**/*.java",
72        "org.jacoco.cli/src/**/*.java",
73    ],
74
75    java_resource_dirs: [
76        "org.jacoco.core/src",
77        "org.jacoco.report/src",
78    ],
79
80    static_libs: [
81        "asm-6.0",
82        "asm-commons-6.0",
83        "asm-tree-6.0",
84        "args4j-2.0.28",
85    ],
86}
87