diff --git a/README.markdown b/README.markdown
index eb88c72..ef6a175 100644
--- a/README.markdown
+++ b/README.markdown
@@ -41,3 +41,9 @@ you can change the target platform for your build straight from your command lin
```scala
sbt compile -Dsbt.javacpp.platform="android-arm android-x86"
```
+
+In case you want to select a different javacpp version:
+
+```scala
+javaCppVersion := "1.4.3"
+```
diff --git a/build.sbt b/build.sbt
index 4668da4..2bc9c3c 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,4 +1,4 @@
-name := """sbt-javacpp"""
+name := "sbt-javacpp"
version := "1.14-SNAPSHOT"
@@ -8,11 +8,11 @@ sbtPlugin := true
publishMavenStyle := true
-scalaVersion := "2.12.4"
+scalaVersion in Global := "2.12.8"
-sbtVersion in Global := "1.0.4"
+sbtVersion in Global := "1.2.7"
-crossSbtVersions := Vector("0.13.17", "1.0.4")
+crossSbtVersions := Vector("0.13.17", "1.2.7")
scalaCompilerBridgeSource := {
val sv = appConfiguration.value.provider.id.version
@@ -23,7 +23,7 @@ publishArtifact in Test := false
pomIncludeRepository := { _ => false }
-libraryDependencies += "org.bytedeco" % "javacpp" % "1.4"
+libraryDependencies += "org.bytedeco" % "javacpp" % "1.4.3"
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-Xlint", "-Xlog-free-terms")
@@ -35,7 +35,7 @@ publishTo := {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
-pomExtra := (
+pomExtra :=
https://github.com/bytedeco/sbt-javacpp
@@ -55,4 +55,3 @@ pomExtra := (
https://beachape.com
- )
\ No newline at end of file
diff --git a/project/build.properties b/project/build.properties
index 8310a2c..64bba09 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1,4 +1,4 @@
#Activator-generated Properties
#Mon Feb 22 20:41:33 JST 2016
template.uuid=e17acfbb-1ff5-41f5-b8cf-2c40be6a8340
-sbt.version=0.13.17
\ No newline at end of file
+sbt.version=0.13.17
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 725eef8..3e6b628 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,3 +1,3 @@
classpathTypes += "maven-plugin"
-addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")
+addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
diff --git a/project/scripted.sbt b/project/scripted.sbt
index da0e3ca..c693c13 100644
--- a/project/scripted.sbt
+++ b/project/scripted.sbt
@@ -1,4 +1 @@
-libraryDependencies += {
- "org.scala-sbt" % "scripted-plugin" % sbtVersion.value
-}
-
+libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value
diff --git a/scripted.sbt b/scripted.sbt
index 651b9a7..5a07aec 100644
--- a/scripted.sbt
+++ b/scripted.sbt
@@ -4,4 +4,4 @@ scriptedLaunchOpts := { scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
}
-scriptedBufferLog := false
\ No newline at end of file
+scriptedBufferLog := false
diff --git a/src/main/scala/org/bytedeco/sbt/javacpp/Plugin.scala b/src/main/scala/org/bytedeco/sbt/javacpp/Plugin.scala
index aaac95b..e96dade 100644
--- a/src/main/scala/org/bytedeco/sbt/javacpp/Plugin.scala
+++ b/src/main/scala/org/bytedeco/sbt/javacpp/Plugin.scala
@@ -4,6 +4,8 @@ import scala.language.postfixOps
import sbt._
import sbt.Keys._
+import scala.util.Try
+
object Plugin extends AutoPlugin {
override def projectSettings: Seq[Setting[_]] = {
@@ -21,7 +23,7 @@ object Plugin extends AutoPlugin {
}
object Versions {
- val javaCppVersion = "1.4"
+ val javaCppVersion = "1.4.3"
}
object autoImport {
@@ -37,25 +39,37 @@ object Plugin extends AutoPlugin {
private def javaCppPresetDependencies: Def.Setting[Seq[ModuleID]] = {
import autoImport._
libraryDependencies ++= {
- val majorMinorJavaCppVersion = majorMinorOnly(javaCppVersion.value)
+ val cppPresetVersion = majorMinorOnly(javaCppVersion.value)
javaCppPresetLibs.value.flatMap {
- case (libName, libVersion) => {
- val generic = "org.bytedeco.javacpp-presets" % libName % s"$libVersion-$majorMinorJavaCppVersion" classifier ""
+ case (libName, libVersion) =>
+ val generic = "org.bytedeco.javacpp-presets" % libName % s"$libVersion-$cppPresetVersion" classifier ""
val platformSpecific = javaCppPlatform.value.map { platform =>
- "org.bytedeco.javacpp-presets" % libName % s"$libVersion-$majorMinorJavaCppVersion" classifier platform
+ "org.bytedeco.javacpp-presets" % libName % s"$libVersion-$cppPresetVersion" classifier platform
}
generic +: platformSpecific
- }
}
}
}
/**
+ * Before javacpp 1.4
* Given a version string, simply drops the patch level and returns the major-minor version only
- * @param version
+ *
+ * Starting from javacpp 1.4
+ * The version number of the presets are equal to the javacpp version.
+ *
+ * @param version eg. "1.4.2"
*/
- private def majorMinorOnly(version: String): String = {
- version.split('.').take(2).mkString(".")
+ private def majorMinorOnly(version: String): String =
+ version match {
+ case VersionSplit(a :: b :: _) if a < 2 & b < 4 => s"$a.$b"
+ case VersionSplit(_) => version
+ case _ => throw new IllegalArgumentException("Version format not recognized")
+ }
+
+ private object VersionSplit {
+ def unapply(arg: String): Option[List[Int]] =
+ Try(arg.split('.').map(_.toInt).toList).toOption
}
}
\ No newline at end of file
diff --git a/src/sbt-test/sbt-javacpp/simple/build.sbt b/src/sbt-test/sbt-javacpp/simple/build.sbt
index 90f7fd7..c37a302 100644
--- a/src/sbt-test/sbt-javacpp/simple/build.sbt
+++ b/src/sbt-test/sbt-javacpp/simple/build.sbt
@@ -1,5 +1,5 @@
version := "0.1"
-scalaVersion := "2.11.8"
+scalaVersion := "2.11.12"
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
\ No newline at end of file