1<!-- Generated with Stardoc: http://skydoc.bazel.build --> 2 3Skylib module containing utilities for Bazel modules and module extensions. 4 5<a id="modules.as_extension"></a> 6 7## modules.as_extension 8 9<pre> 10modules.as_extension(<a href="#modules.as_extension-macro">macro</a>, <a href="#modules.as_extension-doc">doc</a>) 11</pre> 12 13Wraps a WORKSPACE dependency macro into a module extension. 14 15Example: 16```starlark 17def rules_foo_deps(optional_arg = True): 18 some_repo_rule(name = "foobar") 19 http_archive(name = "bazqux") 20 21rules_foo_deps_ext = modules.as_extension(rules_foo_deps) 22``` 23 24 25**PARAMETERS** 26 27 28| Name | Description | Default Value | 29| :------------- | :------------- | :------------- | 30| <a id="modules.as_extension-macro"></a>macro | A [WORKSPACE dependency macro](https://bazel.build/rules/deploying#dependencies), i.e., a function with no required parameters that instantiates one or more repository rules. | none | 31| <a id="modules.as_extension-doc"></a>doc | A description of the module extension that can be extracted by documentation generating tools. | `None` | 32 33**RETURNS** 34 35A module extension that generates the repositories instantiated by the given macro and also 36uses [`use_all_repos`](#use_all_repos) to indicate that all of those repositories should be 37imported via `use_repo`. The extension is marked as reproducible if supported by the current 38version of Bazel and thus doesn't result in a lockfile entry. 39 40 41<a id="modules.use_all_repos"></a> 42 43## modules.use_all_repos 44 45<pre> 46modules.use_all_repos(<a href="#modules.use_all_repos-module_ctx">module_ctx</a>, <a href="#modules.use_all_repos-reproducible">reproducible</a>) 47</pre> 48 49Return from a module extension that should have all its repositories imported via `use_repo`. 50 51Example: 52```starlark 53def _ext_impl(module_ctx): 54 some_repo_rule(name = "foobar") 55 http_archive(name = "bazqux") 56 return modules.use_all_repos(module_ctx) 57 58ext = module_extension(_ext_impl) 59``` 60 61 62**PARAMETERS** 63 64 65| Name | Description | Default Value | 66| :------------- | :------------- | :------------- | 67| <a id="modules.use_all_repos-module_ctx"></a>module_ctx | The [`module_ctx`](https://bazel.build/rules/lib/builtins/module_ctx) object passed to the module extension's implementation function. | none | 68| <a id="modules.use_all_repos-reproducible"></a>reproducible | The value of the `reproducible` parameter to pass to the [`extension_metadata`](https://bazel.build/rules/lib/builtins/extension_metadata.html) object returned by this function. This is safe to set with Bazel versions that don't support this parameter and will be ignored in that case. | `False` | 69 70**RETURNS** 71 72An [`extension_metadata`](https://bazel.build/rules/lib/builtins/extension_metadata.html) 73object that, when returned from a module extension implementation function, specifies that all 74repositories generated by this extension should be imported via `use_repo`. If the current 75version of Bazel doesn't support `extension_metadata`, returns `None` instead, which can 76safely be returned from a module extension implementation function in all versions of Bazel. 77 78 79