Skip to content

Commit

Permalink
New docs website
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamet committed Aug 3, 2020
1 parent c88c40d commit 00e5794
Show file tree
Hide file tree
Showing 99 changed files with 11,743 additions and 457 deletions.
7 changes: 0 additions & 7 deletions .cicd/install_jekyll.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .cicd/jekyll/Gemfile

This file was deleted.

67 changes: 0 additions & 67 deletions .cicd/jekyll/Gemfile.lock

This file was deleted.

7 changes: 0 additions & 7 deletions .cicd/push_website.sh

This file was deleted.

19 changes: 7 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,20 @@ jobs:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- name: Ruby caches
uses: actions/cache@v2
with:
path: .cicd/jekyll/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('.cicd/**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- uses: actions/setup-ruby@v1

- uses: actions/setup-node@v1
with:
ruby-version: '2.6'
- name: Install jekyll
run: ./.cicd/install_jekyll.sh
node-version: '12.x'
- name: Update docs
run: |
git config --global user.name "ScalaPB Docs"
git config --global user.email "[email protected]"
eval "$(ssh-agent -s)"
echo "$TOKEN" | ssh-add -
.cicd/push_website.sh
sbt docs/mdoc docs/unidoc
cd website
yarn install
yarn deploy
env:
TOKEN: ${{secrets.DEPLOY_KEY}}

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ e2e/project/project/Version.scala
e2e/project/Version.scala
e2e/.bin
protoc-gen-scala-native-image

# API
website/static/api
43 changes: 17 additions & 26 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ lazy val e2eNoJava = (projectMatrix in file("e2e-nojava"))
)

lazy val docs = project
.in(file("docs"))
.enablePlugins(MicrositesPlugin, ScalaUnidocPlugin)
.in(file("scalapb-docs"))
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)
.dependsOn(runtimeJVM2_12)
.settings(commonSettings)
.settings(
Expand All @@ -306,39 +306,30 @@ lazy val docs = project
"com.lihaoyi" %% "os-lib" % "0.5.0",
"org.plotly-scala" %% "plotly-render" % "0.7.2"
),
micrositeAnalyticsToken := "UA-346180-20",
micrositeName := "ScalaPB",
micrositeCompilingDocsTool := WithMdoc,
mdocIn := baseDirectory.value / "src" / "main" / "markdown",
micrositeDescription := "Protocol buffer compiler for Scala",
micrositeDocumentationUrl := "/",
micrositeAuthor := "Nadav Samet",
micrositeGithubOwner := "scalapb",
micrositeGithubRepo := "ScalaPB",
micrositeGitterChannelUrl := "ScalaPB/community",
micrositeHighlightTheme := "atom-one-light",
micrositeHighlightLanguages := Seq("scala", "java", "bash", "protobuf"),
micrositeTheme := "pattern",
micrositePalette := Map(
"brand-primary" -> "#D62828", // active item marker on the left
"brand-secondary" -> "#003049", // menu background
"brand-tertiary" -> "#F77F00", // active item
"gray-dark" -> "#F77F00", // headlines
"gray" -> "#000000", // text
"gray-light" -> "#D0D0D0", // stats on top
"gray-lighter" -> "#F4F3F4", // content wrapper background
"white-color" -> "#FFFFFF" // ???
),
// mdocIn := baseDirectory.value / "src" / "main" / "markdown",
siteSubdirName in ScalaUnidoc := "api/scalapb/latest",
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc),
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(
lensesJVM2_12,
runtimeJVM2_12,
grpcRuntimeJVM2_12
),
target in (ScalaUnidoc, unidoc) := (baseDirectory in LocalRootProject).value / "website" / "static" / "api",
cleanFiles += (target in (ScalaUnidoc, unidoc)).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(unidoc in Compile).value,
docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(unidoc in Compile).value,

mdocVariables := Map(
"scalapb" -> "0.10.8",
"sbt_protoc" -> "0.99.34",
"protoc" -> "3.11.4",
"sparksql_scalapb" -> "0.10.4"
),
git.remoteRepo := "[email protected]:scalapb/scalapb.github.io.git",
ghpagesBranch := "master",
ghpagesBranch := "master"
/*
includeFilter in ghpagesCleanSite := GlobFilter(
(ghpagesRepository.value / "README.md").getCanonicalPath
)
*/
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: "Common protos"
layout: docs
---

# Common protos

This page lists packages that contain compiled ScalaPB classes for common third-party protobuf libraries.

Each of these packages require you to add two library dependencies in your `build.sbt`:
Expand All @@ -20,11 +18,11 @@ Each of these packages require you to add two library dependencies in your `buil

If you don't have any proto files that import the common protos, then you can omit the `"protobuf"` dependency.

# Adding new packages
## Adding new packages

If you don't see your favorite third-party proto package here, and there is already a maven package for it that provides the proto files (with possibly Java generated classes), you can send a pull request to common-protos to have it added. See instruction on the [ScalaPB Common Protos project page on Github](https://github.com/scalapb/common-protos).

# Available packages
## Available packages

```scala mdoc:passthrough
scalapb.docs.CommonProtos.printTable()
Expand Down
4 changes: 1 addition & 3 deletions docs/src/main/markdown/contact.md → docs/contact.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
title: "Contact us"
title: "Contacting us"
layout: docs
---

# Contacting us

## Supporting ScalaPB development

