Permalink
Browse files

[jdbc-scala] Cross build for Scala 2.11

  • Loading branch information...
cchantep
cchantep committed Apr 22, 2014
1 parent 10a23da commit 363aab2f67d2d7866626d750f442b61d4c728223
View
@@ -1,3 +1,7 @@
## 1.0.17
Cross compilation from Scala 2.10 to 2.11.
## 1.0.16
([2a2093606f5c4582efa2fea4aa18de357f4b8a1c](https://github.com/cchantep/acolyte/commit/2a2093606f5c4582efa2fea4aa18de357f4b8a1c) @ [jdbc-driver](https://github.com/cchantep/acolyte/tree/master/jdbc-driver)) Batch support on statement and prepared statement.
@@ -136,7 +136,7 @@ public T withQueryDetection(final String... pattern) {
* @param pattern Query detection pattern
* @throws IllegalArgumentException if pattern is null
*/
public abstract T withQueryDetection(final Pattern... pattern);
public abstract T withQueryDetection(final Pattern[] pattern);
/**
* Appends given |pattern| to current query detection.
@@ -142,7 +142,7 @@ final class ScalaCompositeHandler(qd: Array[Pattern], qh: QueryHandler, uh: Upda
* handleStatement.withQueryDetection("^SELECT ", "EXEC proc")
* }}}
*/
def withQueryDetection(pattern: Pattern*) = new ScalaCompositeHandler(
def withQueryDetection(pattern: Array[Pattern]) = new ScalaCompositeHandler(
queryDetectionPattern(pattern: _*), queryHandler, updateHandler)
/**
View
@@ -9,9 +9,10 @@ object Acolyte extends Build with Dependencies
aggregate(jdbcDriver, scalacPlugin, jdbcScala, studio).
settings(
organization in ThisBuild := "org.eu.acolyte",
version in ThisBuild := "1.0.16-2",
version in ThisBuild := "1.0.17",
javaOptions in ThisBuild ++= Seq("-source", "1.6", "-target", "1.6"),
scalaVersion in ThisBuild := "2.10.3",
crossScalaVersions in ThisBuild := Seq("2.10.4", "2.11.0"),
publishTo in ThisBuild := Some(Resolver.file("file",
new File(Path.userHome.absolutePath+"/.m2/repository"))),
pomExtra in ThisBuild := (
@@ -49,5 +50,5 @@ object Acolyte extends Build with Dependencies
}
trait Dependencies {
val specs2Test = "org.specs2" %% "specs2" % "2.3.8" % "test"
val specs2Test = "org.specs2" %% "specs2" % "2.3.11" % "test"
}
View
@@ -15,7 +15,11 @@ trait JdbcScala { deps: Dependencies ⇒
zip(baseDirectory in (scalacPlugin, Compile)).
zip(name in (scalacPlugin, Compile)) map { d =>
val (((v, sv), b), n) = d
val msv = if (sv startsWith "2.10") "2.10" else sv
val msv =
if (sv startsWith "2.10") "2.10"
else if (sv startsWith "2.11") "2.11"
else sv
val td = b / "target" / "scala-%s".format(msv)
val j = td / "%s_%s-%s.jar".format(n, msv, v)
@@ -15,7 +15,11 @@ trait ScalacPlugin { deps: Dependencies ⇒
zip(scalaVersion in ThisBuild).zip(baseDirectory in Compile).
zip(name in Compile) map { d =>
val (((v, sv), b), n) = d
val msv = if (sv startsWith "2.10") "2.10" else sv
val msv =
if (sv startsWith "2.10") "2.10"
else if (sv startsWith "2.11") "2.11"
else sv
val td = b / "target" / "scala-%s".format(msv)
val j = td / "%s_%s-%s.jar".format(n, msv, v)
View
@@ -931,17 +931,19 @@ mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=jdbc-driver/target/jdbc-dr
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=jdbc-driver/target/jdbc-driver-$VERSION.pom -Dfile=jdbc-driver/target/jdbc-driver-$VERSION-sources.jar -Dclassifier=sources -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=jdbc-scala/target/scala-2.10/jdbc-scala_2.10-$VERSION.pom -Dfile=jdbc-scala/target/scala-2.10/jdbc-scala_2.10-$VERSION.jar -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
export SCALAVER="2.10"
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=jdbc-scala/target/scala-2.10/jdbc-scala_2.10-$VERSION.pom -Dfile=jdbc-scala/target/scala-2.10/jdbc-scala_2.10-$VERSION-javadoc.jar -Dclassifier=javadoc -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=jdbc-scala/target/scala-$SCALAVER/jdbc-scala_$SCALAVER-$VERSION.pom -Dfile=jdbc-scala/target/scala-$SCALAVER/jdbc-scala_$SCALAVER-$VERSION.jar -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=jdbc-scala/target/scala-2.10/jdbc-scala_2.10-$VERSION.pom -Dfile=jdbc-scala/target/scala-2.10/jdbc-scala_2.10-$VERSION-sources.jar -Dclassifier=sources -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=jdbc-scala/target/scala-$SCALAVER/jdbc-scala_$SCALAVER-$VERSION.pom -Dfile=jdbc-scala/target/scala-$SCALAVER/jdbc-scala_$SCALAVER-$VERSION-javadoc.jar -Dclassifier=javadoc -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=scalac-plugin/target/scala-2.10/scalac-plugin_2.10-$VERSION.pom -Dfile=scalac-plugin/target/scala-2.10/scalac-plugin_2.10-$VERSION.jar -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=jdbc-scala/target/scala-$SCALAVER/jdbc-scala_$SCALAVER-$VERSION.pom -Dfile=jdbc-scala/target/scala-$SCALAVER/jdbc-scala_$SCALAVER-$VERSION-sources.jar -Dclassifier=sources -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=scalac-plugin/target/scala-2.10/scalac-plugin_2.10-$VERSION.pom -Dfile=scalac-plugin/target/scala-2.10/scalac-plugin_2.10-$VERSION-javadoc.jar -Dclassifier=javadoc -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=scalac-plugin/target/scala-$SCALAVER/scalac-plugin_$SCALAVER-$VERSION.pom -Dfile=scalac-plugin/target/scala-$SCALAVER/scalac-plugin_$SCALAVER-$VERSION.jar -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=scalac-plugin/target/scala-2.10/scalac-plugin_2.10-$VERSION.pom -Dfile=scalac-plugin/target/scala-2.10/scalac-plugin_2.10-$VERSION-sources.jar -Dclassifier=sources -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=scalac-plugin/target/scala-$SCALAVER/scalac-plugin_$SCALAVER-$VERSION.pom -Dfile=scalac-plugin/target/scala-$SCALAVER/scalac-plugin_$SCALAVER-$VERSION-javadoc.jar -Dclassifier=javadoc -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
mvn gpg:sign-and-deploy-file -Dkeyname=$KEY -DpomFile=scalac-plugin/target/scala-$SCALAVER/scalac-plugin_$SCALAVER-$VERSION.pom -Dfile=scalac-plugin/target/scala-$SCALAVER/scalac-plugin_$SCALAVER-$VERSION-sources.jar -Dclassifier=sources -Durl=$REPO -DrepositoryId=sonatype-nexus-staging
```
Authentication should be configured in `~/.m2/settings.xml`:
View
@@ -165,4 +165,10 @@ If there result from given extractor factory is not a valid extract, it will rai
```
[error] /path/to/file.scala#refactored-match-M:1: value Xtr0 is not a case class constructor, nor does it have an unapply/unapplySeq method
[error] case Xtr1((a @ _)) => Nil // generated from ln L, col C
```
When using `~(Xtractor(params))`, following error can be raised if `unapply` from `Xtractor` wait at least one argument.
```
[error] /path/to/file.scala#refactored-match-M:1: not enough patterns for class Clazz offering Xtractor: expected 1, found 0
```
@@ -9,7 +9,7 @@ class AcolytePlugin(val global: Global) extends Plugin {
val description = "Syntax extensions: Extractors with arguments"
val components = List[PluginComponent](ExtractorComponent)
var debug: Boolean with NotNull = false
var debug: Boolean = false
override def processOptions(options: List[String], error: String Unit) {
for (o options) {
@@ -27,9 +27,12 @@ class AcolytePlugin(val global: Global) extends Plugin {
override val runsBefore = List[String]("typer")
val phaseName = "rich-patmat"
def newTransformer(unit: global.CompilationUnit) = MatchTransformer
def newTransformer(unit: global.CompilationUnit) =
new MatchTransformer(unit)
class MatchTransformer(
unit: global.CompilationUnit) extends global.Transformer {
object MatchTransformer extends global.Transformer {
import scala.collection.mutable.ListBuffer
import global.{
//abort,
@@ -129,19 +132,20 @@ class AcolytePlugin(val global: Global) extends Plugin {
@inline private def refactorPattern[T](xp: Position, ex: Tree, xa: List[Tree], ua: List[Tree]): (ValDef, Apply) = {
import global.{ atPos, show, Ident, Modifiers }
import global.{ atPos, show, newTermName, Ident, Modifiers }
val of = xp.source.file
val file = new VirtualFile(of.name,
s"${of.path}#refactored-match-${xp.line}")
// ValDef
val xn = global.treeBuilder.freshTermName("Xtr")
val xn = unit.freshTermName("Xtr")
val vd = ValDef(Modifiers(), xn, global.TypeTree(), Apply(ex, xa))
val vdc =
s"${show(vd)} // generated from ln ${xp.line}, col ${xp.column - 1}"
val vdp = xp.withPoint(0).withSource(new BatchSourceFile(file, vdc), 0)
// TODO: Scala 2.11 -> withSource(new BatchSourceFile(file, vdc))
(atPos(vdp)(vd), Apply(Ident(xn), ua))
}
@@ -1,6 +1,6 @@
package acolyte
object ExtractorComponentSpec extends org.specs2.mutable.Specification
object ExtractorComponentSpec extends org.specs2.mutable.Specification
with MatchTest with PartialFunctionTest {
"Extractor component" title
@@ -157,7 +157,7 @@ object ExtractorComponentSpec extends org.specs2.mutable.Specification
sealed trait PartialFunctionTest {
val partialFun1: String List[String] = {
case ~(IntRange(5, 10)) List("5-to-10")
case ~(IntRange(5, 10), _) List("5-to-10")
case ~(IntRange(10, 20), i) List(s"range:$i")
case Integer(n) List(s"num-$n")
case ~(Regex("^a.*")) List("no-binding")
@@ -166,7 +166,7 @@ sealed trait PartialFunctionTest {
}
def partialFun2: String List[String] = {
case ~(IntRange(5, 10)) List("5-to-10")
case ~(IntRange(5, 10), _) List("5-to-10")
case ~(IntRange(10, 20), i) List(s"range:$i")
case Integer(n) List(s"num-$n")
case ~(Regex("^a.*")) List("no-binding")
@@ -176,7 +176,7 @@ sealed trait PartialFunctionTest {
/* Anonymous partial function */
def partialFun3(s: Option[String]): Option[List[String]] = s map {
case ~(IntRange(5, 10)) List("5-to-10")
case ~(IntRange(5, 10), _) List("5-to-10")
case ~(IntRange(10, 20), i) List(s"range:$i")
case Integer(n) List(s"num-$n")
case ~(Regex("^a.*")) List("no-binding")
@@ -187,7 +187,7 @@ sealed trait PartialFunctionTest {
sealed trait MatchTest {
def patternMatching(s: String): List[String] = s match {
case ~(IntRange(5, 10)) List("5-to-10")
case ~(IntRange(5, 10), _) List("5-to-10")
case ~(IntRange(10, 20), i) List(s"range:$i")
case Integer(n) List(s"num-$n")
case ~(Regex("^a.*")) List("no-binding")
View
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.eu.acolyte</groupId>
<artifactId>acolyte</artifactId>
<version>1.0.16</version>
<version>1.0.17</version>
<packaging>pom</packaging>
<name>Acolyte</name>
View
@@ -4,7 +4,7 @@
<artifactId>studio</artifactId>
<packaging>jar</packaging>
<name>Acolyte Studio</name>
<version>1.0.16</version>
<version>1.0.17</version>
<url>https://github.com/cchantep/acolyte/</url>
<scm>

0 comments on commit 363aab2

Please sign in to comment.