• 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/jvm/bsp/resources.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 pants.base.build_root import BuildRoot
×
UNCOV
5
from pants.bsp.spec.base import BuildTargetIdentifier
×
UNCOV
6
from pants.bsp.util_rules.targets import BSPResourcesRequest, BSPResourcesResult
×
UNCOV
7
from pants.core.target_types import ResourceSourceField
×
UNCOV
8
from pants.core.util_rules import stripped_source_files
×
UNCOV
9
from pants.core.util_rules.source_files import SourceFilesRequest
×
UNCOV
10
from pants.core.util_rules.stripped_source_files import strip_source_roots
×
UNCOV
11
from pants.engine.addresses import Addresses
×
UNCOV
12
from pants.engine.fs import AddPrefix
×
UNCOV
13
from pants.engine.internals.graph import resolve_coarsened_targets
×
UNCOV
14
from pants.engine.intrinsics import add_prefix
×
UNCOV
15
from pants.engine.rules import collect_rules, implicitly
×
UNCOV
16
from pants.engine.target import SourcesField
×
UNCOV
17
from pants.util.strutil import path_safe
×
18

19

UNCOV
20
def _jvm_resources_directory(target_id: BuildTargetIdentifier) -> str:
×
21
    # TODO: Currently, we have a single BuildTarget per group, and so we include the transitive
22
    # resource dependencies in one owning directory. As part of #15051 we'll likely need to find
23
    # "owning" BuildTargets for each resources target in order to avoid having all of them
24
    # emit the transitive resources.
25
    return f"jvm/resources/{path_safe(target_id.uri)}"
×
26

27

UNCOV
28
async def _jvm_bsp_resources(
×
29
    request: BSPResourcesRequest,
30
    build_root: BuildRoot,
31
) -> BSPResourcesResult:
32
    """Generically handles a BSPResourcesRequest (subclass).
33

34
    This is a rule helper rather than a `@rule` for the same reason as `_jvm_bsp_compile`.
35
    """
36
    coarsened_tgts = await resolve_coarsened_targets(
×
37
        **implicitly(Addresses([fs.address for fs in request.field_sets]))
38
    )
39

40
    source_files = await strip_source_roots(
×
41
        **implicitly(
42
            SourceFilesRequest(
43
                [tgt.get(SourcesField) for tgt in coarsened_tgts.closure()],
44
                for_sources_types=(ResourceSourceField,),
45
                enable_codegen=True,
46
            )
47
        )
48
    )
49

50
    rel_resources_dir = _jvm_resources_directory(request.bsp_target.bsp_target_id)
×
51
    output_digest = await add_prefix(
×
52
        AddPrefix(source_files.snapshot.digest, rel_resources_dir),
53
    )
54

55
    return BSPResourcesResult(
×
56
        resources=(
57
            # NB: IntelliJ requires that directory URIs end in slashes.
58
            build_root.pathlib_path.joinpath(".pants.d/bsp", rel_resources_dir).as_uri() + "/",
59
        ),
60
        output_digest=output_digest,
61
    )
62

63

UNCOV
64
def rules():
×
UNCOV
65
    return [
×
66
        *collect_rules(),
67
        *stripped_source_files.rules(),
68
    ]
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