Skip to content

Commit

Permalink
Build with jvm 11
Browse files Browse the repository at this point in the history
  • Loading branch information
tpasternak committed Nov 24, 2021
1 parent 04aad10 commit 99b932d
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 30 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- name: Copy launcher
run: ./mill -i copyJvmLauncher artifacts/
if: runner.os == 'Linux'
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- name: Generate native launcher
run: ./mill -i show defaultNativeImage
- name: Build OS packages
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- name: Generate native launcher
run: ./mill -i show cli.nativeImageMostlyStatic
- name: Build docker image
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- name: Generate native launcher
run: ./mill -i show cli.nativeImageStatic
- name: Copy artifacts
Expand All @@ -156,12 +156,12 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- name: Test documentation
run: .github/scripts/check_docs.sh

- name: Test gifs
run: gifs/generate_gifs.sh $(ls gifs/scenarios/)
run: gifs/generate_gifs.sh $(ls gifs/scenarios/)

checks:
timeout-minutes: 15
Expand All @@ -174,7 +174,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- name: Check native-image config format
run: ./mill -i __.checkNativeImageConfFormat
- name: Check Ammonite availability
Expand All @@ -198,7 +198,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
apps: scalafmt:3.0.0
- run: scalafmt --check

Expand All @@ -213,7 +213,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- name: Check that reference doc is up-to-date
run: |
./mill -i generate-reference-doc.run --check || (
Expand All @@ -235,7 +235,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- run: ./mill -i ci.copyVcRedist
- uses: actions/upload-artifact@v2.2.4
with:
Expand All @@ -256,7 +256,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- name: GPG setup
run: .github/scripts/gpg-setup.sh
env:
Expand All @@ -282,7 +282,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- run: ./mill -i ci.setShouldPublish
- uses: actions/download-artifact@v2
if: env.SHOULD_PUBLISH == 'true'
Expand All @@ -307,7 +307,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- uses: actions/download-artifact@v2
with:
name: launchers
Expand Down Expand Up @@ -353,7 +353,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- run: ./mill -i ci.setShouldPublish
- uses: actions/setup-node@v2.4.1
if: env.SHOULD_PUBLISH == 'true'
Expand All @@ -379,7 +379,7 @@ jobs:
- uses: coursier/cache-action@v6.3
- uses: coursier/setup-action@v1.1.2
with:
jvm: 8
jvm: 11
- uses: actions/setup-node@v2.4.1
with:
node-version: '12.x'
Expand Down
12 changes: 7 additions & 5 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ class Runner(val crossScalaVersion: String) extends CrossSbtModule with ScalaCli
super.scalacOptions() ++ {
if (scalaVersion().startsWith("2.")) Seq("-Ywarn-unused")
else Nil
}
} ++ Seq("-release", "8")

}
def mainClass = Some("scala.cli.runner.Runner")
def ivyDeps =
Expand Down Expand Up @@ -474,7 +475,7 @@ class TestRunner(val crossScalaVersion: String) extends CrossSbtModule with Scal
super.scalacOptions() ++ {
if (scalaVersion().startsWith("2.")) Seq("-Ywarn-unused", "-deprecation")
else Nil
}
} ++ Seq("-release", "8")
}
def ivyDeps = super.ivyDeps() ++ Agg(
Deps.asm,
Expand Down Expand Up @@ -524,12 +525,13 @@ class BloopRifle(val crossScalaVersion: String) extends CrossSbtModule with Scal

class TastyLib(val crossScalaVersion: String) extends CrossSbtModule with ScalaCliPublishModule
with ScalaCliScalafixModule {
def scalacOptions = T {
def scalacOptions = T(
super.scalacOptions() ++ {
if (scalaVersion().startsWith("2.")) Seq("-Ywarn-unused")
else Nil
}
}
} ++ Seq("-release", "8")
)

}

object `local-repo` extends LocalRepo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class NativePackagerTests extends munit.FunSuite {
// format: off
val cmd = Seq[os.Shellable](
TestUtil.cli,
"package", helloWorldFileName,
"package", "--jvm", "8", helloWorldFileName,
"--docker",
"--docker-image-repository", imageRepository,
"--docker-image-tag", imageTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,4 +1141,15 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
}
}

test("Runs with JVM 8") {
val inputs = TestInputs(
Seq(
os.rel / "run.scala" -> """object Main extends App { println("hello")}"""
)
)
inputs.fromRoot { root =>
val p = os.proc(TestUtil.cli, "run.scala", "--jvm", "8").call(cwd = root)
expect(p.out.text().trim == "hello")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -509,5 +509,4 @@ abstract class TestTestDefinitions(val scalaVersionOpt: Option[String])
expect(output.contains("Hello from native"))
}
}

}
6 changes: 3 additions & 3 deletions website/docs/commands/package.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ scala-cli package Hello.scala -o hello
# Hello
```

<!-- Expected
<!-- Expected
Hello
-->

Expand Down Expand Up @@ -114,7 +114,7 @@ The docker image name parameter `--docker-image-repository` is mandatory.
The following command generates a `hello-docker` image with the `latest` tag:

```bash
scala-cli package --docker HelloDocker.scala --docker-image-repository hello-docker
scala-cli package --jvm 8 --docker HelloDocker.scala --docker-image-repository hello-docker
```

<!-- Expected:
Expand Down Expand Up @@ -280,7 +280,7 @@ scala-cli package --rpm --output 'path.rpm' Hello.scala
### macOS (PKG)

PKG is the software package format for macOs.
To build a PKG you will need to have [`pkgbuild`](https://www.unix.com/man-page/osx/1/pkgbuild/) installed.
To build a PKG you will need to have [`pkgbuild`](https://www.unix.com/man-page/osx/1/pkgbuild/) installed.

Example:

Expand Down
7 changes: 2 additions & 5 deletions website/docs/cookbooks/scala-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Passing `--docker` to the `package` sub-command generates a Docker image. When c
The following command generates a `hello-docker` image with the `latest` tag:

```bash
scala-cli package --docker HelloDocker.scala --docker-image-repository hello-docker
scala-cli package --jvm 8 --docker HelloDocker.scala --docker-image-repository hello-docker
```

<!-- Expected:
Expand Down Expand Up @@ -51,12 +51,9 @@ Built docker image, run it with
This command creates a Scala Native Docker image:

```bash ignore
scala-cli package --native --docker HelloDocker.scala --docker-image-repository hello-docker
scala-cli package --native --jvm 8 --docker HelloDocker.scala --docker-image-repository hello-docker
```

:::note
Packaging a Scala Native application to a Docker image is supported only on Linux.
:::



0 comments on commit 99b932d

Please sign in to comment.