File tree Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -1588,8 +1588,7 @@ def _declare_multiple_outputs_and_write_output_file_map(
1588
1588
def _declare_validated_generated_header (actions , generated_header_name ):
1589
1589
"""Validates and declares the explicitly named generated header.
1590
1590
1591
- If the file does not have a `.h` extension or conatins path separators, the
1592
- build will fail.
1591
+ If the file does not have a `.h` extension, the build will fail.
1593
1592
1594
1593
Args:
1595
1594
actions: The context's `actions` object.
@@ -1598,12 +1597,6 @@ def _declare_validated_generated_header(actions, generated_header_name):
1598
1597
Returns:
1599
1598
A `File` that should be used as the output for the generated header.
1600
1599
"""
1601
- if "/" in generated_header_name :
1602
- fail (
1603
- "The generated header for a Swift module may not contain " +
1604
- "directory components (got '{}')." .format (generated_header_name ),
1605
- )
1606
-
1607
1600
extension = paths .split_extension (generated_header_name )[1 ]
1608
1601
if extension != ".h" :
1609
1602
fail (
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ swift_library(
28
28
)
29
29
30
30
swift_library (
31
- name = "invalid_path_separator " ,
31
+ name = "valid_path_separator " ,
32
32
srcs = ["Empty.swift" ],
33
- generated_header_name = "Invalid /Separator.h" ,
33
+ generated_header_name = "Valid /Separator.h" ,
34
34
tags = FIXTURE_TAGS ,
35
35
)
Original file line number Diff line number Diff line change @@ -121,12 +121,17 @@ def generated_header_test_suite(name = "generated_header"):
121
121
target_under_test = "@build_bazel_rules_swift//test/fixtures/generated_header:invalid_extension" ,
122
122
)
123
123
124
- # Verify that the build fails to analyze if a path separator is used.
125
- generate_header_and_module_map_failure_test (
126
- name = "{}_invalid_path_separator" .format (name ),
127
- expected_message = "The generated header for a Swift module may not contain directory components" ,
124
+ # Verify that the build analyzes if a path separator is used.
125
+ generate_header_and_module_map_provider_test (
126
+ name = "{}_valid_path_separator" .format (name ),
127
+ expected_files = [
128
+ "test/fixtures/generated_header/Valid/Separator.h" ,
129
+ "*" ,
130
+ ],
131
+ field = "files" ,
132
+ provider = "DefaultInfo" ,
128
133
tags = [name ],
129
- target_under_test = "@build_bazel_rules_swift//test/fixtures/generated_header:invalid_path_separator " ,
134
+ target_under_test = "@build_bazel_rules_swift//test/fixtures/generated_header:valid_path_separator " ,
130
135
)
131
136
132
137
# Verify that the header is not generated if the feature
You can’t perform that action at this time.
0 commit comments