diff --git a/MODULE.bazel b/MODULE.bazel index 3e6fd2f15..2c6caea2c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -43,7 +43,7 @@ register_toolchains("@build_bazel_rules_swift_local_config//:all") # Dev dependencies bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True) bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle") -bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc") +bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True, repo_name = "io_bazel_stardoc") http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") diff --git a/README.md b/README.md index b20618a47..791d2b4c0 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you run into any problems with these rules, please Create a simple CLI that can run on macOS, Linux, or Windows: ```bzl -load("@build_bazel_rules_swift//swift:swift_binary.bzl", "swift_binary") +load("@rules_swift//swift:swift_binary.bzl", "swift_binary") swift_binary( name = "cli", @@ -29,7 +29,7 @@ Create a single library target that can be used by other targets in your build: ```bzl -load("@build_bazel_rules_swift//swift:swift_library.bzl", "swift_library") +load("@rules_swift//swift:swift_library.bzl", "swift_library") swift_library( name = "MyLibrary", @@ -92,7 +92,7 @@ toolchain's Info.plist file. To list the available toolchains and their bundle identifiers, you can run: ```command -bazel run @build_bazel_rules_swift//tools/dump_toolchains +bazel run @rules_swift//tools/dump_toolchains ``` **Linux hosts:** At this time, Bazel uses whichever `swift` executable is diff --git a/WORKSPACE b/WORKSPACE index 89e409cfd..eac6d10e5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -32,10 +32,10 @@ http_archive( # so we declare it in the WORKSPACE http_archive( name = "io_bazel_stardoc", - sha256 = "62bd2e60216b7a6fec3ac79341aa201e0956477e7c8f6ccc286f279ad1d96432", + sha256 = "fabb280f6c92a3b55eed89a918ca91e39fb733373c81e87a18ae9e33e75023ec", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.6.2/stardoc-0.6.2.tar.gz", - "https://github.com/bazelbuild/stardoc/releases/download/0.6.2/stardoc-0.6.2.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.7.1/stardoc-0.7.1.tar.gz", + "https://github.com/bazelbuild/stardoc/releases/download/0.7.1/stardoc-0.7.1.tar.gz", ], ) diff --git a/doc/api.md b/doc/api.md index 756be148a..2c1f2eb1f 100644 --- a/doc/api.md +++ b/doc/api.md @@ -9,6 +9,8 @@ compilation and/or linking as part of their implementation. ## swift_common.cc_feature_configuration
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.cc_feature_configuration(feature_configuration)
 
