Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Remove swift_version.
Browse files Browse the repository at this point in the history
It was deprecated a while ago, and it avoids the collection in swift_library now.

RELNOTES: None
PiperOrigin-RevId: 351595739
  • Loading branch information
thomasvl authored and swiple-rules-gardener committed Jan 13, 2021
1 parent 52b9ffa commit 5b1aabd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 38 deletions.
22 changes: 0 additions & 22 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1860,28 +1860,6 @@ def _register_post_compile_actions(
linker_inputs = linker_inputs,
)

def find_swift_version_copt_value(copts):
"""Returns the value of the `-swift-version` argument, if found.
Args:
copts: The list of copts to be scanned.
Returns:
The value of the `-swift-version` argument, or None if it was not found
in the copt list.
"""

# Note that the argument can occur multiple times, and the last one wins.
last_swift_version = None

count = len(copts)
for i in range(count):
copt = copts[i]
if copt == "-swift-version" and i + 1 < count:
last_swift_version = copts[i + 1]

return last_swift_version

def new_objc_provider(
deps,
link_inputs,
Expand Down
15 changes: 1 addition & 14 deletions swift/internal/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ has reasonable defaults for any fields not explicitly set.
"direct_modules": """\
`List` of values returned from `swift_common.create_module`. The modules (both
Swift and C/Objective-C) emitted by the library that propagated this provider.
""",
"swift_version": """\
`String`. The version of the Swift language that was used when compiling the
propagating target; that is, the value passed via the `-swift-version` compiler
flag. This will be `None` if the flag was not set.
This field is deprecated; the Swift version should be obtained by inspecting the
arguments passed to specific compilation actions.
""",
"transitive_modules": """\
`Depset` of values returned from `swift_common.create_module`. The transitive
Expand Down Expand Up @@ -277,8 +269,7 @@ def create_swift_module(
def create_swift_info(
*,
modules = [],
swift_infos = [],
swift_version = None):
swift_infos = []):
"""Creates a new `SwiftInfo` provider with the given values.
This function is recommended instead of directly creating a `SwiftInfo`
Expand All @@ -298,9 +289,6 @@ def create_swift_info(
swift_infos: A list of `SwiftInfo` providers from dependencies, whose
transitive fields should be merged into the new one. If omitted, no
transitive data is collected.
swift_version: A string containing the value of the `-swift-version`
flag used when compiling this target, or `None` (the default) if it
was not set or is not relevant.
Returns:
A new `SwiftInfo` provider with the given values.
Expand All @@ -310,6 +298,5 @@ def create_swift_info(

return SwiftInfo(
direct_modules = modules,
swift_version = swift_version,
transitive_modules = depset(modules, transitive = transitive_modules),
)
2 changes: 0 additions & 2 deletions swift/internal/swift_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
load(":attrs.bzl", "swift_deps_attr")
load(
":compiling.bzl",
"find_swift_version_copt_value",
"new_objc_provider",
"output_groups_from_compilation_outputs",
"swift_library_output_map",
Expand Down Expand Up @@ -246,7 +245,6 @@ def _swift_library_impl(ctx):
# Note that private_deps are explicitly omitted here; they should
# not propagate.
swift_infos = get_providers(deps, SwiftInfo),
swift_version = find_swift_version_copt_value(copts),
),
]

Expand Down

0 comments on commit 5b1aabd

Please sign in to comment.