Skip to content

Bundler only build for SJS 1.0 with autopublish #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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 comp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yzc09+1d5RMAJVWdKOKVjrbDwvKaNWfEHW6GXJ83xm8cbo3dCREfL7UTKjejkQTRgmj2BdrZVRB9xs+XKZpZi0ECVbIrwik9tyYoiuSHe96yNN3Ma56Q4x094ZTvsccjy7pET4FCpNwrFu0aD+HFPerWB/xlr9ILz7sWy99r4eafS+O2eidoQnPIHAHZ+z/k9ExQedKUzTxO/skgrf1FvswrY7cpfnNApOhCSKm8C5NfMB5BC7M7OsYqDIhIwfs/Q3J9gw18F4fa9czpnduVzkpQUGdZ2vtS+oxDGICB7uaxkRq7HudHHElhz4w9qEOIMpTJjICPa38Hr/fKGxpuhKE=
51 changes: 41 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 := {
<url>https://github.com/UdashFramework/scala-js-jquery</url>
<licenses>
<license>
<name>Apache v.2 License</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:UdashFramework/scala-js-jquery.git</url>
<connection>scm:git@github.com:UdashFramework/scala-js-jquery.git</connection>
</scm>
<developers>
<developer>
<id>avsystem</id>
<name>AVSystem</name>
<url>http://www.avsystem.com/</url>
</developer>
</developers>
}
)

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("."))
Expand All @@ -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",
Expand Down
46 changes: 5 additions & 41 deletions example/build.sbt
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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,
Expand Down
13 changes: 0 additions & 13 deletions example/global-demo/src/main/assets/index.html

This file was deleted.

7 changes: 1 addition & 6 deletions example/project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -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"
))
}
2 changes: 1 addition & 1 deletion example/project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# suppress inspection "UnusedProperty"
sbt.version=1.3.2
sbt.version=1.3.8
4 changes: 2 additions & 2 deletions example/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler-sjs06" % "0.17.0")
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# suppress inspection "UnusedProperty"
sbt.version=1.3.2
sbt.version=1.3.8
8 changes: 5 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")
Original file line number Diff line number Diff line change
@@ -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._

Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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")
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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._

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Binary file added travis/travis.gpg.enc
Binary file not shown.