Skip to content

Commit

Permalink
Upgrade to scala3
Browse files Browse the repository at this point in the history
  • Loading branch information
mbryzek committed Jul 11, 2024
1 parent fdc0035 commit 75aa1da
Show file tree
Hide file tree
Showing 80 changed files with 1,557 additions and 16,614 deletions.
2 changes: 1 addition & 1 deletion .apibuilder/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ code:
apibuilder-spec:
version: latest
generators:
play_2_x_standalone_json: src/main/scala/io/apibuilder/generated
play_2_x_scala_3_standalone_json: src/main/scala/io/apibuilder/generated
4 changes: 0 additions & 4 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ apibuilder download apicollective apibuilder-explicit-validation-core latest ser
apibuilder download apicollective apibuilder-explicit-validation latest service > ./src/test/resources/apibuilder-explicit-validation-service.json
apibuilder download flow api latest service > ./src/test/resources/flow-api-service.json
apibuilder download flow api-internal latest service > ./src/test/resources/flow-api-internal-service.json
apibuilder download apicollective apibuilder-api latest service > ./src/test/resources/apibuilder-api-service.json
apibuilder download apicollective apibuilder-common latest service > ./src/test/resources/apibuilder-common-service.json
Expand Down
6 changes: 0 additions & 6 deletions apibuilder-explicit-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@
]
},

"browser_bundle_form": {
"fields": [
{ "name": "feature", "type": "browser_bundle_feature_form", "required": false }
]
},

"browser_bundle_form": {
"fields": [
{ "name": "optin", "type": "browser_bundle_optin_form", "required": false },
Expand Down
48 changes: 8 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,15 @@ name := "apibuilder-validation"

organization := "io.apibuilder"

ThisBuild / scalaVersion := "2.13.10"

crossScalaVersions := Seq("2.13.10")
ThisBuild / scalaVersion := "3.4.2"

lazy val allScalacOptions = Seq(
"-deprecation",
"-feature",
"-Xfatal-warnings",
"-unchecked",
"-Xcheckinit",
"-Xlint:adapted-args",
"-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
"-Wconf:src=generated/.*:silent",
"-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val resolversSettings = Seq(
resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release/",
resolvers += "Flow Artifactory" at "https://flow.jfrog.io/flow/libs-release-local/",
credentials += Credentials(
"Artifactory Realm",
"flow.jfrog.io",
System.getenv("ARTIFACTORY_USERNAME"),
System.getenv("ARTIFACTORY_PASSWORD")
)
resolvers += "jitpack" at "https://jitpack.io"
)

lazy val root = project
Expand All @@ -35,28 +19,12 @@ lazy val root = project
.settings(
testOptions += Tests.Argument("-oF"),
libraryDependencies ++= Seq(
"io.apibuilder" %% "apibuilder-commons" % "0.0.6",
"com.typesafe.play" %% "play-json" % "2.9.0",
"com.typesafe.play" %% "play-json-joda" % "2.9.0",
"org.apache.commons" % "commons-compress" % "1.20",
"org.typelevel" %% "cats-core" % "2.1.1",
"org.scalatest" %% "scalatest" % "3.2.9" % Test,
),
credentials += Credentials(
"Artifactory Realm",
"flow.jfrog.io",
System.getenv("ARTIFACTORY_USERNAME"),
System.getenv("ARTIFACTORY_PASSWORD")
"com.github.apicollective" % "apibuilder-commons" % "0.1.0",
"com.typesafe.play" %% "play-json" % "2.10.6",
"com.typesafe.play" %% "play-json-joda" % "2.10.6",
"org.apache.commons" % "commons-compress" % "1.26.2",
"org.typelevel" %% "cats-core" % "2.12.0",
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
),
scalacOptions ++= allScalacOptions,
)

publishTo := {
val host = "https://flow.jfrog.io/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
version := "0.4.33"
4 changes: 3 additions & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
sbt.version=1.8.2
sbt.version=1.10.0


5 changes: 0 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
// Comment to get more information during initialization
logLevel := Level.Warn

// Artifactory credentials
credentials += Credentials(Path.userHome / ".ivy2" / ".artifactory")

addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.10")
6 changes: 3 additions & 3 deletions src/main/scala/io/apibuilder/ApiBuilderHelper.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package apibuilder

import io.apibuilder.spec.v0.models._
import io.apibuilder.validation.{AnyType, ApiBuilderField, ApiBuilderService, ApiBuilderType, ApiBuilderUnionType, MultiService, ScalarType, TypeName}
import io.apibuilder.spec.v0.models.*
import io.apibuilder.validation.*

import scala.annotation.tailrec
import scala.util.matching.Regex
Expand Down Expand Up @@ -49,7 +49,7 @@ trait ApiBuilderHelper {
def resolveType(service: Service, parameter: Parameter): Option[AnyType] = resolveType(service, parameter.`type`)

def resolveType(typeName: TypeName): Option[AnyType] = {
multiService.services().find(_.namespace == typeName.namespace).flatMap { s =>
multiService.services.find(_.namespace == typeName.namespace).flatMap { s =>
resolveType(s, typeName.name)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait ApiBuilderServiceBuilders {
}

def makeService(
apidoc: Apidoc = makeApidoc(),
apidoc: Option[Apidoc] = None,
name: String = random(),
organization: Organization = makeOrganization(),
application: Application = makeApplication(),
Expand Down
Loading

0 comments on commit 75aa1da

Please sign in to comment.