Skip to content

Commit 0f2aa03

Browse files
shahmishalcmcgee1024airspeedswiftBen Cohenegernst
authored andcommitted
[install] Add Swiftly to the install page (#830)
* [install] Add Swiftly to the install page under beta/preview * Adjust the download URLs and instructions to support upcoming swiftly preview release (#857) * Swiftly preview (#866) * Adjust the download URLs and instructions to support upcoming swiftly preview release * Correct the swiftly download URLs --------- Co-authored-by: Mishal Shah <shahmishal@users.noreply.github.com> * Update swiftly install pages (#887) * Tweak wording, replace mac package option with Swiftly * Wording tweaks for Linux, raise Docker prominence. --------- Co-authored-by: Ben Cohen <ben@airspeedvelo.city> * container install directions (#888) Signed-off-by: Eric Ernst <eric_ernst@apple.com> * Update _includes/install/_linux_platforms_tabs.md * Update the install command for Swiftly * Update the Getting started pages for Swiftly * Add copy code button * Shoe copy button only at code block hover * Add copy button for Linux * Don't jump to the platforms on linux page * Fix swiftly macos GSG instructions to remove unnecessary paragraph (#926) * Update swiftly install one-liner and instructions (#936) * Update the one-liners to explicitly set a swiftly home dir so that the source line works. Update the swiftly path for macOS based on installer changes * Add notes about the environment variables and install location customization * Fix awkward wording in install note. * Fix awkward wording in macOS install note * Adjust the one-liners and installation pages for macOS and Linux * Update the install command to use latest swiftly installer --------- Signed-off-by: Eric Ernst <eric_ernst@apple.com> Co-authored-by: Chris McGee <87777443+cmcgee1024@users.noreply.github.com> Co-authored-by: Ben Cohen <airspeedswift@users.noreply.github.com> Co-authored-by: Ben Cohen <ben@airspeedvelo.city> Co-authored-by: Eric Ernst <eric.g.ernst@gmail.com> Co-authored-by: Federico Bucchi <b.federico@gmail.com>
1 parent 5f77f09 commit 0f2aa03

File tree

9 files changed

+305
-33
lines changed

9 files changed

+305
-33
lines changed

_data/builds/swiftly_release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
version: "0.4.0"
1+
version: "1.0.0"
22
platforms:
33
- platform: Linux
4-
x86_64: "https://download.swift.org/swiftly/linux/swiftly-0.4.0-x86_64.tar.gz"
5-
arm64: "https://download.swift.org/swiftly/linux/swiftly-0.4.0-aarch64.tar.gz"
4+
x86_64: "https://download.swift.org/swiftly/linux/swiftly-1.0.0-x86_64.tar.gz"
5+
arm64: "https://download.swift.org/swiftly/linux/swiftly-1.0.0-aarch64.tar.gz"
66
- platform: Darwin
7-
x86_64: "https://download.swift.org/swiftly/darwin/swiftly-0.4.0.pkg"
8-
arm64: "https://download.swift.org/swiftly/darwin/swiftly-0.4.0.pkg"
7+
x86_64: "https://download.swift.org/swiftly/darwin/swiftly-1.0.0.pkg"
8+
arm64: "https://download.swift.org/swiftly/darwin/swiftly-1.0.0.pkg"

_includes/install/_linux_platforms_tabs.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
## Latest Release
2+
<ul class="grid-level-0 grid-layout-1-column">
3+
<li class="grid-level-1 featured">
4+
<h3>Swiftly (recommended)</h3>
5+
<p class="description">
6+
The Swiftly installer manages Swift and its dependencies. It supports switching between different versions and downloading updates.
7+
</p>
8+
<h4>Run this in a terminal:</h4>
9+
<div class="language-plaintext highlighter-rouge"><div class="highlight"><button>Copy</button><pre class="highlight"><code>curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz &amp;&amp; \
10+
tar zxf swiftly-$(uname -m).tar.gz &amp;&amp; \
11+
./swiftly init --quiet-shell-followup &amp;&amp; \
12+
. ~/.local/share/swiftly/env.sh &amp;&amp; \
13+
hash -r
14+
</code></pre></div></div>
15+
<h4>License: <a href="https://raw.githubusercontent.com/swiftlang/swiftly/refs/heads/main/LICENSE.txt">Apache-2.0</a> | PGP: <a href="https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz.sig">Signature</a></h4>
16+
<a href="/install/linux/swiftly" class="cta-secondary">Instructions</a>
17+
</li>
18+
</ul>
19+
<ul class="grid-level-0 grid-layout-1-column">
20+
<li class="grid-level-1">
21+
<h3>Container</h3>
22+
<p class="description">
23+
If you prefer a containerized environment, you can download the official container images for compiling and running Swift on a variety of distributions.
24+
</p>
25+
<a href="https://hub.docker.com/_/swift" class="cta-secondary external">Docker Hub</a>
26+
<a href="/install/linux/docker" class="cta-secondary">Instructions</a>
27+
</li>
28+
</ul>
29+
30+
## Alternate installation options
31+
132
<p id="platforms">Select Linux platform:</p>
233

334
<div class="interactive-tabs os">

_includes/install/_os_tabs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Follow the instructions below to install the latest version of Swift on a [suppo
33
<div class="interactive-tabs os">
44
<div class="tabs">
55
<a href="/install/macos" aria-pressed="{{ include.macos }}">macOS</a>
6-
<a href="/install/linux#platforms" aria-pressed="{{ include.linux }}">Linux</a>
6+
<a href="/install/linux" aria-pressed="{{ include.linux }}">Linux</a>
77
<a href="/install/windows" aria-pressed="{{ include.windows }}">Windows</a>
88
</div>
99
</div>

assets/javascripts/application.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,24 @@
102102
}
103103
});
104104
}
105+
106+
if (navigator && navigator.clipboard) {
107+
const copyCodeButtons = document.querySelectorAll('[class^="language-"] button');
108+
109+
copyCodeButtons.forEach(function(button) {
110+
const codeElement = button.parentElement.querySelector('code');
111+
const originalText = button.innerText;
112+
113+
button.addEventListener('mousedown', async function() {
114+
await navigator.clipboard.writeText(codeElement.innerText);
115+
116+
button.innerText = 'Copied!';
117+
118+
setTimeout(() => {
119+
button.innerText = originalText;
120+
}, 1000);
121+
});
122+
});
123+
}
105124
});
106125
})();

