Skip to content
Open
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
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
scalaversion: ["2.12.20", "2.13.15"]
browser: ["chrome"]
scalaversion: [ "2.12.20", "2.13.16" ]
browser: [ "chrome" ]
include:
- scalaversion: "2.12.20"
browser: "firefox"
env:
SJS_TEST_BROWSER: ${{ matrix.browser }}
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v10
- uses: coursier/setup-action@v1
with:
java-version: "[email protected]"
- uses: coursier/cache-action@v5
jvm: "temurin:11"
apps: sbt
- uses: coursier/cache-action@v6
- name: Scalastyle
run: >
sbt "++${{ matrix.scalaversion }}"
Expand Down
63 changes: 23 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@ import org.openqa.selenium.Capabilities
import org.scalajs.jsenv.selenium.SeleniumJSEnv
import org.scalajs.jsenv.selenium.TestDrivers

// we're breaking bincompat with the bump to selenium 4
val previousVersion: Option[String] = None

val newScalaBinaryVersionsInThisRelease: Set[String] =
Set()

val commonSettings: Seq[Setting[_]] = Seq(
version := "2.0.0-SNAPSHOT",
organization := "org.scala-js",
scalaVersion := "2.12.20",
crossScalaVersions := Seq("2.12.20", "2.13.15"),
scalaVersion := crossScalaVersions.value.head,
crossScalaVersions := Seq("2.12.20", "2.13.16"),
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),

homepage := Some(url("http://scala-js.org/")),
Expand All @@ -30,29 +24,20 @@ val commonSettings: Seq[Setting[_]] = Seq(
testOptions += Tests.Argument(TestFramework("com.novocode.junit.JUnitFramework"), "-v", "-a")
)

val previousArtifactSetting = Def.settings(
mimaPreviousArtifacts ++= {
val scalaV = scalaVersion.value
val scalaBinaryV = scalaBinaryVersion.value
val thisProjectID = projectID.value
previousVersion match {
case None =>
Set.empty
case _ if newScalaBinaryVersionsInThisRelease.contains(scalaBinaryV) =>
// New in this release, no binary compatibility to comply to
Set.empty
case Some(prevVersion) =>
/* Filter out e:info.apiURL as it expects 0.6.7-SNAPSHOT, whereas the
* artifact we're looking for has 0.6.6 (for example).
*/
val prevExtraAttributes =
thisProjectID.extraAttributes.filterKeys(_ != "e:info.apiURL")
val prevProjectID =
(thisProjectID.organization % thisProjectID.name % prevVersion)
.cross(thisProjectID.crossVersion)
.extra(prevExtraAttributes.toSeq: _*)
Set(prevProjectID)
}
val mimaSettings = Seq(
mimaBinaryIssueFilters ++= BinaryIncompatibilities.SeleniumJSEnv,
mimaFailOnNoPrevious := false,
mimaPreviousArtifacts := {
// Released versions - will be Set("2.0.0", "2.0.1", etc.) after releases
val all: Set[String] = Set.empty

// Exclusion predicates per Scala binary version
// Example: Map("3" -> (_.startsWith("2.0."))) would exclude 2.0.x versions for Scala 3
val exclusions: Map[String, String => Boolean] = Map.empty

all
.filterNot(exclusions.getOrElse(scalaBinaryVersion.value, _ => false))
.map(v => organization.value %% name.value % v)
}
)

Expand All @@ -66,6 +51,7 @@ name := "root"

lazy val seleniumJSEnv: Project = project.
settings(commonSettings).
settings(mimaSettings).
settings(
name := "scalajs-env-selenium",

Expand All @@ -74,16 +60,13 @@ lazy val seleniumJSEnv: Project = project.
* It pulls in "closure-compiler-java-6" which in turn bundles some old
* guava stuff which in turn makes selenium fail.
*/
"org.seleniumhq.selenium" % "selenium-java" % "4.25.0",
"org.scala-js" %% "scalajs-js-envs" % "1.1.1",
"com.google.jimfs" % "jimfs" % "1.1",
"org.scala-js" %% "scalajs-js-envs-test-kit" % "1.1.1" % "test",
"com.novocode" % "junit-interface" % "0.11" % "test"
"org.seleniumhq.selenium" % "selenium-java" % "4.35.0",
"org.scala-js" %% "scalajs-js-envs" % "1.4.0",
"com.google.jimfs" % "jimfs" % "1.3.1",
"org.scala-js" %% "scalajs-js-envs-test-kit" % "1.4.0" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
),

previousArtifactSetting,
mimaBinaryIssueFilters ++= BinaryIncompatibilities.SeleniumJSEnv,

publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
Expand Down Expand Up @@ -135,4 +118,4 @@ lazy val seleniumJSHttpEnvTest: Project = project.
)
},
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
)
)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.2
sbt.version=1.11.5
4 changes: 2 additions & 2 deletions project/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.20.1")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")

Expand All @@ -9,7 +9,7 @@ addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "1.0.0")
* guava stuff which in turn makes selenium fail.
*/
libraryDependencies ~=
("org.seleniumhq.selenium" % "selenium-java" % "4.25.0" +: _)
("org.seleniumhq.selenium" % "selenium-java" % "4.35.0" +: _)

Compile / unmanagedSourceDirectories ++= {
val root = baseDirectory.value.getParentFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.scalajs.jsenv.selenium

import org.scalajs.jsenv._

import java.net.URI
import java.net.URL
import java.nio.file.{Path, Paths}
import org.openqa.selenium.Capabilities
Expand Down Expand Up @@ -90,7 +91,7 @@ object SeleniumJSEnv {
* }}}
*/
def withMaterializeInServer(contentDir: String, webRoot: String): Config =
withMaterializeInServer(Paths.get(contentDir), new URL(webRoot))
withMaterializeInServer(Paths.get(contentDir), URI.create(webRoot).toURL)

/** Materializes files in a static directory of a user configured server.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private sealed class SeleniumRun(

protected val intf = "this.scalajsSeleniumInternalInterface"

private[this] implicit val ec =
private[this] implicit val ec: ExecutionContextExecutor =
ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor())

private val handler = Future {
Expand Down Expand Up @@ -166,9 +166,10 @@ private[selenium] object SeleniumRun {

private def htmlPage(fullInput: Seq[Input], materializer: FileMaterializer): String = {
val tags = fullInput.map {
case Input.Script(path) => makeTag(path, "text/javascript", materializer)
case Input.ESModule(path) => makeTag(path, "module", materializer)
case _ => throw new UnsupportedInputException(fullInput)
case Input.Script(path) => makeTag(path, "text/javascript", materializer)
case Input.ESModule(path) => makeTag(path, "module", materializer)
case Input.CommonJSModule(path) => makeTag(path, "text/javascript", materializer)
case _ => throw new UnsupportedInputException(fullInput)
}

s"""<html>
Expand Down