forked from orbeon/orbeon-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
94 lines (69 loc) · 3.59 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
val ExplodedWarWebInf = "build/orbeon-war/WEB-INF"
val ExplodedWarClassesPath = ExplodedWarWebInf + "/classes"
val ExplodedWarResourcesPath = ExplodedWarWebInf + "/resources"
val FormBuilderResourcesPathInWar = "forms/orbeon/builder/resources"
val ScalaJSFileNameFormat = "((.+)-(fastopt|opt)).js".r
val fastOptJSToExplodedWar = taskKey[Unit]("Copy fast-optimized JavaScript files to the exploded WAR.")
val fullOptJSToExplodedWar = taskKey[Unit]("Copy full-optimized JavaScript files to the exploded WAR.")
def copyScalaJSToExplodedWar(sourceFile: File, rootDirectory: File): Unit = {
val (prefix, optType) =
sourceFile.name match { case ScalaJSFileNameFormat(_, prefix, optType) ⇒ prefix → optType }
val launcherName = s"$prefix-launcher.js"
val sourceMapName = s"${sourceFile.name}.map"
val targetDir =
rootDirectory / ExplodedWarResourcesPath / FormBuilderResourcesPathInWar / "scalajs"
IO.createDirectory(targetDir)
val names = List(
sourceFile → s"$prefix.js",
(sourceFile.getParentFile / launcherName) → launcherName,
(sourceFile.getParentFile / sourceMapName) → sourceMapName
)
for ((file, newName) ← names)
IO.copyFile(
sourceFile = file,
targetFile = targetDir / newName,
preserveLastModified = true
)
}
lazy val formBuilder = (project in file("builder")).
enablePlugins(ScalaJSPlugin).
settings(
organization := "org.orbeon",
name := "form-builder",
version := "4.11-SNAPSHOT",
scalaVersion := "2.11.7",
scalaSource in Compile := baseDirectory.value / "src" / "builder" / "scala",
javaSource in Compile := baseDirectory.value / "src" / "builder" / "java",
resourceDirectory in Compile := baseDirectory.value / "src" / "builder" / "resources",
jsDependencies += RuntimeDOM,
jsDependencies += "org.webjars" % "jquery" % "2.1.3" / "2.1.3/jquery.js",
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.8.1",
// Temporary, until there is an 0.8.2 which fixes the jquery.js issue
unmanagedBase := baseDirectory.value / "lib",
persistLauncher in Compile := true,
fastOptJSToExplodedWar := copyScalaJSToExplodedWar(
(fastOptJS in Compile).value.data,
baseDirectory.value.getParentFile
),
fullOptJSToExplodedWar := copyScalaJSToExplodedWar(
(fullOptJS in Compile).value.data,
baseDirectory.value.getParentFile
)
)
lazy val core = (project in file(".")).
dependsOn(formBuilder).
settings(
organization := "org.orbeon",
name := "orbeon-core",
version := "4.11-SNAPSHOT",
scalaVersion := "2.11.7",
scalaSource in Compile := baseDirectory.value / "src" / "main" / "scala",
javaSource in Compile := baseDirectory.value / "src" / "main" / "java",
resourceDirectory in Compile := baseDirectory.value / "src" / "main" / "resources",
scalaSource in Test := baseDirectory.value / "src" / "test" / "scala",
javaSource in Test := baseDirectory.value / "src" / "test" / "java",
resourceDirectory in Test := baseDirectory.value / "src" / "test" / "resources",
unmanagedBase := baseDirectory.value / "lib",
classDirectory in Compile := baseDirectory.value / ExplodedWarClassesPath
)
sound.play(compile in Compile, Sounds.Blow, Sounds.Basso)