Skip to content

improvement: Bump using directives to 1.0.0 #2076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Replace usages of quotes and comas, which are no longer needed
  • Loading branch information
tgodzik committed May 8, 2023
commit bb8a47c8f4dc1dc45da148c17e9306324169ee49
16 changes: 8 additions & 8 deletions website/docs/commands/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For a full list of options, run `scala-cli compile --help`, or check the options
`--test` makes Scala CLI compile main and test scopes:

```scala title=Sample.test.scala
//> using dep "org.scalameta::munit:0.7.29"
//> using dep org.scalameta::munit:0.7.29
class Test extends munit.FunSuite {
test("sample") {
assert(2 + 2 == 4)
Expand Down Expand Up @@ -118,15 +118,15 @@ scala-cli Hello.scala -S 2.13.9-bin-4505094
For setting this inside scala files, use [`using` directives](/docs/guides/using-directives.md):

```scala compile
//> using scala "2.nightly"
//> using scala 2.nightly
```

```scala compile
//> using scala "3.nightly"
//> using scala 3.nightly
```

```scala compile
//> using scala "2.13.9-bin-4505094"
//> using scala 2.13.9-bin-4505094
```

## Dependencies
Expand Down Expand Up @@ -189,22 +189,22 @@ It is also possible to pass compiler options with the appropriate `using` direct
A single option can be passed like this:

```scala compile
//> using option "-new-syntax"
//> using option -new-syntax
@main def hello = if true then println("Hello")
```

It's also possible to pass a value to the option with the same directive:

```scala compile
//> using option "-release", "11"
//> using option -release 11

import java.net.http.HttpRequest
```

There's a separate directive for passing multiple options at one time:

```scala compile
//> using options "-new-syntax", "-rewrite", "-source:3.2-migration"
//> using options -new-syntax -rewrite -source:3.2-migration

@main def hello = if (true) println("Hello")
```
Expand Down Expand Up @@ -459,7 +459,7 @@ scala-cli Hello.scala --javac-opt source --javac-opt 1.8 --javac-opt target --ja
You can also add javac options with the using directive `//> using javacOpt`:

```scala compile
//> using javacOpt "source", "1.8", "target", "1.8"
//> using javacOpt source 1.8 target 1.8
```

## Exclude sources
Expand Down
6 changes: 3 additions & 3 deletions website/docs/commands/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ as well as options passed to the `export` sub-command.

Let's take a simple one-file project as an example:
```scala title=Hello.scala
//> using scala "3.1.3"
//> using option "-Xasync"
//> using dep "com.lihaoyi::os-lib:0.9.0"
//> using scala 3.1.3
//> using option -Xasync
//> using dep com.lihaoyi::os-lib:0.9.0

object Hello {
def main(args: Array[String]): Unit =
Expand Down
14 changes: 7 additions & 7 deletions website/docs/commands/package.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ Instead of passing the `package` options directly from bash, it is possible to p
This using directive makes it possible to define the type of the package generated by the `package` command. For example:

```scala compile power
//> using packaging.packageType "assembly"
//> using packaging.packageType assembly
```

Available types: `assembly`, `raw-assembly`, `bootstrap`, `library`, `source`, `doc`, `spark`, `js`, `native`, `docker`, `graalvm`, `deb`, `dmg`, `pkg`, `rpm`, `msi`.
Expand All @@ -460,7 +460,7 @@ Available types: `assembly`, `raw-assembly`, `bootstrap`, `library`, `source`, `
This using directive makes it possible to define the destination path of the package generated by the `package` command. For example:

```scala compile power
//> using packaging.output "foo"
//> using packaging.output foo
```

The using directive above makes it possible to create a package named `foo` inside the current directory.
Expand All @@ -470,7 +470,7 @@ The using directive above makes it possible to create a package named `foo` insi
This using directive makes it possible to pass args to GraalVM:

```scala compile power
//> using packaging.graalvmArgs "--no-fallback", "--enable-url-protocols=http,https"
//> using packaging.graalvmArgs --no-fallback --enable-url-protocols=http,https
```

### Docker
Expand All @@ -480,30 +480,30 @@ This using directive makes it possible to pass args to GraalVM:
The using directive allows you to define the base Docker image that is used to run your application.

```scala compile power
//> using packaging.dockerFrom "openjdk:11"
//> using packaging.dockerFrom openjdk:11
```

#### packaging.dockerFrom

The using directive allows you to define the generated Docker image tag.

```scala compile power
//> using packaging.dockerImageTag "1.0.0"
//> using packaging.dockerImageTag 1.0.0
```

#### packaging.dockerImageRegistry

The using directive allows you to define the image registry.

```scala compile power
//> using packaging.dockerImageRegistry "virtuslab"
//> using packaging.dockerImageRegistry virtuslab
```

#### packaging.dockerImageRegistry

The using directive allows you to define the image repository.

```scala compile power
//> using packaging.dockerImageRepository "scala-cli"
//> using packaging.dockerImageRepository scala-cli
```

10 changes: 5 additions & 5 deletions website/docs/commands/publishing/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ will infer an organization from it: if your project lives in GitHub organization

