Преглед на файлове

scala/akka-http: Speed up packaging (#2990)

* akka-http: Speed up the app packaging process

Use sbt-native-packager instead of sbt-assembly to avoid
unpacking dependencies and packing them again.

* akka-http: Bump dependencies up

* akka-http: Turn off SSL for DB connections
Maxim Fedorov преди 7 години
родител
ревизия
a6636f637f

+ 12 - 12
frameworks/Scala/akka-http/build.sbt

@@ -1,5 +1,7 @@
-val akkaV = "2.5.1"
-val akkaHttpV = "10.0.6"
+enablePlugins(JavaAppPackaging)
+
+val akkaVersion = "2.5.6"
+val akkaHttpVersion = "10.0.10"
 
 organization := "com.typesafe.akka"
 
@@ -7,20 +9,18 @@ name := "akka-http-benchmark"
 
 version := "0.0.1-SNAPSHOT"
 
-scalaVersion := "2.12.2"
+scalaVersion := "2.12.3"
 
 resolvers += "Akka Snapshot Repository" at "http://repo.akka.io/snapshots/"
 
 libraryDependencies ++= Seq(
-  "com.typesafe.akka" %% "akka-http" % akkaHttpV,
-  "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpV,
-  "com.typesafe.akka" %% "akka-stream" % akkaV,
-  "mysql" % "mysql-connector-java" % "5.1.38",
-  "com.zaxxer" % "HikariCP" % "2.5.1",
+  "com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
+  "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
+  "com.typesafe.akka" %% "akka-stream" % akkaVersion,
+  "mysql" % "mysql-connector-java" % "5.1.44",
+  "com.zaxxer" % "HikariCP" % "2.7.2",
   "org.scalatra.scalate" %% "scalate-core" % "1.8.0",
-  "org.scalatest" %% "scalatest" % "3.0.3" % "test"
+  "org.scalatest" %% "scalatest" % "3.0.4" % "test"
 )
 
-assemblyJarName in assembly := "akka-http-benchmark.jar"
-
-mainClass in assembly := Some("com.typesafe.akka.http.benchmark.Main")
+mainClass in Compile := Some("com.typesafe.akka.http.benchmark.Main")

+ 1 - 1
frameworks/Scala/akka-http/project/Formatting.scala

@@ -22,6 +22,6 @@ object Formatting extends AutoPlugin {
       .setPreference(AlignParameters, true)
       .setPreference(AlignSingleLineCaseStatements, true)
       .setPreference(DanglingCloseParenthesis, Preserve)
-      .setPreference(DoubleIndentClassDeclaration, true)
+      .setPreference(DoubleIndentConstructorArguments, true)
       .setPreference(SpacesAroundMultiImports, true)
 }

+ 1 - 1
frameworks/Scala/akka-http/project/build.properties

@@ -1 +1 @@
-sbt.version=0.13.15
+sbt.version=1.0.2

+ 8 - 2
frameworks/Scala/akka-http/project/plugins.sbt

@@ -1,2 +1,8 @@
-addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")
-addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.4")
+
+// Workaround for https://github.com/coursier/coursier/issues/450
+classpathTypes += "maven-plugin"
+
+addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.1")
+addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.2.2")
+addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC11")
+

+ 1 - 0
frameworks/Scala/akka-http/project/project/plugins.sbt

@@ -0,0 +1 @@
+addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC11")

+ 3 - 2
frameworks/Scala/akka-http/setup.sh

@@ -2,6 +2,7 @@
 
 fw_depends mysql java sbt
 
-sbt 'assembly' -batch
+sbt -batch 'universal:stage'
 
-java -server -Dakka.http.benchmark.mysql.dbhost=$DBHOST -jar target/scala-2.12/akka-http-benchmark.jar &
+./target/universal/stage/bin/akka-http-benchmark \
+  -Dakka.http.benchmark.mysql.dbhost=$DBHOST &

+ 1 - 1
frameworks/Scala/akka-http/src/main/resources/application.conf

@@ -18,7 +18,7 @@ akka {
         dbport: 3306
         dbuser: "benchmarkdbuser"
         dbpass: "benchmarkdbpass"
-        jdbc-url: "jdbc:mysql://"${akka.http.benchmark.mysql.dbhost}":"${akka.http.benchmark.mysql.dbport}"/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
+        jdbc-url: "jdbc:mysql://"${akka.http.benchmark.mysql.dbhost}":"${akka.http.benchmark.mysql.dbport}"/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true&useSSL=false"
         connection-pool-size: 100
         thread-pool-size: 100
       }