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

pantsbuild / pants / 25259185675

02 May 2026 06:47PM UTC coverage: 92.141% (-0.8%) from 92.955%
25259185675

push

github

web-flow
Fix the dynamic UI. (#23306)

In #23114 we upgraded to indicatif 0.18.4,
which included a fix to respect TERM, and 
display nothing if it's unset.

Since we did not pass TERM through pantsd, the
dynamic ui is now not shown. 

This change fixes that, and also pass NO_COLOR
through, since indicatif inspects it too.

88773 of 96345 relevant lines covered (92.14%)

3.83 hits per line

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

78.85
/src/python/pants/backend/codegen/protobuf/java/dependency_inference.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from __future__ import annotations
1✔
4

5
from dataclasses import dataclass
1✔
6

7
from pants.backend.codegen.protobuf.target_types import (
1✔
8
    ProtobufDependenciesField,
9
    ProtobufGrpcToggleField,
10
)
11
from pants.build_graph.address import Address
1✔
12
from pants.engine.rules import collect_rules, implicitly, rule
1✔
13
from pants.engine.target import FieldSet, InferDependenciesRequest, InferredDependencies
1✔
14
from pants.engine.unions import UnionRule
1✔
15
from pants.jvm.dependency_inference.artifact_mapper import (
1✔
16
    AllJvmArtifactTargets,
17
    UnversionedCoordinate,
18
    find_jvm_artifacts_or_raise,
19
)
20
from pants.jvm.dependency_inference.artifact_mapper import rules as artifact_mapper_rules
1✔
21
from pants.jvm.subsystems import JvmSubsystem
1✔
22
from pants.jvm.target_types import JvmResolveField
1✔
23

24
_PROTOBUF_JAVA_RUNTIME_GROUP = "com.google.protobuf"
1✔
25
_PROTOBUF_JAVA_RUNTIME_ARTIFACT = "protobuf-java"
1✔
26

27

28
@dataclass(frozen=True)
1✔
29
class ProtobufJavaRuntimeDependencyInferenceFieldSet(FieldSet):
1✔
30
    required_fields = (
1✔
31
        ProtobufDependenciesField,
32
        JvmResolveField,
33
        ProtobufGrpcToggleField,
34
    )
35

36
    dependencies: ProtobufDependenciesField
1✔
37
    resolve: JvmResolveField
1✔
38
    grpc: ProtobufGrpcToggleField
1✔
39

40

41
class InferProtobufJavaRuntimeDependencyRequest(InferDependenciesRequest):
1✔
42
    infer_from = ProtobufJavaRuntimeDependencyInferenceFieldSet
1✔
43

44

45
@dataclass(frozen=True)
1✔
46
class ProtobufJavaRuntimeForResolveRequest:
1✔
47
    resolve_name: str
1✔
48

49

50
@dataclass(frozen=True)
1✔
51
class ProtobufJavaRuntimeForResolve:
1✔
52
    addresses: frozenset[Address]
1✔
53

54

55
@rule
1✔
56
async def resolve_protobuf_java_runtime_for_resolve(
1✔
57
    request: ProtobufJavaRuntimeForResolveRequest,
58
    jvm_artifact_targets: AllJvmArtifactTargets,
59
    jvm: JvmSubsystem,
60
) -> ProtobufJavaRuntimeForResolve:
61
    addresses = find_jvm_artifacts_or_raise(
×
62
        required_coordinates=[
63
            UnversionedCoordinate(
64
                group=_PROTOBUF_JAVA_RUNTIME_GROUP,
65
                artifact=_PROTOBUF_JAVA_RUNTIME_ARTIFACT,
66
            )
67
        ],
68
        resolve=request.resolve_name,
69
        jvm_artifact_targets=jvm_artifact_targets,
70
        jvm=jvm,
71
        subsystem="the Protobuf Java runtime",
72
        target_type="protobuf_sources",
73
    )
74
    return ProtobufJavaRuntimeForResolve(addresses)
×
75

76

77
@dataclass(frozen=True)
1✔
78
class ProtobufJavaGrpcRuntimeForResolveRequest:
1✔
79
    resolve_name: str
1✔
80

81

82
@dataclass(frozen=True)
1✔
83
class ProtobufJavaGrpcRuntimeForResolve:
1✔
84
    addresses: frozenset[Address]
1✔
85

86

87
@rule
1✔
88
async def resolve_protobuf_java_grpc_runtime_for_resolve(
1✔
89
    request: ProtobufJavaGrpcRuntimeForResolveRequest,
90
    jvm_artifact_targets: AllJvmArtifactTargets,
91
    jvm: JvmSubsystem,
92
) -> ProtobufJavaGrpcRuntimeForResolve:
93
    addresses = find_jvm_artifacts_or_raise(
×
94
        required_coordinates=[
95
            # For non-Android uses:
96
            # TODO: Maybe support Android jars? See https://github.com/grpc/grpc-java#download for
97
            # the differences in required jars.
98
            UnversionedCoordinate(
99
                group="io.grpc",
100
                artifact="grpc-netty-shaded",
101
            ),
102
            UnversionedCoordinate(
103
                group="io.grpc",
104
                artifact="grpc-protobuf",
105
            ),
106
            UnversionedCoordinate(
107
                group="io.grpc",
108
                artifact="grpc-stub",
109
            ),
110
            # TODO: This is only required for JDK 9+ according to https://github.com/grpc/grpc-java#download.
111
            UnversionedCoordinate(
112
                group="org.apache.tomcat",
113
                artifact="annotations-api",
114
            ),
115
        ],
116
        resolve=request.resolve_name,
117
        jvm_artifact_targets=jvm_artifact_targets,
118
        jvm=jvm,
119
        subsystem="the Protobuf Java gRPC runtime",
120
        target_type="protobuf_sources",
121
    )
122
    return ProtobufJavaGrpcRuntimeForResolve(addresses)
×
123

124

125
@rule
1✔
126
async def infer_protobuf_java_runtime_dependency(
1✔
127
    request: InferProtobufJavaRuntimeDependencyRequest,
128
    jvm: JvmSubsystem,
129
) -> InferredDependencies:
130
    resolve = request.field_set.resolve.normalized_value(jvm)
×
131

132
    protobuf_java_runtime_target_info = await resolve_protobuf_java_runtime_for_resolve(
×
133
        ProtobufJavaRuntimeForResolveRequest(resolve), **implicitly()
134
    )
135
    addresses: set[Address] = set(protobuf_java_runtime_target_info.addresses)
×
136

137
    if request.field_set.grpc.value:
×
138
        grpc_runtime_info = await resolve_protobuf_java_grpc_runtime_for_resolve(
×
139
            ProtobufJavaGrpcRuntimeForResolveRequest(resolve), **implicitly()
140
        )
141
        addresses.update(grpc_runtime_info.addresses)
×
142

143
    return InferredDependencies(frozenset(addresses))
×
144

145

146
def rules():
1✔
147
    return (
1✔
148
        *collect_rules(),
149
        *artifact_mapper_rules(),
150
        UnionRule(InferDependenciesRequest, InferProtobufJavaRuntimeDependencyRequest),
151
    )
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

© 2026 Coveralls, Inc