diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0d870103..d43b89f9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ '13' ] - scala: [ '2.13.8' ] + java: [ '17' ] + scala: [ '2.13.11' ] steps: - uses: actions/checkout@v2 - name: Set up JDK @@ -25,4 +25,4 @@ jobs: - name: Build run: | docker run -d -p 127.0.0.1:5432:5432 flowcommerce/apibuilder-postgresql:latest - sbt ++${{ matrix.scala }} clean coverage test coverageReport + sbt ++${{ matrix.scala }} clean test diff --git a/.travis.yml b/.travis.yml index fc01feba3..d842141d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ services: before_script: - docker run -d -p 127.0.0.1:7659:5432 flowcommerce/apibuilder-postgresql:latest script: - - sbt ++$TRAVIS_SCALA_VERSION clean compile test + - CONF_APIBUILDER_API_HOST=http://localhost:9001 sbt ++$TRAVIS_SCALA_VERSION clean compile test branches: only: - main diff --git a/api/Dockerfile b/api/Dockerfile index 73727d6de..df4244d02 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,9 +1,9 @@ -FROM flowdocker/play_builder:latest-java13 as builder +FROM flowdocker/play_builder:latest-java17 as builder ADD . /opt/play WORKDIR /opt/play RUN sbt 'project api' clean stage -FROM flowdocker/play:latest-java13 +FROM flowdocker/play:latest-java17 COPY --from=builder /opt/play /opt/play WORKDIR /opt/play/api/target/universal/stage ENTRYPOINT ["java", "-jar", "/root/environment-provider.jar", "--service", "play", "apibuilder-api", "bin/apibuilder-api"] diff --git a/api/app/actors/EmailActor.scala b/api/app/actors/EmailActor.scala index de6b6105d..41c5b5402 100644 --- a/api/app/actors/EmailActor.scala +++ b/api/app/actors/EmailActor.scala @@ -1,10 +1,10 @@ package actors -import akka.actor.{ActorLogging, ActorSystem} +import akka.actor.{Actor, ActorLogging, ActorSystem} import db._ import io.apibuilder.api.v0.models.Publication import lib.{AppConfig, Email, Person, Role} -import akka.actor.Actor + import java.util.UUID object EmailActor { @@ -36,8 +36,6 @@ class EmailActor @javax.inject.Inject() ( usersDao: UsersDao ) extends Actor with ActorLogging with ErrorHandler { - private[this] implicit val ec = system.dispatchers.lookup("email-actor-context") - def receive = { case m @ EmailActor.Messages.MembershipRequestCreated(guid) => withVerboseErrorHandler(m) { diff --git a/api/app/actors/GeneratorServiceActor.scala b/api/app/actors/GeneratorServiceActor.scala index 3501c1800..bb72698c6 100644 --- a/api/app/actors/GeneratorServiceActor.scala +++ b/api/app/actors/GeneratorServiceActor.scala @@ -24,7 +24,7 @@ class GeneratorServiceActor @javax.inject.Inject() ( processor: GeneratorServiceActorProcessor, ) extends Actor with ActorLogging with ErrorHandler { - private[this] implicit val ec = system.dispatchers.lookup("generator-service-actor-context") + private[this] implicit val ec: ExecutionContext = system.dispatchers.lookup("generator-service-actor-context") system.scheduler.scheduleAtFixedRate(1.hour, 1.hour, self, GeneratorServiceActorMessage.SyncAll) diff --git a/api/app/actors/MainActor.scala b/api/app/actors/MainActor.scala index dc2be37f2..8ac429923 100644 --- a/api/app/actors/MainActor.scala +++ b/api/app/actors/MainActor.scala @@ -1,12 +1,12 @@ package actors import java.util.UUID - import akka.actor._ import db.VersionsDao import lib.Role import play.api.Mode +import scala.concurrent.ExecutionContext import scala.concurrent.duration.{FiniteDuration, SECONDS} import scala.util.{Failure, Success, Try} @@ -39,7 +39,7 @@ class MainActor @javax.inject.Inject() ( @javax.inject.Named("user-actor") userActor: akka.actor.ActorRef ) extends Actor with ActorLogging with ErrorHandler { - private[this] implicit val ec = system.dispatchers.lookup("main-actor-context") + private[this] implicit val ec: ExecutionContext = system.dispatchers.lookup("main-actor-context") private[this] case object Startup diff --git a/api/app/actors/UserActor.scala b/api/app/actors/UserActor.scala index 2e32daa6b..e84589aa7 100644 --- a/api/app/actors/UserActor.scala +++ b/api/app/actors/UserActor.scala @@ -1,10 +1,10 @@ package actors -import akka.actor.{Actor, ActorLogging, ActorSystem} -import db.{EmailVerificationsDao, MembershipRequestsDao, OrganizationsDao, UsersDao} -import lib.Role -import play.api.Logger +import akka.actor.{Actor, ActorLogging} +import db.UsersDao + import java.util.UUID +import javax.inject.{Inject, Singleton} object UserActor { @@ -14,14 +14,11 @@ object UserActor { } -@javax.inject.Singleton -class UserActor @javax.inject.Inject() ( - system: ActorSystem, +@Singleton +class UserActor @Inject() ( usersDao: UsersDao ) extends Actor with ActorLogging with ErrorHandler { - private[this] implicit val ec = system.dispatchers.lookup("user-actor-context") - def receive = { case m @ UserActor.Messages.UserCreated(guid) => withVerboseErrorHandler(m) { diff --git a/api/app/controllers/MembershipRequests.scala b/api/app/controllers/MembershipRequests.scala index 96ddb3425..551c3a40e 100644 --- a/api/app/controllers/MembershipRequests.scala +++ b/api/app/controllers/MembershipRequests.scala @@ -24,7 +24,7 @@ class MembershipRequests @Inject() ( object MembershipRequestForm { - implicit val membershipRequestFormReads = Json.reads[MembershipRequestForm] + private[controllers] implicit val membershipRequestFormReads: Reads[MembershipRequestForm] = Json.reads[MembershipRequestForm] } diff --git a/api/app/controllers/Users.scala b/api/app/controllers/Users.scala index 2db4844e3..9b3d38022 100644 --- a/api/app/controllers/Users.scala +++ b/api/app/controllers/Users.scala @@ -5,12 +5,13 @@ import io.apibuilder.api.v0.models.json._ import lib.Validation import util.SessionHelper import db.{UserPasswordsDao, UsersDao} + import javax.inject.Inject +import play.api.libs.json.{JsArray, JsBoolean, JsError, JsObject, JsString, JsSuccess, Json, Reads} -import play.api.libs.json.{JsArray, JsBoolean, JsError, JsObject, JsString, JsSuccess, Json} import java.util.UUID - import play.api.libs.ws.WSClient + import scala.concurrent.Future class Users @Inject() ( @@ -24,10 +25,10 @@ class Users @Inject() ( import scala.concurrent.ExecutionContext.Implicits.global private[this] case class UserAuthenticationForm(email: String, password: String) - private[this] implicit val userAuthenticationFormReads = Json.reads[UserAuthenticationForm] + private[this] implicit val userAuthenticationFormReads: Reads[UserAuthenticationForm] = Json.reads[UserAuthenticationForm] private[this] case class GithubAuthenticationForm(token: String) - private[this] implicit val githubAuthenticationFormReads = Json.reads[GithubAuthenticationForm] + private[this] implicit val githubAuthenticationFormReads: Reads[GithubAuthenticationForm] = Json.reads[GithubAuthenticationForm] def get( guid: Option[UUID], diff --git a/api/app/lib/AppConfig.scala b/api/app/lib/AppConfig.scala index f35bbf99a..4de9228cd 100644 --- a/api/app/lib/AppConfig.scala +++ b/api/app/lib/AppConfig.scala @@ -9,8 +9,6 @@ class AppConfig @Inject() ( val apibuilderWwwHost: String = config.requiredString("apibuilder.app.host") - val apibuilderVersion: String = config.requiredString("git.version") - val subjectPrefix: String = config.requiredString("mail.subjectPrefix") val emailDefaultFromEmail: String = config.requiredString("mail.defaultFromEmail") diff --git a/api/app/util/UserAgent.scala b/api/app/util/UserAgent.scala index 1dc1ef273..f38576213 100644 --- a/api/app/util/UserAgent.scala +++ b/api/app/util/UserAgent.scala @@ -20,7 +20,6 @@ class UserAgent @Inject() ( ): String = { Seq( "apibuilder", - appConfig.apibuilderVersion, Seq( Some("https://" + appConfig.apibuilderWwwHost), Some(orgKey), diff --git a/api/conf/application.conf b/api/conf/application.conf new file mode 100644 index 000000000..1640f4f7a --- /dev/null +++ b/api/conf/application.conf @@ -0,0 +1,3 @@ +include "devandtest.conf" + +play.modules.enabled += "modules.ProductionClientModule" diff --git a/api/conf/application.test.conf b/api/conf/application.test.conf index 1ccf27022..f611cb1af 100644 --- a/api/conf/application.test.conf +++ b/api/conf/application.test.conf @@ -1,12 +1,3 @@ -include "base.conf" +include "devandtest.conf" -db.default.url="jdbc:postgresql://localhost/apibuilderdb" -db.default.url=${?CONF_DB_DEFAULT_URL} - -apibuilder.app.host="http://localhost:9000" - -play.http.secret.key="development:uauTKwTxIpP4dWJA53s1ekGwpPdVfUmdCmSMgxa4" - -mail.localDeliveryDir="/tmp/email.apibuilder" - -play.modules.enabled += "modules.TestClientModule" +play.modules.enabled += "modules.TestClientModule" \ No newline at end of file diff --git a/api/conf/base.conf b/api/conf/base.conf index 72be5e28a..8ef56535d 100644 --- a/api/conf/base.conf +++ b/api/conf/base.conf @@ -19,14 +19,12 @@ play.http.requestHandler = "play.http.DefaultHttpRequestHandler" play.modules.enabled += "actors.ActorsModule" play.modules.enabled += "io.flow.play.clients.ConfigModule" -mail.defaultFromEmail="mbryzek@alum.mit.edu" +mail.defaultFromEmail="mbryzek@gmail.com" mail.defaultFromName="apibuilder" mail.subjectPrefix="[apibuilder]" # Space separate list of email addresses -apibuilder.sendErrorsTo="mbryzek@alum.mit.edu" - -git.version=0.15.33 +apibuilder.sendErrorsTo="mbryzek@gmail.com" akka { actor { diff --git a/api/conf/devandtest.conf b/api/conf/devandtest.conf new file mode 100644 index 000000000..445106913 --- /dev/null +++ b/api/conf/devandtest.conf @@ -0,0 +1,11 @@ +include "base.conf" + +db.default.url="jdbc:postgresql://localhost/apibuilderdb" +db.default.url=${?CONF_DB_DEFAULT_URL} + +apibuilder.app.host="http://localhost:9000" + +play.http.secret.key="development:uauTKwTxIpP4dWJA53s1ekGwpPdVfUmdCmSMgxa4" + +mail.localDeliveryDir="/tmp/email.apibuilder" + diff --git a/api/test/util/UserAgentSpec.scala b/api/test/util/UserAgentSpec.scala index 2842bd56d..07dd1bbfa 100644 --- a/api/test/util/UserAgentSpec.scala +++ b/api/test/util/UserAgentSpec.scala @@ -13,21 +13,21 @@ class UserAgentSpec extends PlaySpec with GuiceOneAppPerSuite { applicationKey = "apibuilder", versionName = "1.2.3", generatorKey = Some("play_client") - ) must fullyMatch regex("apibuilder 0\\.[0-9]+\\.[0-9]+ localhost 9000/apicollective/apibuilder/1\\.2\\.3/play_client") + ) must fullyMatch regex("apibuilder localhost 9000/apicollective/apibuilder/1\\.2\\.3/play_client") userAgent.generate( orgKey = "apicollective", applicationKey = "apibuilder", versionName = "1:0", generatorKey = Some("play_client") - ) must fullyMatch regex("apibuilder 0\\.[0-9]+\\.[0-9]+ localhost 9000/apicollective/apibuilder/1 0/play_client") + ) must fullyMatch regex("apibuilder localhost 9000/apicollective/apibuilder/1 0/play_client") userAgent.generate( orgKey = "apicollective", applicationKey = "apibuilder", versionName = "1:0", generatorKey = None - ) must fullyMatch regex("apibuilder 0\\.[0-9]+\\.[0-9]+ localhost 9000/apicollective/apibuilder/1 0") + ) must fullyMatch regex("apibuilder localhost 9000/apicollective/apibuilder/1 0") } } diff --git a/app/Dockerfile b/app/Dockerfile index 289f3e8bf..b0a613e32 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,9 +1,9 @@ -FROM flowdocker/play_builder:latest-java13 as builder +FROM flowdocker/play_builder:latest-java17 as builder ADD . /opt/play WORKDIR /opt/play RUN sbt 'project app' clean stage -FROM flowdocker/play:latest-java13 +FROM flowdocker/play:latest-java17 COPY --from=builder /opt/play /opt/play WORKDIR /opt/play/app/target/universal/stage ENTRYPOINT ["java", "-jar", "/root/environment-provider.jar", "--service", "play", "apibuilder-app", "bin/apibuilder-app"] diff --git a/app/app/controllers/AccountController.scala b/app/app/controllers/AccountController.scala index bbd29a79c..3144d64a8 100644 --- a/app/app/controllers/AccountController.scala +++ b/app/app/controllers/AccountController.scala @@ -1,12 +1,13 @@ package controllers import javax.inject.Inject +import scala.concurrent.ExecutionContext class AccountController @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def redirect = Action { implicit request => Redirect(routes.AccountController.index()) diff --git a/app/app/controllers/AccountProfileController.scala b/app/app/controllers/AccountProfileController.scala index bd16beb22..525fb2bb7 100644 --- a/app/app/controllers/AccountProfileController.scala +++ b/app/app/controllers/AccountProfileController.scala @@ -1,18 +1,18 @@ package controllers import io.apibuilder.api.v0.models.UserUpdateForm -import javax.inject.Inject +import javax.inject.Inject import play.api.data._ import play.api.data.Forms._ -import scala.concurrent.Future +import scala.concurrent.{ExecutionContext, Future} class AccountProfileController @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def redirect = Action { implicit request => Redirect(routes.AccountProfileController.index()) diff --git a/app/app/controllers/ApplicationController.scala b/app/app/controllers/ApplicationController.scala index a13f45dbb..4316a9fdc 100644 --- a/app/app/controllers/ApplicationController.scala +++ b/app/app/controllers/ApplicationController.scala @@ -1,14 +1,16 @@ package controllers import lib.{ApiClientProvider, PaginatedCollection, Pagination} + import javax.inject.Inject +import scala.concurrent.ExecutionContext class ApplicationController @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents, apiClientProvider: ApiClientProvider ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def redirect() = Action { request => Redirect(request.path + "/") diff --git a/app/app/controllers/ApplicationSettings.scala b/app/app/controllers/ApplicationSettings.scala index 9479a30ff..74dc3fd4f 100644 --- a/app/app/controllers/ApplicationSettings.scala +++ b/app/app/controllers/ApplicationSettings.scala @@ -1,6 +1,7 @@ package controllers import io.apibuilder.api.v0.models.{ApplicationForm, MoveForm, Visibility} + import javax.inject.Inject import lib.ApiClientProvider import models._ @@ -8,14 +9,14 @@ import play.api.data.Forms._ import play.api.data._ import play.api.mvc.Result -import scala.concurrent.Future +import scala.concurrent.{ExecutionContext, Future} class ApplicationSettings @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents, apiClientProvider: ApiClientProvider ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global private[this] def withRedirect( result: Either[String, MainTemplate] diff --git a/app/app/controllers/AttributesController.scala b/app/app/controllers/AttributesController.scala index 63fa71020..a1870111a 100644 --- a/app/app/controllers/AttributesController.scala +++ b/app/app/controllers/AttributesController.scala @@ -3,9 +3,8 @@ package controllers import io.apibuilder.api.v0.models.AttributeForm import lib.{ApiClientProvider, PaginatedCollection, Pagination} -import scala.concurrent.Future +import scala.concurrent.{ExecutionContext, Future} import javax.inject.Inject - import play.api.data.Forms._ import play.api.data._ @@ -14,7 +13,7 @@ class AttributesController @Inject() ( apiClientProvider: ApiClientProvider ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def index(page: Int = 0) = Anonymous.async { implicit request => for { diff --git a/app/app/controllers/Domains.scala b/app/app/controllers/Domains.scala index f19230c21..7243429f0 100644 --- a/app/app/controllers/Domains.scala +++ b/app/app/controllers/Domains.scala @@ -6,7 +6,7 @@ import models._ import play.api.data._ import play.api.data.Forms._ -import scala.concurrent.Future +import scala.concurrent.{ExecutionContext, Future} import javax.inject.Inject class Domains @Inject() ( @@ -14,7 +14,7 @@ class Domains @Inject() ( apiClientProvider: ApiClientProvider ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def index(orgKey: String) = IdentifiedOrg { implicit request => request.withMember { diff --git a/app/app/controllers/EmailVerifications.scala b/app/app/controllers/EmailVerifications.scala index 41210b0dd..9805d0dee 100644 --- a/app/app/controllers/EmailVerifications.scala +++ b/app/app/controllers/EmailVerifications.scala @@ -1,14 +1,15 @@ package controllers import javax.inject.Inject - import io.apibuilder.api.v0.models.EmailVerificationConfirmationForm +import scala.concurrent.ExecutionContext + class EmailVerifications @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def get(token: String) = Anonymous.async { implicit request => request.api.emailVerificationConfirmationForms.post( diff --git a/app/app/controllers/GeneratorServices.scala b/app/app/controllers/GeneratorServices.scala index 833260092..982390f4f 100644 --- a/app/app/controllers/GeneratorServices.scala +++ b/app/app/controllers/GeneratorServices.scala @@ -1,15 +1,17 @@ package controllers import lib.{ApiClientProvider, PaginatedCollection, Pagination} + import java.util.UUID import javax.inject.Inject +import scala.concurrent.ExecutionContext class GeneratorServices @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents, apiClientProvider: ApiClientProvider ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def show(guid: UUID, page: Int = 0) = Anonymous.async { implicit request => for { diff --git a/app/app/controllers/Generators.scala b/app/app/controllers/Generators.scala index 203dce810..5d5d95d99 100644 --- a/app/app/controllers/Generators.scala +++ b/app/app/controllers/Generators.scala @@ -5,7 +5,7 @@ import lib.{ApiClientProvider, PaginatedCollection, Pagination} import play.api.data.Forms._ import play.api.data._ -import scala.concurrent.Future +import scala.concurrent.{ExecutionContext, Future} import javax.inject.Inject class Generators @Inject() ( @@ -13,7 +13,7 @@ class Generators @Inject() ( apiClientProvider: ApiClientProvider ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def redirect = Action { implicit request => Redirect(routes.Generators.index()) diff --git a/app/app/controllers/Healthchecks.scala b/app/app/controllers/Healthchecks.scala index 991476499..96f825ef4 100644 --- a/app/app/controllers/Healthchecks.scala +++ b/app/app/controllers/Healthchecks.scala @@ -1,16 +1,15 @@ package controllers import models.MainTemplate -import javax.inject.Inject -import lib.ApiClientProvider +import javax.inject.Inject +import scala.concurrent.ExecutionContext class Healthchecks @Inject() ( - val apiBuilderControllerComponents: ApiBuilderControllerComponents, - apiClientProvider: ApiClientProvider + val apiBuilderControllerComponents: ApiBuilderControllerComponents ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def index() = Anonymous.async { implicit request => for { diff --git a/app/app/controllers/HistoryController.scala b/app/app/controllers/HistoryController.scala index 7cac1b488..f017b1e1f 100644 --- a/app/app/controllers/HistoryController.scala +++ b/app/app/controllers/HistoryController.scala @@ -1,14 +1,15 @@ package controllers -import lib.{ApiClientProvider, PaginatedCollection, Pagination} +import lib.{PaginatedCollection, Pagination} + import javax.inject.Inject +import scala.concurrent.ExecutionContext class HistoryController @Inject() ( - val apiBuilderControllerComponents: ApiBuilderControllerComponents, - apiClientProvider: ApiClientProvider + val apiBuilderControllerComponents: ApiBuilderControllerComponents ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def index( orgKey: Option[String], diff --git a/app/app/controllers/Members.scala b/app/app/controllers/Members.scala index 1f43894a3..8a2759c83 100644 --- a/app/app/controllers/Members.scala +++ b/app/app/controllers/Members.scala @@ -6,9 +6,10 @@ import models._ import play.api.data._ import play.api.data.Forms._ -import scala.concurrent.Await +import scala.concurrent.{Await, ExecutionContext} import scala.concurrent.duration._ import org.joda.time.DateTime + import java.util.UUID import javax.inject.Inject @@ -17,7 +18,7 @@ class Members @Inject() ( apiClientProvider: ApiClientProvider ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def show(orgKey: String, page: Int = 0) = IdentifiedOrg.async { implicit request => request.withMember { diff --git a/app/app/controllers/MembershipRequestReviews.scala b/app/app/controllers/MembershipRequestReviews.scala index 0261006d1..18534aa1f 100644 --- a/app/app/controllers/MembershipRequestReviews.scala +++ b/app/app/controllers/MembershipRequestReviews.scala @@ -2,12 +2,13 @@ package controllers import java.util.UUID import javax.inject.Inject +import scala.concurrent.ExecutionContext class MembershipRequestReviews @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def accept(orgKey: String, membershipRequestGuid: UUID) = IdentifiedOrg.async { implicit request => request.withAdmin { diff --git a/app/app/controllers/OrganizationAttributesController.scala b/app/app/controllers/OrganizationAttributesController.scala index 69096a090..1be5ac1ab 100644 --- a/app/app/controllers/OrganizationAttributesController.scala +++ b/app/app/controllers/OrganizationAttributesController.scala @@ -1,23 +1,18 @@ package controllers -import io.apibuilder.api.v0.models.{AttributeValueForm, User} -import lib.{ApiClientProvider, PaginatedCollection, Pagination} -import models.{MainTemplate, SettingSection, SettingsMenu} - -import scala.concurrent.Future -import java.util.UUID -import javax.inject.Inject - +import io.apibuilder.api.v0.models.AttributeValueForm +import models.{SettingSection, SettingsMenu} import play.api.data.Forms._ import play.api.data._ -import play.api.mvc.{Action, BaseController, ControllerComponents} + +import javax.inject.Inject +import scala.concurrent.{ExecutionContext, Future} class OrganizationAttributesController @Inject() ( - val apiBuilderControllerComponents: ApiBuilderControllerComponents, - apiClientProvider: ApiClientProvider + val apiBuilderControllerComponents: ApiBuilderControllerComponents ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def redirect = Action { implicit request => Redirect(routes.AttributesController.index()) diff --git a/app/app/controllers/SearchController.scala b/app/app/controllers/SearchController.scala index a6732b284..6578cba29 100644 --- a/app/app/controllers/SearchController.scala +++ b/app/app/controllers/SearchController.scala @@ -1,15 +1,16 @@ package controllers -import lib.{ApiClientProvider, PaginatedCollection, Pagination, Util} +import lib.{PaginatedCollection, Pagination, Util} + import javax.inject.Inject +import scala.concurrent.ExecutionContext class SearchController @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents, - apiClientProvider: ApiClientProvider, util: Util ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def index(q: Option[String], org: Option[String], page: Int = 0) = Anonymous.async { implicit request => val finalQuery = Seq( diff --git a/app/app/controllers/TokensController.scala b/app/app/controllers/TokensController.scala index 5f4d43d03..78c74489b 100644 --- a/app/app/controllers/TokensController.scala +++ b/app/app/controllers/TokensController.scala @@ -2,20 +2,19 @@ package controllers import java.util.UUID import javax.inject.Inject - import io.apibuilder.api.v0.models.TokenForm import lib.{ApiClientProvider, PaginatedCollection, Pagination} - import play.api.data._ import play.api.data.Forms._ -import scala.concurrent.Future + +import scala.concurrent.{ExecutionContext, Future} class TokensController @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents, apiClientProvider: ApiClientProvider ) extends ApiBuilderController { - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def redirect = Action { implicit request => Redirect(routes.TokensController.index()) diff --git a/app/app/controllers/Versions.scala b/app/app/controllers/Versions.scala index 91a651f11..5350deff4 100644 --- a/app/app/controllers/Versions.scala +++ b/app/app/controllers/Versions.scala @@ -10,7 +10,7 @@ import play.api.data._ import play.api.libs.json._ import scala.concurrent.duration._ -import scala.concurrent.{Await, Future} +import scala.concurrent.{Await, ExecutionContext, Future} class Versions @Inject() ( val apiBuilderControllerComponents: ApiBuilderControllerComponents, @@ -20,7 +20,7 @@ class Versions @Inject() ( private[this] val DefaultVersion = "0.0.1-dev" private[this] val LatestVersion = "latest" - private[this] implicit val ec = scala.concurrent.ExecutionContext.Implicits.global + private[this] implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global def redirectToLatest(orgKey: String, applicationKey: String) = Action { Redirect(routes.Versions.show(orgKey, applicationKey, LatestVersion)) diff --git a/app/conf/base.conf b/app/conf/base.conf index a878c9e1f..f34b92ff3 100644 --- a/app/conf/base.conf +++ b/app/conf/base.conf @@ -6,11 +6,9 @@ play.filters.disabled += "play.filters.headers.SecurityHeadersFilter" play.http.parser.maxMemoryBuffer=10M play.http.requestHandler = "play.http.DefaultHttpRequestHandler" -apibuilder.supportEmail="mbryzek@alum.mit.edu" +apibuilder.supportEmail="mbryzek@gmail.com" apibuilder.github.oauth.client.secret=${?CONF_APIBUILDER_GITHUB_OAUTH_CLIENT_SECRET} -git.version=0.11.19 - akka { actor { default-dispatcher { diff --git a/build.sbt b/build.sbt index 9dd00b089..3c8a0ad9c 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,9 @@ name := "apibuilder" organization := "io.apibuilder" -ThisBuild / scalaVersion := "2.13.8" +ThisBuild / scalaVersion := "2.13.11" + +ThisBuild / javacOptions ++= Seq("-source", "17", "-target", "17") lazy val allScalacOptions = Seq( "-deprecation", @@ -37,6 +39,10 @@ lazy val avro = project "org.apache.avro" % "avro-compiler" % avroVersion, "com.typesafe.play" %% "play-json" % playJsonVersion, "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test + ), + Test / javaOptions ++= Seq( + "--add-exports=java.base/sun.security.x509=ALL-UNNAMED", + "--add-opens=java.base/sun.security.ssl=ALL-UNNAMED" ) ) @@ -50,7 +56,11 @@ lazy val swagger = project "io.swagger" % "swagger-parser" % "1.0.61", "com.typesafe.play" %% "play-json" % playJsonVersion, "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test - ) + ), + Test / javaOptions ++= Seq( + "--add-exports=java.base/sun.security.x509=ALL-UNNAMED", + "--add-opens=java.base/sun.security.ssl=ALL-UNNAMED" + ) ) val circeVersion = "0.14.3" @@ -88,6 +98,10 @@ lazy val api = project .settings(commonSettings: _*) .settings( scalacOptions ++= allScalacOptions, + Test / javaOptions ++= Seq( + "--add-exports=java.base/sun.security.x509=ALL-UNNAMED", + "--add-opens=java.base/sun.security.ssl=ALL-UNNAMED" + ), PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value)), testOptions += Tests.Argument("-oF"), javaAgents += "com.datadoghq" % "dd-java-agent" % "1.8.0", @@ -98,9 +112,11 @@ lazy val api = project resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release", libraryDependencies ++= Seq( filters, - guice, jdbc, ws, + "com.google.inject" % "guice" % "5.1.0", + "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", + "org.projectlombok" % "lombok" % "1.18.28" % "provided", "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "com.typesafe.play" %% "play-json" % playJsonVersion, "org.postgresql" % "postgresql" % "42.5.0", @@ -124,13 +140,16 @@ lazy val app = project .enablePlugins(SbtTwirl) .settings(commonSettings: _*) .settings( + scalacOptions ++= allScalacOptions, PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value)), javaAgents += "com.datadoghq" % "dd-java-agent" % "1.8.0", routesImport += "io.apibuilder.api.v0.Bindables.Core._", routesImport += "io.apibuilder.api.v0.Bindables.Models._", routesGenerator := InjectedRoutesGenerator, libraryDependencies ++= Seq( - guice, + "com.google.inject" % "guice" % "5.1.0", + "com.google.inject.extensions" % "guice-assistedinject" % "5.1.0", + "org.projectlombok" % "lombok" % "1.18.28" % "provided", "com.typesafe.play" %% "play-json-joda" % playJsonVersion, "com.typesafe.play" %% "play-json" % playJsonVersion, "org.apache.commons" % "commons-compress" % "1.22", @@ -140,6 +159,11 @@ lazy val app = project "org.webjars" % "bootstrap" % "3.3.7", "org.webjars" % "bootstrap-social" % "5.0.0", "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test + ), + Test / javaOptions ++= Seq( + "--add-exports=java.base/sun.security.x509=ALL-UNNAMED", + "--add-opens=java.base/sun.security.ssl=ALL-UNNAMED", + "-Dconfig.resource=application.test.conf" ) ) @@ -165,6 +189,10 @@ lazy val commonSettings: Seq[Setting[_]] = Seq( "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test ), scalacOptions ++= allScalacOptions, + Test / javaOptions ++= Seq( + "--add-exports=java.base/sun.security.x509=ALL-UNNAMED", + "--add-opens=java.base/sun.security.ssl=ALL-UNNAMED" + ), Compile / doc / sources := Seq.empty, Compile / packageDoc / publishArtifact := false ) ++ publishSettings diff --git a/project/plugins.sbt b/project/plugins.sbt index 34c58d9a0..7af92e59f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,10 +5,8 @@ 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.18") +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.20") addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1") - -addSbtPlugin("org.scoverage" %% "sbt-scoverage" % "1.6.1")