Skip to content

Commit 6fff54d

Browse files
committed
Use swift-docc-render-artifact instead of building swift-docc-render
1 parent f662d50 commit 6fff54d

File tree

8 files changed

+30
-149
lines changed

8 files changed

+30
-149
lines changed

utils/build-presets.ini

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -887,21 +887,6 @@ mixin-preset=
887887
buildbot_linux
888888
mixin_buildbot_linux,no_test
889889

890-
# Linux buidbot that include Swift-DocC-Render.
891-
[preset: buildbot_linux,swiftdoccrender]
892-
mixin-preset=buildbot_linux
893-
894-
swiftdoccrender
895-
install-swiftdoccrender
896-
897-
# Linux buidbot without tests that include Swift-DocC-Render.
898-
[preset: buildbot_linux,swiftdoccrender,no_test]
899-
mixin-preset=buildbot_linux,no_test
900-
901-
swiftdoccrender
902-
install-swiftdoccrender
903-
skip-test-swiftdoccrender
904-
905890
[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build]
906891
mixin-preset=
907892
mixin_lightweight_assertions,no-stdlib-asserts
@@ -1448,36 +1433,6 @@ mixin-preset=
14481433
mixin_buildbot_osx_package,no_test
14491434
mixin_osx_package,use_os_runtime
14501435

1451-
# macOS package that include Swift-DocC-Render.
1452-
[preset: buildbot_osx_package,swiftdoccrender]
1453-
mixin-preset=buildbot_osx_package
1454-
1455-
swiftdoccrender
1456-
install-swiftdoccrender
1457-
1458-
# macOS package without tests that include Swift-DocC-Render.
1459-
[preset: buildbot_osx_package,swiftdoccrender,no_test]
1460-
mixin-preset=buildbot_osx_package,no_test
1461-
1462-
swiftdoccrender
1463-
install-swiftdoccrender
1464-
skip-test-swiftdoccrender
1465-
1466-
# macOS package that use the OS runtime and include Swift-DocC-Render.
1467-
[preset: buildbot_osx_package,swiftdoccrender,use_os_runtime]
1468-
mixin-preset=buildbot_osx_package,use_os_runtime
1469-
1470-
swiftdoccrender
1471-
install-swiftdoccrender
1472-
1473-
# macOS package without tests that use the OS runtime and include Swift-DocC-Render.
1474-
[preset: buildbot_osx_package,swiftdoccrender,no_test,use_os_runtime]
1475-
mixin-preset=buildbot_osx_package,no_test,use_os_runtime
1476-
1477-
swiftdoccrender
1478-
install-swiftdoccrender
1479-
skip-test-swiftdoccrender
1480-
14811436
#===------------------------------------------------------------------------===#
14821437
# LLDB build configurations
14831438
#

utils/build-toolchain

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ DRY_RUN=
5050
BUNDLE_PREFIX=
5151
PRESET_FILE_FLAGS=
5252
PRESET_PREFIX=
53-
SWIFT_DOCC_RENDER=
5453
NO_TEST=",no_test"
5554
USE_OS_RUNTIME=
5655

@@ -95,9 +94,6 @@ while [ $# -ne 0 ]; do
9594
;;
9695
--use-os-runtime)
9796
USE_OS_RUNTIME=",use_os_runtime"
98-
;;
99-
--swift-docc-render)
100-
SWIFT_DOCC_RENDER=",swiftdoccrender"
10197
;;
10298
-h|--help)
10399
usage
@@ -149,7 +145,7 @@ SCCACHE_FLAG="${SCCACHE_FLAG}"
149145

150146
./utils/build-script ${DRY_RUN} ${DISTCC_FLAG} ${PRESET_FILE_FLAGS} \
151147
${SCCACHE_FLAG} \
152-
--preset="${PRESET_PREFIX}${SWIFT_PACKAGE}${SWIFT_DOCC_RENDER}${NO_TEST}${USE_OS_RUNTIME}" \
148+
--preset="${PRESET_PREFIX}${SWIFT_PACKAGE}${NO_TEST}${USE_OS_RUNTIME}" \
153149
install_destdir="${SWIFT_INSTALL_DIR}" \
154150
installable_package="${SWIFT_INSTALLABLE_PACKAGE}" \
155151
install_toolchain_dir="${SWIFT_TOOLCHAIN_DIR}" \

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ def _apply_default_arguments(args):
194194
args.test_swiftevolve = False
195195
args.test_toolchainbenchmarks = False
196196
args.test_swiftdocc = False
197-
args.test_swiftdoccrender = False
198197

