Skip to content

Commit

Permalink
Unify java versions (#399)
Browse files Browse the repository at this point in the history
* Unify java versions

* Unify java versions

* Unify java versions

* Unify java versions

Restore Java 17
  • Loading branch information
andrzejressel authored May 28, 2024
1 parent bfe6e28 commit 96417fd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ This will generate a GitHub workflow file inside the `.github/workflows` directo

### Default Testing Strategy

The default testing strategy for ZIO SBT CI plugin is to run `sbt +test` on java 8, 11 and 17. So this will generate the following job:
The default testing strategy for ZIO SBT CI plugin is to run `sbt +test` on Corretto Java 11, 17 and 21. So this will generate the following job:

```yaml
test:
Expand Down
2 changes: 1 addition & 1 deletion zio-sbt-ci/src/main/scala/zio/sbt/ZioSbtCiPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object ZioSbtCiPlugin extends AutoPlugin {
)
val ciDefaultJavaVersion: SettingKey[String] =
settingKey[String](
"The default Java version which is used in CI, especially for releasing artifacts, defaults to 17"
"The default Java version which is used in CI, especially for releasing artifacts, defaults to 17. Note that this is just JDK version used for compilation. Artefact will be compiled with -target and -source flags specified by 'javaPlatform' setting or 'javaPlatform' parameter in 'stdSettings'"
)
val ciCheckGithubWorkflow: TaskKey[Unit] = taskKey[Unit]("Make sure if the ci.yml file is up-to-date")
val ciCheckArtifactsBuildSteps: SettingKey[Seq[Step]] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ object ZioSbtEcosystemPlugin extends AutoPlugin {
lazy val scala213: SettingKey[String] = settingKey[String]("Scala 2.13 version")
lazy val zioVersion: SettingKey[String] = settingKey[String]("ZIO version")

lazy val javaPlatform: SettingKey[String] = settingKey[String]("java target platform, default is 8")
lazy val javaPlatform: SettingKey[String] = settingKey[String]("java target platform, default is 11")

val welcomeBannerEnabled: SettingKey[Boolean] =
settingKey[Boolean]("Indicates whether or not to enable the welcome banner.")
Expand Down Expand Up @@ -109,7 +109,7 @@ object ZioSbtEcosystemPlugin extends AutoPlugin {
scalaVersion := scala213.value,
crossScalaVersions := Seq(scala212.value, scala213.value, scala3.value),
zioVersion := Versions.zioVersion,
javaPlatform := "8"
javaPlatform := "11"
)

override def globalSettings: Seq[Def.Setting[_]] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package zio.sbt.githubactions

import io.circe.syntax._

import zio.sbt.githubactions.ScalaWorkflow.JavaVersion.AdoptJDK18
import zio.sbt.githubactions.ScalaWorkflow.JavaVersion.JDK11

// The original code of the githubactions package was originally copied from the zio-aws-codegen project:
// https://github.com/zio/zio-aws/tree/master/zio-aws-codegen/src/main/scala/zio/aws/codegen/githubactions
Expand Down Expand Up @@ -217,23 +217,25 @@ object ScalaWorkflow {

case class ScalaVersion(version: String)

sealed trait JavaVersion {
trait JavaVersion {
val asString: String
}
object JavaVersion {
case object AdoptJDK18 extends JavaVersion {
override val asString: String = "[email protected]"
}
case object ZuluJDK17 extends JavaVersion {
override val asString: String = "[email protected]"

case class CorrettoJDK(javaVersion: String) extends JavaVersion {
override val asString: String = s"corretto:$javaVersion"
}

val JDK11: JavaVersion = CorrettoJDK("11")
val JDK17: JavaVersion = CorrettoJDK("17")
val JDK21: JavaVersion = CorrettoJDK("21")
}

implicit class JobOps(job: Job) {
def matrix(
scalaVersions: Seq[ScalaVersion],
operatingSystems: Seq[OS] = Seq(OS.UbuntuLatest),
javaVersions: Seq[JavaVersion] = Seq(AdoptJDK18)
javaVersions: Seq[JavaVersion] = Seq(JDK11)
): Job =
job.copy(
strategy = Some(
Expand Down

0 comments on commit 96417fd

Please sign in to comment.