1# Copyright 2017 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build/toolchain/toolchain.gni") 6 7# There are two ways to enable code coverage instrumentation: 8# 1. When |use_clang_coverage| or |use_jacoco_coverage| is true and 9# |coverage_instrumentation_input_file| is empty, all source files or 10# Java class files are instrumented. 11# 2. When |use_clang_coverage| or |use_jacoco_coverage| is true and 12# |coverage_instrumentation_input_file| is NOT empty and points to 13# a text file on the file system, ONLY source files specified in the 14# input file or Java class files related to source files are instrumented. 15declare_args() { 16 # Enable Clang's Source-based Code Coverage. 17 use_clang_coverage = false 18 19 # Enables JaCoCo Java code coverage. 20 use_jacoco_coverage = false 21 22 # The path to the coverage instrumentation input file should be a source root 23 # absolute path (e.g. //out/Release/coverage_instrumentation_input.txt), and 24 # the file consists of multiple lines where each line represents a path to a 25 # source file, and the paths must be relative to the root build directory. 26 # e.g. ../../base/task/post_task.cc for build directory 'out/Release'. 27 # 28 # NOTE that this arg will be non-op if use_clang_coverage is false. 29 coverage_instrumentation_input_file = "" 30} 31 32assert(!use_clang_coverage || is_clang, 33 "Clang Source-based Code Coverage requires clang.") 34