199198
# --test implies --test-early-swift-driver
200199
# (unless explicitly skipped with `--skip-test-early-swift-driver`)
@@ -636,8 +635,6 @@ def create_argument_parser():
636635
help='build swift-driver')
637636
option(['--swiftdocc'], toggle_true('build_swiftdocc'),
638637
help='build Swift DocC')
639-
option(['--swiftdoccrender'], toggle_true('build_swiftdoccrender'),
640-
help='build Swift DocC Render')
641638

642639
option(['--skip-early-swift-driver'], toggle_false('build_early_swift_driver'),
643640
help='skip building the early swift-driver')
@@ -668,8 +665,6 @@ def create_argument_parser():
668665
help='install SwiftEvolve')
669666
option(['--install-swiftdocc'], toggle_true('install_swiftdocc'),
670667
help='install Swift DocC')
671-
option(['--install-swiftdoccrender'], toggle_true('install_swiftdoccrender'),
672-
help='install Swift DocC Render')
673668
option(['--toolchain-benchmarks'],
674669
toggle_true('build_toolchainbenchmarks'),
675670
help='build Swift Benchmarks using swiftpm against the just built '
@@ -1131,8 +1126,6 @@ def create_argument_parser():
11311126
help='skip testing swift_inspect')
11321127
option('--skip-test-swiftdocc', toggle_false('test_swiftdocc'),
11331128
help='skip testing swift-docc')
1134-
option('--skip-test-swiftdoccrender', toggle_false('test_swiftdoccrender'),
1135-
help='skip testing swift-docc-render')
11361129

11371130
# -------------------------------------------------------------------------
11381131
in_group('Build settings specific for LLVM')

utils/build_swift/tests/expected_options.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
'build_swiftformat': False,
9898
'build_swiftevolve': False,
9999
'build_swiftdocc': False,
100-
'build_swiftdoccrender': False,
101100
'build_indexstoredb': False,
102101
'test_indexstoredb_sanitize_all': False,
103102
'test_sourcekitlsp_sanitize_all': False,
@@ -106,7 +105,6 @@
106105
'install_swiftsyntax': False,
107106
'install_swift_driver': False,
108107
'install_swiftdocc': False,
109-
'install_swiftdoccrender': False,
110108
'swiftsyntax_verify_generated_files': False,
111109
'install_playgroundsupport': False,
112110
'install_sourcekitlsp': False,
@@ -267,7 +265,6 @@
267265
'test_swiftformat': False,
268266
'test_swiftevolve': False,
269267
'test_swiftdocc': False,
270-
'test_swiftdoccrender': False,
271268
'test_toolchainbenchmarks': False,
272269
'tvos': False,
273270
'tvos_all': False,
@@ -516,7 +513,6 @@ class BuildScriptImplOption(_BaseOption):
516513
SetTrueOption('--swiftformat', dest='build_swiftformat'),
517514
SetTrueOption('--swiftevolve', dest='build_swiftevolve'),
518515
SetTrueOption('--swiftdocc', dest='build_swiftdocc'),
519-
SetTrueOption('--swiftdoccrender', dest='build_swiftdoccrender'),
520516
SetTrueOption('-B', dest='benchmark'),
521517
SetTrueOption('-S', dest='skip_build'),
522518
SetTrueOption('-b', dest='build_llbuild'),
@@ -572,7 +568,6 @@ class BuildScriptImplOption(_BaseOption):
572568
EnableOption('--install-skstresstester', dest='install_skstresstester'),
573569
EnableOption('--install-swiftevolve', dest='install_swiftevolve'),
574570
EnableOption('--install-swiftdocc', dest='install_swiftdocc'),
575-
EnableOption('--install-swiftdoccrender', dest='install_swiftdoccrender'),
576571
EnableOption('--toolchain-benchmarks', dest='build_toolchainbenchmarks'),
577572
EnableOption('--swift-inspect', dest='build_swift_inspect'),
578573
EnableOption('--tsan-libdispatch-test'),
@@ -655,7 +650,6 @@ class BuildScriptImplOption(_BaseOption):
655650
DisableOption('--skip-test-swiftformat', dest='test_swiftformat'),
656651
DisableOption('--skip-test-swiftevolve', dest='test_swiftevolve'),
657652
DisableOption('--skip-test-swiftdocc', dest='test_swiftdocc'),
658-
DisableOption('--skip-test-swiftdoccrender', dest='test_swiftdoccrender'),
659653
DisableOption('--skip-test-toolchain-benchmarks',
660654
dest='test_toolchainbenchmarks'),
661655
DisableOption('--skip-test-swift-inspect',

utils/swift_build_support/swift_build_support/build_script_invocation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def compute_product_pipelines(self):
608608
builder.add_product(products.SwiftDocC,
609609
is_enabled=self.args.build_swiftdocc)
610610
builder.add_product(products.SwiftDocCRender,
611-
is_enabled=self.args.build_swiftdoccrender)
611+
is_enabled=self.args.install_swiftdocc)
612612

