Skip to content

Commit 018e6f0

Browse files
authored
feat: recursively initialize external Swift packages to match SPM behavior (#1095)
Fixes #1090.
1 parent 63f615e commit 018e6f0

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

docs/repository_rules_overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Used to download and build an external Swift package.
6565
| <a id="swift_package-patch_cmds_win"></a>patch_cmds_win | Sequence of Powershell commands to be applied on Windows after patches are applied. If this attribute is not set, patch_cmds will be executed on Windows, which requires Bash binary to exist. | List of strings | optional | <code>[]</code> |
6666
| <a id="swift_package-patch_tool"></a>patch_tool | The patch(1) utility to use. If this is specified, Bazel will use the specified patch tool instead of the Bazel-native patch implementation. | String | optional | <code>""</code> |
6767
| <a id="swift_package-patches"></a>patches | A list of files that are to be applied as patches after extracting the archive. By default, it uses the Bazel-native patch implementation which doesn't support fuzz match and binary patch, but Bazel will fall back to use patch command line tool if <code>patch_tool</code> attribute is specified or there are arguments other than <code>-p</code> in <code>patch_args</code> attribute. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
68-
| <a id="swift_package-recursive_init_submodules"></a>recursive_init_submodules | Whether to clone submodules recursively in the repository. | Boolean | optional | <code>False</code> |
68+
| <a id="swift_package-recursive_init_submodules"></a>recursive_init_submodules | Whether to clone submodules recursively in the repository. | Boolean | optional | <code>True</code> |
6969
| <a id="swift_package-remote"></a>remote | The version control location from where the repository should be downloaded. | String | required | |
7070
| <a id="swift_package-repo_mapping"></a>repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.&lt;p&gt;For example, an entry <code>"@foo": "@bar"</code> declares that, for any time this repository depends on <code>@foo</code> (such as a dependency on <code>@foo//some:target</code>, it should actually resolve that dependency within globally-declared <code>@bar</code> (<code>@bar//some:target</code>). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
7171
| <a id="swift_package-shallow_since"></a>shallow_since | an optional date, not after the specified commit; the argument is not allowed if a tag is specified (which allows cloning with depth 1). Setting such a date close to the specified commit allows for a more shallow clone of the repository, saving bandwidth and wall-clock time. | String | optional | <code>""</code> |

examples/interesting_deps/MODULE.bazel

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,3 @@ use_repo(
5959
"swiftpkg_swift_log",
6060
)
6161
# swift_deps END
62-
swift_deps.configure_package(
63-
name = "swiftpkg_libwebp_xcode",
64-
init_submodules = True,
65-
)

swiftpkg/bzlmod/swift_deps.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ _configure_package_tag = tag_class(
9191
mandatory = True,
9292
),
9393
"recursive_init_submodules": attr.bool(
94-
default = False,
94+
default = True,
9595
doc = "Whether to clone submodules recursively in the repository.",
9696
),
9797
},

swiftpkg/internal/swift_package.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ The commit or revision to download from version control.\
109109
doc = "Whether to clone submodules in the repository.",
110110
),
111111
"recursive_init_submodules": attr.bool(
112-
default = False,
112+
default = True,
113113
doc = "Whether to clone submodules recursively in the repository.",
114114
),
115115
"remote": attr.string(

0 commit comments

Comments
 (0)