To override this default value, set the `publish.organization` directive, like
```scala
//> using publish.organization "io.github.foo"
//> using publish.organization io.github.foo
```

### Name
Expand All @@ -67,7 +67,7 @@ Scala CLI project lives in a directory named `something`, it will be published a

To override this default value, set the `publish.name` directive, like
```scala
//> using publish.name "something"
//> using publish.name something
```

### Version
Expand All @@ -78,7 +78,7 @@ Else, if it has such a tag earlier in the git history, version `1.2.4-SNAPSHOT`

To override this default value, set the `publish.computeVersion` directive, like
```scala
//> using publish.computeVersion "git:tag"
//> using publish.computeVersion git:tag
```

## Repository settings
Expand Down Expand Up @@ -180,9 +180,9 @@ To get started, consult the [documentation on the library's website](https://gnu
[Protecting code integrity with PGP guide from the Linux Foundation](https://github.com/lfit/itpol/blob/master/protecting-code-integrity.md#target-audience).

To enable signing with GPG, pass `--gpg-key *key_id*` on the command line
or specify it with a `using` directive: `//>using publish.gpgKey "key_id"`.
or specify it with a `using` directive: `//>using publish.gpgKey key_id`.
If needed, you can specify arguments meant to be passed to `gpg`,
with `--gpg-option` or `//>using publish.gpgOptions "--opt1" "--opt2"`, like
with `--gpg-option` or `//>using publish.gpgOptions --opt1 --opt2`, like
```text
--gpg-key 1234567890ABCDEF --gpg-option --foo --gpg-option --bar
```
Expand Down
8 changes: 4 additions & 4 deletions website/docs/commands/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ scala-cli Hello.scala --jvm adopt:14
You can also specify custom JVM with the using directive `//> using jvm`:

```scala compile
//> using jvm "adopt:14"
//> using jvm adopt:14
```

JVMs are [managed by coursier](https://get-coursier.io/docs/cli-java#managed-jvms), and are read from
Expand All @@ -107,7 +107,7 @@ scala-cli Hello.scala --java-opt -Xmx1g --java-opt -Dfoo=bar
You can also add java options with the using directive `//> using javaOpt`:

```scala compile
//> using javaOpt "-Xmx1g", "-Dfoo=bar"
//> using javaOpt -Xmx1g -Dfoo=bar
```

Additionally, java properties can be passed to Scala CLI without `--java-prop`:
Expand Down Expand Up @@ -135,7 +135,7 @@ When you provide a JAR file as input to Scala CLI, it will be added to the `clas
You can also add source files with the using directive `//> using file`:

```scala title=Main.scala
//> using file "Utils.scala"
//> using file Utils.scala

object Main extends App {
println(Utils.message)
Expand Down Expand Up @@ -169,7 +169,7 @@ Hello World
It is also possible to pass multiple paths to source files in a single using directive:

```scala title=Multiple.scala
//> using files "Utils.scala", "Main.scala"
//> using files Utils.scala Main.scala
```

```bash
Expand Down
12 changes: 6 additions & 6 deletions website/docs/commands/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ or [special imports](/docs/guides/configuration#special-imports)) can be used to

A source file is treated as test source if:

- it contains the `//> using target.scope "test"` directive, or
- it contains the `//> using target.scope test` directive, or
- the file name ends with `.test.scala`, or
- the file comes from a directory that is provided as input, and the relative path from that file to its original
directory contains a `test` directory
Expand Down Expand Up @@ -80,7 +80,7 @@ when running your whole app, you only need it in tests. So rather than declare i
the `test.dep` directive:

```scala compile
//> using test.dep "org.scalameta::munit::0.7.29"
//> using test.dep org.scalameta::munit::0.7.29
```

For more details on test directives,
Expand All @@ -103,7 +103,7 @@ Some of the most popular test frameworks in Scala are:
The following example shows how to run an munit-based test suite:

```scala title=MyTests.test.scala
//> using test.dep "org.scalameta::munit::0.7.29"
//> using test.dep org.scalameta::munit::0.7.29

class MyTests extends munit.FunSuite {
test("foo") {
Expand Down Expand Up @@ -137,7 +137,7 @@ foo
Passing the `--test-only` option to the `test` sub-command filters the test suites to be run:

```scala title=BarTests.test.scala
//> using test.dep "org.scalameta::munit::0.7.29"
//> using test.dep org.scalameta::munit::0.7.29
package tests.only

class BarTests extends munit.FunSuite {
Expand Down Expand Up @@ -175,7 +175,7 @@ tests.only.BarTests:
To run a specific test case inside the unit test suite pass `*exact-test-name*` as an argument to scala-cli:

```scala title=BarTests.test.scala
//> using test.dep "org.scalameta::munit::0.7.29"
//> using test.dep org.scalameta::munit::0.7.29
package tests.only

class Tests extends munit.FunSuite {
Expand Down Expand Up @@ -209,7 +209,7 @@ tests.only.Tests:
You can pass test arguments to your test framework by passing them after `--`:

```scala title=MyTests.test.scala
//> using test.dep "org.scalatest::scalatest::3.2.9"
//> using test.dep org.scalatest::scalatest::3.2.9

import org.scalatest._
import org.scalatest.flatspec._
Expand Down
2 changes: 1 addition & 1 deletion website/docs/cookbooks/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object MyClass extends App {
```

```scala title=MyTests.test.scala
//> using dep "org.scalameta::munit::0.7.27"
//> using dep org.scalameta::munit::0.7.27

class MyTests extends munit.FunSuite {
test("foo") {
Expand Down
10 changes: 5 additions & 5 deletions website/docs/cookbooks/gh-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ To use Scala CLI features in a simple way you can use the GitHub Actions [scala-

For example, here's a simple `ls` application printing the files in a given directory:
```scala title=Ls.scala
//> using scala "2.13"
//> using dep "com.lihaoyi::os-lib:0.7.8"
//> using scala 2.13
//> using dep com.lihaoyi::os-lib:0.7.8

@main def hello(args: String*) =
val path = args.headOption match
Expand All @@ -25,7 +25,7 @@ For example, here's a simple `ls` application printing the files in a given dire
and some tests for `ls` application:

```scala title=TestsLs.test.scala
//> using dep "org.scalameta::munit::0.7.27"
//> using dep org.scalameta::munit::0.7.27
import scala.util.Properties

class TestsLs extends munit.FunSuite {
Expand Down Expand Up @@ -106,8 +106,8 @@ Scala CLI allows to build native executable applications using [GraalVM](https:/

Given this simple Scala Script `package.sc` to package application to every platform:
```scala title=package.sc
//> using scala "3.1.2"
//> using dep "com.lihaoyi::os-lib:0.8.0"
//> using scala 3.1.2
//> using dep com.lihaoyi::os-lib:0.8.0
import scala.util.Properties

val platformSuffix: String = {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/cookbooks/gists.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ You can also use resources from gists archive. This is done by passing `resource
For example, given the gist `https://gist.github.com/lwronski/7ee12fa4b8b8bac3211841273df82080` which containing Scala code and text file:

```scala title=Hello.scala
//> using resourceDir "./"
//> using resourceDir ./
import scala.io.Source

object Hello extends App {
Expand Down
18 changes: 9 additions & 9 deletions website/docs/cookbooks/instant-startup-scala-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ As an example, let’s build a script printing files from
a directory with sizes bigger than a passed value.

```scala title=size-higher-than.scala
//> using scala "3.1.1"
//> using dep "com.lihaoyi::os-lib::0.8.1"
//> using scala 3.1.1
//> using dep com.lihaoyi::os-lib::0.8.1

@main
def sizeHigherThan(dir: String, minSizeMB: Int) =
Expand Down Expand Up @@ -55,9 +55,9 @@ We can fix that by either running with a `—-native` option, or,
in this case, by including an additional using directive:

```scala compile title=size-higher-than.scala
//> using scala "3.1.1"
//> using dep "com.lihaoyi::os-lib::0.8.1"
//> using platform "scala-native"
//> using scala 3.1.1
//> using dep com.lihaoyi::os-lib::0.8.1
//> using platform scala-native

@main
def sizeHigherThan(dir: String, minSizeMB: Int) =
Expand All @@ -81,10 +81,10 @@ We can make the runtime itself even faster, using various Scala Native optimizat
We pass these using a `-–native-mode` scala-cli option or, like previously, by adding a using directive:

```scala compile title=size-higher-than.scala
//> using scala "3.1.1"
//> using dep "com.lihaoyi::os-lib::0.8.1"
//> using platform "scala-native"
//> using nativeMode "release-full"
//> using scala 3.1.1
//> using dep com.lihaoyi::os-lib::0.8.1
//> using platform scala-native
//> using nativeMode release-full

@main
def sizeHigherThan(dir: String, minSizeMB: Int) =
Expand Down
4 changes: 2 additions & 2 deletions website/docs/cookbooks/intellij-multi-bsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tree -a
```

```scala title=app1/test/MyTests1.scala
//> using dep "org.scalameta::munit:1.0.0-M7"
//> using dep org.scalameta::munit:1.0.0-M7
class MyTests1 extends munit.FunSuite {
test("my test 1") {
assert(2 + 2 == 4)
Expand All @@ -58,7 +58,7 @@ class MyTests1 extends munit.FunSuite {
```

```scala title=app2/test/MyTests2.scala
//> using dep "com.lihaoyi::utest::0.8.1"
//> using dep com.lihaoyi::utest::0.8.1

import utest.*

Expand Down
2 changes: 1 addition & 1 deletion website/docs/cookbooks/intellij.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def hello() = println("Hello, world")
```

```scala title=test/MyTests.test.scala
//> using dep "org.scalameta::munit::1.0.0-M1"
//> using dep org.scalameta::munit::1.0.0-M1

class MyTests extends munit.FunSuite {
test("test") {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/cookbooks/scala-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The `using` directives syntax is still experimental, and may change in future ve
Here’s an example of a source code file named `version.scala` that contains a `using` directive:

```scala title=version.scala
//> using scala "2.12"
//> using scala 2.12

object OldCode
//rest of the config
Expand Down
Loading