Colin Cross | 919bf5c | 2017-10-06 13:29:25 -0700 | [diff] [blame^] | 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 | // Some Jacoco source files depend on classes that do not exist in Android. While these classes are |
| 18 | // not executed at runtime (because we use offline instrumentation), they will cause issues when |
| 19 | // compiling them with ART during dex pre-opting. Therefore, it would prevent from applying code |
| 20 | // coverage on classes in the bootclasspath (frameworks, services, ...) or system apps. |
| 21 | // Note: we still may need to update the source code to cut dependencies in mandatory jacoco classes. |
| 22 | jacoco_android_exclude_list = [ |
| 23 | "%org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java", |
| 24 | "%org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/PreMain.java", |
| 25 | "%org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/CoverageTransformer.java", |
| 26 | "%org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/JmxRegistration.java", |
| 27 | ] |
| 28 | |
| 29 | // Build jacoco-agent from sources for the platform |
| 30 | // |
| 31 | // Note: this is only intended to be used for the platform development. This is *not* intended |
| 32 | // to be used in the SDK where apps can use the official jacoco release. |
| 33 | java_library_static { |
| 34 | name: "jacocoagent", |
| 35 | |
| 36 | srcs: [ |
| 37 | "org.jacoco.core/src/**/*.java", |
| 38 | "org.jacoco.agent/src/**/*.java", |
| 39 | "org.jacoco.agent.rt/src/**/*.java", |
| 40 | ], |
| 41 | |
| 42 | exclude_srcs: [ |
| 43 | "org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java", |
| 44 | "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/PreMain.java", |
| 45 | "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/CoverageTransformer.java", |
| 46 | "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/JmxRegistration.java", |
| 47 | ], |
| 48 | |
| 49 | // In order to include Jacoco in core libraries, we cannot depend on anything in the |
| 50 | // bootclasspath (or we would create dependency cycle). Therefore we compile against |
| 51 | // the SDK android.jar which gives the same APIs Jacoco depends on. |
| 52 | sdk_version: "9", |
| 53 | |
| 54 | static_libs: ["jacoco-asm"], |
| 55 | } |
| 56 | |
| 57 | // Build jacoco-cli from sources for the platform |
| 58 | |
| 59 | // TODO(jeffrygaston) it'd be nice to keep the build process and/or list of source files in sync with |
| 60 | // what is defined in the pom.xml files, although it's probably much more trouble than it's worth |
| 61 | java_library_host { |
| 62 | name: "jacoco-cli", |
| 63 | |
| 64 | manifest: "org.jacoco.cli/src/MANIFEST.MF", |
| 65 | |
| 66 | srcs: [ |
| 67 | "org.jacoco.core/src/**/*.java", |
| 68 | "org.jacoco.report/src/**/*.java", |
| 69 | "org.jacoco.cli/src/**/*.java", |
| 70 | ], |
| 71 | |
| 72 | java_resource_dirs: [ |
| 73 | "org.jacoco.core/src", |
| 74 | "org.jacoco.report/src", |
| 75 | ], |
| 76 | |
| 77 | static_libs: [ |
| 78 | "jacoco-asm", |
| 79 | "args4j-2.0.28", |
| 80 | ], |
| 81 | } |
| 82 | |
| 83 | // |
| 84 | // Build asm-5.0.1 as a static library |
| 85 | // |
| 86 | java_import { |
| 87 | name: "jacoco-asm", |
| 88 | host_supported: true, |
| 89 | |
| 90 | jars: ["asm-debug-all-5.0.1.jar"], |
| 91 | } |