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

pantsbuild / pants / 18252174847

05 Oct 2025 01:36AM UTC coverage: 43.382% (-36.9%) from 80.261%
18252174847

push

github

web-flow
run tests on mac arm (#22717)

Just doing the minimal to pull forward the x86_64 pattern.

ref #20993

25776 of 59416 relevant lines covered (43.38%)

1.3 hits per line

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

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

4
from collections import defaultdict
×
5
from collections.abc import Mapping
×
6

7
from pants.backend.kotlin.dependency_inference.kotlin_parser import (
×
8
    resolve_fallible_result_to_analysis,
9
)
10
from pants.backend.kotlin.target_types import KotlinSourceField
×
11
from pants.core.util_rules.source_files import SourceFilesRequest
×
12
from pants.engine.internals.selectors import concurrently
×
13
from pants.engine.rules import collect_rules, implicitly, rule
×
14
from pants.engine.target import AllTargets, Targets
×
15
from pants.engine.unions import UnionRule
×
16
from pants.jvm.dependency_inference.artifact_mapper import MutableTrieNode
×
17
from pants.jvm.dependency_inference.symbol_mapper import FirstPartyMappingRequest, SymbolMap
×
18
from pants.jvm.subsystems import JvmSubsystem
×
19
from pants.jvm.target_types import JvmResolveField
×
20
from pants.util.logging import LogLevel
×
21

22

23
# TODO: add third-party targets here? That would allow us to avoid iterating over AllTargets twice.
24
#  See `backend/python/dependency_inference/module_mapper.py` for an example.
25
class AllKotlinTargets(Targets):
×
26
    pass
×
27

28

29
class FirstPartyKotlinTargetsMappingRequest(FirstPartyMappingRequest):
×
30
    pass
×
31

32

33
@rule(desc="Find all Kotlin targets in project", level=LogLevel.DEBUG)
×
34
async def find_all_kotlin_targets(targets: AllTargets) -> AllKotlinTargets:
×
35
    return AllKotlinTargets(tgt for tgt in targets if tgt.has_field(KotlinSourceField))
×
36

37

38
@rule(desc="Map all first party Kotlin targets to their symbols", level=LogLevel.DEBUG)
×
39
async def map_first_party_kotlin_targets_to_symbols(
×
40
    _: FirstPartyKotlinTargetsMappingRequest,
41
    kotlin_targets: AllKotlinTargets,
42
    jvm: JvmSubsystem,
43
) -> SymbolMap:
44
    source_analysis = await concurrently(
×
45
        resolve_fallible_result_to_analysis(
46
            **implicitly(SourceFilesRequest([target[KotlinSourceField]]))
47
        )
48
        for target in kotlin_targets
49
    )
50
    address_and_analysis = zip(
×
51
        [(tgt.address, tgt[JvmResolveField].normalized_value(jvm)) for tgt in kotlin_targets],
52
        source_analysis,
53
    )
54

55
    mapping: Mapping[str, MutableTrieNode] = defaultdict(MutableTrieNode)
×
56
    for (address, resolve), analysis in address_and_analysis:
×
57
        for symbol in analysis.named_declarations:
×
58
            mapping[resolve].insert(symbol, [address], first_party=True)
×
59

60
    return SymbolMap((resolve, node.frozen()) for resolve, node in mapping.items())
×
61

62

63
def rules():
×
64
    return (
×
65
        *collect_rules(),
66
        UnionRule(FirstPartyMappingRequest, FirstPartyKotlinTargetsMappingRequest),
67
    )
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