@@ -6,23 +6,24 @@ load("@bazel_skylib//lib:sets.bzl", "sets")
66# For a list of the auto-discovered resource types, see
77# https://github.com/apple/swift-package-manager/blob/main/Sources/PackageLoading/TargetSourcesBuilder.swift#L634-L677
88_XIB_EXTS = ["nib" , "xib" , "storyboard" ]
9- _ASSET_CATALOG_EXTS = ["xcassets" ]
109_STRING_CATALOG_EXTS = ["xcstrings" ]
11- _COREDATA_EXTS = ["xcdatamodeld" , "xcdatamodel" , " xcmappingmodel" ]
10+ _COREDATA_EXTS = ["xcmappingmodel" ]
1211_METAL_EXTS = ["metal" ]
13- _ALL_AUTO_DISCOVERED_RES_EXTS = _XIB_EXTS + _ASSET_CATALOG_EXTS + \
14- _STRING_CATALOG_EXTS + _COREDATA_EXTS + _METAL_EXTS
15- _ALL_AUTO_DISCOVERED_RES_EXTS_SET = sets . make ( _ALL_AUTO_DISCOVERED_RES_EXTS )
12+ _ALL_AUTO_DISCOVERED_RES_EXTS_SET = sets . make (
13+ _XIB_EXTS + _STRING_CATALOG_EXTS + _COREDATA_EXTS + _METAL_EXTS ,
14+ )
1615
1716def _is_under_asset_catalog_dir (path ):
18- for ext in _ASSET_CATALOG_EXTS :
19- # This won't work for Windows. It is unclear how to determine to proper
20- # separator to use. The bazel-skylib paths.bzl just uses forward slash
21- # (/) without checking.
22- pattern = ".{}/" .format (ext )
23- if path .find (pattern ) > 0 :
24- return True
25- return False
17+ # This won't work for Windows. It is unclear how to determine to proper
18+ # separator to use. The bazel-skylib paths.bzl just uses forward slash
19+ # (/) without checking.
20+ return path .find (".xcassets/" ) > 0
21+
22+ def _is_under_xcdatamodeld_dir (path ):
23+ # This won't work for Windows. It is unclear how to determine to proper
24+ # separator to use. The bazel-skylib paths.bzl just uses forward slash
25+ # (/) without checking.
26+ return path .find (".xcdatamodeld/" ) > 0
2627
2728def _is_auto_discovered_resource (path ):
2829 """Determines whether the specified path points to an auto-discoverable \
@@ -43,7 +44,7 @@ def _is_auto_discovered_resource(path):
4344 ext = ext_with_dot [1 :] if ext_with_dot != "" else ""
4445 return sets .contains (_ALL_AUTO_DISCOVERED_RES_EXTS_SET , ext ) or \
4546 _is_under_asset_catalog_dir (path ) or \
46- False
47+ _is_under_xcdatamodeld_dir ( path )
4748
4849resource_files = struct (
4950 is_auto_discovered_resource = _is_auto_discovered_resource ,
0 commit comments