Skip to content

Commit

Permalink
#21 Support Scala 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
ihostage committed Feb 14, 2020
1 parent 12d03df commit 619c499
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ align = true
assumeStandardLibraryStripMargin = true
danglingParentheses = true
docstrings = JavaDoc
maxColumn = 140
maxColumn = 120
project.git = true
rewrite.rules = [ AvoidInfix, ExpandImportSelectors, RedundantParens, SortModifiers, PreferCurlyFors ]
rewrite.sortModifiers.order = [ "private", "protected", "final", "sealed", "abstract", "implicit", "override", "lazy" ]
spaces.inImportCurlyBraces = true # more idiomatic to include whitepsace in import x.{ yyy }
trailingCommas = preserve
version = 2.0.0-RC5
version = 2.3.2
14 changes: 6 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ jdk:
- openjdk8

env:
- SCALA_VERSION=2.11
- SCALA_VERSION=2.12
- SCALA_VERSION=2.11 LAGOM_VERSION=1.4.15
- SCALA_VERSION=2.12 LAGOM_VERSION=1.5.5
- SCALA_VERSION=2.13 LAGOM_VERSION=1.6.0

matrix:
fast_finish: true
Expand All @@ -19,10 +20,7 @@ cache:
- $HOME/.gradle/wrapper/

