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

pantsbuild / pants / 25443604553

06 May 2026 03:05PM UTC coverage: 92.879% (-0.04%) from 92.915%
25443604553

push

github

web-flow
[pants_ng] Scaffolding for a pants_ng mode. (#23319)

In this mode the command line is parsed as an
NG invocation, and dispatched appropriately.

Of course at the moment there are no
implementations to dispatch to. That will follow.

This does expose a new option, `pants_ng` to users. 
There is a big warning not to set it, but we're not trying
to hide that we're working on a new thing, so I am
comfortable with this.

25 of 76 new or added lines in 9 files covered. (32.89%)

1294 existing lines in 76 files now uncovered.

92234 of 99306 relevant lines covered (92.88%)

4.05 hits per line

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

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

UNCOV
5
from dataclasses import dataclass
1✔
6

UNCOV
7
from pants.backend.codegen.protobuf.scala.subsystem import ScalaPBSubsystem
1✔
UNCOV
8
from pants.backend.codegen.protobuf.target_types import ProtobufDependenciesField
1✔
UNCOV
9
from pants.backend.scala.subsystems.scala import ScalaSubsystem
1✔
UNCOV
10
from pants.build_graph.address import Address
1✔
UNCOV
11
from pants.engine.rules import collect_rules, implicitly, rule
1✔
UNCOV
12
from pants.engine.target import FieldSet, InferDependenciesRequest, InferredDependencies
1✔
UNCOV
13
from pants.engine.unions import UnionRule
1✔
UNCOV
14
from pants.jvm.dependency_inference.artifact_mapper import (
1✔
15
    AllJvmArtifactTargets,
16
    find_jvm_artifacts_or_raise,
17
)
UNCOV
18
from pants.jvm.resolve.coordinate import Coordinate
1✔
UNCOV
19
from pants.jvm.subsystems import JvmSubsystem
1✔
UNCOV
20
from pants.jvm.target_types import JvmResolveField
1✔
21

UNCOV
22
_SCALAPB_RUNTIME_GROUP = "com.thesamet.scalapb"
1✔
UNCOV
23
_SCALAPB_RUNTIME_ARTIFACT = "scalapb-runtime"
1✔
24

25

UNCOV
26
@dataclass(frozen=True)
1✔
UNCOV
27
class ScalaPBRuntimeDependencyInferenceFieldSet(FieldSet):
1✔
UNCOV
28
    required_fields = (ProtobufDependenciesField, JvmResolveField)
1✔
29

UNCOV
30
    dependencies: ProtobufDependenciesField
1✔
UNCOV
31
    resolve: JvmResolveField
1✔
32

33

UNCOV
34
class InferScalaPBRuntimeDependencyRequest(InferDependenciesRequest):
1✔
UNCOV
35
    infer_from = ScalaPBRuntimeDependencyInferenceFieldSet
1✔
36

37

UNCOV
38
@dataclass(frozen=True)
1✔
UNCOV
39
class ScalaPBRuntimeForResolveRequest:
1✔
UNCOV
40
    resolve_name: str
1✔
41

42

UNCOV
43
@dataclass(frozen=True)
1✔
UNCOV
44
class ScalaPBRuntimeForResolve:
1✔
UNCOV
45
    addresses: frozenset[Address]
1✔
46

47

UNCOV
48
@rule
1✔
UNCOV
49
async def resolve_scalapb_runtime_for_resolve(
1✔
50
    request: ScalaPBRuntimeForResolveRequest,
51
    jvm_artifact_targets: AllJvmArtifactTargets,
52
    jvm: JvmSubsystem,
53
    scala_subsystem: ScalaSubsystem,
54
    scalapb: ScalaPBSubsystem,
55
) -> ScalaPBRuntimeForResolve:
UNCOV
56
    scala_version = scala_subsystem.version_for_resolve(request.resolve_name)
1✔
UNCOV
57
    scala_binary_version = scala_version.binary
1✔
UNCOV
58
    version = scalapb.version
1✔
59

UNCOV
60
    addresses = find_jvm_artifacts_or_raise(
1✔
61
        required_coordinates=[
62
            Coordinate(
63
                group=_SCALAPB_RUNTIME_GROUP,
64
                artifact=f"{_SCALAPB_RUNTIME_ARTIFACT}_{scala_binary_version}",
65
                version=version,
66
            )
67
        ],
68
        resolve=request.resolve_name,
69
        jvm_artifact_targets=jvm_artifact_targets,
70
        jvm=jvm,
71
        subsystem="the ScalaPB runtime",
72
        target_type="protobuf_sources",
73
        requirement_source="the `[scalapb].version` option",
74
    )
UNCOV
75
    return ScalaPBRuntimeForResolve(addresses)
1✔
76

77

UNCOV
78
@rule
1✔
UNCOV
79
async def infer_scalapb_runtime_dependency(
1✔
80
    request: InferScalaPBRuntimeDependencyRequest,
81
    jvm: JvmSubsystem,
82
) -> InferredDependencies:
UNCOV
83
    resolve = request.field_set.resolve.normalized_value(jvm)
1✔
84

UNCOV
85
    scalapb_runtime_target_info = await resolve_scalapb_runtime_for_resolve(
1✔
86
        ScalaPBRuntimeForResolveRequest(resolve), **implicitly()
87
    )
UNCOV
88
    return InferredDependencies(scalapb_runtime_target_info.addresses)
1✔
89

90

UNCOV
91
def rules():
1✔
UNCOV
92
    return (
1✔
93
        *collect_rules(),
94
        UnionRule(InferDependenciesRequest, InferScalaPBRuntimeDependencyRequest),
95
    )
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