-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from UdashFramework/upgrade
Upgrade to jQuery 3.2.1
- Loading branch information
Showing
39 changed files
with
375 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,71 @@ | ||
import org.openqa.selenium.chrome.ChromeOptions | ||
import org.openqa.selenium.remote.DesiredCapabilities | ||
import org.scalajs.jsenv.selenium.SeleniumJSEnv | ||
|
||
name := "udash-jquery" | ||
|
||
version := "1.1.1" | ||
organization := "io.udash" | ||
scalaVersion := "2.12.2" | ||
crossScalaVersions := Seq("2.11.11", "2.12.2") | ||
scalacOptions in ThisBuild ++= Seq( | ||
"-feature", | ||
"-deprecation", | ||
"-unchecked", | ||
"-language:implicitConversions", | ||
"-language:existentials", | ||
"-language:dynamics", | ||
"-Xfuture", | ||
"-Xfatal-warnings", | ||
CrossVersion.partialVersion(scalaVersion.value).collect { | ||
// WORKAROUND https://github.com/scala/scala/pull/5402 | ||
case (2, 12) => "-Xlint:-unused,_" | ||
}.getOrElse("-Xlint:_") | ||
) | ||
inThisBuild(Seq( | ||
version := "1.2.0", | ||
organization := "io.udash", | ||
scalaVersion := "2.12.6", | ||
crossScalaVersions := Seq("2.11.12", "2.12.6"), | ||
scalacOptions ++= Seq( | ||
"-feature", | ||
"-deprecation", | ||
"-unchecked", | ||
"-language:implicitConversions", | ||
"-language:existentials", | ||
"-language:dynamics", | ||
"-language:postfixOps", | ||
"-language:experimental.macros", | ||
"-Xfuture", | ||
"-Xfatal-warnings", | ||
"-Xlint:_", | ||
), | ||
scalacOptions ++= { | ||
if (CrossVersion.partialVersion((root / scalaVersion).value).contains((2, 12))) Seq( | ||
"-Ywarn-unused:_,-explicits,-implicits", | ||
"-Ybackend-parallelism", "4", | ||
"-Ycache-plugin-class-loader:last-modified", | ||
"-Ycache-macro-class-loader:last-modified" | ||
) else Seq.empty | ||
}, | ||
)) | ||
|
||
// Settings for JS tests run in browser | ||
val browserCapabilities: DesiredCapabilities = { | ||
// requires ChromeDriver: https://sites.google.com/a/chromium.org/chromedriver/ | ||
val capabilities = DesiredCapabilities.chrome() | ||
capabilities.setCapability(ChromeOptions.CAPABILITY, { | ||
val options = new ChromeOptions() | ||
options.addArguments("--headless", "--disable-gpu") | ||
options | ||
}) | ||
capabilities | ||
} | ||
|
||
jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox()) | ||
val commonJSSettings = Seq( | ||
Compile / emitSourceMaps := true, | ||
Test / parallelExecution := false, | ||
Test / scalaJSStage := FastOptStage, | ||
Test / jsEnv := new SeleniumJSEnv(browserCapabilities), | ||
scalacOptions += { | ||
val localDir = (ThisBuild / baseDirectory).value.toURI.toString | ||
val githubDir = "https://raw.githubusercontent.com/UdashFramework/scala-js-jquery" | ||
s"-P:scalajs:mapSourceURI:$localDir->$githubDir/v${version.value}/" | ||
}, | ||
scalacOptions += "-P:scalajs:sjsDefinedByDefault", | ||
) | ||
|
||
libraryDependencies ++= Seq( | ||
"org.scala-js" %%% "scalajs-dom" % "0.9.2", | ||
"org.scalatest" %%% "scalatest" % "3.0.3" % Test, | ||
"com.lihaoyi" %%% "scalatags" % "0.6.5" % Test | ||
"org.scala-js" %%% "scalajs-dom" % "0.9.5", | ||
"org.scalatest" %%% "scalatest" % "3.0.5" % Test, | ||
"com.lihaoyi" %%% "scalatags" % "0.6.7" % Test | ||
) | ||
|
||
jsDependencies += | ||
"org.webjars" % "jquery" % "3.2.1" / "3.2.1/jquery.js" minified "3.2.1/jquery.min.js" | ||
|
||
requiresDOM in Test := true | ||
"org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js" | ||
|
||
lazy val root = project.in(file(".")) | ||
.enablePlugins(ScalaJSPlugin) | ||
.settings(commonJSSettings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### How to use? | ||
|
||
Run `sbt fastOptJS` or `sbt fullOptJS` to compile this demo. You can find all generated files | ||
in the `generated` directory. Open `index.html` in your browser. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,61 @@ | ||
import UdashBuild._ | ||
import Dependencies._ | ||
|
||
name := "jquery-demo" | ||
|
||
version in ThisBuild := "1.1.0" | ||
scalaVersion in ThisBuild := "2.12.2" | ||
organization in ThisBuild := "io.udash" | ||
crossPaths in ThisBuild := false | ||
scalacOptions in ThisBuild ++= Seq( | ||
"-feature", | ||
"-deprecation", | ||
"-unchecked", | ||
"-language:implicitConversions", | ||
"-language:existentials", | ||
"-language:dynamics", | ||
"-Xfuture", | ||
"-Xfatal-warnings" | ||
) | ||
inThisBuild(Seq( | ||
version := "1.2.0", | ||
organization := "io.udash", | ||
scalaVersion := "2.12.6", | ||
scalacOptions ++= Seq( | ||
"-feature", | ||
"-deprecation", | ||
"-unchecked", | ||
"-language:implicitConversions", | ||
"-language:existentials", | ||
"-language:dynamics", | ||
"-language:postfixOps", | ||
"-Xfuture", | ||
"-Xfatal-warnings", | ||
"-Xlint:_", | ||
), | ||
scalacOptions ++= { | ||
if (CrossVersion.partialVersion((`jquery-demo` / scalaVersion).value).contains((2, 12))) Seq( | ||
"-Ywarn-unused:_,-explicits,-implicits", | ||
"-Ybackend-parallelism", "4", | ||
"-Ycache-plugin-class-loader:last-modified", | ||
"-Ycache-macro-class-loader:last-modified" | ||
) else Seq.empty | ||
}, | ||
)) | ||
|
||
val generatedDir = file("generated") | ||
val copyAssets = taskKey[Unit]("Copies all assets to the target directory.") | ||
val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin) | ||
.settings( | ||
libraryDependencies ++= deps.value, | ||
libraryDependencies ++= Dependencies.deps.value, | ||
|
||
/* move these files out of target/. */ | ||
crossTarget in (Compile, fullOptJS) := generatedDir, | ||
crossTarget in (Compile, fastOptJS) := generatedDir, | ||
crossTarget in (Compile, packageJSDependencies) := generatedDir, | ||
crossTarget in (Compile, packageMinifiedJSDependencies) := generatedDir, | ||
Compile / fullOptJS / crossTarget := generatedDir, | ||
Compile / fastOptJS / crossTarget := generatedDir, | ||
Compile / packageJSDependencies / crossTarget := generatedDir, | ||
Compile / packageMinifiedJSDependencies / crossTarget := generatedDir, | ||
|
||
compile := (compile in Compile).dependsOn(compileStatics).value, | ||
compileStatics := { | ||
compileStaticsForRelease.value | ||
(crossTarget.value / StaticFilesDir).***.get | ||
}, | ||
Compile / fastOptJS := (Compile / fastOptJS).dependsOn(copyAssets).value, | ||
Compile / fullOptJS := (Compile / fullOptJS).dependsOn(copyAssets).value, | ||
|
||
scalaJSUseMainModuleInitializer := true, | ||
|
||
artifactPath in(Compile, fastOptJS) := | ||
(crossTarget in(Compile, fastOptJS)).value / StaticFilesDir / WebContent / "scripts" / "frontend-impl-fast.js", | ||
artifactPath in(Compile, fullOptJS) := | ||
(crossTarget in(Compile, fullOptJS)).value / StaticFilesDir / WebContent / "scripts" / "frontend-impl.js", | ||
artifactPath in(Compile, packageJSDependencies) := | ||
(crossTarget in(Compile, packageJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps-fast.js", | ||
artifactPath in(Compile, packageMinifiedJSDependencies) := | ||
(crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps.js" | ||
copyAssets := { | ||
IO.copyFile( | ||
sourceDirectory.value / "main/assets/index.html", | ||
generatedDir / "index.html" | ||
) | ||
}, | ||
|
||
Compile / fastOptJS / artifactPath := | ||
(Compile / fastOptJS / crossTarget).value / "scripts" / "frontend-impl.js", | ||
Compile / fullOptJS / artifactPath := | ||
(Compile / fullOptJS / crossTarget).value / "scripts" / "frontend-impl.js", | ||
Compile / packageJSDependencies / artifactPath := | ||
(Compile / packageJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js", | ||
Compile / packageMinifiedJSDependencies / artifactPath := | ||
(Compile / packageMinifiedJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version = 0.13.15 | ||
sbt.version = 1.1.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
logLevel := Level.Warn | ||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18") | ||
|
||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.