613613
# Keep SwiftDriver at last.
614614
# swift-driver's integration with the build scripts is not fully

utils/swift_build_support/swift_build_support/products/swiftdocc.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -99,55 +99,8 @@ def install(self, host_target):
9999

100100
additional_params = ['--install-dir', install_dir]
101101

102-
# PLEASE READ:
103-
# The code below does something different than other build-script products do.
104-
#
105-
# Installing swift-docc without also building swift-docc-render will find the
106-
# already built swift-docc-render template in the host toolchain and copy it
107-
# over to the install toolchain.
108-
# This allows developers with local swift-docc changes but no swift-docc-render
109-
# changes to build and run their swift-docc changes without requiring 'node'
110-
# which is required to build and install swift-docc-render from source.
111-
# (Displaying the output from swift-docc with built swift-docc-render template
112-
# doesn't require 'node' or other tools.)
113-
if not self.args.build_swiftdoccrender:
114-
# swift-docc and swift-docc-render are expected to come in pairs.
115-
# When building swift-docc without building swift-docc-render,
116-
# attempt to copy the prebuilt swift-docc-render from the host toolchain.
117-
docc_path = self.toolchain.find_tool("docc")
118-
if docc_path is None:
119-
warn_msg = 'Host toolchain could not locate an prebuilt'\
120-
'swift-docc-render to copy.'\
121-
'(Use `--swiftdoccrender` to build swift-docc-render)'
122-
print('-- Warning: {}', warn_msg)
123-
else:
124-
additional_params.append('--copy-doccrender-from')
125-
# Drop two path components from the docc path to get to the `/usr/` dir.
126-
host_toolchain_path = os.path.dirname(os.path.dirname(docc_path))
127-
# Get the location of the swift-docc-render in the host toolchain.
128-
built_render_dir = self.get_render_install_destdir(
129-
host_toolchain_path)
130-
additional_params.append(built_render_dir)
131-
132-
additional_params.append('--copy-doccrender-to')
133-
# Get the install location of the swift-docc-render in the install
134-
# toolchain.
135-
render_install_dir = self.get_render_install_destdir(
136-
install_toolchain_path)
137-
additional_params.append(render_install_dir)
138-
note_msg = 'Copying already built swift-docc-render output '\
139-
'from %s to %s.' % (built_render_dir, render_install_dir)
140-
print('-- Note: {}', note_msg)
141-
142102
self.run_build_script_helper('install', host_target, additional_params)
143103