assets/stylesheets/elements/_grid.scss

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
}
7878

7979
// Button typically embedded in a grid-level-1
80-
a.cta-secondary {
80+
a.cta-secondary, [class^="language-"] button {
8181
background-color: var(--color-fill-tertiary);
8282
border: 1px solid var(--color-fill-quaternary);
8383
border-radius: var(--border-radius);
@@ -111,3 +111,22 @@ a.cta-secondary {
111111
content: "";
112112
}
113113
}
114+
115+
div.highlight {
116+
position: relative;
117+
118+
&:hover button {
119+
display: block;
120+
}
121+
}
122+
123+
[class^="language-"] button {
124+
cursor: pointer;
125+
padding: 0.1rem 0.4rem;
126+
font-size: 0.8rem;
127+
position: absolute;
128+
right: 0.4rem;
129+
top: 0.4rem;
130+
margin: 0;
131+
display: none;
132+
}

install/linux/index.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,5 @@ label: install-linux
55
atom: true
66
---
77

8-
{% capture banner-section %}
9-
<div class="grid-1-cols" markdown=1>
10-
<h1>Install Swift</h1>
11-
{% include new-includes/components/tabs.html
12-
group="1"
13-
default="Linux"
14-
tabs=site.data.new-data.install.os
15-
%}
16-
</div>
17-
{% endcapture %}
18-
{% include new-includes/components/section.html
19-
content=banner-section
20-
%}
8+
{% include install/_os_tabs.md linux="true" %}
9+
{% include install/_linux_platforms_tabs.md %}

install/linux/swiftly/index.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
layout: page
3+
title: Getting Started with Swiftly on Linux
4+
---
5+
6+
Download swiftly for [Linux (Intel)](https://download.swift.org/swiftly/linux/swiftly-{{ site.data.builds.swiftly_release.version }}-x86_64.tar.gz), or [Linux (ARM)](https://download.swift.org/swiftly/linux/swiftly-{{ site.data.builds.swiftly_release.version }}-aarch64.tar.gz).
7+
8+
```
9+
curl -O https://download.swift.org/swiftly/linux/swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz
10+
```
11+
12+
You can verify the integrity of the archive using the PGP signature. This will download the signature, install the swift.org signatures into your keychain, and verify the signature.
13+
14+
```
15+
curl https://www.swift.org/keys/all-keys.asc | gpg --import -
16+
curl -O https://download.swift.org/swiftly/linux/swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz.sig
17+
gpg --verify swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz.sig swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz
18+
```
19+
20+
Extract the archive.
21+
22+
```
23+
tar -zxf swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz
24+
```
25+
26+
Run the following command in your terminal, to configure swiftly for your account, and automatically download the latest swift toolchain.
27+
28+
```
29+
./swiftly init
30+
```
31+
32+
Note: You can set the SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR environment variables to customize your install location.
33+
34+
Your current shell may need some additional steps to update your session. Follow the guidance at the end of the installation for a smooth install experience, such as sourcing the environment file, and rehashing your shell's PATH.
35+
36+
There can be certain packages that need to be installed on your system so that the Swift toolchain can function. The swiftly initialization routine will show you how to install any missing packages.
37+
38+
Now that swiftly and swift are installed, you can access the `swift` command from the latest Swift release:
39+
40+
```
41+
swift --version
42+
--
43+
Swift version {{ site.data.builds.swift_releases.last.name }} (swift-{{ site.data.builds.swift_releases.last.name }}-RELEASE)
44+
Target: x86_64-unknown-linux-gnu
45+
```
46+
47+
Or, you can install (and use) another swift release:
48+
49+
```
50+
swiftly install --use 5.10
51+
swift --version
52+
--
53+
Swift version 5.10 (swift-5.10-RELEASE)
54+
Target: x86_64-unknown-linux-gnu
55+
```
56+
57+
There's also an option to install the latest snapshot release and get access to the latest features:
58+
59+
```
60+
swiftly install --use main-snapshot
61+
```
62+
63+
Check for updates to swiftly and install them by running the self-update command:
64+
65+
```
66+
swiftly self-update
67+
```
68+
69+
You can discover more about swiftly in the [documentation](https://www.swift.org/swiftly/documentation/swiftlydocs/)

install/macos/index.md

Lines changed: 101 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,104 @@ label: install-macos
55
atom: true
66
---
77

8-
{% capture banner-section %}
9-
<div class="grid-1-cols" markdown=1>
10-
<h1>Install Swift</h1>
11-
{% include new-includes/components/tabs.html
12-
group="1"
13-
default="macOS"
14-
tabs=site.data.new-data.install.os
15-
%}
16-
</div>
17-
{% endcapture %}
18-
{% include new-includes/components/section.html
19-
content=banner-section
20-
%}
8+
{% include install/_os_tabs.md macos="true" %}
9+
10+
## Latest Release
11+
<ul class="grid-level-0 grid-layout-1-column">
12+
<li class="grid-level-1 featured">
13+
<h3>Swiftly</h3>
14+
<p class="description">
15+
To download toolchains from Swift.org, use the Swiftly toolchain installer. Swift.org toolchains include experimental features like Embedded Swift and support for WebAssembly.
16+
</p>
17+
<h4>Run this in a terminal:</h4>
18+
<div class="language-plaintext highlighter-rouge"><div class="highlight"><button>Copy</button><pre class="highlight"><code>curl -O https://download.swift.org/swiftly/darwin/swiftly.pkg &amp;&amp; \
19+
installer -pkg swiftly.pkg -target CurrentUserHomeDirectory &amp;&amp; \
20+
~/.swiftly/bin/swiftly init --quiet-shell-followup &amp;&amp; \
21+
. ~/.swiftly/env.sh &amp;&amp; \
22+
hash -r
23+
</code></pre></div></div>
24+
<h4>License: <a href="https://raw.githubusercontent.com/swiftlang/swiftly/refs/heads/main/LICENSE.txt">Apache-2.0</a></h4>
25+
<a href="/install/macos/swiftly" class="cta-secondary">Instructions</a>
26+
</li>
27+
</ul>
28+
<ul class="grid-level-0 grid-layout-1-column">
29+
<li class="grid-level-1">
30+
<h3>Xcode</h3>
31+
<p class="description">
32+
To develop with Swift for Apple platforms, download the latest version of Xcode, which is regularly refreshed with the latest Swift toolchain.
33+
</p>
34+
<a href="https://developer.apple.com/xcode/" class="cta-secondary external">Install Xcode</a>
35+
</li>
36+
</ul>
37+
38+
39+
## Other Install Options
40+
<ul class="grid-level-0 grid-layout-2-column">
41+
<li class="grid-level-1">
42+
<h3>Package Installer</h3>
43+
<p class="description">
44+
The toolchain package installer (.pkg) that Swiftly automates is available as a stand-alone download.
45+
</p>
46+
<a href="https://download.swift.org/{{ site.data.builds.swift_releases.last.tag | downcase }}/xcode/{{ site.data.builds.swift_releases.last.tag }}/{{ site.data.builds.swift_releases.last.tag }}-osx.pkg" class="cta-secondary">Download Toolchain</a>
47+
<a href="/install/macos/package_installer" class="cta-secondary">Instructions</a>
48+
</li>
49+
{% include install/_static_sdk_release.md %}
50+
</ul>
51+
52+
<details class="download" style="margin-bottom: 0;">
53+
<summary>Older Releases</summary>
54+
{% include_relative _older-releases.md %}
55+
</details>
56+
57+
<hr>
58+
59+
## Development Snapshots
60+
61+
Swift snapshots are prebuilt binaries that are automatically created from the branch. These snapshots are not official releases. They have gone through automated unit testing, but they have not gone through the full testing that is performed for official releases.
62+
63+
The easiest way to install development snapshots is with the Swiftly tool. Read more on the [instructions page](/install/macos/swiftly).
64+
65+
{% assign xcode_dev_builds = site.data.builds.development.xcode | sort: 'date' | reverse %}
66+
{% assign xcode_6_1_builds = site.data.builds.swift-6_1-branch.xcode | sort: 'date' | reverse %}
67+
68+
<h3>Toolchain</h3>
69+
<ul class="grid-level-0 grid-layout-2-column">
70+
<li class="grid-level-1">
71+
<h3>main</h3>
72+
<p class="description" style="font-size: 14px;">
73+
<time datetime="{{ xcode_dev_builds.first.date | date_to_xmlschema }}" title="{{ xcode_dev_builds.first.date | date: '%B %-d, %Y %l:%M %p (%Z)' }}">{{ xcode_dev_builds.first.date | date: '%B %-d, %Y' }}</time>
74+
</p>
75+
<p class="description">
76+
Toolchain package installer (.pkg)
77+
<ul>
78+
<li><a href="https://download.swift.org/development/xcode/{{ xcode_dev_builds.first.dir }}/{{ xcode_dev_builds.first.debug_info }}">Debugging Symbols</a></li>
79+
</ul>
80+
</p>
81+
<a href="https://download.swift.org/development/xcode/{{ xcode_dev_builds.first.dir }}/{{ xcode_dev_builds.first.download }}" class="cta-secondary">Download Toolchain</a>
82+
</li>
83+
<li class="grid-level-1">
84+
<h3>release/6.1</h3>
85+
<p class="description" style="font-size: 14px;">
86+
<time datetime="{{ xcode_6_1_builds.first.date | date_to_xmlschema }}" title="{{ xcode_6_1_builds.first.date | date: '%B %-d, %Y %l:%M %p (%Z)' }}">{{ xcode_6_1_builds.first.date | date: '%B %-d, %Y' }}</time>
87+
</p>
88+
<p class="description">
89+
Toolchain package installer (.pkg)
90+
<ul>
91+
<li><a href="https://download.swift.org/swift-6.1-branch/xcode/{{ xcode_6_1_builds.first.dir }}/{{ xcode_6_1_builds.first.debug_info }}">Debugging Symbols</a></li>
92+
</ul>
93+
</p>
94+
<a href="https://download.swift.org/swift-6.1-branch/xcode/{{ xcode_6_1_builds.first.dir }}/{{ xcode_6_1_builds.first.download }}" class="cta-secondary">Download Toolchain</a>
95+
</li>
96+
</ul>
97+
<a href="/install/macos/package_installer" class="cta-secondary">Instructions (Toolchain)</a>
98+
99+
{% include install/_static_sdk_dev.md %}
100+
101+
<details class="download" style="margin-bottom: 0;">
102+
<summary>Older Snapshots (main)</summary>
103+
{% include_relative _older-development-snapshots.md %}
104+
</details>
105+
<details class="download" style="margin-bottom: 0;">
106+
<summary>Older Snapshots (release/6.1)</summary>
107+
{% include_relative _older-6_1-snapshots.md %}
108+
</details>

install/macos/swiftly/index.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
layout: page
3+
title: Getting Started with Swiftly on macOS
4+
---
5+
6+
Download the [swiftly package for macOS](https://download.swift.org/swiftly/darwin/swiftly-{{ site.data.builds.swiftly_release.version }}.pkg).
7+
8+
Install the package in your user account:
9+
10+
```
11+
installer -pkg swiftly-{{ site.data.builds.swiftly_release.version }}.pkg -target CurrentUserHomeDirectory
12+
```
13+
14+
Run the following command in your terminal, to configure swiftly for your account, and automatically download the latest swift toolchain.
15+
16+
```
17+
~/.swiftly/bin/swiftly init
18+
```
19+
20+
Note: You can set the SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR environment variables to customize the install location.
21+
22+
<div class="warning" markdown="1">
23+
Your current shell may need some additional steps to update your session. Follow the guidance at the end of the installation for a smooth install experience, such as sourcing the environment file, and rehashing your shell's PATH.
24+
</div>
25+
26+
Now that swiftly and swift are installed, you can access the `swift` command from the latest Swift release:
27+
28+
```
29+
swift --version
30+
--
31+
Apple Swift version {{ site.data.builds.swift_releases.last.name }} (swift-{{ site.data.builds.swift_releases.last.name }}-RELEASE)
32+
Target: arm64-apple-macosx15.0
33+
```
34+
35+
Or, you can install (and use) another swift release:
36+
37+
```
38+
swiftly install --use 5.10
39+
swift --version
40+
--
41+
Apple Swift version 5.10 (swift-5.10-RELEASE)
42+
Target: arm64-apple-macosx15.0
43+
```
44+
45+
There's also an option to install the latest snapshot release and get access to the latest features:
46+
47+
```
48+
swiftly install --use main-snapshot
49+
```
50+
51+
Check for updates to swiftly and install them by running the self-update command:
52+
53+
```
54+
swiftly self-update
55+
```
56+
57+
You can discover more about swiftly in the [documentation](https://www.swift.org/swiftly/documentation/swiftlydocs/)

0 commit comments

Comments
 (0)