diff --git a/.travis.yml b/.travis.yml index 56f862c..e2322af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,36 @@ -language: scala dist: trusty - +language: scala jdk: openjdk11 - scala: - 2.13.1 -before_script: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" - - sleep 3 # give xvfb some time to start - # Instal google-chrome - - export CHROME_BIN=/usr/bin/google-chrome - - sudo apt-get update - - sudo apt-get install -y libappindicator1 fonts-liberation - - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - - sudo dpkg -i google-chrome*.deb - # Install Selenium chromedriver - - wget http://chromedriver.storage.googleapis.com/2.38/chromedriver_linux64.zip - - unzip chromedriver_linux64.zip -d selenium-bin - - export PATH=$PWD/selenium-bin:$PATH +jobs: + include: + - stage: test + script: + - sbt +test +publishLocal + - cd example && sbt compileStatics + - stage: release + if: tag =~ ^v + script: + - openssl aes-256-cbc -K $encrypted_f00a6d0a0202_key -iv $encrypted_f00a6d0a0202_iv + -in travis/travis.gpg.enc -out travis/travis.gpg -d + - gpg --import travis/travis.gpg + - test $TRAVIS_PULL_REQUEST = "false" && sbt +publishSigned sonatypeBundleRelease + +before_cache: + - rm -fv $HOME/.ivy2/.sbt.ivy.lock + - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete + - find $HOME/.sbt -name "*.lock" -print -delete + +cache: + directories: + - "$HOME/.ivy2/cache" + - "$HOME/.m2" + - "$HOME/.cache" + - "$HOME/.sbt" -script: - - sbt +test +publishLocal - - cd example && sbt compile jquery-global-demo/fullOptJS jquery-bundler-demo/compileStatics \ No newline at end of file +env: + global: + - secure: rG9cHG3au9EUYQSJKHAsMxws3IW/tSxG1Y/xbuW2Ri1JVr6L6c9ig8gYj4Hju5KkVvxXejb1/8bYCoZEP1vZpNeSkNordHECp0l+i9mI5ZFo5RN3vMCq4/0xWEQTdZ7c3BjN+pn4veDJ+W8cHFXgivC9tsX7FEbksz4bFVIm1knvz5r7HN4ntgQUeLwY/J9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7OsYqDIhIwfs/Q3J9gw18F4fa9czpnduVzkpQUGdZ2vtS+oxDGICB7uaxkRq7HudHHElhz4w9qEOIMpTJjICPa38Hr/fKGxpuhKE= \ No newline at end of file diff --git a/build.sbt b/build.sbt index 383767f..ed68634 100644 --- a/build.sbt +++ b/build.sbt @@ -3,13 +3,14 @@ name := "udash-jquery" inThisBuild(Seq( - version := "3.0.2", + version := sys.env.get("TRAVIS_TAG").filter(_.startsWith("v")).map(_.drop(1)).getOrElse("3.0.0-SNAPSHOT"), organization := "io.udash", + cancelable := true, )) val commonSettings = Seq( scalaVersion := "2.13.1", - crossScalaVersions := Seq("2.12.10", "2.13.1"), + crossScalaVersions := Seq("2.12.11", "2.13.1"), scalacOptions ++= Seq( "-feature", "-deprecation", @@ -26,21 +27,51 @@ val commonSettings = Seq( "-Ycache-plugin-class-loader:last-modified", "-Ycache-macro-class-loader:last-modified", ), + autoAPIMappings := true, + publishMavenStyle := true, + publishArtifact in Test := false, + pomIncludeRepository := { _ => false }, + + publishTo := sonatypePublishToBundle.value, + + credentials in Global += Credentials( + "Sonatype Nexus Repository Manager", + "oss.sonatype.org", + sys.env.getOrElse("SONATYPE_USERNAME", ""), + sys.env.getOrElse("SONATYPE_PASSWORD", "") + ), + + pomExtra := { + https://github.com/UdashFramework/scala-js-jquery + + + Apache v.2 License + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + git@github.com:UdashFramework/scala-js-jquery.git + scm:git@github.com:UdashFramework/scala-js-jquery.git + + + + avsystem + AVSystem + http://www.avsystem.com/ + + + } ) val commonJSSettings = Seq( - Compile / emitSourceMaps := true, Test / parallelExecution := false, Test / scalaJSStage := FastOptStage, - // ScalaJSBundlerPlugin does not work with scalajs-env-selenium: - // https://github.com/scalacenter/scalajs-bundler/issues/89 - // 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", ) lazy val root = project.in(file(".")) @@ -50,9 +81,9 @@ lazy val root = project.in(file(".")) commonJSSettings, libraryDependencies ++= Seq( - "org.scala-js" %%% "scalajs-dom" % "0.9.7", - "org.scalatest" %%% "scalatest" % "3.0.8" % Test, - "com.lihaoyi" %%% "scalatags" % "0.7.0" % Test + "org.scala-js" %%% "scalajs-dom" % "0.9.8", + "org.scalatest" %%% "scalatest" % "3.1.1" % Test, + "com.lihaoyi" %%% "scalatags" % "0.8.6" % Test ), Compile / npmDependencies += "jquery" -> "3.3.1", diff --git a/example/build.sbt b/example/build.sbt index 04eeabb..422bf9d 100644 --- a/example/build.sbt +++ b/example/build.sbt @@ -1,13 +1,13 @@ name := "jquery-demo" inThisBuild(Seq( - version := "3.0.1", + version := "3.0.2", organization := "io.udash", )) val commonSettings = Seq( scalaVersion := "2.12.10", - crossScalaVersions := Seq("2.12.10"), //todo 2.13 + crossScalaVersions := Seq("2.12.10"), //todo 2.13 & SJS 1.0 with Udash 0.9 scalacOptions ++= Seq( "-feature", "-deprecation", @@ -33,46 +33,10 @@ val root = project.in(file(".")) .enablePlugins(ScalaJSPlugin) .settings(commonSettings) -val `jquery-global-demo` = project.in(file("global-demo")) - .enablePlugins(ScalaJSPlugin) - .settings( - commonSettings, - - jsDependencies ++= Dependencies.jsDeps.value, - - sourceDirsSettings(_.getParentFile), - - /* move these files out of target/. */ - Compile / fullOptJS / crossTarget := generatedGlobalDir, - Compile / fastOptJS / crossTarget := generatedGlobalDir, - Compile / packageJSDependencies / crossTarget := generatedGlobalDir, - Compile / packageMinifiedJSDependencies / crossTarget := generatedGlobalDir, - - Compile / fastOptJS := (Compile / fastOptJS).dependsOn(copyAssets).value, - Compile / fullOptJS := (Compile / fullOptJS).dependsOn(copyAssets).value, - - scalaJSUseMainModuleInitializer := true, - - copyAssets := { - IO.copyFile( - sourceDirectory.value / "main/assets/index.html", - generatedGlobalDir / "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" - ) - -val generatedBundlerDir = file("generated/bundler") +val generatedBundlerDir = file("generated") val compileStatics = taskKey[Unit]("Compiles all static files.") -val `jquery-bundler-demo` = project.in(file("bundler-demo")) + +val example = project.in(file(".")) .enablePlugins(ScalaJSBundlerPlugin) .settings( commonSettings, diff --git a/example/global-demo/src/main/assets/index.html b/example/global-demo/src/main/assets/index.html deleted file mode 100644 index b746eab..0000000 --- a/example/global-demo/src/main/assets/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - jquery-demo - global scope - - -
- - - - - \ No newline at end of file diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala index caa9172..32852d9 100644 --- a/example/project/Dependencies.scala +++ b/example/project/Dependencies.scala @@ -1,17 +1,12 @@ -import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._ import sbt._ object Dependencies { - val udashCoreVersion = "0.8.1" + val udashCoreVersion = "0.8.3" val udashJQueryVersion = "3.0.2" val deps = Def.setting(Seq[ModuleID]( "io.udash" %%% "udash-core" % udashCoreVersion, "io.udash" %%% "udash-jquery" % udashJQueryVersion )) - - val jsDeps = Def.setting(Seq[org.scalajs.sbtplugin.JSModuleID]( - "org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js" - )) } \ No newline at end of file diff --git a/example/project/build.properties b/example/project/build.properties index ebcc8ac..c9c5a37 100644 --- a/example/project/build.properties +++ b/example/project/build.properties @@ -1,2 +1,2 @@ # suppress inspection "UnusedProperty" -sbt.version=1.3.2 \ No newline at end of file +sbt.version=1.3.8 \ No newline at end of file diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt index cafe39a..c0848e6 100644 --- a/example/project/plugins.sbt +++ b/example/project/plugins.sbt @@ -1,4 +1,4 @@ logLevel := Level.Warn -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29") -addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6") \ No newline at end of file +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32") +addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler-sjs06" % "0.17.0") \ No newline at end of file diff --git a/example/bundler-demo/src/main/assets/index.html b/example/src/main/assets/index.html similarity index 100% rename from example/bundler-demo/src/main/assets/index.html rename to example/src/main/assets/index.html diff --git a/project/build.properties b/project/build.properties index ebcc8ac..c9c5a37 100755 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ # suppress inspection "UnusedProperty" -sbt.version=1.3.2 \ No newline at end of file +sbt.version=1.3.8 \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 6b9840d..418498b 100755 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,8 @@ logLevel := Level.Warn -libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.3.0" +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1") +addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.17.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29") -addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6") +// Deployment configuration +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1") \ No newline at end of file diff --git a/src/test/scala/io/udash/wrappers/jquery_test/DomManipulationTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/DomManipulationTest.scala index ede038d..d16b4cc 100644 --- a/src/test/scala/io/udash/wrappers/jquery_test/DomManipulationTest.scala +++ b/src/test/scala/io/udash/wrappers/jquery_test/DomManipulationTest.scala @@ -1,8 +1,10 @@ package io.udash.wrappers.jquery_test -import org.scalatest.{Matchers, WordSpec} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec + +class DomManipulationTest extends AnyWordSpec with Matchers { -class DomManipulationTest extends WordSpec with Matchers { import io.udash.wrappers.jquery._ import scalatags.JsDom.all._ diff --git a/src/test/scala/io/udash/wrappers/jquery_test/EventsHandlingTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/EventsHandlingTest.scala index 42fea1c..710fa0a 100644 --- a/src/test/scala/io/udash/wrappers/jquery_test/EventsHandlingTest.scala +++ b/src/test/scala/io/udash/wrappers/jquery_test/EventsHandlingTest.scala @@ -1,10 +1,13 @@ +package io.udash.wrappers.jquery_test + import org.scalajs.dom.Element import org.scalajs.dom.html.Input -import org.scalatest.{Matchers, WordSpec} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec -class EventsHandlingTest extends WordSpec with Matchers { - import io.udash.wrappers.jquery._ +class EventsHandlingTest extends AnyWordSpec with Matchers { + import io.udash.wrappers.jquery._ import scalatags.JsDom.all._ class C(i: Int) diff --git a/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala index 95b3953..4d32382 100644 --- a/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala +++ b/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala @@ -1,10 +1,11 @@ package io.udash.wrappers.jquery_test -import org.scalatest.{Matchers, WordSpec} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec -class MiscellaneousTest extends WordSpec with Matchers { - import io.udash.wrappers.jquery._ +class MiscellaneousTest extends AnyWordSpec with Matchers { + import io.udash.wrappers.jquery._ import scalatags.JsDom.all._ class C(i: Int) @@ -45,7 +46,8 @@ class MiscellaneousTest extends WordSpec with Matchers { } "serialize objects to URL query string" in { - import scala.scalajs.js, js.JSConverters._ + import scala.scalajs.js + import js.JSConverters._ jQ.param(js.Dynamic.literal("a" -> Seq(1, 2, 3).toJSArray, "b" -> "c")) should be("a%5B%5D=1&a%5B%5D=2&a%5B%5D=3&b=c") } } diff --git a/src/test/scala/io/udash/wrappers/jquery_test/SelectorsTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/SelectorsTest.scala index 6654210..61ea636 100644 --- a/src/test/scala/io/udash/wrappers/jquery_test/SelectorsTest.scala +++ b/src/test/scala/io/udash/wrappers/jquery_test/SelectorsTest.scala @@ -1,8 +1,10 @@ package io.udash.wrappers.jquery_test -import org.scalatest.{Matchers, WordSpec} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec + +class SelectorsTest extends AnyWordSpec with Matchers { -class SelectorsTest extends WordSpec with Matchers { import io.udash.wrappers.jquery._ import scalatags.JsDom.all._ diff --git a/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala index 1400684..82116cf 100644 --- a/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala +++ b/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala @@ -1,10 +1,11 @@ package io.udash.wrappers.jquery_test -import org.scalatest.{Matchers, WordSpec} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec -class TraversingTest extends WordSpec with Matchers { - import io.udash.wrappers.jquery._ +class TraversingTest extends AnyWordSpec with Matchers { + import io.udash.wrappers.jquery._ import scalatags.JsDom.all._ "jQuery" should { diff --git a/travis/travis.gpg.enc b/travis/travis.gpg.enc new file mode 100644 index 0000000..399e477 Binary files /dev/null and b/travis/travis.gpg.enc differ