Skip to content

Commit

Permalink
refactor(docs): update the contributing docs (scala#17585)
Browse files Browse the repository at this point in the history
This makes a bunch of small updates the contributing docs that were
recently migrated over from the scala-lang site. I think there are
actually some more updates to be done, but much of these changes are
just structural. To sort of summarize this does the following:

- gets rid of old irrelevant things like the `checklist.sh`
- removes some instructions that are no longer relevant
- re-organizes the side bar to better group things by topic
- gets rid of redundant information and tries to group things better
- moves the scaladoc docs into the contributing docs

I'll add some more comments inline to further explain.

[skip community_build]

_Old sidebar_

<img width="321" alt="Screenshot 2023-05-25 at 15 18 32"
src="https://github.com/lampepfl/dotty/assets/13974112/2e493110-8098-445c-b101-166998c7c95f">

_New sidebar_
<img width="321" alt="Screenshot 2023-05-25 at 15 18 03"
src="https://github.com/lampepfl/dotty/assets/13974112/2f86764e-bc3e-4356-9f56-006197a10153">
  • Loading branch information
ckipp01 committed May 30, 2023
1 parent ceca748 commit 28915c4
Show file tree
Hide file tree
Showing 28 changed files with 490 additions and 786 deletions.
37 changes: 37 additions & 0 deletions docs/_docs/contributing/cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
layout: doc-page
title: Command Cheatsheet
---

## sbt commands

Below is a cheat sheet of some frequently used commands to be used from SBT
console – `sbt`.


| Command | Description |
|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| `scala3/scalac` | Run the compiler directly, with any current changes. |
| `scala3/scala` | Run the main method of a given class name. |
| `scalac ../issues/Playground.scala` | Compile the given file – path relative to the Dotty directory. Output the compiled class files to the Dotty directory itself. |
| `scala Playground` | Run the compiled class `Playground`. Dotty directory is on classpath by default. |
| `repl` | Start REPL |
| `scala3/scalac -print-tasty Foo.tasty` | Print the TASTy of top-level class `Foo` |
| `scala3-bootstrapped/test` | Run all tests for Scala 3. (Slow, recommended for CI only) |
| `scala3-bootstrapped/publishLocal` | Build Scala 3 locally. (Use to debug a specific project) |
| `testOnly dotty.tools.dotc.CompilationTests -- *pos` | Run test (method) `pos` from `CompilationTests` suite. |
| `testCompilation sample` | In all test suites, run test files containing the word `sample` in their title. |
| `scala3-compiler/Test/runMain dotty.tools.printTypes`| Print types underlying representation |
| `scaladoc/generateScalaDocumentation` | Build the documentation website (published to https://dotty.epfl.ch) |
| `scaladoc/generateReferenceDocumentation` | Build the reference documentation website (published to https://docs.scala-lang.org/scala3/reference) |


## Shell Commands

Below is a cheat sheet of some frequently used commands to be used from your
shell.

| Command | Description |
|--------------------------------------|------------------------------------------------------------------|
| `rm -rv *.tasty *.class out || true` | clean all compiled artifacts, from root dotty directory |
| `git clean -fdx` | a full clean of all files in the codebase not tracked by git |
60 changes: 0 additions & 60 deletions docs/_docs/contributing/checklist.sh

This file was deleted.

124 changes: 0 additions & 124 deletions docs/_docs/contributing/debug-tests.md

This file was deleted.

14 changes: 14 additions & 0 deletions docs/_docs/contributing/debugging/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
layout: doc-page
title: Debugging the Compiler
redirectFrom: /docs/contributing/issues/debugging.html
---

This section goes over the various ways to debug either the compiler or the code
that you're having issues with. This can be just inspecting the trees of your
code or stepping through the dotty codebase with a Debugger.

The following sections will help you with this:
- [Debugging with your IDE](./ide-debugging.md.md)
- [How to Inspect Values](./inspection.md)
- [Other Debugging Techniques](./other-debugging.md)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: doc-page
title: Debugging the Compiler
title: Debugging with your IDE
---

The debugger is a powerful tool to navigate the internals of the compiler and track bugs.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: doc-page
title: How to Inspect Values
redirectFrom: /docs/contributing/issues/inspection.html
---

In this section, you will find out how to debug the contents of certain objects
Expand All @@ -11,7 +12,10 @@ while the compiler is running, and inspect produced artifacts of the compiler.
Frequently you will need to inspect the content of a particular variable.
You can either use `println`s or the debugger, more info on how to setup the latter.

In the remeainder of this article we'll use `println(<someUsefulExpression>)` inserted in the code, but the same effect can be accomplished by stopping at a breakpoint, and typing `<someUsefulExpression>` in the [debug console](./debugging.md#the-debug-console) of the debugger.
In the remainder of this article we'll use `println(<someUsefulExpression>)`
inserted in the code, but the same effect can be accomplished by stopping at a
breakpoint, and typing `<someUsefulExpression>` in the [debug
console](./ide-debugging.md#the-debug-console) of the debugger.

When printing a variable, it's always a good idea to call `show` on that variable: `println(x.show)`.
Many objects of the compiler define `show`, returning a human-readable string.
Expand Down Expand Up @@ -102,6 +106,7 @@ If you are curious about the representation of a type, say `[T] =>> List[T]`,
you can use a helper program [dotty.tools.printTypes][DottyTypeStealer],
it prints the internal representation of types, along with their class. It can be
invoked from the sbt shell with three arguments as follows:

```bash
sbt:scala3> scala3-compiler/Test/runMain
dotty.tools.printTypes
Expand Down
Loading

0 comments on commit 28915c4

Please sign in to comment.