Skip to content

Commit

Permalink
Merge pull request sbt#1173 from eed3si9n/wip/docusaurus
Browse files Browse the repository at this point in the history
Migrate to Docusaurus: Phase 1
  • Loading branch information
eed3si9n authored Jan 24, 2024
2 parents 8333000 + 4b85f01 commit af878d2
Show file tree
Hide file tree
Showing 136 changed files with 10,207 additions and 666 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
distribution: 'adopt'
java-version: '11'
cache: 'sbt'
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Build and test
run: |
Expand Down
23 changes: 22 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,25 @@
.metals
metals.sbt

.vscode
.vscode

# Dependencies
node_modules

# Production
build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11.0
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ These steps are derived from Haruhiko Okumura's instructions at
- update TeX Live package manager with `sudo tlmgr update --self --all` (this may take a while)
- `brew install pandoc`

## Docusaurus

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.



## Usage

To make the site locally, from sbt shell:
Expand Down
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
21 changes: 1 addition & 20 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,12 @@ ThisBuild / scalafmtOnCompile := true

lazy val root = (project in file("."))
.enablePlugins(
(if (!isBetaBranch) Seq(ParadoxSitePlugin) else Seq()) ++
(if (!isBetaBranch) Seq(DocusaurusSitePlugin) else Seq()) ++
Seq(LowTechSnippetPamfletPlugin, ScriptedPlugin): _*
)
.settings(
name := "website",
siteEmail := "eed3si9n" + "@gmail.com",
// Landing
Compile / paradox / sourceDirectory := baseDirectory.value / "src" / "landing",
Compile / paradoxTheme / sourceDirectory := (Compile / paradox / sourceDirectory).value / "_template",
paradoxProperties ++= Map(
"sbtVersion" -> Docs.targetSbtFullVersion,
"windowsBuild" -> Docs.sbtWindowsBuild,
"sbtVersionForScalaDoc" -> Docs.sbtVersionForScalaDoc,
"scala3ExampleVersion" -> Docs.scala3ExampleVersion,
),
Compile / paradoxRoots := List(
"404.html",
"community.html",
"cookie.html",
"documentation.html",
"download.html",
"index.html",
"learn.html",
"thank-you.html",
),
// Reference
Pamflet / sourceDirectory := baseDirectory.value / "src" / "reference",
Pamflet / siteSubdirName := s"""$targetSbtBinaryVersion/docs""",
Expand Down
179 changes: 179 additions & 0 deletions docs/getting-started/01-setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
sidebar_position: 1
title: Installing sbt runner
slug: /setup
---

import { sbtVersion, windowsBuild, downloadUrl } from '@site/variables';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Installing sbt runner
=====================

To build an sbt project, you'll need to take these steps:

- Install JDK (We recommend Eclipse Adoptium Temurin JDK 8, 11, or 17, or Zulu JDK 8 for macOS with ARM chips).
- Install sbt runner.

sbt runner is a script that invokes a declared version of sbt, downloading it beforehand if necessary. This allows build authors to precisely control
the sbt version, instead of relying on users' machine environment.

Prerequisites
-------------

sbt runs on all major operating systems. It requires JDK 8 or higher to run.

```bash
$ java -version
openjdk version "1.8.0_352"
```

Install sbt with **cs setup**
-----------------------------

Follow [Install](https://www.scala-lang.org/download/) page, and install Scala using Coursier.

```bash
cs setup
```

This should install the latest stable version of `sbt`.

Installing from SDKMAN
----------------------

To install both JDK and sbt, consider using [SDKMAN](https://sdkman.io/).

```
$ sdk install java $(sdk list java | grep -o "\b8\.[0-9]*\.[0-9]*\-tem" | head -1)
$ sdk install sbt
```

Using Coursier or SDKMAN has two advantages.

1. They will install the official packaging by Eclipse Adoptium etc, as opposed to the ["mystery meat OpenJDK builds"](https://mail.openjdk.java.net/pipermail/jdk8u-dev/2019-May/009330.html).
2. They will install `tgz` packaging of sbt that contains all JAR files. (DEB and RPM packages do not to save bandwidth)

OS specific setup
-----------------

<Tabs groupId="operating-systems">
<TabItem value="mac" label="macOS">
### Homebrew

```bash
$ brew install sbt
```

:::warning
Homebrew maintainers have added a dependency to JDK 13 because they want to use more brew dependencies ([brew#50649](https://github.com/Homebrew/homebrew-core/issues/50649)). This causes sbt to use JDK 13 even when `java` available on PATH is JDK 8 or 11. To prevent `sbt` from running on JDK 13, install [jEnv](https://www.jenv.be/) or switch to using [SDKMAN](https://sdkman.io/).
:::
</TabItem>
<TabItem value="win" label="Windows">

- <a href={ downloadUrl(sbtVersion, windowsBuild, ".msi") }>sbt-{windowsBuild}.msi</a>
- <a href={ downloadUrl(sbtVersion, windowsBuild, ".msi.sha256") }>sbt-{windowsBuild}.msi.sha256</a>
- <a href={ downloadUrl(sbtVersion, windowsBuild, ".msi.asc") }>sbt-{windowsBuild}.msi.asc</a>

:::note
Third-party packages may not provide the latest version. Please make
sure to report any issues with these packages to the relevant maintainers.
:::

### [Chocolatey](https://chocolatey.org/packages/sbt)

```
> choco install sbt
```

### [Scoop](https://scoop.sh/)

```
> scoop install sbt
```
</TabItem>
<TabItem value="linux" label="Linux">

### Ubuntu and other Debian-based distributions

[DEB][DEB] package is officially supported by sbt.

Ubuntu and other Debian-based distributions use the DEB format, but usually you don't install your software from a local DEB file. Instead they come with package managers both for the command line (e.g. `apt-get`, `aptitude`) or with a graphical user interface (e.g. Synaptic).
Run the following from the terminal to install `sbt` (You'll need superuser privileges to do so, hence the `sudo`).

```bash
sudo apt-get update
sudo apt-get install apt-transport-https curl gnupg -yqq
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
sudo apt-get update
sudo apt-get install sbt
```

Package managers will check a number of configured repositories for packages to offer for installation. You just have to add the repository to the places your package manager will check.

Once `sbt` is installed, you'll be able to manage the package in `aptitude` or Synaptic after you updated their package cache. You should also be able to see the added repository at the bottom of the list in System Settings -> Software & Updates -> Other Software:

![Ubuntu Software & Updates Screenshot](/img/ubuntu-sources.png "Ubuntu Software & Updates Screenshot")

:::note
`sudo apt-key adv --keyserver hkps://keyserver.ubuntu.com:443 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823` may not work on Ubuntu Bionic LTS (18.04) since it's using a buggy GnuPG, so we are advising to use web API to download the public key in the above.
:::

### Red Hat Enterprise Linux and other RPM-based distributions

[RPM][RPM] package is officially supported by sbt.

Red Hat Enterprise Linux and other RPM-based distributions use the RPM format.
Run the following from the terminal to install `sbt` (You'll need superuser privileges to do so, hence the `sudo`).

```bash
# remove old Bintray repo file
sudo rm -f /etc/yum.repos.d/bintray-rpm.repo
curl -L https://www.scala-sbt.org/sbt-rpm.repo > sbt-rpm.repo
sudo mv sbt-rpm.repo /etc/yum.repos.d/
sudo yum install sbt
```

On Fedora (31 and above), use `sbt-rpm.repo`:

```bash
# remove old Bintray repo file
sudo rm -f /etc/yum.repos.d/bintray-rpm.repo
curl -L https://www.scala-sbt.org/sbt-rpm.repo > sbt-rpm.repo
sudo mv sbt-rpm.repo /etc/yum.repos.d/
sudo dnf install sbt
```

</TabItem>
</Tabs>

Universal packages
------------------

- <a href={ downloadUrl(sbtVersion, sbtVersion, ".zip") }>sbt-{sbtVersion}.zip</a>
- <a href={ downloadUrl(sbtVersion, sbtVersion, ".zip.sha256") }>sbt-{sbtVersion}.zip.sha256</a>
- <a href={ downloadUrl(sbtVersion, sbtVersion, ".zip.asc") }>sbt-{sbtVersion}.zip.asc</a>
- <a href={ downloadUrl(sbtVersion, sbtVersion, ".tgz") }>sbt-{sbtVersion}.tgz</a>
- <a href={ downloadUrl(sbtVersion, sbtVersion, ".tgz.sha256") }>sbt-{sbtVersion}.tgz.sha256</a>
- <a href={ downloadUrl(sbtVersion, sbtVersion, ".tgz.asc") }>sbt-{sbtVersion}.tgz.asc</a>

Verify the sbt runner
---------------------

```bash
$ sbt --script-version
```

[MSI]: $sbt_native_package_base$/v$app_version$/sbt-$windows_app_version$.msi
[ZIP]: $sbt_native_package_base$/v$app_version$/sbt-$app_version$.zip
[TGZ]: $sbt_native_package_base$/v$app_version$/sbt-$app_version$.tgz
[RPM]: $sbt_rpm_package_base$sbt-$app_version$.rpm
[DEB]: $sbt_deb_package_base$sbt-$app_version$.deb
[Manual-Installation]: Manual-Installation.html
[website127]: https://github.com/sbt/website/issues/127
[cert-bug]: https://bugs.launchpad.net/ubuntu/+source/ca-certificates-java/+bug/1739631
[openjdk-devel]: https://pkgs.org/download/java-1.8.0-openjdk-devel
Loading

0 comments on commit af878d2

Please sign in to comment.