Skip to content

Commit

Permalink
docs: Follow sidebar structure more
Browse files Browse the repository at this point in the history
Summary:
Moves a bunch of the remaining pages to follow the sidebar.

I had to rename `benefits.md` to `compared_to_buck1.md` as otherwise it got picked up as an index page

I tried to enforce this in code but simplifying the configuration of the sidebar even more turns out to be a bit hard, so I'm not doing it

To keep from breaking links, I've added redirects. Those are documented as not being testable in dev builds, but I can see them in the build output so probably they're working fine

Reviewed By: iguridi

Differential Revision: D60024231

fbshipit-source-id: b93c8f67668ad6d68e3ddb9c3c7eb749435bed64
  • Loading branch information
JakobDegen authored and facebook-github-bot committed Jul 22, 2024
1 parent 383dc1c commit b8c3eba
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: benefits
id: compared_to_buck1
title: Benefits When Compared to Buck1
---

Expand Down
File renamed without changes.
File renamed without changes.
36 changes: 18 additions & 18 deletions docs/why.md → docs/about/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,28 @@ different from Bazel).
having all the rules external to the binary, the most important and complex
rule (such as in C++), don't have access to magic internal features. As a
result, features have been made available to all rules, including:
- [Dep files](rule_authors/dep_files.md) - the ability to declare that a
- [Dep files](../rule_authors/dep_files.md) - the ability to declare that a
subset of the files weren't actually used, and thus not be sensitive to
changes within them.
- [Incremental actions](rule_authors/incremental_actions.md) - the ability to
have the action short-circuit some subset of the work if run again.
- [Incremental actions](../rule_authors/incremental_actions.md) - the ability
to have the action short-circuit some subset of the work if run again.
- **Buck2 uses a dynamic (aka monadic) graph as its underlying computation
engine** - while most dependencies are specified statically, there are two
particular features that expose dynamic power to rule authors:
- [Dynamic dependencies](rule_authors/dynamic_dependencies.md) - enable rules
to build a file then look at its contents before specifying the dependencies
and steps in future actions. Common uses are languages where the dependency
structure within a project must follow imports (e.g. Haskell, OCaml) and
distributed ThinLTO (where the best optimization plan is generated from
summaries).
- [Anonymous targets](rule_authors/anon_targets.md) - enable rules to create a
graph that has more sharing than the original user graph. As a result, two
unrelated binaries can compile shared code only once, despite the shared
code not knowing about this commonality. This feature is useful for rules
like Swift feature resolution.
- **[Transitive-sets](rule_authors/transitive_sets.md)** - similar in purpose to
Bazel's [depset](https://bazel.build/rules/lib/depset). But, instead of being
just a memory optimization, are also wired into the dependency graph,
- [Dynamic dependencies](../rule_authors/dynamic_dependencies.md) - enable
rules to build a file then look at its contents before specifying the
dependencies and steps in future actions. Common uses are languages where
the dependency structure within a project must follow imports (e.g. Haskell,
OCaml) and distributed ThinLTO (where the best optimization plan is
generated from summaries).
- [Anonymous targets](../rule_authors/anon_targets.md) - enable rules to
create a graph that has more sharing than the original user graph. As a
result, two unrelated binaries can compile shared code only once, despite
the shared code not knowing about this commonality. This feature is useful
for rules like Swift feature resolution.
- **[Transitive-sets](../rule_authors/transitive_sets.md)** - similar in purpose
to Bazel's [depset](https://bazel.build/rules/lib/depset). But, instead of
being just a memory optimization, are also wired into the dependency graph,
providing a reduction in the size of the dependency graph.
- **Buck2 is not phased** - there are no target graph/action graph phases, just
a series of dependencies in a
Expand All @@ -115,7 +115,7 @@ different from Bazel).
builds 2x as fast as Buck1.

For a comprehensive list of benefits, see
[Benefits Compared to Buck1](benefits.md).
[Benefits Compared to Buck1](benefits/compared_to_buck1.md).

## Why use Buck2?

Expand Down
5 changes: 3 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ your team.

### For end users

- [Getting Started](getting_started.md) - how to get started with using Buck2.
- [Benefits](benefits.md) - the benefits of using Buck2.
- [Getting Started](about/getting_started.md) - how to get started with using
Buck2.
- [Benefits](about/benefits/compared_to_buck1.md) - the benefits of using Buck2.

<FbInternalOnly>

Expand Down
33 changes: 33 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,39 @@ const { fbContent, isInternal } = require('docusaurus-plugin-internaldocs-fb/int
anonymizeIP: true,
},
],
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
{
to: '/docs/about/why',
from: '/docs/why',
},
{
to: '/docs/about/getting_started',
from: '/docs/getting_started',
},
{
to: '/docs/about/benefits/compared_to_buck1',
from: '/docs/benefits',
},
{
to: '/docs/about/bootstrapping',
from: '/docs/bootstrapping',
},
] + (!isInternal()) ? [] : [
// Internal-only redirects
{
to: '/docs/about/benefits/testimonials',
from: '/docs/testimonials',
},
{
to: '/docs/about/knowledge_sharing',
from: '/docs/knowledge_sharing',
},
],
},
],
],

themeConfig:
Expand Down
12 changes: 6 additions & 6 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ const manualSidebar = [
type: 'category',
label: 'About Buck2',
items: [
'why',
'about/why',
// The getting_started page is for OSS only.
isInternal() ? [] : 'getting_started',
isInternal() ? [] : 'about/getting_started',
{
type: 'category',
label: 'Benefits',
items: [
'benefits',
isInternal() ? 'testimonials' : [],
'about/benefits/compared_to_buck1',
isInternal() ? 'about/benefits/testimonials' : [],
],
},
isInternal() ? 'knowledge_sharing' : [],
'bootstrapping',
isInternal() ? 'about/knowledge_sharing' : [],
'about/bootstrapping',
],
},
{
Expand Down
6 changes: 3 additions & 3 deletions website/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function HomepageHeader() {
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/benefits">
to="/docs/about/benefits/compared_to_buck1">
Why switch?
</Link>
<Link
Expand All @@ -44,12 +44,12 @@ function HomepageHeader() {
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/why">
to="/docs/about/why">
Why Buck2?
</Link>
<Link
className="button button--secondary button--lg"
to="/docs/getting_started">
to="/docs/about/getting_started">
Getting started
</Link>
</div>
Expand Down

0 comments on commit b8c3eba

Please sign in to comment.