Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove build_graph.Target #10266

Merged
merged 3 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
116 changes: 0 additions & 116 deletions src/python/pants/backend/native/subsystems/native_build_step.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from dataclasses import dataclass
from enum import Enum
from typing import Any, Tuple, Union

from pants.backend.native.config.environment import (
Expand All @@ -16,7 +17,6 @@
from pants.backend.native.subsystems.binaries.gcc import GCC
from pants.backend.native.subsystems.binaries.llvm import LLVM
from pants.backend.native.subsystems.libc_dev import LibcDev
from pants.backend.native.subsystems.native_build_step import ToolchainVariant
from pants.backend.native.subsystems.xcode_cli_tools import XCodeCLITools
from pants.engine.platform import Platform
from pants.engine.rules import RootRule, rule
Expand All @@ -26,6 +26,11 @@
from pants.util.memo import memoized_property


class ToolchainVariant(Enum):
gnu = "gnu"
llvm = "llvm"


class NativeToolchain(Subsystem):
"""Abstraction over platform-specific tools to compile and link native code.

Expand Down
17 changes: 0 additions & 17 deletions src/python/pants/build_graph/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,14 @@
python_library(
sources=["*.py", "!address.py", "!*_test.py"],
dependencies = [
':address',
'3rdparty/python:dataclasses',
'src/python/pants/base:build_environment',
'src/python/pants/base:build_file_target_factory',
'src/python/pants/base:exceptions',
'src/python/pants/base:fingerprint_strategy',
'src/python/pants/base:hash_utils',
'src/python/pants/base:parse_context',
'src/python/pants/base:payload',
'src/python/pants/base:payload_field',
'src/python/pants/base:specs',
'src/python/pants/base:validation',
'src/python/pants/engine:rules',
'src/python/pants/engine:target',
'src/python/pants/fs',
'src/python/pants/option',
'src/python/pants/source',
'src/python/pants/source:payload_fields',
'src/python/pants/subsystem',
'src/python/pants/util:dirutil',
'src/python/pants/util:frozendict',
'src/python/pants/util:memo',
'src/python/pants/util:meta',
'src/python/pants/util:netrc',
'src/python/pants/util:objects',
'src/python/pants/util:ordered_set',
],
)
Expand Down
65 changes: 0 additions & 65 deletions src/python/pants/build_graph/addressable.py

This file was deleted.

36 changes: 0 additions & 36 deletions src/python/pants/build_graph/build_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def target_types(self) -> FrozenOrderedSet[Type[Target]]:

@dataclass
class Builder:
_target_by_alias: Dict[Any, Any] = field(default_factory=dict)
_target_macro_factory_by_alias: Dict[Any, Any] = field(default_factory=dict)
_exposed_object_by_alias: Dict[Any, Any] = field(default_factory=dict)
_exposed_context_aware_object_factory_by_alias: Dict[Any, Any] = field(default_factory=dict)
_optionables: OrderedSet = field(default_factory=OrderedSet)
Expand All @@ -70,10 +68,7 @@ def registered_aliases(self) -> BuildFileAliases:
:returns: A new BuildFileAliases instance containing this BuildConfiguration's registered alias
mappings.
"""
target_factories_by_alias = self._target_by_alias.copy()
target_factories_by_alias.update(self._target_macro_factory_by_alias)
return BuildFileAliases(
targets=target_factories_by_alias,
objects=self._exposed_object_by_alias.copy(),
context_aware_object_factories=self._exposed_context_aware_object_factory_by_alias.copy(),
)
Expand All @@ -87,12 +82,6 @@ def register_aliases(self, aliases):
if not isinstance(aliases, BuildFileAliases):
raise TypeError("The aliases must be a BuildFileAliases, given {}".format(aliases))

for alias, target_type in aliases.target_types.items():
self._register_target_alias(alias, target_type)

for alias, target_macro_factory in aliases.target_macro_factories.items():
self._register_target_macro_factory_alias(alias, target_macro_factory)

for alias, obj in aliases.objects.items():
self._register_exposed_object(alias, obj)

Expand All @@ -104,28 +93,6 @@ def register_aliases(self, aliases):
alias, context_aware_object_factory
)

# TODO(John Sirois): Warn on alias override across all aliases since they share a global
# namespace in BUILD files.
# See: https://github.com/pantsbuild/pants/issues/2151
def _register_target_alias(self, alias, target_type):
if alias in self._target_by_alias:
logger.debug(
"Target alias {} has already been registered. Overwriting!".format(alias)
)

self._target_by_alias[alias] = target_type
self.register_optionables(target_type.subsystems())

def _register_target_macro_factory_alias(self, alias, target_macro_factory):
if alias in self._target_macro_factory_by_alias:
logger.debug(
"TargetMacro alias {} has already been registered. Overwriting!".format(alias)
)

self._target_macro_factory_by_alias[alias] = target_macro_factory
for target_type in target_macro_factory.target_types:
self.register_optionables(target_type.subsystems())

def _register_exposed_object(self, alias, obj):
if alias in self._exposed_object_by_alias:
logger.debug(
Expand Down Expand Up @@ -230,10 +197,7 @@ def register_target_types(
self._target_types.update(target_types)

def create(self) -> "BuildConfiguration":
target_factories_by_alias = self._target_by_alias.copy()
target_factories_by_alias.update(self._target_macro_factory_by_alias)
registered_aliases = BuildFileAliases(
targets=target_factories_by_alias,
objects=self._exposed_object_by_alias.copy(),
context_aware_object_factories=self._exposed_context_aware_object_factory_by_alias.copy(),
)
Expand Down