forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[internal] java: add debug goal to dump first-party dep map (pantsbui…
…ld#13314) Add `java-dump-first-party-dep-map` goal to dump the `FirstPartyJavaPackageMapping` type used in dependency inference mapping for Java. This is gated behind the `pants.backend.experimental.java.debug_goals` backend package so ordinary users won't see it.
- Loading branch information
Tom Dyas
authored
Oct 22, 2021
1 parent
f04f167
commit c83d604
Showing
9 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
python_sources() |
Empty file.
7 changes: 7 additions & 0 deletions
7
src/python/pants/backend/experimental/java/debug_goals/register.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
from pants.backend.java.goals import debug_goals | ||
|
||
|
||
def rules(): | ||
return [*debug_goals.rules()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
python_sources() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
import json | ||
|
||
from pants.backend.experimental.java.register import rules as java_rules | ||
from pants.backend.java.dependency_inference.package_mapper import FirstPartyJavaPackageMapping | ||
from pants.engine.console import Console | ||
from pants.engine.goal import Goal, GoalSubsystem | ||
from pants.engine.rules import collect_rules, goal_rule | ||
|
||
|
||
class DumpFirstPartyDepMapSubsystem(GoalSubsystem): | ||
name = "java-dump-first-party-dep-map" | ||
help = "Dump dependency inference data for Java dep inference." | ||
|
||
|
||
class DumpFirstPartyDepMap(Goal): | ||
subsystem_cls = DumpFirstPartyDepMapSubsystem | ||
|
||
|
||
@goal_rule | ||
async def dump_dep_inference_data( | ||
console: Console, first_party_dep_map: FirstPartyJavaPackageMapping | ||
) -> DumpFirstPartyDepMap: | ||
console.write_stdout( | ||
json.dumps(first_party_dep_map.package_rooted_dependency_map.to_json_dict()) | ||
) | ||
return DumpFirstPartyDepMap(exit_code=0) | ||
|
||
|
||
def rules(): | ||
return [ | ||
*collect_rules(), | ||
*java_rules(), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters