Skip to content

Commit

Permalink
Added support for LWJGL-3.0.0a. From version 3, the group ID has chan…
Browse files Browse the repository at this point in the history
…ged and the LWJGL-utils artifact is no longer available.
  • Loading branch information
Tillaert committed Jul 23, 2015
1 parent fecfe27 commit 4f5c594
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name := "sbt-lwjgl-plugin"

organization := "com.github.philcali"

version := "3.1.5"
version := "3.1.5-SNAPSHOT"

libraryDependencies += "net.databinder.dispatch" %% "dispatch-core" % "0.11.0"

Expand Down
24 changes: 17 additions & 7 deletions src/main/scala/LWJGLPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,17 @@ object LWJGLPlugin extends Plugin {
}
}

private def major(v: String): Int = v.split("\\.")(0) toInt

lazy val lwjglSettings: Seq[Setting[_]] = baseSettings ++ runSettings

lazy val baseSettings: Seq[Setting[_]] = Seq (
lwjgl.includePlatform := true,

lwjgl.org := "org.lwjgl.lwjgl",
// The group ID changed at version 3
lwjgl.org <<= (lwjgl.version) {
v => if (major(v) <= 2) "org.lwjgl.lwjgl" else "org.lwjgl"
},

lwjgl.utilsName := "lwjgl_util",

Expand All @@ -150,13 +155,18 @@ object LWJGLPlugin extends Plugin {
manifestNatives <<= manifestNatives dependsOn update,

libraryDependencies <++=
(lwjgl.version, lwjgl.org, lwjgl.utilsName, lwjgl.os, lwjgl.includePlatform) {
(v, org, utils, os, isNew) =>
val deps = Seq(org % "lwjgl" % v, org % utils % v)
(lwjgl.version, lwjgl.org, lwjgl.utilsName, lwjgl.os, lwjgl.includePlatform) {
(v, org, utils, os, isNew) =>
val deps = Seq(org % "lwjgl" % v)

// Version 2 includes a util artifact.
if (major(v) <= 2)
deps ++ Seq(org % utils % v)

if (isNew)
deps ++ Seq(org % "lwjgl-platform" % v classifier "natives-" + (os._1))

if (isNew)
deps ++ Seq(org % "lwjgl-platform" % v classifier "natives-" + (os._1))
else deps
deps
}
)

Expand Down

0 comments on commit 4f5c594

Please sign in to comment.