script:
# Test with Lagom 1.4.X
- ./gradlew clean check -PlagomVersion=1.4.13 -PscalaBinaryVersion=$SCALA_VERSION
# Test with Lagom 1.5.X
- ./gradlew clean check -PscalaBinaryVersion=$SCALA_VERSION
- ./gradlew clean check -PlagomVersion=$LAGOM_VERSION -PscalaBinaryVersion=$SCALA_VERSION

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand All @@ -33,13 +31,13 @@ before_deploy:
deploy:
# Deploy releases
- provider: script
script: ./gradlew publishToNexus closeAndReleaseRepository -x test -Psigning.keyId=$GPG_KEY_NAME -Psigning.password="$GPG_PASSPHRASE" -Psigning.secretKeyRingFile=$HOME/.gnupg/taymyr.gpg -PossrhUsername=$OSS_USERNAME -PossrhPassword="$OSS_PASSWORD" -PscalaBinaryVersion=$SCALA_VERSION
script: ./gradlew publishToNexus closeAndReleaseRepository -x test -Psigning.keyId=$GPG_KEY_NAME -Psigning.password="$GPG_PASSPHRASE" -Psigning.secretKeyRingFile=$HOME/.gnupg/taymyr.gpg -PossrhUsername=$OSS_USERNAME -PossrhPassword="$OSS_PASSWORD" -PscalaBinaryVersion=$SCALA_VERSION -PlagomVersion=$LAGOM_VERSION
skip_cleanup: true
on:
tags: true
# Deploy snapshots
- provider: script
script: ./gradlew publishToNexus -x test -Psigning.keyId=$GPG_KEY_NAME -Psigning.password="$GPG_PASSPHRASE" -Psigning.secretKeyRingFile=$HOME/.gnupg/taymyr.gpg -PossrhUsername=$OSS_USERNAME -PossrhPassword="$OSS_PASSWORD" -PscalaBinaryVersion=$SCALA_VERSION
script: ./gradlew publishToNexus -x test -Psigning.keyId=$GPG_KEY_NAME -Psigning.password="$GPG_PASSPHRASE" -Psigning.secretKeyRingFile=$HOME/.gnupg/taymyr.gpg -PossrhUsername=$OSS_USERNAME -PossrhPassword="$OSS_PASSWORD" -PscalaBinaryVersion=$SCALA_VERSION -PlagomVersion=$LAGOM_VERSION
skip_cleanup: true
on:
branch: master
Expand Down
10 changes: 5 additions & 5 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@Suppress("ObjectPropertyName")
object Versions {
const val kotlin = "1.3.30"
const val scalaBinary = "2.12"
const val lagom = "1.5.1" // "1.4.13"
const val kotlin = "1.3.61"
const val scalaBinary = "2.13"
const val lagom = "1.6.0" // "1.4.13"
const val ktlint = "0.32.0"
const val `ktlint-plugin` = "8.0.0"
const val `kotlin-logging` = "1.6.10"
Expand All @@ -16,6 +16,6 @@ object Versions {
const val `nexus-publish` = "0.2.0"
const val dokka = "0.9.18"
const val lombok = "3.5.1"
const val `scalafmt-plugin` = "1.8.0"
const val scalatest = "3.0.7"
const val `scalafmt-plugin` = "1.13.0"
const val scalatest = "3.0.8"
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,16 @@ class SpecGenerator(spec: OpenAPI = new OpenAPI()) extends InternalServiceReader
private def parseServiceInfo(service: Service): LagomServiceInfo = {
val serviceClass = service.getClass
val calls: List[LagomCallInfo] = service.descriptor.calls
.map(
call =>
call.serviceCallHolder match {
case serviceCall: ScalaMethodServiceCall[_, _] =>
val method = serviceCall.method
new LagomCallInfo(method, opeapiPath(call), httpMethod(call, method).name())
case _ =>
throw new IllegalArgumentException(
"Undefined type of ServiceCallHolder, only ScalaMethodServiceCall is supported at the moment"
)
}
.map(call =>
call.serviceCallHolder match {
case serviceCall: ScalaMethodServiceCall[_, _] =>
val method = serviceCall.method
new LagomCallInfo(method, opeapiPath(call), httpMethod(call, method).name())
case _ =>
throw new IllegalArgumentException(
"Undefined type of ServiceCallHolder, only ScalaMethodServiceCall is supported at the moment"
)
}
)
.toList
new LagomServiceInfo(serviceClass, calls.asJava)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import org.taymyr.lagom.scaladsl.openapi.OpenAPIService
info = new Info(
version = "1.0.0",
title = "Swagger Petstore",
description = "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification",
description =
"A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification",
termsOfService = "http://swagger.io/terms/",
contact = new Contact(name = "Swagger API Team", email = "apiteam@swagger.io", url = "http://swagger.io"),
license = new License(name = "Apache 2.0", url = "https://www.apache.org/licenses/LICENSE-2.0.html")
Expand Down Expand Up @@ -60,12 +61,17 @@ trait PetsService extends OpenAPIService with Service {
new ApiResponse(
responseCode = "200",
description = "pet response",
content =
Array(new Content(mediaType = "application/json", array = new ArraySchema(schema = new Schema(implementation = classOf[Pet]))))
content = Array(
new Content(
mediaType = "application/json",
array = new ArraySchema(schema = new Schema(implementation = classOf[Pet]))
)
)
),
new ApiResponse(
description = "unexpected error",
content = Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[Error])))
content =
Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[Error])))
)
)
)
Expand All @@ -77,7 +83,8 @@ trait PetsService extends OpenAPIService with Service {
requestBody = new RequestBody(
description = "Pet to add to the store",
required = true,
content = Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[NewPet])))
content =
Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[NewPet])))
),
responses = Array(
new ApiResponse(
Expand All @@ -87,7 +94,8 @@ trait PetsService extends OpenAPIService with Service {
),
new ApiResponse(
description = "unexpected error",
content = Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[Error])))
content =
Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[Error])))
)
)
)
Expand All @@ -113,7 +121,8 @@ trait PetsService extends OpenAPIService with Service {
),
new ApiResponse(
description = "unexpected error",
content = Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[Error])))
content =
Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[Error])))
)
)
)
Expand All @@ -135,7 +144,8 @@ trait PetsService extends OpenAPIService with Service {
new ApiResponse(responseCode = "204", description = "pet deleted"),
new ApiResponse(
description = "unexpected error",
content = Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[Error])))
content =
Array(new Content(mediaType = "application/json", schema = new Schema(implementation = classOf[Error])))
)
)
)
Expand Down

0 comments on commit 619c499

Please sign in to comment.