Skip to content

Commit 0096720

Browse files
committed
fix artifactId and exclude some transitive dependencies
Signed-off-by: Joern Bernhardt <jb@campudus.com>
1 parent 9dde61d commit 0096720

File tree

1 file changed

+37
-22
lines changed

1 file changed

+37
-22
lines changed

project/VertxScalaBuild.scala

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,31 @@ import java.nio.charset.StandardCharsets
33
import sbt.Keys._
44
import sbt._
55

6-
object VertxScalaBuild extends Build {
6+
object Variables {
7+
val org = "io.vertx"
8+
val name = "mod-mysql-postgresql"
9+
val version = "0.3.0-SNAPSHOT"
10+
val scalaVersion = "2.10.4"
11+
val crossScalaVersions = Seq("2.10.4", "2.11.2")
12+
val description = "Fully async MySQL / PostgreSQL module for Vert.x"
13+
}
714

8-
val baseSettings = Defaults.defaultSettings ++ Seq(
9-
organization := "io.vertx",
10-
name := "mod-mysql-postgresql",
11-
version := "0.3.0-SNAPSHOT",
12-
scalaVersion := "2.10.4",
13-
crossScalaVersions := Seq("2.10.4", "2.11.2"),
14-
description := "Fully async MySQL / PostgreSQL module for Vert.x"
15-
)
15+
object VertxScalaBuild extends Build {
1616

1717
lazy val project = Project(
1818
"project",
1919
file("."),
20-
settings = baseSettings ++ Seq(
20+
settings = Seq(
21+
organization := Variables.org,
22+
name := Variables.name,
23+
version := Variables.version,
24+
scalaVersion := Variables.scalaVersion,
25+
crossScalaVersions := Variables.crossScalaVersions,
26+
description := Variables.description,
2127
copyModTask,
2228
zipModTask,
23-
libraryDependencies ++= Dependencies.compile,
24-
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _),
29+
libraryDependencies := Dependencies.compile,
30+
// libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _),
2531
// Fork JVM to allow Scala in-flight compilation tests to load the Scala interpreter
2632
fork in Test := true,
2733
// Vert.x tests are not designed to run in paralell
@@ -35,11 +41,12 @@ object VertxScalaBuild extends Build {
3541
resourceGenerators in Compile += Def.task {
3642
val file = (resourceManaged in Compile).value / "langs.properties"
3743
val contents = s"scala=io.vertx~lang-scala_${getMajor(scalaVersion.value)}~${Dependencies.Versions.vertxLangScalaVersion}:org.vertx.scala.platform.impl.ScalaVerticleFactory\n.scala=scala\n"
38-
IO.write(file, contents)
44+
IO.write(file, contents, StandardCharsets.UTF_8)
3945
Seq(file)
4046
}.taskValue,
41-
copyMod <<= copyMod dependsOn (compile in Compile),
47+
copyMod <<= copyMod dependsOn (copyResources in Compile),
4248
(test in Test) <<= (test in Test) dependsOn copyMod,
49+
zipMod <<= zipMod dependsOn copyMod,
4350
(packageBin in Compile) <<= (packageBin in Compile) dependsOn copyMod,
4451
// Publishing settings
4552
publishMavenStyle := true,
@@ -78,7 +85,7 @@ object VertxScalaBuild extends Build {
7885
</developer>
7986
</developers>
8087
)
81-
).settings(addArtifact(Artifact("lang-scala", "zip", "zip", "mod"), zipMod).settings: _*)
88+
).settings(addArtifact(Artifact(Variables.name, "zip", "zip", "mod"), zipMod).settings: _*)
8289

8390
val copyMod = TaskKey[Unit]("copy-mod", "Assemble the module into the local mods directory")
8491
val zipMod = TaskKey[File]("zip-mod", "Package the module .zip file")
@@ -88,7 +95,7 @@ object VertxScalaBuild extends Build {
8895
val modOwner = organization.value
8996
val modName = name.value
9097
val modVersion = version.value
91-
val scalaMajor = scalaVersion.value.substring(0, scalaVersion.value.lastIndexOf('.'))
98+
val scalaMajor = getMajor(scalaVersion.value)
9299
val moduleName = s"$modOwner~${modName}_$scalaMajor~$modVersion"
93100
log.info("Create module " + moduleName)
94101
val moduleDir = target.value / "mods" / moduleName
@@ -108,7 +115,7 @@ object VertxScalaBuild extends Build {
108115
val modOwner = organization.value
109116
val modName = name.value
110117
val modVersion = version.value
111-
val scalaMajor = scalaVersion.value.substring(0, scalaVersion.value.lastIndexOf('.'))
118+
val scalaMajor = getMajor(scalaVersion.value)
112119
val moduleName = s"$modOwner~${modName}_$scalaMajor~$modVersion"
113120
log.info("Create ZIP module " + moduleName)
114121
val moduleDir = target.value / "mods" / moduleName
@@ -155,24 +162,32 @@ object Dependencies {
155162

156163
val vertxCore = "io.vertx" % "vertx-core" % vertxVersion % "provided"
157164
val vertxPlatform = "io.vertx" % "vertx-platform" % vertxVersion % "provided"
158-
val vertxTesttools = "io.vertx" % "testtools" % testtoolsVersion % "provided"
159165
val vertxLangScala = "io.vertx" %% "lang-scala" % vertxLangScalaVersion % "provided"
160-
val postgreSqlDriver = "com.github.mauricio" %% "postgresql-async" % asyncDriverVersion % "provided"
161-
val mySqlDriver = "com.github.mauricio" %% "mysql-async" % asyncDriverVersion % "provided"
166+
val postgreSqlDriver = ("com.github.mauricio" %% "postgresql-async" % asyncDriverVersion % "compile").excludeAll(
167+
ExclusionRule(organization = "org.scala-lang"),
168+
ExclusionRule(organization = "io.netty"),
169+
ExclusionRule(organization = "org.slf4j")
170+
)
171+
val mySqlDriver = ("com.github.mauricio" %% "mysql-async" % asyncDriverVersion % "compile"). excludeAll(
172+
ExclusionRule(organization = "org.scala-lang"),
173+
ExclusionRule(organization = "io.netty"),
174+
ExclusionRule(organization = "org.slf4j")
175+
)
162176
}
163177

164178
object Test {
165179

166180
import Dependencies.Versions._
167181

182+
val vertxTesttools = "io.vertx" % "testtools" % testtoolsVersion % "test"
168183
val hamcrest = "org.hamcrest" % "hamcrest-library" % hamcrestVersion % "test"
169184
val junitInterface = "com.novocode" % "junit-interface" % junitInterfaceVersion % "test"
170185
}
171186

172187
import Dependencies.Compile._
173188

174-
val test = List(Test.hamcrest, Test.junitInterface)
189+
val test = List(Test.vertxTesttools, Test.hamcrest, Test.junitInterface)
175190

176-
val compile = List(vertxCore, vertxPlatform, vertxTesttools, vertxLangScala, postgreSqlDriver, mySqlDriver) ::: test
191+
val compile = List(vertxCore, vertxPlatform, vertxLangScala, postgreSqlDriver, mySqlDriver) ::: test
177192

178193
}

0 commit comments

Comments
 (0)