@@ -33,6 +35,8 @@ A C++ `FeatureConfiguration` value (see ## swift_common.compile
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.compile(actions, additional_inputs, cc_infos, copts, defines, exec_group,
                      extra_swift_infos, feature_configuration, generated_header_name, is_test,
                      include_dev_srch_paths, module_name, objc_infos, package_name, plugins,
@@ -118,6 +122,8 @@ A `struct` with the following fields:
 ## swift_common.compile_module_interface
 
 
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.compile_module_interface(actions, clang_module, compilation_contexts, copts,
                                       exec_group, feature_configuration, is_framework, module_name,
                                       swiftinterface_file, swift_infos, swift_toolchain, target_name)
@@ -158,6 +164,8 @@ A Swift module context (as returned by `create_swift_module_context`)
 ## swift_common.configure_features
 
 
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.configure_features(ctx, swift_toolchain, requested_features, unsupported_features)
 
@@ -192,6 +200,8 @@ An opaque value representing the feature configuration that can be ## swift_common.create_compilation_context
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.create_compilation_context(defines, srcs, transitive_modules)
 
@@ -225,6 +235,8 @@ A `struct` containing four fields: ## swift_common.create_linking_context_from_compilation_outputs
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.create_linking_context_from_compilation_outputs(actions, additional_inputs, alwayslink,
                                                              compilation_outputs,
                                                              feature_configuration, is_test,
@@ -274,6 +286,8 @@ A tuple of `(CcLinkingContext, CcLinkingOutputs)` containing the linking
 ## swift_common.extract_symbol_graph
 
 
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.extract_symbol_graph(actions, compilation_contexts, emit_extension_block_symbols,
                                   feature_configuration, include_dev_srch_paths, minimum_access_level,
                                   module_name, output_dir, swift_infos, swift_toolchain)
@@ -303,6 +317,8 @@ Extracts the symbol graph from a Swift module.
 ## swift_common.get_toolchain
 
 
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.get_toolchain(ctx, exec_group, mandatory, attr)
 
@@ -329,6 +345,8 @@ A `SwiftToolchainInfo` provider, or `None` if the toolchain was not ## swift_common.is_enabled
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.is_enabled(feature_configuration, feature_name)
 
@@ -357,6 +375,8 @@ check it. ## swift_common.precompile_clang_module
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.precompile_clang_module(actions, cc_compilation_context, exec_group,
                                      feature_configuration, module_map_file, module_name,
                                      swift_toolchain, target_name, swift_infos)
@@ -390,6 +410,8 @@ A struct containing the precompiled module and optional indexstore directory,
 ## swift_common.toolchain_attrs
 
 
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.toolchain_attrs(toolchain_attr_name)
 
@@ -436,6 +458,8 @@ A new attribute dictionary that can be added to the attributes of a ## swift_common.use_toolchain
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.use_toolchain(mandatory)
 
diff --git a/doc/providers.md b/doc/providers.md index 7292973fe..3e91f8bac 100644 --- a/doc/providers.md +++ b/doc/providers.md @@ -17,7 +17,9 @@ On this page: ## SwiftInfo
-SwiftInfo(direct_modules, transitive_modules)
+load("@rules_swift//doc:doc.bzl", "SwiftInfo")
+
+SwiftInfo(direct_swift_infos, modules, swift_infos)
 
Contains information about the compiled artifacts of a Swift module. @@ -48,8 +50,15 @@ where the arguments are: When reading an existing `SwiftInfo` provider, it has the two fields described below. -**FIELDS** +**CONSTRUCTOR PARAMETERS** +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| direct_swift_infos |

-

| `[]` | +| modules |

-

| `[]` | +| swift_infos |

-

| `[]` | + +**FIELDS** | Name | Description | | :------------- | :------------- | @@ -62,6 +71,8 @@ below. ## SwiftProtoCompilerInfo
+load("@rules_swift//doc:doc.bzl", "SwiftProtoCompilerInfo")
+
 SwiftProtoCompilerInfo(bundled_proto_paths, compile, compiler_deps, internal)
 
@@ -69,7 +80,6 @@ Provides information needed to generate Swift code from `ProtoInfo` providers **FIELDS** - | Name | Description | | :------------- | :------------- | | bundled_proto_paths | List of proto paths for which to skip generation because they're built into the modules imported by the generated Swift proto code, e.g., SwiftProtobuf. | @@ -83,6 +93,8 @@ Provides information needed to generate Swift code from `ProtoInfo` providers ## SwiftProtoInfo
+load("@rules_swift//doc:doc.bzl", "SwiftProtoInfo")
+
 SwiftProtoInfo(module_name, module_mappings, direct_pbswift_files, pbswift_files)
 
@@ -90,7 +102,6 @@ Propagates Swift-specific information about a `proto_library`. **FIELDS** - | Name | Description | | :------------- | :------------- | | module_name | The name of the Swift module compiled from the `swift_proto_library` which produced this provider. | @@ -104,6 +115,8 @@ Propagates Swift-specific information about a `proto_library`. ## SwiftToolchainInfo
+load("@rules_swift//doc:doc.bzl", "SwiftToolchainInfo")
+
 SwiftToolchainInfo(action_configs, cc_language, cc_toolchain_info, clang_implicit_deps_providers,
                    const_protocols_to_gather, cross_import_overlays, debug_outputs_provider,
                    developer_dirs, entry_point_linkopts_provider, feature_allowlists,
@@ -117,7 +130,6 @@ that use the toolchain.
 
 **FIELDS**
 
-
 | Name  | Description |
 | :------------- | :------------- |
 | action_configs |  This field is an internal implementation detail of the build rules.    |
diff --git a/doc/rules.md b/doc/rules.md
index baab8cb0d..4dfd8aec0 100644
--- a/doc/rules.md
+++ b/doc/rules.md
@@ -40,6 +40,8 @@ On this page:
 ## swift_binary
 
 
+load("@rules_swift//doc:doc.bzl", "swift_binary")
+
 swift_binary(name, deps, srcs, data, copts, defines, linkopts, malloc, module_name, package_name,
              plugins, stamp, swiftc_inputs)
 
@@ -83,6 +85,8 @@ please use one of the platform-specific application rules in ## swift_compiler_plugin
+load("@rules_swift//doc:doc.bzl", "swift_compiler_plugin")
+
 swift_compiler_plugin(name, deps, srcs, data, copts, defines, linkopts, malloc, module_name,
                       package_name, plugins, stamp, swiftc_inputs)
 
@@ -171,6 +175,8 @@ swift_library( ## swift_cross_import_overlay
+load("@rules_swift//doc:doc.bzl", "swift_cross_import_overlay")
+
 swift_cross_import_overlay(name, deps, bystanding_module, declaring_module)
 
@@ -212,6 +218,8 @@ the future, this rule is not recommended for other widespread use. ## swift_feature_allowlist
+load("@rules_swift//doc:doc.bzl", "swift_feature_allowlist")
+
 swift_feature_allowlist(name, aspect_ids, managed_features, packages)
 
@@ -243,6 +251,8 @@ package. ## swift_import
+load("@rules_swift//doc:doc.bzl", "swift_import")
+
 swift_import(name, deps, data, archives, module_name, swiftdoc, swiftinterface, swiftmodule)
 
@@ -281,6 +291,8 @@ the `.private.swiftinterface` files are required in order to build any code that ## swift_interop_hint
+load("@rules_swift//doc:doc.bzl", "swift_interop_hint")
+
 swift_interop_hint(name, exclude_hdrs, module_map, module_name, suppressed)
 
@@ -423,6 +435,8 @@ its transitive dependencies be propagated. ## swift_library
+load("@rules_swift//doc:doc.bzl", "swift_library")
+
 swift_library(name, deps, srcs, data, always_include_developer_search_paths, alwayslink, copts,
               defines, generated_header_name, generates_header, library_evolution, linkopts,
               linkstatic, module_name, package_name, plugins, private_deps, swiftc_inputs)
@@ -460,6 +474,8 @@ Compiles and links Swift code into a static library and Swift module.
 ## swift_library_group
 
 
+load("@rules_swift//doc:doc.bzl", "swift_library_group")
+
 swift_library_group(name, deps)
 
@@ -484,6 +500,8 @@ need to import the grouped libraries directly. ## swift_module_alias
+load("@rules_swift//doc:doc.bzl", "swift_module_alias")
+
 swift_module_alias(name, deps, module_name)
 
@@ -520,6 +538,8 @@ symbol is defined; it is not repeated by the alias module.) ## swift_module_mapping
+load("@rules_swift//doc:doc.bzl", "swift_module_mapping")
+
 swift_module_mapping(name, aliases)
 
@@ -585,6 +605,8 @@ source asked to `import Utils`. ## swift_module_mapping_test
+load("@rules_swift//doc:doc.bzl", "swift_module_mapping_test")
+
 swift_module_mapping_test(name, deps, exclude, mapping)
 
@@ -619,6 +641,8 @@ remaining modules collected are not present in the `aliases` of the ## swift_package_configuration
+load("@rules_swift//doc:doc.bzl", "swift_package_configuration")
+
 swift_package_configuration(name, configured_features, packages)
 
@@ -644,6 +668,8 @@ target's label is included by the package specifications in the configuration. ## swift_proto_compiler
+load("@rules_swift//doc:doc.bzl", "swift_proto_compiler")
+
 swift_proto_compiler(name, deps, bundled_proto_paths, plugin, plugin_name, plugin_option_allowlist,
                      plugin_options, protoc, suffixes)
 
@@ -671,6 +697,8 @@ swift_proto_compiler(name, name, deps, srcs, data, additional_compiler_deps, additional_compiler_info, always_include_developer_search_paths, alwayslink, compilers, copts, defines, generated_header_name, generates_header, library_evolution, linkopts, linkstatic, @@ -747,6 +775,8 @@ swift_proto_library( ## swift_proto_library_group
+load("@rules_swift//doc:doc.bzl", "swift_proto_library_group")
+
 swift_proto_library_group(name, compiler, proto)
 
@@ -825,6 +855,8 @@ swift_binary( ## swift_test
+load("@rules_swift//doc:doc.bzl", "swift_test")
+
 swift_test(name, deps, srcs, data, copts, defines, discover_tests, env, linkopts, malloc,
            module_name, package_name, plugins, stamp, swiftc_inputs)
 
@@ -913,6 +945,8 @@ bazel test --test_filter=AModule,BModule.SomeTests,BModule.OtherTests/testX //my ## universal_swift_compiler_plugin
+load("@rules_swift//doc:doc.bzl", "universal_swift_compiler_plugin")
+
 universal_swift_compiler_plugin(name, plugin)
 
@@ -964,6 +998,8 @@ swift_library( ## mixed_language_library
+load("@rules_swift//doc:doc.bzl", "mixed_language_library")
+
 mixed_language_library(name, alwayslink, clang_copts, clang_defines, clang_srcs, enable_modules,
                        hdrs, includes, linkopts, module_map, module_name, non_arc_srcs, private_deps,
                        sdk_dylibs, sdk_frameworks, swift_copts, swift_defines, swift_srcs,
diff --git a/doc/setup.md b/doc/setup.md
index 933e79208..90c42bacd 100644
--- a/doc/setup.md
+++ b/doc/setup.md
@@ -5,6 +5,8 @@
 ## swift_rules_dependencies
 
 
+load("@rules_swift//swift:repositories.bzl", "swift_rules_dependencies")
+
 swift_rules_dependencies(include_bzlmod_ready_dependencies)
 
diff --git a/swift/swift.bzl b/swift/swift.bzl index 0bb92206c..8419ee53b 100644 --- a/swift/swift.bzl +++ b/swift/swift.bzl @@ -23,7 +23,7 @@ meant for build rule use only. """ load( - "@build_bazel_rules_swift//swift:swift_compiler_plugin.bzl", + "//swift:swift_compiler_plugin.bzl", _swift_compiler_plugin = "swift_compiler_plugin", _universal_swift_compiler_plugin = "universal_swift_compiler_plugin", )