Love ScalaPB? Want to show your support for its continued maintenance?
Expand Down
31 changes: 15 additions & 16 deletions docs/src/main/markdown/customizations.md → docs/customizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Customizations"
layout: docs
---

# ScalaPB File-level Options
## ScalaPB File-level Options

ScalaPB file-level options lets you

Expand All @@ -16,7 +16,7 @@ The file-level options are not required, unless you are interested in those
customizations. If you do not want to customize the defaults, you can safely
skip this section.

# File-level options
## File-level options

```protobuf
import "scalapb/scalapb.proto";
Expand Down Expand Up @@ -49,7 +49,7 @@ then it falls back to `java_package` and then to `package`.

- Setting `flat_package` to true (default is `false`) makes ScalaPB not append
the protofile base name to the package name. You can also apply this option
globally to all files by adding it to your [ScalaPB SBT Settings]({{site.baseurl}}/sbt-settings.html).
globally to all files by adding it to your [ScalaPB SBT Settings](sbt-settings.md).

- The `single_file` option makes the generator output all messages and
enums to a single Scala file.
Expand Down Expand Up @@ -100,7 +100,7 @@ enums to a single Scala file.
found if it is defined under `YourType` companion object, or on a package
object that matches the generated code (or any of its parent packages).

# Package-scoped options
## Package-scoped options

Note: this option is experimental and is available in ScalaPB 0.8.2 and later.

Expand Down Expand Up @@ -154,7 +154,7 @@ options proto explicitly from all the proto files that are meant to inherit the
reason is that if you don't do that, then downstream projects would not
process the proto package file which may lead to compilation errors.

# Auxiliary options
## Auxiliary options

In some situations, you may want to set some options in a proto file, but without
modifying the original proto file or adding anything ScalaPB-specific to it. To accomplish
Expand Down Expand Up @@ -198,7 +198,7 @@ option (scalapb.options) = {

The list `aux_message_options` contains options targeted at different messages define under the same proto package of the package-scoped options. The `target` name needs to be fully-qualified message name in the protobuf namespace. Similar to `aux_message_options`, we also have `aux_enum_options` and `aux_field_options`. See [example usage here](https://github.com/scalapb/ScalaPB/tree/master/e2e/src/main/protobuf/scoped).

# Primitive wrappers
## Primitive wrappers

In proto 3, unlike proto 2, primitives are not wrapped in an option by default.
The standard technique to obtain an optional primitive is to wrap it inside a
Expand Down Expand Up @@ -245,7 +245,7 @@ option (scalapb.options) = {
};
```

# Custom base traits for messages
## Custom base traits for messages

Note: this option is available in ScalaPB 0.6.1 and later.

Expand Down Expand Up @@ -294,7 +294,7 @@ message MyMessage {
Will generate a case class that extends `MySuperClass`, and the companion
object will extend `MySuperCompanionClass`.

# Custom base traits for sealed oneofs
## Custom base traits for sealed oneofs

Note: this option is available in ScalaPB 0.9.0 and later.

Expand All @@ -311,7 +311,7 @@ message MyEither {
}
```

# Custom base traits for enums
## Custom base traits for enums

In a similar fashion to custom base traits for messages, it is possible to
define custom base traits for enum types, for the companion objects of enum
Expand Down Expand Up @@ -356,7 +356,7 @@ object MyEnum extends GeneratedEnumCompanion[MyEnum]
}
```

# Custom types
## Custom types

You can customize the Scala type of any field. One use-case for this is when
you would like to use type-safe wrappers around primitive values to enforce unit
Expand Down Expand Up @@ -424,7 +424,7 @@ package object c {
}
```

# Message-level custom type and boxing
## Message-level custom type and boxing

In the previous section you saw how to customize the type generated for a
specific field. ScalaPB also lets you specify a custom type at the message
Expand Down Expand Up @@ -535,7 +535,7 @@ Example: see `CustomMaps` in [maps.proto](https://github.com/scalapb/ScalaPB/blo
You can also customize the collection type used for a map. See the next
section for details.

# Custom collection types
## Custom collection types

By default, ScalaPB compiles repeated fields into a `Seq[T]`. When a message
is parsed from bytes, the default implementation instantiates a `Vector[T]`,
Expand Down Expand Up @@ -592,7 +592,7 @@ and `MyMap`, the simplest custom collection that is compatible with ScalaPB:
- [MyMap.scala](https://github.com/scalapb/ScalaPB/blob/master/e2e/src/main/scala-pre-2.13/com/thesamet/pb/MyMap.scala)
- [collection_types.proto](https://github.com/scalapb/ScalaPB/blob/master/e2e/src/main/protobuf/collection_types.proto)

# Custom names
## Custom names

Sometimes it may be useful to manually specify the name of a field in the
generated code. For example, if you have a field named `hash_code`, then the
Expand All @@ -614,8 +614,7 @@ enum MyEnum {
}
```


# Adding annotations
## Adding annotations

Since ScalaPB 0.6.3, you can add annotations to the generated case classes like this:

Expand All @@ -627,7 +626,7 @@ message BarMessage {
}
```

# Adding scalapb.proto to your project
## Adding scalapb.proto to your project

The easiest way to get `protoc` to find `scalapb/scalapb.proto` when compiling
through SBT is by adding the following to your `build.sbt`:
Expand Down
Loading

0 comments on commit 00e5794

Please sign in to comment.