Skip to content

Commit

Permalink
Apply more of Eric's suggested changes.
Browse files Browse the repository at this point in the history
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
  • Loading branch information
stuhood committed Aug 6, 2020
1 parent 88689ec commit b5cc97d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def address_for_module(self, module: str) -> Optional[Address]:

@rule
async def map_first_party_modules_to_addresses() -> FirstPartyModuleToAddressMapping:
all_explicit_targets = await Get(Targets, AddressSpecs([DescendantAddresses("")]))
candidate_targets = tuple(tgt for tgt in all_explicit_targets if tgt.has_field(PythonSources))
all_expanded_targets = await Get(Targets, AddressSpecs([DescendantAddresses("")]))
candidate_targets = tuple(tgt for tgt in all_expanded_targets if tgt.has_field(PythonSources))
stripped_sources_per_explicit_target = await MultiGet(
Get(StrippedSourceFiles, SourceFilesRequest([tgt[PythonSources]]))
for tgt in candidate_targets
Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/core/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

from pants.core.goals import binary, fmt, lint, repl, run, test, typecheck
from pants.core.target_types import Files, Resources, TargetAlias
from pants.core.target_types import Files, GenericTarget, Resources
from pants.core.util_rules import (
archive,
determine_source_files,
Expand Down Expand Up @@ -43,4 +43,4 @@ def rules():


def target_types():
return [Files, TargetAlias, Resources]
return [Files, GenericTarget, Resources]
5 changes: 3 additions & 2 deletions src/python/pants/core/target_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ class Resources(Target):
# -----------------------------------------------------------------------------------------------


class TargetAlias(Target):
class GenericTarget(Target):
"""A generic target with no specific target type.
This is useful for aggregate targets: https://www.pantsbuild.org/target_aggregate.html.
This can be used as a generic "bag of dependencies", i.e. you can group several different
targets into one single target so that your other targets only need to depend on one thing.
"""

alias = "target"
Expand Down

0 comments on commit b5cc97d

Please sign in to comment.