Skip to content

Commit

Permalink
Merge pull request #52 from mkurz/upgrade
Browse files Browse the repository at this point in the history
Upgrade to latest sbt-js-engine, use GHA/sbt-ci-release
  • Loading branch information
mkurz authored Jan 11, 2024
2 parents be552fe + 2c5367d commit c4fbd8a
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 53 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check

on:
pull_request:

push:
branches:
- main # Check branch after merge

concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Tests
uses: playframework/.github/.github/workflows/cmd.yml@v3
with:
java: 17, 11, 8
scala: 2.12.18
cmd: |
sbt ++$MATRIX_SCALA test ^scripted
finish:
name: Finish
if: github.event_name == 'pull_request'
needs: # Should be last
- "tests"
uses: playframework/.github/.github/workflows/rtm.yml@v3
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish

on:
push:
branches: # Snapshots
- main
tags: ["**"] # Releases

jobs:
publish-artifacts:
name: JDK 8
runs-on: ubuntu-20.04
if: ${{ github.repository_owner == 'sbt' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Coursier Cache
id: coursier-cache
uses: coursier/cache-action@v6

- name: Install Adoptium Temurin OpenJDK
uses: coursier/setup-action@v1
with:
jvm: adoptium:8

- name: Publish artifacts
run: sbt ci-release
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}

- name: Cleanup before cache
shell: bash
run: |
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ project/plugins/project/
.idea/
.idea_modules/

.bsp/
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

23 changes: 22 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
lazy val `sbt-jshint` = project in file(".")

enablePlugins(SbtWebBase)

sonatypeProfileName := "com.github.sbt.sbt-jshint" // See https://issues.sonatype.org/browse/OSSRH-77819#comment-1203625

description := "Allows JSHint to be used from within sbt"

developers += Developer(
"playframework",
"The Play Framework Team",
"[email protected]",
url("https://github.com/playframework")
)

libraryDependencies ++= Seq(
"org.webjars.npm" % "jshint" % "2.9.7",
"org.webjars" % "strip-json-comments" % "1.0.2-1"
)

addSbtJsEngine("1.2.2")
addSbtJsEngine("1.3.5")

// Customise sbt-dynver's behaviour to make it work with tags which aren't v-prefixed
ThisBuild / dynverVTagPrefix := false

// Sanity-check: assert that version comes from a tag (e.g. not a too-shallow clone)
// https://github.com/dwijnand/sbt-dynver/#sanity-checking-the-version
Global / onLoad := (Global / onLoad).value.andThen { s =>
dynverAssertTagVersion.value
s
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.0.2
sbt.version=1.9.7
4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-web-build-base" % "1.2.0")
addSbtPlugin("com.github.sbt" % "sbt-web-build-base" % "2.0.2")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
8 changes: 4 additions & 4 deletions src/main/scala/com/typesafe/sbt/jshint/SbtJSHint.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ object SbtJSHint extends AutoPlugin {
}
) ++ inTask(jshint)(
SbtJsTask.jsTaskSpecificUnscopedProjectSettings ++ Seq(
includeFilter in Assets := (jsFilter in Assets).value,
includeFilter in TestAssets := (jsFilter in TestAssets).value,
Assets / includeFilter := (Assets / jsFilter).value,
TestAssets / includeFilter := (TestAssets / jsFilter).value,

jsOptions := resolvedConfig.value.fold("{}")(IO.read(_)),

taskMessage in Assets := "JavaScript linting",
taskMessage in TestAssets := "JavaScript test linting"
Assets / taskMessage := "JavaScript linting",
TestAssets / taskMessage := "JavaScript test linting"

)
) ++ SbtJsTask.addJsSourceFileTasks(jshint)
Expand Down
4 changes: 4 additions & 0 deletions src/sbt-test/sbt-jshint-plugin/test/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lazy val root = (project in file(".")).enablePlugins(SbtWeb)

WebKeys.reporter := new TestBuild.TestReporter(target.value)

36 changes: 13 additions & 23 deletions src/sbt-test/sbt-jshint-plugin/test/project/TestBuild.scala
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
import sbt._
import sbt.Keys._
import java.util.function.Supplier

import com.typesafe.sbt.web.SbtWeb
import com.typesafe.sbt.web.SbtWeb.autoImport._
object TestBuild {

object TestBuild extends Build {
class TestLogger(target: File) extends xsbti.Logger {

class TestLogger(target: File) extends Logger {
def trace(t: => Throwable): Unit = {}

def success(message: => String): Unit = {}

def log(level: Level.Value, message: => String): Unit = {
if (level == Level.Error) {
if (message.contains("Missing semicolon.")) {
IO.touch(target / "missing-semi-error")
}
def error(msg: Supplier[String]): Unit = {
if (msg.get().contains("Missing semicolon.")) {
IO.touch(target / "missing-semi-error")
}
}
}

class TestReporter(target: File) extends LoggerReporter(-1, new TestLogger(target))

lazy val root = Project(
id = "test-build",
base = file("."),
settings = Seq(WebKeys.reporter := new TestReporter(target.value))
).enablePlugins(SbtWeb)
def warn(msg: Supplier[String]): Unit = {}
def info(msg: Supplier[String]): Unit = {}
def debug(msg: Supplier[String]): Unit = {}
def trace(t: Supplier[Throwable]): Unit = {}
}

}
class TestReporter(target: File) extends sbt.internal.inc.LoggedReporter(-1, new TestLogger(target))
}

This file was deleted.

4 changes: 1 addition & 3 deletions src/sbt-test/sbt-jshint-plugin/test/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
resolvers ++= Seq(
Resolver.url("sbt snapshot plugins", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns),
Resolver.mavenLocal,
Resolver.sonatypeRepo("snapshots"),
"Typesafe Snapshots Repository" at "http://repo.typesafe.com/typesafe/snapshots/"
)

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % sys.props("project.version"))
addSbtPlugin("com.github.sbt" % "sbt-jshint" % sys.props("project.version"))
1 change: 0 additions & 1 deletion version.sbt

This file was deleted.

0 comments on commit c4fbd8a

Please sign in to comment.