Skip to content
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
21 changes: 10 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: test
on:
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
fail-fast: false
runs-on: ubuntu-latest
env:
JVM_OPTS: "-Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=128m -XX:MaxPermSize=256m -Dfile.encoding=UTF-8"
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v2
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
distribution: zulu
java-version: 8
cache: sbt
- uses: sbt/setup-sbt@v1
- name: Test
env:
JVM_OPTS: "-Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=128m -XX:MaxPermSize=256m"
run: |
sbt "^test"
sbt "^publishLocal"
sbt "it:test"
sbt -v "^test"
sbt -v "^publishLocal"
sbt -v "it:test"
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.8
26 changes: 25 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Dependencies._
import RemoteDepHelper._
import SbtSupport._

def MyVersion: String = "0.9.20"

Expand All @@ -24,6 +25,19 @@ scmInfo in ThisBuild := Some(
"scm:git:git@github.com:lightbend-labs/dbuild.git")
)

sbtLaunchJarLocation in ThisBuild := (baseDirectory in ThisBuild).value / "target" / "sbt" / "sbt-launch.jar"

sbtLaunchJar in ThisBuild := {
val cp = (externalDependencyClasspath in (sbtLauncher, Compile)).value
val location = (sbtLaunchJarLocation in ThisBuild).value
cp.map(_.data).find(_.getName.startsWith("sbt-launch")) match {
case Some(x) =>
IO.copyFile(x, location)
Seq(location)
case None => sys.error("failed to resolve sbt-launch")
}
}

def SubProj(name: String) = (
Project(name, file(if (name=="root") "." else name))
configs( IntegrationTest )
Expand Down Expand Up @@ -60,7 +74,7 @@ def skip212 = Seq(
def selectScalaVersion =
scalaVersion := {
val sb = (sbtVersion in pluginCrossBuild).value
if (sb.startsWith("0.13")) "2.10.7" else "2.12.6"
if (sb.startsWith("0.13")) "2.10.7" else "2.12.21"
}

lazy val root = (
Expand Down Expand Up @@ -268,3 +282,13 @@ lazy val docs = (
}).value
)
)

lazy val sbtLauncher = (
SubProj("sbt-launcher")
settings(
autoScalaLibrary := false,
libraryDependencies += ("org.scala-sbt" % "sbt-launch" % "1.0.0").intransitive,
publish := (),
publishLocal := ()
)
)
22 changes: 3 additions & 19 deletions project/SbtSupport.scala
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
import sbt._
import Keys._
import scala.concurrent.ExecutionContext.Implicits.global

object SbtSupport {
val sbtLaunchJarUrl = SettingKey[String]("sbt-launch-jar-url")
val sbtLaunchJarLocation = SettingKey[File]("sbt-launch-jar-location")
val sbtLaunchJar = TaskKey[Seq[java.io.File]]("sbt-launch-jar", "Resolves SBT launch jar")
val sbtLaunchJarLocation = SettingKey[File]("sbt-launch-jar-location")
val sbtLaunchJar = TaskKey[Seq[java.io.File]]("sbt-launch-jar", "Resolves sbt launch jar")

def downloadFile(log: Logger, dbuildVersion:String, uri: String, file: File): Seq[File] = {
log.info("Downloading "+uri+" to "+ file.getAbsolutePath() +"...")
val ht = new com.typesafe.dbuild.http.HttpTransfer(dbuildVersion)
try {
ht.download(uri, file)
} finally {
ht.close()
}
Seq(file)
}

val buildSettings: Seq[Setting[_]] = Seq(
sbtLaunchJarUrl := "https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/1.0.0/sbt-launch.jar",
sbtLaunchJarLocation := baseDirectory.value / "target" / "sbt" / "sbt-launch.jar",
sbtLaunchJar := downloadFile(streams.value.log, version.value, sbtLaunchJarUrl.value, sbtLaunchJarLocation.value)
)
val buildSettings: Seq[Setting[_]] = Nil
val settings: Seq[Setting[_]] = buildSettings ++ Seq(
// The jar is added as a resource, so that the running dbuild can find it and use it to spawn new instances of sbt
resourceGenerators in Compile += sbtLaunchJar.taskValue
Expand Down