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

Play 2.7.0-RC3 and sbt upgrade #68

Merged
merged 4 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
language: scala
scala:
- 2.11.12
- 2.12.6
- 2.12.7
# - 2.13.0-M4
services:
- memcache
jdk:
- oraclejdk8
env:
- PLAY_VERSION=2.7.0-M2
- PLAY_VERSION=2.7.0-RC8
# see https://github.com/travis-ci/travis-ci/issues/5227#issuecomment-165131913
before_install:
- cat /etc/hosts
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ Configure your configuration endpoint in `application.conf`:

0.10.0-M2 Built for Play 2.7.0-M2 and Scala 2.11.12 and 2.12.6. Artifact ID for this build is `play2-memcached-play27_2.1{1,2}`

0.10.0-RC3 Built for Play 2.7.0-RC8 and Scala 2.11.12 and 2.12.7. Artifact ID for this build is `play2-memcached-play27_2.1{1,2}`

### Publishing to the central

```
Expand Down
96 changes: 96 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
val appName = "play2-memcached-" + playShortName
val appVersion = "0.10.0-RC3"
val spymemcached = "net.spy" % "spymemcached" % "2.12.3"
val h2databaseTest = "com.h2database" % "h2" % "1.4.196" % Test

lazy val baseSettings = Seq(
scalaVersion := "2.12.7",
crossScalaVersions := Seq("2.11.12", "2.12.7"),
parallelExecution in Test := false
)

def playShortName: String = {
val version = play.core.PlayVersion.current
val majorMinor = version.split("""\.""").take(2).mkString("")
s"play$majorMinor"
}

lazy val root = Project("root", base = file("."))
.settings(baseSettings: _*)
.settings(
publishLocal := {},
publish := {}
).aggregate(plugin, scalaSample, javaSample)

lazy val plugin = Project(appName, base = file("plugin"))
.settings(baseSettings: _*)
.settings(
libraryDependencies += h2databaseTest,
libraryDependencies += spymemcached,
libraryDependencies += playCore % Provided,
libraryDependencies += cacheApi % Provided,
libraryDependencies += specs2 % Test,
organization := "com.github.mumoshu",
version := appVersion,
//scalacOptions += "-deprecation",
publishTo := {
val v = version.value
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
pomExtra := (
<url>https://github.com/mumoshu/play2-memcached</url>
<licenses>
<license>
<name>BSD-style</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:mumoshu/play2-memcached.git</url>
<connection>scm:git:git@github.com:mumoshu/play2-memcached.git</connection>
</scm>
<developers>
<developer>
<id>you</id>
<name>KUOKA Yusuke</name>
<url>https://github.com/mumoshu</url>
</developer>
</developers>
),
unmanagedSourceDirectories in Compile := {
(unmanagedSourceDirectories in Compile).value ++ Seq((sourceDirectory in Compile).value)
},
unmanagedSourceDirectories in Test := {
(unmanagedSourceDirectories in Test).value ++ Seq((sourceDirectory in Test).value)
}
)

lazy val scalaSample = Project(
"scala-sample",
file("samples/scala")
).enablePlugins(PlayScala)
.settings(baseSettings: _*)
.settings(
libraryDependencies += cacheApi,
libraryDependencies += h2databaseTest,
publishLocal := {},
publish := {}
).dependsOn(plugin)

lazy val javaSample = Project(
"java-sample",
file("samples/java")
).enablePlugins(PlayJava)
.settings(baseSettings: _*)
.settings(
libraryDependencies += cacheApi,
libraryDependencies += h2databaseTest,
publishLocal := {},
publish := {}
).dependsOn(plugin)
29 changes: 10 additions & 19 deletions plugin/src/test/MemcachedSpec.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import com.github.mumoshu.play2.memcached._
import net.spy.memcached.MemcachedClient
import org.specs2.mutable._
import play.api.test._

import com.github.mumoshu.play2.memcached._
import play.api.cache.AsyncCacheApi
import play.api.inject._
import play.api.inject.guice.GuiceApplicationBuilder
import play.cache.NamedCacheImpl
import play.test.WithApplication
import play.api.test.WithApplication

import scala.collection.JavaConverters._

import play.api.{Configuration, Environment, ApplicationLoader}

object MemcachedSpec extends Specification {

sequential
Expand Down Expand Up @@ -55,29 +51,24 @@ object MemcachedSpec extends Specification {
}

"Injector" should {
import play.api.inject.bind

def app = play.test.Helpers.fakeApplication(
configurationMap.asJava
)

def injector = app.injector
def app = GuiceApplicationBuilder().configure(configurationMap).build()

"provide memcached clients" in {
val memcachedClient = injector.instanceOf(play.api.inject.BindingKey(classOf[MemcachedClient]))
"provide memcached clients" in new WithApplication(app) {
val memcachedClient = app.injector.instanceOf(play.api.inject.BindingKey(classOf[MemcachedClient]))

memcachedClient must beAnInstanceOf[MemcachedClient]
}

"provide a CacheApi implementation backed by memcached" in {
val cacheApi = injector.instanceOf(play.api.inject.BindingKey(classOf[AsyncCacheApi]))
"provide a CacheApi implementation backed by memcached" in new WithApplication(app) {
val cacheApi = app.injector.instanceOf(play.api.inject.BindingKey(classOf[AsyncCacheApi]))

cacheApi must beAnInstanceOf[MemcachedCacheApi]
cacheApi.asInstanceOf[MemcachedCacheApi].namespace must equalTo ("default")
}

"provide a named CacheApi implementation backed by memcached" in {
val cacheApi = injector.instanceOf(play.api.inject.BindingKey(classOf[AsyncCacheApi]).qualifiedWith(new NamedCacheImpl("secondary")))
"provide a named CacheApi implementation backed by memcached" in new WithApplication(app) {
val cacheApi = app.injector.instanceOf(play.api.inject.BindingKey(classOf[AsyncCacheApi]).qualifiedWith(new NamedCacheImpl("secondary")))

cacheApi must beAnInstanceOf[MemcachedCacheApi]
cacheApi.asInstanceOf[MemcachedCacheApi].namespace must equalTo ("secondary")
Expand Down
110 changes: 0 additions & 110 deletions project/Build.scala

This file was deleted.

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.17
sbt.version=1.2.6
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ivyLoggingLevel := UpdateLogging.Full

val playVersion = scala.util.Properties.envOrElse("PLAY_VERSION", "2.7.0-M2")
val playVersion = scala.util.Properties.envOrElse("PLAY_VERSION", "2.7.0-RC8")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % playVersion)

Expand Down
6 changes: 3 additions & 3 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

PLAY_VERSION=2.7.0-M2 sbt ++2.11.12 publish-signed
PLAY_VERSION=2.7.0-M2 sbt ++2.12.6 publish-signed
PLAY_VERSION=2.7.0-RC8 sbt ++2.11.12 publishSigned
PLAY_VERSION=2.7.0-RC8 sbt ++2.12.7 publishSigned
# not working yet, wait for final Play 2.7 and Scala 2.13 release:
#PLAY_VERSION=2.7.0-M2 sbt ++2.13.0-M4 publish-signed
#PLAY_VERSION=2.7.0-RC8 sbt ++2.13.0-M4 publishSigned
2 changes: 1 addition & 1 deletion samples/java/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ libraryDependencies ++= Seq(
javaJdbc,
cacheApi,
javaWs,
"com.github.mumoshu" %% "play2-memcached-play27" % "0.10.0-M2"
"com.github.mumoshu" %% "play2-memcached-play27" % "0.10.0-RC3"
)
2 changes: 1 addition & 1 deletion samples/java/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.17
sbt.version=1.2.6
2 changes: 1 addition & 1 deletion samples/java/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0-M2")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0-RC8")

2 changes: 1 addition & 1 deletion samples/scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ libraryDependencies ++= Seq(
jdbc,
cacheApi,
ws,
"com.github.mumoshu" %% "play2-memcached-play27" % "0.10.0-M2",
"com.github.mumoshu" %% "play2-memcached-play27" % "0.10.0-RC3",
specs2 % Test
)

Expand Down
2 changes: 1 addition & 1 deletion samples/scala/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.17
sbt.version=1.2.6
2 changes: 1 addition & 1 deletion samples/scala/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0-M2")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0-RC8")