144-
# This is defined on swift-docc to avoid a circular import.
145-
@classmethod
146-
def get_render_install_destdir(cls, toolchain_install_dir):
147-
# swift-docc-render is installed at '/usr/share/docc/render' in the built
148-
# toolchain.
149-
return os.path.join(toolchain_install_dir, 'share', 'docc', 'render')
150-
151104
@classmethod
152105
def get_dependencies(cls):
153106
return [cmark.CMark,

utils/swift_build_support/swift_build_support/products/swiftdoccrender.py

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import os
1414

1515
from . import product
16-
from . import swiftdocc
1716
from .. import shell
1817

1918

@@ -24,7 +23,7 @@ def product_source_name(cls):
2423
2524
The name of the source code directory of this product.
2625
"""
27-
return "swift-docc-render"
26+
return "swift-docc-render-artifact"
2827

2928
@classmethod
3029
def is_build_script_impl_product(cls):
@@ -38,41 +37,32 @@ def is_before_build_script_impl_product(cls):
3837
def is_swiftpm_unified_build_product(cls):
3938
return False
4039

41-
def run_build_script_helper(self, action, host_target, additional_params=[]):
42-
script_path = os.path.join(
43-
self.source_dir, 'build-script-helper.py')
44-
45-
helper_cmd = [
46-
script_path,
47-
action
48-
]
49-
if self.args.verbose_build:
50-
helper_cmd.append('--verbose')
51-
helper_cmd.extend(additional_params)
52-
53-
shell.call(helper_cmd)
54-
5540
def should_build(self, host_target):
56-
return True
57-
58-
def build(self, host_target):
59-
self.run_build_script_helper('build', host_target)
41+
# Swift-DocC-Render is a pre-built, installable artifact.
42+
return False
6043

6144
def should_test(self, host_target):
62-
return self.args.test_swiftdoccrender
63-
64-
def test(self, host_target):
65-
self.run_build_script_helper('test', host_target)
45+
# Swift-DocC-Render is a pre-built, installable artifact.
46+
return False
6647

6748
def should_install(self, host_target):
68-
return self.args.install_swiftdoccrender
49+
# Swift-DocC-Render should always be installed if Swift-DocC is being installed
50+
return self.args.install_swiftdocc
6951

7052
def install(self, host_target):
71-
install_dir = swiftdocc.SwiftDocC.get_render_install_destdir(
72-
self.install_toolchain_path(host_target))
73-
additional_params = ['--install-dir', install_dir]
74-
self.run_build_script_helper('install', host_target, additional_params)
75-
76-
@classmethod
77-
def get_dependencies(cls):
78-
return [swiftdocc.SwiftDocC]
53+
# Swift-DocC-Render is installed at '/usr/share/docc/render' in the built
54+
# toolchain.
55+
install_toolchain_path = self.install_toolchain_path(host_target)
56+
install_path = os.path.join(install_toolchain_path, 'share', 'docc', 'render')
57+
58+
# The pre-built version of Swift-DocC-Render is distributed in the 'dist'
59+
# folder at the root of the swift-docc-render-artifact repository
60+
artifact_dist_path = os.path.join(self.source_dir, 'dist')
61+
62+
# Add a trailing slash so that we copy the contents of the 'dist' directory
63+
# instead of the 'dist' directory itself.
64+
artifact_dist_path_with_trailing_slash = os.path.join(artifact_dist_path, '')
65+
66+
shell.call(["mkdir", "-p", install_path])
67+
shell.call(
68+
["rsync", "-a", artifact_dist_path_with_trailing_slash, install_path])

utils/update_checkout/update-checkout-config.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"remote": { "id": "apple/swift-docc" } },
6666
"swift-lmdb": {
6767
"remote": { "id": "apple/swift-lmdb" } },
68-
"swift-docc-render": {
69-
"remote": { "id": "apple/swift-docc-render" } },
68+
"swift-docc-render-artifact": {
69+
"remote": { "id": "apple/swift-docc-render-artifact" } },
7070
"swift-docc-symbolkit": {
7171
"remote": { "id": "apple/swift-docc-symbolkit" } },
7272
"swift-markdown": {
@@ -115,7 +115,7 @@
115115
"swift-installer-scripts": "main",
116116
"swift-docc": "main",
117117
"swift-lmdb": "main",
118-
"swift-docc-render": "main",
118+
"swift-docc-render-artifact": "main",
119119
"swift-docc-symbolkit": "main",
120120
"swift-markdown": "main",
121121
"swift-cmark-gfm": "gfm",
@@ -152,7 +152,7 @@
152152
"swift-installer-scripts": "main",
153153
"swift-docc": "main",
154154
"swift-lmdb": "main",
155-
"swift-docc-render": "main",
155+
"swift-docc-render-artifact": "main",
156156
"swift-docc-symbolkit": "main",
157157
"swift-markdown": "main",
158158
"swift-cmark-gfm": "gfm",
@@ -189,7 +189,7 @@
189189
"swift-installer-scripts": "main",
190190
"swift-docc": "main",
191191
"swift-lmdb": "main",
192-
"swift-docc-render": "main",
192+
"swift-docc-render-artifact": "main",
193193
"swift-docc-symbolkit": "main",
194194
"swift-markdown": "main",
195195
"swift-cmark-gfm": "gfm",

0 commit comments

Comments
 (0)