You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is very useful for the packages that require form of authentication
to clone or download binary artifacts.
It is true that SPM and rules_swift_package_manager work without this if
the `.netrc` file is in `$HOME` but there are use cases where it is
desirable to have `.netrc` relative to the bazel workspace.
---------
Co-authored-by: Chuck Grindel <[email protected]>
Co-authored-by: Claude <[email protected]>
@@ -82,6 +82,7 @@ Load Swift packages from `Package.swift` and `Package.resolved` files.
82
82
| <aid="swift_deps.from_package-declare_swift_package"></a>declare_swift_package | Declare a `swift_package_tool` repository named `swift_package` which defines two targets: `update` and `resolve`. These targets run can be used to run the `swift package` binary in a Bazel context. The flags used when running the underlying `swift package` can be configured using the `configure_swift_package` tag.<br><br>They can be `bazel run` to update/resolve the `resolved` file:<br><br><pre><code>bazel run @swift_package//:update bazel run @swift_package//:resolve</code></pre> | Boolean | optional |`True`|
83
83
| <aid="swift_deps.from_package-env"></a>env | Environment variables that will be passed to the execution environments for this repository rule. (e.g. SPM version check, SPM dependency resolution, SPM package description generation) | <ahref="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional |`{}`|
84
84
| <aid="swift_deps.from_package-env_inherit"></a>env_inherit | Environment variables to inherit from the external environment that will be passed to the execution environments for this repository rule. (e.g. SPM version check, SPM dependency resolution, SPM package description generation) | List of strings | optional |`[]`|
85
+
| <aid="swift_deps.from_package-netrc"></a>netrc | A `.netrc` file that contains authentication credentials used for fetching Swift packages and or binary artifacts.<br><br>When provided, this file will be passed to Swift Package Manager commands using the `--netrc-file` flag during package resolution and updates. | <ahref="https://bazel.build/concepts/labels">Label</a> | optional |`None`|
85
86
| <aid="swift_deps.from_package-registries"></a>registries | A `registries.json` file that defines the configured Swift package registries.<br><br>The `registries.json` file is used when resolving Swift packages from a Swift package registry. It is created by Swift Package Manager when using the `swift package-registry` commands.<br><br>When using the `swift_package_tool` rules, this file is symlinked to the `config_path` directory defined in the `configure_swift_package` tag. If not using the `swift_package_tool` rules, the file must be in one of Swift Package Manager's search paths or in the manually specified `--config-path` directory. | <ahref="https://bazel.build/concepts/labels">Label</a> | optional |`None`|
86
87
| <aid="swift_deps.from_package-resolve_transitive_local_dependencies"></a>resolve_transitive_local_dependencies | Local Swift packages that are declared directly in the `Package.swift` file can depend on other local packages. By default these transitive dependencies will be automatically resolved and made available during the build process.<br><br>The process of resolving transitive local dependencies can become time consuming as the number of local Swift packages grows. Setting this flag to `False` will skip resolving local packages and instead require every local Swift package that is required during the build to be explicitly defined in the `Package.swift` file.<br><br>This time appears as `Fetching module extension swift_deps in @@rules_swift_package_manager~//:extensions.bzl;` in the output log. | Boolean | optional |`True`|
87
88
| <aid="swift_deps.from_package-resolved"></a>resolved | A `Package.resolved`. | <ahref="https://bazel.build/concepts/labels">Label</a> | optional |`None`|
@@ -64,6 +64,7 @@ Used to download and build an external Swift package from a registry.
64
64
| <aid="registry_swift_package-env"></a>env | Environment variables that will be passed to the execution environments for this repository rule. (e.g. SPM version check, SPM dependency resolution, SPM package description generation) | <ahref="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional |`{}`|
65
65
| <aid="registry_swift_package-env_inherit"></a>env_inherit | Environment variables to inherit from the external environment that will be passed to the execution environments for this repository rule. (e.g. SPM version check, SPM dependency resolution, SPM package description generation) | List of strings | optional |`[]`|
| <aid="registry_swift_package-netrc"></a>netrc | A `.netrc` file that contains authentication credentials used for fetching Swift packages and or binary artifacts.<br><br>When provided, this file will be passed to Swift Package Manager commands using the `--netrc-file` flag during package resolution and updates. | <ahref="https://bazel.build/concepts/labels">Label</a> | optional |`None`|
67
68
| <aid="registry_swift_package-registries"></a>registries | A `registries.json` file that defines the configured Swift package registries.<br><br>The `registries.json` file is used when resolving Swift packages from a Swift package registry. It is created by Swift Package Manager when using the `swift package-registry` commands.<br><br>When using the `swift_package_tool` rules, this file is symlinked to the `config_path` directory defined in the `configure_swift_package` tag. If not using the `swift_package_tool` rules, the file must be in one of Swift Package Manager's search paths or in the manually specified `--config-path` directory. | <ahref="https://bazel.build/concepts/labels">Label</a> | optional |`None`|
68
69
| <aid="registry_swift_package-replace_scm_with_registry"></a>replace_scm_with_registry | When enabled replaces SCM identities in dependencies package description with identities from the registries.<br><br>Using this option requires that the registries provide `repositoryURLs` as metadata for the package.<br><br>When `True` the equivalent `--replace-scm-with-registry` option must be used with the Swift Package Manager CLI (or `swift_package` rule) so that the `resolved` file includes the version and identity information from the registry.<br><br>For more information see the [Swift Package Manager documentation](https://github.com/swiftlang/swift-package-manager/blob/swift-6.0.1-RELEASE/Documentation/PackageRegistry/Registry.md#45-lookup-package-identifiers-registered-for-a-url). | Boolean | optional |`False`|
69
70
| <aid="registry_swift_package-repo_mapping"></a>repo_mapping | In `WORKSPACE` context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<br><br>For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`).<br><br>This attribute is _not_ supported in `MODULE.bazel` context (when invoking a repository rule inside a module extension's implementation function). | <ahref="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional ||
@@ -79,7 +80,7 @@ Used to download and build an external Swift package from a registry.
@@ -99,6 +100,7 @@ Used to download and build an external Swift package.
99
100
| <aid="swift_package-env"></a>env | Environment variables that will be passed to the execution environments for this repository rule. (e.g. SPM version check, SPM dependency resolution, SPM package description generation) | <ahref="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional |`{}`|
100
101
| <aid="swift_package-env_inherit"></a>env_inherit | Environment variables to inherit from the external environment that will be passed to the execution environments for this repository rule. (e.g. SPM version check, SPM dependency resolution, SPM package description generation) | List of strings | optional |`[]`|
101
102
| <aid="swift_package-init_submodules"></a>init_submodules | Whether to clone submodules in the repository. | Boolean | optional |`False`|
103
+
| <aid="swift_package-netrc"></a>netrc | A `.netrc` file for authentication when downloading binary artifacts. | <ahref="https://bazel.build/concepts/labels">Label</a> | optional |`None`|
102
104
| <aid="swift_package-patch_args"></a>patch_args | The arguments given to the patch tool. Defaults to -p0, however -p1 will usually be needed for patches generated by git. If multiple -p arguments are specified, the last one will take effect.If arguments other than -p are specified, Bazel will fall back to use patch command line tool instead of the Bazel-native patch implementation. When falling back to patch command line tool and patch_tool attribute is not specified, `patch` will be used. | List of strings | optional |`["-p0"]`|
103
105
| <aid="swift_package-patch_cmds"></a>patch_cmds | Sequence of Bash commands to be applied on Linux/Macos after patches are applied. | List of strings | optional |`[]`|
104
106
| <aid="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 |`[]`|
0 commit comments