• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 19015773527

02 Nov 2025 05:33PM UTC coverage: 17.872% (-62.4%) from 80.3%
19015773527

Pull #22816

github

web-flow
Merge a12d75757 into 6c024e162
Pull Request #22816: Update Pants internal Python to 3.14

4 of 5 new or added lines in 3 files covered. (80.0%)

28452 existing lines in 683 files now uncovered.

9831 of 55007 relevant lines covered (17.87%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/python/pants/backend/cc/subsystems/compiler.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

UNCOV
4
from __future__ import annotations
×
5

UNCOV
6
import logging
×
UNCOV
7
from collections.abc import Iterable
×
8

UNCOV
9
from pants.core.goals.resolves import ExportableTool
×
UNCOV
10
from pants.core.util_rules.external_tool import TemplatedExternalTool
×
UNCOV
11
from pants.engine.rules import Rule, collect_rules
×
UNCOV
12
from pants.engine.unions import UnionRule
×
UNCOV
13
from pants.option.option_types import StrListOption, StrOption
×
UNCOV
14
from pants.option.subsystem import Subsystem
×
UNCOV
15
from pants.util.strutil import softwrap
×
16

UNCOV
17
logger = logging.getLogger(__name__)
×
18

19

UNCOV
20
class CCOptions:
×
UNCOV
21
    include_directories = StrListOption(
×
22
        default=[],
23
        help=softwrap(
24
            """
25
            A list of include directories passed to the compiler. Will be prefixed by -I at the command line.
26
            These flags are merged with the target-level includes, with the target-level includes taking precedence.
27
            """
28
        ),
29
    )
30

UNCOV
31
    c_compiler_flags = StrListOption(
×
32
        default=["-std=c11"],
33
        help=softwrap(
34
            """
35
            Flags passed to the C compiler.
36
            These flags are merged with the target-level defines, with the target-level flags taking precedence.
37
            """
38
        ),
39
    )
40

UNCOV
41
    c_definitions = StrListOption(
×
42
        default=None,
43
        help=softwrap(
44
            """
45
            A list of strings to define in the C preprocessor. Will be prefixed by -D at the command line.
46
            These defines are merged with the target-level defines, with the target-level definitions taking precedence.
47
            """
48
        ),
49
    )
50

UNCOV
51
    cxx_compiler_flags = StrListOption(
×
52
        default=["-std=c++11"],
53
        help=softwrap(
54
            """
55
            Flags passed to the C++ compiler.
56
            These flags are merged with the target-level defines, with the target-level flags taking precedence.
57
            """
58
        ),
59
    )
60

UNCOV
61
    cxx_definitions = StrListOption(
×
62
        default=None,
63
        help=softwrap(
64
            """
65
            A list of strings to define in the C++ preprocessor. Will be prefixed by -D at the command line.
66
            These defines are merged with the target-level defines, with the target-level definitions taking precedence.
67
            """
68
        ),
69
    )
70

71

UNCOV
72
class CCSubsystem(Subsystem, CCOptions):
×
UNCOV
73
    options_scope = "cc"
×
UNCOV
74
    name = "cc"
×
UNCOV
75
    help = """Options for a system-discovered `cc` toolchain."""
×
76

UNCOV
77
    c_executable = StrListOption(
×
78
        default=["clang", "gcc"],
79
        help=softwrap(
80
            """
81
            A list of binary names for the C compiler (in the `search_paths`).
82
            The list is searched in order until a compiler is found.
83
            """
84
        ),
85
    )
86

UNCOV
87
    cxx_executable = StrListOption(
×
88
        default=["clang++", "g++"],
89
        help=softwrap(
90
            """
91
            A list of binary names for the C compiler (in the `search_paths`).
92
            The list is searched in order until a compiler is found.
93
            """
94
        ),
95
    )
96

UNCOV
97
    search_paths = StrListOption(
×
98
        default=["<PATH>"],
99
        help=softwrap(
100
            """
101
            A list of paths to search for CC toolchain binaries.
102

103
            Specify absolute paths to directories, e.g. `/usr/bin`.
104
            Earlier entries will be searched first.
105

106
            The following special strings are supported:
107

108
              * `<PATH>`, the contents of the PATH environment variable
109
            """
110
        ),
111
    )
112

113

UNCOV
114
class ExternalCCSubsystem(TemplatedExternalTool, CCOptions):
×
UNCOV
115
    options_scope = "cc-external"
×
UNCOV
116
    name = "cc-external"
×
UNCOV
117
    help = """Options for downloaded `cc` toolchain."""
×
118

UNCOV
119
    c_executable = StrOption(
×
120
        default="",
121
        help=softwrap(
122
            """
123
            The relative path to the C compiler binary from the downloaded source.
124
            E.g. For the ARM gcc-rm toolchain, this value would be: `gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gcc`
125
            """
126
        ),
127
    )
128

UNCOV
129
    cxx_executable = StrOption(
×
130
        default="",
131
        help=softwrap(
132
            """
133
            The relative path to the C++ compiler binary from the downloaded source.
134
            E.g. For the ARM gcc-rm toolchain, this value would be: `gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-g++`
135
            """
136
        ),
137
    )
138

139
    # TODO: Maybe put the ARM compiler in here?
UNCOV
140
    default_version = ""
×
UNCOV
141
    default_url_template = ""
×
UNCOV
142
    default_url_platform_mapping: dict[str, str] = {}
×
UNCOV
143
    default_known_versions: list[str] = []
×
144

145

UNCOV
146
def rules() -> Iterable[Rule | UnionRule]:
×
UNCOV
147
    return (
×
148
        *collect_rules(),
149
        *CCSubsystem.rules(),
150
        *ExternalCCSubsystem.rules(),
151
        UnionRule(ExportableTool, ExternalCCSubsystem),
152
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc