Skip to content

Commit

Permalink
Removes a deprecation warning whose removal was blocked by plugin code (
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Neugebauer authored Apr 12, 2023
1 parent d02bbdc commit 3c21ef8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ The lazy API is useful, for example, when you only want to `Get` that output typ
We added syntax in 2.17 to now use `Get(OutputType)`, whereas before you had to do `Get(OutputType, OutputTypeRequest)` or (as of 2.15) `Get(OutputType, {})`. So, these `OutputTypeRequest` types are now redudent and deprecated in favor of simply using `Get(OutputType)`.


### `EnvironmentBehavior.UNMIGRATED` is no longer available

Following the deprecation cycle in 2.15, all `Goal`s need to set `EnvironmentBehavior.LOCAL_ONLY` or `EnvironmentBehavior.USES_ENVIRONMENTS`.


2.16
----

Expand Down
21 changes: 3 additions & 18 deletions src/python/pants/engine/goal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from typing_extensions import final

from pants.base.deprecated import deprecated_conditional
from pants.engine.unions import UnionMembership
from pants.option.option_types import StrOption
from pants.option.scope import ScopeInfo
Expand Down Expand Up @@ -83,18 +82,11 @@ class List(Goal):
"""

class EnvironmentBehavior(Enum):
"""Indicates that a goal's behavior with respect to environments has not been considered.
"""Indicates that the goal will always operate on the local environment target.
If set, will trigger a deprecation warning. If the desired behavior is to stay pinned to
defaults, changing to `LOCAL_ONLY` will silence the warning for this goal.
This is largely the same behavior as Pants has had pre-2.15.
"""

UNMIGRATED = 1

""" Indicates that the goal will always operate on the local environment target.
This is largely the same behavior as Pants has had pre-2.15. Set to this value to silence
the deprecation warning that arises from using `UNMIGRATED`."""
LOCAL_ONLY = 2

f""" Indicates that the goal chooses the environments to use to execute rules within the goal.
Expand All @@ -114,17 +106,10 @@ class EnvironmentBehavior(Enum):
See {doc_url('plugin-upgrade-guide')}.
"""
environment_behavior: ClassVar[EnvironmentBehavior] = EnvironmentBehavior.UNMIGRATED
environment_behavior: ClassVar[EnvironmentBehavior]

@classmethod
def _selects_environments(cls) -> bool:
deprecated_conditional(
lambda: cls.environment_behavior == Goal.EnvironmentBehavior.UNMIGRATED,
"2.17.0.dev4",
f"Setting `Goal.environment_behavior=EnvironmentBehavior.UNMIGRATED` for `Goal` "
f"`{cls.name}`",
hint=f"See {doc_url('plugin-upgrade-guide')}\n",
)
return cls.environment_behavior == Goal.EnvironmentBehavior.USES_ENVIRONMENTS

@final
Expand Down

0 comments on commit 3c21ef8

Please sign in to comment.