Skip to content

Commit 3e16d4d

Browse files
authored
chore: remove legacy code and docs (#1179)
Remove docs and obsolete tests for legacy workspaces.
1 parent af74d06 commit 3e16d4d

File tree

7 files changed

+33
-219
lines changed

7 files changed

+33
-219
lines changed

README.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,14 @@ actions. See the [CI GitHub workflow] for more details.
6868

6969
The following provides a quick introduction on how to set up and use the features in this
7070
repository. These instructions assume that you are using [Bazel modules] to load your external
71-
dependencies. If you are using Bazel's legacy external dependency management, please review the
72-
[legacy quickstart], instead.
71+
dependencies. If you are using Bazel's legacy external dependency management, we recommend using
72+
[Bazel's hybrid mode], then follow the steps in this quickstart guide.
7373

7474
Also, check out the [examples] for more information.
7575

7676
### 1. Enable bzlmod
7777

78-
This repository supports [bzlmod]. While you can use this ruleset with [legacy `WORKSPACE`
79-
dependencies], some of the automation will not be available in this mode. If you are starting a new
80-
project, it is highly recommended to use [bzlmod]. To enable bzlmod, add the following to your
81-
`.bazelrc`.
78+
This repository supports [bzlmod].
8279

8380
```
8481
common --enable_bzlmod
@@ -89,9 +86,11 @@ common --enable_bzlmod
8986
Add a dependency on `rules_swift_package_manager`.
9087

9188
<!-- BEGIN MODULE SNIPPET -->
89+
9290
```python
9391
bazel_dep(name = "rules_swift_package_manager", version = "0.35.1")
9492
```
93+
9594
<!-- END MODULE SNIPPET -->
9695

9796
In addition, add the following to load the external dependencies described in your `Package.swift`
@@ -155,7 +154,8 @@ files, at this time.
155154

156155
### 4. Run `swift package update`
157156

158-
This will invoke Swift Package Manager and resolve all dependencies resulting in creation of Package.resolved file.
157+
This will invoke Swift Package Manager and resolve all dependencies resulting in creation of
158+
`Package.resolved` file.
159159

160160
### 5. Run `bazel mod tidy`.
161161

@@ -247,9 +247,8 @@ The following are a few tips to consider as you work with your repository:
247247
<!-- Links -->
248248

249249
[Bazel modules]: https://bazel.build/external/module
250+
[Bazel's hybrid mode]: https://bazel.build/external/migration#hybrid-mode
250251
[bzlmod]: https://bazel.build/external/overview#bzlmod
251-
[legacy `WORKSPACE` dependencies]: https://bazel.build/external/overview#workspace-system
252-
[legacy quickstart]: /docs/legacy_quickstart.md
253252
[our document on patching Swift packages]: docs/patch_swift_package.md
254253
[CI GitHub workflow]: .github/workflows/ci.yml
255254
[Gazelle plugin]: https://github.com/bazelbuild/bazel-gazelle/blob/master/extend.md

docs/README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
# Swift Bazel Documentation
1+
# `rules_swift_package_manager` Documentation
22

3-
- For information on how configure and use Swift Bazel, check out the [quickstart] and the [tips
4-
and tricks]. If you are using Bazel's legacy external dependency management system, please review
5-
the [legacy quickstart].
3+
- For information on how configure and use `rules_swift_package_manager`, check out the [quickstart]
4+
and the [tips and tricks].
65
- To view the Starlark API documentation, check out the [repository rules documentation] and the
76
[rules and macros documentation].
87
- If you are interested in learning more about the rules used to help build the external Swift
98
packages, check out the [internal rules and macros documentation].
109

1110
[quickstart]: /README.md#quickstart
12-
[legacy quickstart]: /docs/legacy_quickstart.md
1311
[repository rules documentation]: /docs/repository_rules_overview.md
1412
[rules and macros documentation]: /docs/rules_and_macros_overview.md
1513
[internal rules and macros documentation]: /docs/internal_rules_and_macros_overview.md

docs/legacy_quickstart.md

-139
This file was deleted.

examples/BUILD.bazel

+8-24
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
load("@bazel_binaries//:defs.bzl", "bazel_binaries")
22
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
33
load("@cgrindel_bazel_starlib//bzllib:defs.bzl", "lists")
4-
load("@cgrindel_bazel_starlib//shlib/rules:execute_binary.bzl", "execute_binary")
54
load(
65
"@rules_bazel_integration_test//bazel_integration_test:defs.bzl",
76
"integration_test_utils",
@@ -28,13 +27,6 @@ sh_binary(
2827
],
2928
)
3029

31-
execute_binary(
32-
name = "legacy_test_runner",
33-
testonly = True,
34-
arguments = ["--legacy"],
35-
binary = ":test_runner",
36-
)
37-
3830
# MARK: - Integration Tests
3931

4032
[
@@ -48,27 +40,19 @@ example_infos.ci_test_params_suite(
4840
)
4941

5042
_smoke_test_names = sorted(lists.flatten([
51-
[
52-
example_infos.test_name(
53-
ei.name,
54-
enable_bzlmod,
55-
bazel_binaries.versions.current,
56-
)
57-
for enable_bzlmod in ei.enable_bzlmods
58-
]
43+
example_infos.test_name(
44+
ei.name,
45+
bazel_binaries.versions.current,
46+
)
5947
for ei in example_infos.all
6048
]))
6149

6250
_all_test_names = sorted(lists.flatten([
6351
[
64-
[
65-
example_infos.test_name(
66-
ei.name,
67-
enable_bzlmod,
68-
version,
69-
)
70-
for enable_bzlmod in ei.enable_bzlmods
71-
]
52+
example_infos.test_name(
53+
ei.name,
54+
version,
55+
)
7256
for version in ei.versions
7357
]
7458
for ei in example_infos.all

examples/example_infos.bzl

+14-16
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@ def _new(name, oss, versions, enable_bzlmods):
3434
enable_bzlmods = enable_bzlmods,
3535
)
3636

37-
def _test_name_prefix(name, enable_bzlmod = True):
38-
suffix = "_test" if enable_bzlmod else "_legacy_test"
39-
return name + suffix
37+
def _test_name_prefix(name):
38+
return name + "_test"
4039

41-
def _test_name(example_name, enable_bzlmod, version):
40+
def _test_name(example_name, version):
4241
return integration_test_utils.bazel_integration_test_name(
43-
_test_name_prefix(example_name, enable_bzlmod = enable_bzlmod),
42+
_test_name_prefix(example_name),
4443
version,
4544
)
4645

@@ -58,9 +57,11 @@ def _bazel_integration_test(ei):
5857
]
5958
workspace_path = ei.name
6059
for enable_bzlmod in ei.enable_bzlmods:
61-
test_runner = ":test_runner" if enable_bzlmod else ":legacy_test_runner"
60+
if not enable_bzlmod:
61+
fail("The {name} example still has legacy test enabled.".format(name = ei.name))
62+
test_runner = ":test_runner"
6263
bazel_integration_tests(
63-
name = _test_name_prefix(ei.name, enable_bzlmod = enable_bzlmod),
64+
name = _test_name_prefix(ei.name),
6465
bazel_binaries = bazel_binaries,
6566
bazel_versions = ei.versions,
6667
tags = integration_test_utils.DEFAULT_INTEGRATION_TEST_TAGS + [
@@ -76,17 +77,17 @@ def _bazel_integration_test(ei):
7677
workspace_path = workspace_path,
7778
)
7879
for version in ei.versions:
79-
_ci_integration_test_params(ei, enable_bzlmod, version)
80+
_ci_integration_test_params(ei, version)
8081

81-
def _test_params_name(name, enable_bzlmod, version):
82-
test_name = _test_name(name, enable_bzlmod, version)
82+
def _test_params_name(name, version):
83+
test_name = _test_name(name, version)
8384
return _test_params_name_from_test_name(test_name)
8485

8586
def _test_params_name_from_test_name(test_name):
8687
return "{}_params".format(test_name)
8788

88-
def _ci_integration_test_params(ei, enable_bzlmod, version):
89-
test_name = _test_name(ei.name, enable_bzlmod, version)
89+
def _ci_integration_test_params(ei, version):
90+
test_name = _test_name(ei.name, version)
9091
ci_integration_test_params(
9192
name = _test_params_name_from_test_name(test_name),
9293
oss = ei.oss,
@@ -99,10 +100,7 @@ def _ci_test_params_suite(name, example_infos):
99100
name = name,
100101
test_params = lists.flatten([
101102
[
102-
[
103-
_test_params_name(ei.name, eb, v)
104-
for eb in ei.enable_bzlmods
105-
]
103+
_test_params_name(ei.name, v)
106104
for v in ei.versions
107105
]
108106
for ei in example_infos

examples/test_runner.sh

-22
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,6 @@ create_scratch_dir_sh="$(rlocation "${create_scratch_dir_sh_location}")" || \
2525

2626
# MARK - Process Arguments
2727

28-
legacy_mode=false
29-
while (("$#")); do
30-
case "${1}" in
31-
"--legacy")
32-
legacy_mode=true
33-
shift 1
34-
;;
35-
"--nolegacy")
36-
legacy_mode=false
37-
shift 1
38-
;;
39-
*)
40-
args+=("${1}")
41-
shift 1
42-
;;
43-
esac
44-
done
45-
4628
bazel="${BIT_BAZEL_BINARY:-}"
4729
workspace_dir="${BIT_WORKSPACE_DIR:-}"
4830

@@ -54,10 +36,6 @@ workspace_dir="${BIT_WORKSPACE_DIR:-}"
5436
scratch_dir="$("${create_scratch_dir_sh}" --workspace "${workspace_dir}")"
5537
cd "${scratch_dir}"
5638

57-
if [[ "${legacy_mode}" == "true" ]]; then
58-
echo "build --config=legacy" >> .bazelrc
59-
fi
60-
6139
# Dump Bazel info
6240
echo "=== Output Bazel info ==="
6341
"${bazel}" info

shared.bazelrc

-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ build --bes_upload_mode=fully_async
4141
run --bes_backend=
4242
run --bes_results_url=
4343

44-
# Configuration group to run using legacy WORKSPACE
45-
common:legacy --noenable_bzlmod
46-
build:legacy --no@cgrindel_bazel_starlib//bzlmod:enabled
47-
4844
# Configure Apple CC toolchain
4945
# https://github.com/bazelbuild/apple_support#toolchain-setup
5046
build --enable_platform_specific_config

0 commit comments

Comments
 (0)