1- import UdashBuild ._
2- import Dependencies ._
3-
41name := " jquery-demo"
52
6- version in ThisBuild := " 1.1.0"
7- scalaVersion in ThisBuild := " 2.12.2"
8- organization in ThisBuild := " io.udash"
9- crossPaths in ThisBuild := false
10- scalacOptions in ThisBuild ++= Seq (
11- " -feature" ,
12- " -deprecation" ,
13- " -unchecked" ,
14- " -language:implicitConversions" ,
15- " -language:existentials" ,
16- " -language:dynamics" ,
17- " -Xfuture" ,
18- " -Xfatal-warnings"
19- )
3+ inThisBuild(Seq (
4+ version := " 1.2.0" ,
5+ organization := " io.udash" ,
6+ scalaVersion := " 2.12.6" ,
7+ scalacOptions ++= Seq (
8+ " -feature" ,
9+ " -deprecation" ,
10+ " -unchecked" ,
11+ " -language:implicitConversions" ,
12+ " -language:existentials" ,
13+ " -language:dynamics" ,
14+ " -language:postfixOps" ,
15+ " -Xfuture" ,
16+ " -Xfatal-warnings" ,
17+ " -Xlint:_" ,
18+ ),
19+ scalacOptions ++= {
20+ if (CrossVersion .partialVersion((`jquery-demo` / scalaVersion).value).contains((2 , 12 ))) Seq (
21+ " -Ywarn-unused:_,-explicits,-implicits" ,
22+ " -Ybackend-parallelism" , " 4" ,
23+ " -Ycache-plugin-class-loader:last-modified" ,
24+ " -Ycache-macro-class-loader:last-modified"
25+ ) else Seq .empty
26+ },
27+ ))
2028
2129val generatedDir = file(" generated" )
30+ val copyAssets = taskKey[Unit ](" Copies all assets to the target directory." )
2231val `jquery-demo` = project.in(file(" ." )).enablePlugins(ScalaJSPlugin )
2332 .settings(
24- libraryDependencies ++= deps.value,
33+ libraryDependencies ++= Dependencies . deps.value,
2534
2635 /* move these files out of target/. */
27- crossTarget in ( Compile , fullOptJS) := generatedDir,
28- crossTarget in ( Compile , fastOptJS) := generatedDir,
29- crossTarget in ( Compile , packageJSDependencies) := generatedDir,
30- crossTarget in ( Compile , packageMinifiedJSDependencies) := generatedDir,
36+ Compile / fullOptJS / crossTarget := generatedDir,
37+ Compile / fastOptJS / crossTarget := generatedDir,
38+ Compile / packageJSDependencies / crossTarget := generatedDir,
39+ Compile / packageMinifiedJSDependencies / crossTarget := generatedDir,
3140
32- compile := (compile in Compile ).dependsOn(compileStatics).value,
33- compileStatics := {
34- compileStaticsForRelease.value
35- (crossTarget.value / StaticFilesDir ).*** .get
36- },
41+ Compile / fastOptJS := (Compile / fastOptJS).dependsOn(copyAssets).value,
42+ Compile / fullOptJS := (Compile / fullOptJS).dependsOn(copyAssets).value,
3743
3844 scalaJSUseMainModuleInitializer := true ,
3945
40- artifactPath in(Compile , fastOptJS) :=
41- (crossTarget in(Compile , fastOptJS)).value / StaticFilesDir / WebContent / " scripts" / " frontend-impl-fast.js" ,
42- artifactPath in(Compile , fullOptJS) :=
43- (crossTarget in(Compile , fullOptJS)).value / StaticFilesDir / WebContent / " scripts" / " frontend-impl.js" ,
44- artifactPath in(Compile , packageJSDependencies) :=
45- (crossTarget in(Compile , packageJSDependencies)).value / StaticFilesDir / WebContent / " scripts" / " frontend-deps-fast.js" ,
46- artifactPath in(Compile , packageMinifiedJSDependencies) :=
47- (crossTarget in(Compile , packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / " scripts" / " frontend-deps.js"
46+ copyAssets := {
47+ IO .copyFile(
48+ sourceDirectory.value / " main/assets/index.html" ,
49+ generatedDir / " index.html"
50+ )
51+ },
52+
53+ Compile / fastOptJS / artifactPath :=
54+ (Compile / fastOptJS / crossTarget).value / " scripts" / " frontend-impl.js" ,
55+ Compile / fullOptJS / artifactPath :=
56+ (Compile / fullOptJS / crossTarget).value / " scripts" / " frontend-impl.js" ,
57+ Compile / packageJSDependencies / artifactPath :=
58+ (Compile / packageJSDependencies / crossTarget).value / " scripts" / " frontend-deps.js" ,
59+ Compile / packageMinifiedJSDependencies / artifactPath :=
60+ (Compile / packageMinifiedJSDependencies / crossTarget).value / " scripts" / " frontend-deps.js"
4861 )
0 commit comments