1# Copyright 2017 The Chromium Authors 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") 6if (is_fuchsia) { 7 import("//third_party/fuchsia-gn-sdk/src/component.gni") 8} 9 10# There are two ways to enable code coverage instrumentation: 11# 1. When |use_clang_coverage| or |use_jacoco_coverage| is true and 12# |coverage_instrumentation_input_file| is empty, all source files or 13# Java class files are instrumented. 14# 2. When |use_clang_coverage| or |use_jacoco_coverage| is true and 15# |coverage_instrumentation_input_file| is NOT empty and points to 16# a text file on the file system, ONLY source files specified in the 17# input file or Java class files related to source files are instrumented. 18declare_args() { 19 # Enable Clang's Source-based Code Coverage. 20 if (is_fuchsia) { 21 use_clang_coverage = fuchsia_code_coverage 22 } else { 23 use_clang_coverage = false 24 } 25 26 # Enables JaCoCo Java code coverage. 27 use_jacoco_coverage = false 28 29 # The path to the coverage instrumentation input file should be a source root 30 # absolute path (e.g. //out/Release/coverage_instrumentation_input.txt), and 31 # the file consists of multiple lines where each line represents a path to a 32 # source file, and the paths must be relative to the root build directory. 33 # e.g. ../../base/task/post_task.cc for build directory 'out/Release'. 34 # 35 # NOTE that this arg will be non-op if use_clang_coverage is false. 36 coverage_instrumentation_input_file = "" 37 38 # Enables TypeScript/JavaScript code coverage. 39 use_javascript_coverage = false 40} 41 42assert(!use_clang_coverage || is_clang, 43 "Clang Source-based Code Coverage requires clang.") 44