Skip to content
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

Upgrade dependencies #694

Merged
merged 12 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
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
59 changes: 30 additions & 29 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name := "apibuilder-generator"

organization := "io.apibuilder.generator"

ThisBuild / scalaVersion := "2.13.11"
ThisBuild / scalaVersion := "2.13.14"

ThisBuild / javacOptions ++= Seq("-source", "17", "-target", "17")

Expand Down Expand Up @@ -33,7 +33,7 @@ lazy val generated = project
.settings(
libraryDependencies ++= Seq(
ws,
"org.scalacheck" %% "scalacheck" % "1.15.4" % Test
"org.scalacheck" %% "scalacheck" % "1.18.0" % Test
),
scalacOptions ++= allScalacOptions
)
Expand All @@ -60,7 +60,7 @@ lazy val generator = project
routesGenerator := InjectedRoutesGenerator,
libraryDependencies ++= Seq(
ws,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % "test"
"org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % "test"
),
scalacOptions ++= allScalacOptions,
Test / javaOptions ++= Seq(
Expand All @@ -75,9 +75,9 @@ lazy val javaAwsLambdaPojos = project
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-java-sdk-dynamodb" % "1.11.461",
"com.amazonaws" % "aws-java-sdk-dynamodb" % "1.12.731",
"me.geso" % "tinyvalidator" % "0.9.1",
"org.projectlombok" % "lombok" % "1.18.24"
"org.projectlombok" % "lombok" % "1.18.32"
)
)

Expand All @@ -88,7 +88,7 @@ lazy val scalaGenerator = project
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"org.scalameta" %% "scalafmt-core" % "2.3.2"
"org.scalameta" %% "scalafmt-core" % "3.8.1"
)
)

Expand All @@ -98,7 +98,7 @@ lazy val csharpGenerator = project
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.10.0"
"org.typelevel" %% "cats-core" % "2.12.0"
)
)

Expand All @@ -108,7 +108,7 @@ lazy val elmGenerator = project
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.10.0"
"org.typelevel" %% "cats-core" % "2.12.0"
)
)

Expand Down Expand Up @@ -145,9 +145,10 @@ lazy val graphQLGenerator = project
),
)

val kotlinLangVersion = "1.3.72"
val mockitoVersion = "4.5.1"
val scalatestVersion = "3.2.12"
val mockitoVersion = "4.11.0"
val scalatestVersion = "3.2.18"
val jacksonVersion = "2.17.1"
val kotlinLangVersion = "2.0.0"

lazy val kotlinGenerator = project
.in(file("kotlin-generator"))
Expand All @@ -156,13 +157,13 @@ lazy val kotlinGenerator = project
Test / fork := true,
Test / baseDirectory := file("."),
libraryDependencies ++= Seq(
"com.fasterxml.jackson.module" % "jackson-module-kotlin" % "2.9.9",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.9.9",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.9",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.9",
"org.threeten" % "threetenbp" % "1.3.8",
"com.squareup" % "kotlinpoet" % "1.3.0",
"com.squareup.retrofit2" % "retrofit" % "2.5.0",
"com.fasterxml.jackson.module" % "jackson-module-kotlin" % jacksonVersion,
"com.fasterxml.jackson.core" % "jackson-annotations" % jacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion,
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % jacksonVersion,
"org.threeten" % "threetenbp" % "1.6.9",
"com.squareup" % "kotlinpoet-jvm" % "1.18.0",
"com.squareup.retrofit2" % "retrofit" % "2.11.0",
"com.jakewharton.retrofit" % "retrofit2-rxjava2-adapter" % "1.0.0",
"org.jetbrains.kotlin" % "kotlin-stdlib" % kotlinLangVersion % "test",
"org.jetbrains.kotlin" % "kotlin-stdlib-jdk8" % kotlinLangVersion % "test",
Expand All @@ -181,7 +182,7 @@ lazy val csvGenerator = project
Test / fork := true,
Test / baseDirectory := file("."),
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-csv" % "1.7"
"org.apache.commons" % "commons-csv" % "1.11.0"
)
)

Expand All @@ -191,7 +192,7 @@ lazy val postmanGenerator = project
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"com.lihaoyi" %% "ammonite-ops" % "2.0.4",
"com.lihaoyi" %% "ammonite-ops" % "2.4.1",
)
)

