diff options
Diffstat (limited to 'Android.bp')
-rw-r--r-- | Android.bp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 00000000..40c1c206 --- /dev/null +++ b/Android.bp @@ -0,0 +1,91 @@ +// +// Copyright (C) 2016 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Some Jacoco source files depend on classes that do not exist in Android. While these classes are +// not executed at runtime (because we use offline instrumentation), they will cause issues when +// compiling them with ART during dex pre-opting. Therefore, it would prevent from applying code +// coverage on classes in the bootclasspath (frameworks, services, ...) or system apps. +// Note: we still may need to update the source code to cut dependencies in mandatory jacoco classes. +jacoco_android_exclude_list = [ + "%org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java", + "%org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/PreMain.java", + "%org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/CoverageTransformer.java", + "%org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/JmxRegistration.java", +] + +// Build jacoco-agent from sources for the platform +// +// Note: this is only intended to be used for the platform development. This is *not* intended +// to be used in the SDK where apps can use the official jacoco release. +java_library_static { + name: "jacocoagent", + + srcs: [ + "org.jacoco.core/src/**/*.java", + "org.jacoco.agent/src/**/*.java", + "org.jacoco.agent.rt/src/**/*.java", + ], + + exclude_srcs: [ + "org.jacoco.core/src/org/jacoco/core/runtime/ModifiedSystemClassRuntime.java", + "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/PreMain.java", + "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/CoverageTransformer.java", + "org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/JmxRegistration.java", + ], + + // In order to include Jacoco in core libraries, we cannot depend on anything in the + // bootclasspath (or we would create dependency cycle). Therefore we compile against + // the SDK android.jar which gives the same APIs Jacoco depends on. + sdk_version: "9", + + static_libs: ["jacoco-asm"], +} + +// Build jacoco-cli from sources for the platform + +// TODO(jeffrygaston) it'd be nice to keep the build process and/or list of source files in sync with +// what is defined in the pom.xml files, although it's probably much more trouble than it's worth +java_library_host { + name: "jacoco-cli", + + manifest: "org.jacoco.cli/src/MANIFEST.MF", + + srcs: [ + "org.jacoco.core/src/**/*.java", + "org.jacoco.report/src/**/*.java", + "org.jacoco.cli/src/**/*.java", + ], + + java_resource_dirs: [ + "org.jacoco.core/src", + "org.jacoco.report/src", + ], + + static_libs: [ + "jacoco-asm", + "args4j-2.0.28", + ], +} + +// +// Build asm-5.0.1 as a static library +// +java_import { + name: "jacoco-asm", + host_supported: true, + + jars: ["asm-debug-all-5.0.1.jar"], +} |