From 2df230754d288d396346e1538501a28029af1d00 Mon Sep 17 00:00:00 2001 From: Thijs Broersen Date: Thu, 9 Jan 2025 22:35:20 +0100 Subject: [PATCH 1/5] chore: update all dependencies --- build.sbt | 75 +++++++++++++++--------------- project/build.properties | 2 +- project/plugins.sbt | 12 ++--- src/main/java/jsenv/DriverJar.java | 18 +++---- 4 files changed, 51 insertions(+), 56 deletions(-) diff --git a/build.sbt b/build.sbt index 78afefb..f3bffb5 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations.* import xerial.sbt.Sonatype.* organization := "io.github.gmkumar2005" organizationName := "io.github.gmkumar2005" -scalaVersion := "2.12.18" +scalaVersion := "2.12.20" sonatypeProfileName := "io.github.gmkumar2005" versionScheme := Some("early-semver") licenses := Seq( @@ -32,40 +32,39 @@ developers := List( //publishTo := Some(Resolver.file("local-ivy-repo", file(Path.userHome.absolutePath + "/.ivy2/local"))(Patterns(true, Resolver.mavenStyleBasePattern))) //val localIvyRepo = Resolver.file("local-ivy-repo", file(Path.userHome.absolutePath + "/.ivy2/local"))(Patterns(true, Resolver.mavenStyleBasePattern)) -lazy val root = (project in file(".")) - .settings( - name := "scala-js-env-playwright", - libraryDependencies ++= Seq( - "com.microsoft.playwright" % "playwright" % "1.40.0", - "org.scala-js" %% "scalajs-js-envs" % "1.4.0", - "com.google.jimfs" % "jimfs" % "1.2", - "com.outr" %% "scribe" % "3.13.0", - "org.typelevel" %% "cats-effect" % "3.5.2", - "org.scala-js" %% "scalajs-js-envs-test-kit" % "1.4.0" % Test, - "com.novocode" % "junit-interface" % "0.11" % Test - ), - releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - runClean, - runTest, - setReleaseVersion, - commitReleaseVersion, - tagRelease, - ReleaseStep(action = Command.process("publishSigned", _)), - setNextVersion, - commitNextVersion - ), - publishTo := { - val nexus = "https://s01.oss.sonatype.org/" - if (isSnapshot.value) - Some("snapshots" at nexus + "content/repositories/snapshots") - else - Some("releases" at nexus + "service/local/staging/deploy/maven2") - }, - // For all Sonatype accounts created on or after February 2021 - sonatypeCredentialHost := "s01.oss.sonatype.org", - Test / parallelExecution := true, - Test / publishArtifact := false, - usePgpKeyHex("F7E440260BAE93EB4AD2723D6613CA76E011F638") - ) +lazy val root = (project in file(".")).settings( + name := "scala-js-env-playwright", + libraryDependencies ++= Seq( + "com.microsoft.playwright" % "playwright" % "1.49.0", + "org.scala-js" %% "scalajs-js-envs" % "1.4.0", + "com.google.jimfs" % "jimfs" % "1.3.0", + "com.outr" %% "scribe" % "3.15.2", + "org.typelevel" %% "cats-effect" % "3.5.7", + "org.scala-js" %% "scalajs-js-envs-test-kit" % "1.4.0" % Test, + "com.novocode" % "junit-interface" % "0.11" % Test + ), + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, + inquireVersions, + runClean, + runTest, + setReleaseVersion, + commitReleaseVersion, + tagRelease, + ReleaseStep(action = Command.process("publishSigned", _)), + setNextVersion, + commitNextVersion + ), + publishTo := { + val nexus = "https://s01.oss.sonatype.org/" + if (isSnapshot.value) + Some("snapshots" at nexus + "content/repositories/snapshots") + else + Some("releases" at nexus + "service/local/staging/deploy/maven2") + }, + // For all Sonatype accounts created on or after February 2021 + sonatypeCredentialHost := "s01.oss.sonatype.org", + Test / parallelExecution := true, + Test / publishArtifact := false, + usePgpKeyHex("F7E440260BAE93EB4AD2723D6613CA76E011F638") +) diff --git a/project/build.properties b/project/build.properties index e8a1e24..73df629 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.7 +sbt.version=1.10.7 diff --git a/project/plugins.sbt b/project/plugins.sbt index 513f021..c636a7d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,9 @@ -val sbtTypelevelVersion = "0.6.4" -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.1") -addSbtPlugin("com.github.sbt" % "sbt-release" % "1.3.0") -addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") +val sbtTypelevelVersion = "0.7.5" +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.0") +addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0") +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.2") addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion) addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % sbtTypelevelVersion) addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion) diff --git a/src/main/java/jsenv/DriverJar.java b/src/main/java/jsenv/DriverJar.java index 7b06ece..85dd558 100644 --- a/src/main/java/jsenv/DriverJar.java +++ b/src/main/java/jsenv/DriverJar.java @@ -33,7 +33,6 @@ public class DriverJar extends Driver { private static final String PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD"; private static final String SELENIUM_REMOTE_URL = "SELENIUM_REMOTE_URL"; - static final String PLAYWRIGHT_NODEJS_PATH = "PLAYWRIGHT_NODEJS_PATH"; private final Path driverTempDir; private Path preinstalledNodePath; @@ -68,7 +67,7 @@ protected void initialize(Boolean installBrowsers) throws Exception { env.put(PLAYWRIGHT_NODEJS_PATH, preinstalledNodePath.toString()); } extractDriverToTempDir(); - logMessage("extracted driver from jar to " + driverPath()); + logMessage("extracted driver from jar to " + driverDir()); if (installBrowsers) installBrowsers(env); } @@ -79,14 +78,14 @@ private void installBrowsers(Map env) throws IOException, Interr skip = System.getenv(PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD); } if (skip != null && !"0".equals(skip) && !"false".equals(skip)) { - System.out.println("Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set"); + logMessage("Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set"); return; } if (env.get(SELENIUM_REMOTE_URL) != null || System.getenv(SELENIUM_REMOTE_URL) != null) { logMessage("Skipping browsers download because `SELENIUM_REMOTE_URL` env variable is set"); return; } - Path driver = driverPath(); + Path driver = driverDir(); if (!Files.exists(driver)) { throw new RuntimeException("Failed to find driver: " + driver); } @@ -119,7 +118,7 @@ private FileSystem initFileSystem(URI uri) throws IOException { } public static URI getDriverResourceURI() throws URISyntaxException { -// ClassLoader classloader = Thread.currentThread().getContextClassLoader(); + // ClassLoader classloader = Thread.currentThread().getContextClassLoader(); ClassLoader classloader = DriverJar.class.getClassLoader(); return classloader.getResource("driver/" + platformDir()).toURI(); } @@ -129,7 +128,7 @@ void extractDriverToTempDir() throws URISyntaxException, IOException { URI uri = maybeExtractNestedJar(originalUri); // Create zip filesystem if loading from jar. - FileSystem fileSystem = "jar".equals(uri.getScheme()) ? initFileSystem(uri) : null; + try (FileSystem fileSystem = "jar".equals(uri.getScheme()) ? initFileSystem(uri) : null) { Path srcRoot = Paths.get(uri); // jar file system's .relativize gives wrong results when used with // spring-boot-maven-plugin, convert to the default filesystem to @@ -159,8 +158,6 @@ void extractDriverToTempDir() throws URISyntaxException, IOException { throw new RuntimeException("Failed to extract driver from " + uri + ", full uri: " + originalUri, e); } }); - if (fileSystem != null) { - fileSystem.close(); } } @@ -175,8 +172,7 @@ private URI maybeExtractNestedJar(final URI uri) throws URISyntaxException { } String innerJar = String.join(JAR_URL_SEPARATOR, parts[0], parts[1]); URI jarUri = new URI(innerJar); - try { - FileSystem fs = FileSystems.newFileSystem(jarUri, Collections.emptyMap()); + try (FileSystem fs = FileSystems.newFileSystem(jarUri, Collections.emptyMap())) { Path fromPath = Paths.get(jarUri); Path toPath = driverTempDir.resolve(fromPath.getFileName().toString()); Files.copy(fromPath, toPath); @@ -212,7 +208,7 @@ private static String platformDir() { } @Override - protected Path driverDir() { + public Path driverDir() { return driverTempDir; } } \ No newline at end of file From 1006c6b4a56231ac5dd7b07c928d5fc29c321fb2 Mon Sep 17 00:00:00 2001 From: Thijs Broersen Date: Mon, 13 Jan 2025 11:43:19 +0100 Subject: [PATCH 2/5] ci: update workflow actions --- .github/workflows/scala.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 49de13f..2db44f7 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -19,15 +19,17 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: 'sbt' + - name: Install sbt + uses: sbt/setup-sbt@v1 - name: Cache Playwright drivers - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/ms-playwright/ key: ${{ runner.os }}-playwright-${{ hashFiles('**/pom.xml') }} @@ -36,4 +38,4 @@ jobs: - name: Run tests run: sbt test - name: Update Dependency Graph - uses: scalacenter/sbt-dependency-submission@v2 \ No newline at end of file + uses: scalacenter/sbt-dependency-submission@v3 \ No newline at end of file From 46babc38ead2a6fbbfcece881adda5e5b5eb7ed8 Mon Sep 17 00:00:00 2001 From: Thijs Broersen Date: Mon, 13 Jan 2025 20:22:43 +0100 Subject: [PATCH 3/5] cleanup old plugins --- project/metals.sbt | 11 ----------- project/plugins.sbt | 2 ++ project/project/metals.sbt | 12 ------------ 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 project/metals.sbt delete mode 100644 project/project/metals.sbt diff --git a/project/metals.sbt b/project/metals.sbt deleted file mode 100644 index 64f6b2b..0000000 --- a/project/metals.sbt +++ /dev/null @@ -1,11 +0,0 @@ -// DO NOT EDIT! This file is auto-generated. - -// This plugin enables semantic information to be produced by sbt. -// It also adds support for debugging using the Debug Adapter Protocol - -addSbtPlugin("org.scalameta" % "sbt-metals" % "1.2.0") - -// This plugin adds the BSP debug capability to sbt server. - -addSbtPlugin("ch.epfl.scala" % "sbt-debug-adapter" % "3.1.5") - diff --git a/project/plugins.sbt b/project/plugins.sbt index c636a7d..e70eb3f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -7,3 +7,5 @@ addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.2") addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion) addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % sbtTypelevelVersion) addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion) + +addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "2.0.6") diff --git a/project/project/metals.sbt b/project/project/metals.sbt deleted file mode 100644 index 03681f6..0000000 --- a/project/project/metals.sbt +++ /dev/null @@ -1,12 +0,0 @@ -// DO NOT EDIT! This file is auto-generated. - -// This plugin enables semantic information to be produced by sbt. -// It also adds support for debugging using the Debug Adapter Protocol - -addSbtPlugin("org.scalameta" % "sbt-metals" % "1.2.0") - -// This plugin makes sure that the JDI tools are in the sbt classpath. -// JDI tools are used by the debug adapter server. - -addSbtPlugin("org.scala-debugger" % "sbt-jdi-tools" % "1.1.1") - From 3ce66d90189c6d2943197689cf68b859345e28bc Mon Sep 17 00:00:00 2001 From: Thijs Broersen Date: Mon, 13 Jan 2025 20:38:32 +0100 Subject: [PATCH 4/5] tweak javacOptions --- build.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sbt b/build.sbt index f3bffb5..a26637b 100644 --- a/build.sbt +++ b/build.sbt @@ -43,6 +43,8 @@ lazy val root = (project in file(".")).settings( "org.scala-js" %% "scalajs-js-envs-test-kit" % "1.4.0" % Test, "com.novocode" % "junit-interface" % "0.11" % Test ), + javacOptions += "-nowarn", + javacOptions -= "-Werror", releaseProcess := Seq[ReleaseStep]( checkSnapshotDependencies, inquireVersions, From 2c4e7a91db377e1679f738a7bac2b9d8e0762afb Mon Sep 17 00:00:00 2001 From: Thijs Broersen Date: Mon, 13 Jan 2025 20:54:42 +0100 Subject: [PATCH 5/5] run sbt-dependency-submission only on the main branch --- .github/workflows/scala.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 2db44f7..9e58647 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -38,4 +38,5 @@ jobs: - name: Run tests run: sbt test - name: Update Dependency Graph + if: github.ref == 'refs/heads/main' uses: scalacenter/sbt-dependency-submission@v3 \ No newline at end of file