Expand All @@ -201,18 +202,19 @@ lazy val commonSettings: Seq[Setting[_]] = Seq(
testOptions += Tests.Argument("-oF"),
libraryDependencies ++= Seq(
guice,
"com.typesafe.play" %% "play-json-joda" % "2.9.4",
"com.google.inject" % "guice" % "5.1.0",
"com.google.inject.extensions" % "guice-assistedinject" % "5.1.0",
"org.atteo" % "evo-inflector" % "1.2.2",
"com.squareup.retrofit2" % "retrofit" % "2.5.0",
"io.reactivex.rxjava2" % "rxjava" % "2.2.4",
"org.typelevel" %% "cats-core" % "2.10.0",
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test,
"org.atteo" % "evo-inflector" % "1.3",
"com.squareup.retrofit2" % "retrofit" % "2.11.0",
"io.reactivex.rxjava2" % "rxjava" % "2.2.21",
"org.typelevel" %% "cats-core" % "2.12.0",
"org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % "test",
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.7.0" % Test,
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.11.0" % Test,
"org.mockito" % "mockito-core" % mockitoVersion % Test,
"com.github.javaparser" % "javaparser-core" % "3.24.2" % Test,
"org.scalameta" %% "scalameta" % "4.4.3" % Test,
"com.github.javaparser" % "javaparser-core" % "3.25.10" % Test,
"org.scalameta" %% "scalameta" % "4.9.5" % Test,
"com.squareup" % "javapoet" % "1.13.0",
),
scalacOptions ++= allScalacOptions,
Expand All @@ -223,4 +225,3 @@ lazy val commonSettings: Seq[Setting[_]] = Seq(
Compile / doc / sources := Seq.empty,
Compile / packageDoc / publishArtifact := false,
)
version := "0.10.19"
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package models.generator.kotlin

import java.io.StringWriter

import com.fasterxml.jackson.annotation._
import com.fasterxml.jackson.core.{JsonGenerator, JsonParser, Version}
import com.fasterxml.jackson.databind._
Expand All @@ -22,7 +21,7 @@ class KotlinGenerator
extends CodeGenerator
with KotlinUtil {

private implicit def classToClassName(clazz: java.lang.Class[_]): ClassName = new ClassName(clazz.getPackage.getName, clazz.getSimpleName)
private implicit def classToClassName(clazz: java.lang.Class[?]): ClassName = new ClassName(clazz.getPackage.getName, java.util.List.of(clazz.getSimpleName))

private val kdocClassMessage = s"This code was generated by [${classOf[KotlinGenerator].getName}]\n"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class KotlinGeneratorTest

private val serviceDefs = Seq(builtInTypesService,
// dateTimeService,
// generatorApiServiceWithUnionAndDescriminator,
// generatorApiServiceWithUnionAndDiscriminator,
apidocApiService,
collectionJsonDefaultsService,
referenceApiService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ object KotlinTestHelper extends Matchers {

def assertKotlinCodeCompiles(kotlinSourceDirectory: java.io.File): Unit = {
assert(kotlinSourceDirectory.exists())
assert(kotlinSourceDirectory.canRead())
assert(kotlinSourceDirectory.isDirectory())
assert(kotlinSourceDirectory.canRead)
assert(kotlinSourceDirectory.isDirectory)
val result = new KotlinCompiler().compileSourceDir(kotlinSourceDirectory.toPath)
result.isSuccess shouldBe true
()
Expand Down
3 changes: 2 additions & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sbt.version=1.7.1
sbt.version=1.10.0

4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ logLevel := Level.Warn
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.20")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.3")

addSbtPlugin("com.github.sbt" % "sbt-javaagent" % "0.1.8")
2 changes: 1 addition & 1 deletion scala-generator/src/main/scala/utils/ScalaFormatter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package utils
object ScalaFormatter {

def format(code: String): Either[Throwable, String] =
org.scalafmt.Scalafmt.format(code, org.scalafmt.config.ScalafmtConfig.default120)
org.scalafmt.Scalafmt.format(code, org.scalafmt.config.ScalafmtConfig.default)
.toEither

}
14 changes: 6 additions & 8 deletions scala-generator/src/test/scala/utils/ScalaFormatterSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ import org.scalatest.matchers.should.Matchers

class ScalaFormatterSpec extends AnyFunSpec with Matchers {

it("ScalaFormatter should format valid scala code") {
val contents = "case class Foo(bar: String)"
val result = ScalaFormatter.format(contents)
private[this] def format(code: String) = {
ScalaFormatter.format(code)
}

result should be(Symbol("right"))
it("ScalaFormatter should format valid scala code") {
format("case class Foo(bar: String)") should be(Symbol("right"))
}

it("ScalaFormatter should fail to format invalid scala code") {
val contents = "Foo Bar"
val result = ScalaFormatter.format(contents)

result should be(Symbol("left"))
format("Foo Bar {") should be(Symbol("left"))
}

}
Loading