Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Merge 0.23.0 from upstream to textnow branch #3

Merged
merged 153 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
616439c
Add .clang-format (#467)
keith Aug 11, 2020
b255732
Add error for no Linux swiftc path (#466)
keith Aug 11, 2020
d93238e
Update dump_toolchains to support home dir (#471)
keith Aug 11, 2020
e87aace
Run clang-format on everything (#470)
keith Aug 11, 2020
fe0a881
Update README instructions (#472)
keith Aug 11, 2020
49de7e5
Ensure that `swift_module_alias` propagates instrumented file info fr…
allevato Aug 6, 2020
fc74b43
Allow generated headers with path separators (#439)
michaeleisel Aug 13, 2020
4bc7405
Delete CONTRIBUTORS (#475)
keith Aug 13, 2020
44e8c29
Various changes related to explicit module compilation: (#477)
keith Aug 22, 2020
d5eb04f
Use a parameter file when linking Swift libraries when the host machi…
thii Aug 24, 2020
a59b8d1
Read the `custom_malloc` configuration field in `swift_{binary,test}`…
keith Aug 31, 2020
28365f0
No need to check if we're on macOS for non-Darwin Swift toolchain (#479)
thii Aug 31, 2020
8015d0e
Update protobuf deps (#480)
keith Sep 1, 2020
9110727
Run //test/... on Linux CI (#463)
keith Sep 2, 2020
57058aa
Ensure that intermediate outputs created for Swift source files (such…
allevato Sep 2, 2020
beb3a30
Update bzl_library targets (#482)
segiddins Sep 4, 2020
48f1b57
Add a feature flag to enable generation from raw proto sources.
thomasvl Sep 8, 2020
9eef33f
Honor the feature flag to enable generation from raw proto sources.
thomasvl Sep 9, 2020
6ae82f5
Remove unused value.
thomasvl Sep 9, 2020
4f4b7f0
Don't propagate an empty module map for `{cc,objc}_library` targets t…
allevato Sep 17, 2020
d2efe38
Added helper macro for declaring transitive dependencies
UebelAndre Sep 13, 2020
b7a2693
Update README shas
keith Sep 21, 2020
9d472c1
Fix buildifier warning
keith Oct 8, 2020
abc377e
Update rules_swift to use the toolchain transition.
a-googler Sep 30, 2020
8e3715a
Update apple_support
keith Oct 8, 2020
3ad9d41
Implement -coverage-prefix-map feature (#489)
keith Oct 13, 2020
cfd9e36
Update worker docstring with example (#505)
keith Oct 14, 2020
dcc5235
Introduce feature to register a separate action to generate swift der…
ghvg1313 Oct 20, 2020
3dcf6f1
Fix index while building with derived files (#506)
keith Oct 20, 2020
f1e125c
Fix derive files with bitcode (#509)
keith Oct 21, 2020
cd66dc7
Output command lines of failed action command line tests (#508)
keith Oct 21, 2020
320d0a3
Add swift.remap_xcode_path feature (#511)
keith Oct 22, 2020
410d8ed
Only read output_file_map if it's going to be written
Apr 21, 2020
ed81c15
Create a build setting to allow forcing a Swift target to Apple with …
keith Oct 30, 2020
17126a9
Update apple_support (#517)
keith Nov 4, 2020
2279303
Update README with new URLs (#518)
keith Nov 4, 2020
aff1754
Migrate to the modern Starlark linker input API. (#512)
benjaminp Nov 6, 2020
8141f74
Update README with new URLs (#520)
keith Nov 10, 2020
77afbc2
Update protobuf (#524)
keith Nov 14, 2020
64c7b95
Clean up some old TODOs.
thomasvl Nov 25, 2020
fe9d08e
Remove the `swift.implicit_modules` feature.
allevato Dec 1, 2020
420cc7a
Stop computing transitive_generated_headers.
thomasvl Nov 30, 2020
a277fe4
Standardize on FIXTURE_TAGS, ensure all targets tagged.
thomasvl Dec 1, 2020
efc75e0
Deduplicate module map flags in Swift compilation
thii Oct 9, 2020
cd67dae
Revert "Migrate to the modern Starlark linker input API. (#512)"
keith Nov 11, 2020
2e1d299
Migrate Swift build rules to the new C++ `LinkerInput` APIs.
allevato Nov 11, 2020
989430f
Fix tests
keith Dec 1, 2020
7fdbb71
Make the `srcs` attribute of `swift_library` mandatory and non-empty.
allevato Dec 2, 2020
0f77332
Update README with new URLs
keith Dec 2, 2020
eca50db
Migration off SwiftInfo.module_name.
thomasvl Dec 2, 2020
768bfe3
Add the SDK's `Developer/Library/Frameworks` directory to the compile…
allevato Dec 10, 2020
92ce702
Require `name` to be a named argument.
thomasvl Dec 11, 2020
bdb2a7b
Retire `module_name` from create_swift_info.
thomasvl Dec 11, 2020
134370d
Allow `optional_implicit_deps` and `required_implicit_deps` to be set…
allevato Dec 16, 2020
e46ae72
Fix XCTest -I for derived files
keith Dec 17, 2020
c512f8e
Remove SwiftInfo.module_name, it was deprecated a while ago.
thomasvl Dec 17, 2020
c517a72
Ignore a feature when a `SwiftToolchainInfo` says it does not support…
allevato Dec 17, 2020
d916037
Uniquify `-fmodule-map-file=` flags passed to `swiftc`.
allevato Dec 18, 2020
ca8fe5b
Work around https://github.com/bazelbuild/stardoc/issues/78.
thomasvl Dec 22, 2020
329a810
Update README with new URLs
keith Jan 7, 2021
d701900
Allow modules propagated by `SwiftInfo` to indicate whether they are …
allevato Jan 15, 2021
5a4f76d
Stop computing/tracking defines.
thomasvl Jan 13, 2021
3d1f6a3
Remove swift_version.
thomasvl Jan 13, 2021
08e3036
Add a `swift_explicit_module` output group to the `swift_clang_module…
allevato Jan 21, 2021
d0b6a7e
Lessen restrictions on when implicit modules can be used:
allevato Jan 25, 2021
4de93c1
Fix header selection when falling back to implicit modules.
allevato Jan 27, 2021
c2eb110
Simplify the paths to module maps generated by the Swift build rules.
allevato Jan 27, 2021
fb60b54
Automated rollback of commit 71998c865b827828c17dbd24bf48bb856523d4f5.
allevato Jan 27, 2021
aa54225
Simplify the paths to module maps generated by the Swift build rules.
allevato Jan 28, 2021
1ef4601
Use released protoc binaries where possible (#555)
thii Feb 1, 2021
18b48c2
Add disable system index feature (#563)
keith Feb 8, 2021
dadd121
Don't re-export the modules imported by a Swift generated header.
allevato Feb 8, 2021
9e743aa
Explicitly set --macos_minimum_os=10.15 to make `swift_{binary,test}`…
thii Feb 17, 2021
3d59e85
Move toolchain- and command-line-provided compiler flags into action …
allevato Feb 3, 2021
3c7ed71
Fix incorrect param name
thii Feb 22, 2021
daf7baa
Fix non-threaded mode WMO
thii Feb 23, 2021
a84b2c6
No longer scan for `-num-threads=X` (specifically the form with the e…
allevato Feb 4, 2021
87b4d41
Unconditionally add `ObjcProvider.umbrella_header` files to compiler …
allevato Feb 4, 2021
ad39543
Compile an explicit module for the generated header of a `swift_libra…
allevato Feb 19, 2021
ff33061
Pass framework search paths directly to clang for pcms
brentleyjones Feb 25, 2021
22a2472
Pass `-no-clang-module-breadcrumbs` to frontend jobs (#574)
thii Feb 26, 2021
5fc096e
Add remotely debuggable Swift document (#576)
keith Mar 12, 2021
6ebb0f0
Update apple_support (#577)
keith Mar 12, 2021
0e84c1e
Update README for new URL (#578)
keith Mar 12, 2021
2a20daa
Support "Make" variable expansion in `copts` and `linkopts`
omarzl Mar 16, 2021
d8d688c
Add a `generates_header` attribute to `swift_library` to control Obje…
allevato Mar 12, 2021
f1c30a2
Internal change.
allevato Apr 2, 2021
9cba5ec
Switch to XcodeVersionConfig.execution_info().
thomasvl Mar 24, 2021
e7ec735
Distinguish between direct and transitive information when creating t…
allevato Mar 17, 2021
03dd9ab
Delete support for compiler performance stats collection.
allevato Mar 19, 2021
97221ad
Simplify and cleanup how implicit toolchain dependencies are managed.
allevato Apr 6, 2021
430311c
Update examples/tests with `generates_header = True` where necessary …
allevato Mar 15, 2021
f81fa6f
Make `swift_library` not generate an Objective-C header by default.
allevato Apr 6, 2021
006a981
Update apple_support to new release
keith Apr 7, 2021
9c8d8f7
Update README with new URLs
keith Apr 7, 2021
a62e084
Add -Werror for C++
keith Apr 7, 2021
5bf6ef7
Fix skylib branch name
keith Apr 19, 2021
21b1541
Add first stardoc API docgen target (#598)
alexeagle Apr 30, 2021
4ee4be0
Generate providers.md from sources (#599)
alexeagle Apr 30, 2021
ec1c3ff
Add `swift_common.create_swift_interop_info`.
allevato Apr 7, 2021
3009fc2
Move swift_clang_module_aspect out of swift_common and directly expos…
thomasvl Apr 9, 2021
29f26cd
Update the module name derivation algorithm to handle any sequence of…
allevato Apr 12, 2021
dea7e72
API changes to `create_swift_interop_info`.
allevato Apr 15, 2021
5f6154d
Factor out Bazel placeholder substitution functionality into a separa…
allevato Apr 2, 2021
65af062
Support older C++ versions
keith Apr 6, 2021
26f81ca
Sort headers in the module maps generated by `swift_clang_module_aspe…
allevato Apr 7, 2021
b1cc212
Remove top level functions for now
keith May 4, 2021
e77df5b
Use cpp fragment, instead of objc fragment, to determine whether to g…
googlewalt Apr 28, 2021
1b4e4c0
Add support for older bazel versions for now
keith May 4, 2021
728528d
Add Xcode toolchain support for an optional binary that can rewrite t…
allevato Apr 19, 2021
bb2efe2
Disable generated_header_rewriter for now
keith May 4, 2021
b44baa3
Make the strict include paths from `objc_proto_library` targets avail…
a-googler Apr 28, 2021
0004011
Rename `swift.strict_modules` to `swift.layering_check` to match the …
allevato May 3, 2021
ee7e6e3
Add a user settable build setting to specify additional swiftcopts fo…
a-googler May 3, 2021
51a8f82
Disable allow_multiple for per_module_swiftcopt_flag
keith May 4, 2021
52827d9
Update README with new URLs
keith May 4, 2021
aab5e21
Use target_compatible_with for macOS only tests (#514)
keith May 4, 2021
83d2fb7
Add `swift.global_module_cache_uses_tmpdir` feature (#581)
brentleyjones May 13, 2021
e64d472
Stop passing `uses_swift` to `new_objc_provider`.
allevato May 14, 2021
c674b9d
Enable CI testing for docgen (#617)
alexeagle May 18, 2021
ae0c5bd
Generate api.md from sources (#618)
alexeagle May 18, 2021
9f42d75
Generate setup.md from sources (#619)
alexeagle May 19, 2021
ce67397
Update README with new URLs (#621)
keith May 27, 2021
bdf5288
Update bazel_skylib (#620)
keith May 27, 2021
a757f59
Update the worker protocol proto (#622)
segiddins May 27, 2021
d824463
Add ubsan support (#544)
keith May 28, 2021
7197d5a
Remove unused command_line_copts (#625)
keith May 28, 2021
4979602
Include the headers from direct dependencies of a Swift target when c…
allevato May 6, 2021
8e63bad
Use `-fsystem-module` if the compiler is new enough to support it (Xc…
allevato May 11, 2021
a0fcdeb
Add the `swift_feature_allowlist` rule that lets toolchains control w…
keith May 28, 2021
046ab58
Disable layering checks when compiling the explicit module for a Swif…
allevato May 4, 2021
021c11b
Disable layering checks for now
keith May 28, 2021
0414e01
Revert "Disable layering checks for now"
keith May 28, 2021
7688933
Get rid of the non-strict use of `-fmodules-decluse`.
allevato May 25, 2021
0487a75
Support implicit C/Objective-C dependencies that are passed when comp…
allevato May 25, 2021
bc0bd43
Update docs
keith May 28, 2021
cde2112
Get rid of spurious diagnostics when compiling system modules with Xc…
allevato May 26, 2021
3d6141f
Add buildifier pre-commit hook (#632)
alexeagle Jun 3, 2021
84286ad
Reuse swiftmodule for incremental builds (#633)
brentleyjones Jun 4, 2021
254e3fa
Add returns (#634)
brentleyjones Jun 7, 2021
914eff9
Implement global index store cache (#567)
jerrymarino Jun 9, 2021
325b91f
Modernize `xcode_swift_toolchain` features and linkopts.
allevato Jun 7, 2021
1b6b854
Remove the `-rpath` for the Xcode's developer frameworks directory fr…
allevato Jun 9, 2021
446d8f4
Propagate Swift-specific linker flags as an implicit dependency of th…
allevato Jun 7, 2021
1386592
Fix worker based error reporting for WMO (#642)
brentleyjones Jun 10, 2021
ebd6175
Fix race condition in MakeDirs (#644)
jerrymarino Jun 10, 2021
0d0f913
Error out on failed `MakeDir` (#645)
brentleyjones Jun 10, 2021
7e284a9
Delete the `swift_common.swift_runtime_linkopts` function.
allevato Jun 10, 2021
1946db6
Refer to build_bazel_rules_swift_index_import via a file rather than …
segiddins Jun 10, 2021
b630afe
Add files in third_party to :for_bazel_tests (#648)
segiddins Jun 11, 2021
334b6fd
Fix index_import label
keith Jun 11, 2021
8dd2c94
Update apple_support to 0.11.0
keith Jun 11, 2021
54cd4b0
Merge tag '0.23.0' into textnow
severnt Sep 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ x_defaults:
test_flags: *linux_flags
test_targets:
- "--"
- "//doc/..."
- "//examples/..."
# - "//test/..." TODO: Enable once https://github.com/bazelbuild/continuous-integration/pull/1015 is deployed
- "//test/..."
- "-//examples/apple/..."

tasks:
Expand Down
2 changes: 1 addition & 1 deletion .bazelci/update_workspace_to_deps_heads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")\
git_repository(\
\ name = "bazel_skylib",\
\ remote = "https://github.com/bazelbuild/bazel-skylib.git",\
\ branch = "master",\
\ branch = "main",\
)\
\
git_repository(\
Expand Down
8 changes: 8 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Since there's no way to set the deployment version for swift_{binary,test},
# this forces all targets' minimum macOS to Catalina until Bazel CI has
# upgraded their Mac machines to Big Sur.
build --macos_minimum_os=10.15

# Make sure no warnings slip into the C++ tools we vendor
build --copt=-Werror
build --host_copt=-Werror
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BasedOnStyle: Google
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See CONTRIBUTING.md for instructions.
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/keith/pre-commit-buildifier
rev: 4.0.1.1
hooks:
- id: buildifier
- id: buildifier-lint
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ filegroup(
srcs = [
"WORKSPACE",
"//swift:for_bazel_tests",
"//third_party:for_bazel_tests",
"//tools:for_bazel_tests",
],
)
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Formatting

Starlark files should be formatted by buildifier.
We suggest using a pre-commit hook to automate this.
First [install pre-commit](https://pre-commit.com/#installation),
then run

```shell
pre-commit install
```

Otherwise the Buildkite CI will yell at you about formatting/linting violations.

## File or claim an issue

Please let us know what you're working on if you want to change or add to the
Expand Down
12 changes: 0 additions & 12 deletions CONTRIBUTORS

This file was deleted.

63 changes: 25 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,12 @@ replacing the `urls` and `sha256` attributes with the values from the release
you wish to depend on:

```python
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# rules_swift and apple_support no longer support releases. If you'd like to pin
# down these dependencies to a specific commit, please add the following to the
# top of your WORKSPACE, using the commit you'd like to pin for each of the
# repositories.
git_repository(
http_archive(
name = "build_bazel_rules_swift",
remote = "https://github.com/bazelbuild/rules_swift.git",
commit = "[SOME_HASH_VALUE]",
)

git_repository(
name = "build_bazel_apple_support",
remote = "https://github.com/bazelbuild/apple_support.git",
commit = "[SOME_HASH_VALUE]",
sha256 = "653e8756001616500b110fd156694de7899278bb7480aba22b2f156438a1d810",
url = "https://github.com/bazelbuild/rules_swift/releases/download/0.22.0/rules_swift.0.22.0.tar.gz",
)

load(
Expand All @@ -74,18 +63,11 @@ load(
swift_rules_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)

apple_support_dependencies()

load(
"@com_google_protobuf//:protobuf_deps.bzl",
"protobuf_deps",
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

protobuf_deps()
swift_rules_extra_dependencies()
```

The `swift_rules_dependencies` macro creates a toolchain appropriate for your
Expand All @@ -109,7 +91,7 @@ uses `clang`.
`/Library/Developer/Toolchains` instead of Xcode's default. To do so, pass the
following flag to Bazel:

```
```lang-none
--define=SWIFT_CUSTOM_TOOLCHAIN=toolchain.id
```

Expand All @@ -118,33 +100,38 @@ 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
```

**Linux hosts:** At this time, Bazel uses whichever `swift` executable is
encountered first on your `PATH`.

## Supporting remote builds

To make remote builds work correctly with debugging and general
reproducibility see [this doc](doc/debuggable_remote_swift.md)

## Future Work

* Support for building and linking to shared libraries (`.dylib`/`.so`) written
- Support for building and linking to shared libraries (`.dylib`/`.so`) written
in Swift.
* Interoperability with Swift Package Manager.
* Migration to the Bazel platforms/toolchains APIs.
* Support for multiple toolchains, and support for non-Xcode toolchains on
- Interoperability with Swift Package Manager.
- Migration to the Bazel platforms/toolchains APIs.
- Support for multiple toolchains, and support for non-Xcode toolchains on
macOS.
* Automatically download a Linux toolchain from [swift.org](https://swift.org)
- Automatically download a Linux toolchain from [swift.org](https://swift.org)
if one is not already installed.

## Acknowledgments

We gratefully acknowledge the following external packages that rules_swift
depends on:

* [Apple Support for Bazel](https://github.com/bazelbuild/apple_support) (Google)
* [Bazel Skylib](https://github.com/bazelbuild/bazel-skylib) (Google)
* [JSON for Modern C++](https://github.com/nlohmann/json) (Niels Lohmann)
* [Protocol Buffers](https://github.com/protocolbuffers/protobuf) (Google)
* [Swift gRPC](https://github.com/grpc/grpc-swift) (Google)
* [Swift Protobuf](https://github.com/apple/swift-protobuf) (Apple)
* [zlib](https://www.zlib.net) (Jean-loup Gailly and Mark Adler)
- [Apple Support for Bazel](https://github.com/bazelbuild/apple_support) (Google)
- [Bazel Skylib](https://github.com/bazelbuild/bazel-skylib) (Google)
- [JSON for Modern C++](https://github.com/nlohmann/json) (Niels Lohmann)
- [Protocol Buffers](https://github.com/protocolbuffers/protobuf) (Google)
- [Swift gRPC](https://github.com/grpc/grpc-swift) (Google)
- [Swift Protobuf](https://github.com/apple/swift-protobuf) (Apple)
- [zlib](https://www.zlib.net) (Jean-loup Gailly and Mark Adler)
28 changes: 18 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,27 @@ load(
swift_rules_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

apple_support_dependencies()

load(
"@com_google_protobuf//:protobuf_deps.bzl",
"protobuf_deps",
)

protobuf_deps()
swift_rules_extra_dependencies()

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

# For API doc generation
# This is a dev dependency, users should not need to install it
# so we declare it in the WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_stardoc",
patches = ["//doc:stardoc.pr103.patch"],
sha256 = "f89bda7b6b696c777b5cf0ba66c80d5aa97a6701977d43789a9aee319eef71e8",
strip_prefix = "stardoc-d93ee5347e2d9c225ad315094507e018364d5a67",
urls = [
"https://github.com/bazelbuild/stardoc/archive/d93ee5347e2d9c225ad315094507e018364d5a67.tar.gz",
],
)
155 changes: 155 additions & 0 deletions doc/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")

_DOC_SRCS = {
"api": [
"swift_common",
],
"aspects": [
"swift_usage_aspect",
],
"providers": [
"SwiftInfo",
"SwiftToolchainInfo",
"SwiftProtoInfo",
"SwiftUsageInfo",
],
"rules": [
"swift_binary",
"swift_c_module",
"swift_feature_allowlist",
"swift_grpc_library",
"swift_import",
"swift_library",
"swift_module_alias",
"swift_proto_library",
"swift_test",
],
}

write_file(
name = "api_header",
out = "api_header.vm",
content = [
"<!-- Generated with Stardoc, Do Not Edit! -->",
"# Build API",
"",
"The `swift_common` module provides API access to the behavior implemented",
"by the Swift build rules, so that other custom rules can invoke Swift",
"compilation and/or linking as part of their implementation.",
],
)

write_file(
name = "aspects_header",
out = "aspects_header.vm",
content = [
"<!-- Generated with Stardoc, Do Not Edit! -->",
"# Aspects",
"",
"The aspects described below are used within the build rule implementations.",
"Clients interested in writing custom rules that interface with the rules/provides",
"in this package might needs them to provide some of the same information.",
"",
"On this page:",
"",
] + [" * [{0}](#{0})".format(r) for r in _DOC_SRCS["aspects"]] + [
"",
],
)

write_file(
name = "rules_header",
out = "rules_header.vm",
content = [
"<!-- Generated with Stardoc, Do Not Edit! -->",
"",
"${moduleDocstring}",
"On this page:",
"",
] + [" * [{0}](#{0})".format(r) for r in _DOC_SRCS["rules"]] + [
"",
],
)

write_file(
name = "providers_header",
out = "providers_header.vm",
content = [
"<!-- Generated with Stardoc, Do Not Edit! -->",
"",
"The providers described below are propagated and required by various Swift",
"build rules. Clients interested in writing custom rules that interface",
"with the rules in this package should use these providers to communicate",
"with the Swift build rules as needed.",
"",
"On this page:",
"",
] + [" * [{0}](#{0})".format(r) for r in _DOC_SRCS["providers"]] + [
"",
],
)

write_file(
name = "setup_header",
out = "setup_header.vm",
content = [
"<!-- Generated with Stardoc, Do Not Edit! -->",
"# Workspace Setup",
],
)

[
stardoc(
name = file + "_doc",
out = file + ".md_",
header_template = file + "_header.vm",
input = "//swift:swift.bzl",
symbol_names = symbols,
deps = ["//swift"],
)
for [
file,
symbols,
] in _DOC_SRCS.items()
]

stardoc(
name = "setup_doc",
out = "setup.md_",
header_template = "setup_header.vm",
input = "//swift:repositories.bzl",
deps = ["//swift:repositories"],
)

# To make these tests pass, run
# bazel run //doc:update
[
diff_test(
name = "test_" + file,
file1 = file + ".md_",
file2 = file + ".md",
)
for file in _DOC_SRCS.keys() + ["setup"]
]

write_file(
name = "gen_update",
out = "update.sh",
content = [
"#!/usr/bin/env bash",
"cd $BUILD_WORKSPACE_DIRECTORY",
] + [
"cp -fv bazel-bin/doc/{0}.md_ doc/{0}.md".format(
file,
)
for file in _DOC_SRCS.keys() + ["setup"]
],
)

sh_binary(
name = "update",
srcs = ["update.sh"],
data = [file + ".md_" for file in _DOC_SRCS.keys()],
)
Loading