mirror of https://github.com/sbt/sbt.git
[2.x] test: Refactor global plugin test (#9380)
This commit is contained in:
parent
128697c73b
commit
b1392daa60
|
|
@ -172,8 +172,8 @@ jobs:
|
|||
if: ${{ matrix.jobtype == 5 }}
|
||||
shell: bash
|
||||
run: |
|
||||
./sbt -v "scripted global-plugin/*"
|
||||
./sbt -v "scripted project/*"
|
||||
./sbt -v "scripted project1/*"
|
||||
# - name: Build and test (6)
|
||||
# if: ${{ matrix.jobtype == 6 }}
|
||||
# shell: bash
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
@transient
|
||||
lazy val check = taskKey[Unit]("Verifies that the junit dependency has the newer version (4.8)")
|
||||
|
||||
lazy val proj = (project in file("."))
|
||||
.settings(
|
||||
name := "my-test-proj",
|
||||
name := "test-proj",
|
||||
organization := "com.example",
|
||||
check := (update map checkVersion).value,
|
||||
check := update.map(checkVersion).value,
|
||||
version := "0.1.0-SNAPSHOT"
|
||||
)
|
||||
|
||||
def checkVersion(report: UpdateReport): Unit = {
|
||||
for mod <- report.allModules do
|
||||
if(mod.name == "junit") assert(mod.revision == "4.8", s"JUnit version (${mod.revision}) does not have the correct version")
|
||||
if mod.name == "junit" then assert(mod.revision == "4.8", s"JUnit version (${mod.revision}) does not have the correct version")
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
// use a small java library instead of a plugin to avoid incompatibilities when upgrading
|
||||
// This version should be overridden by the one in the project.
|
||||
libraryDependencies += "junit" % "junit" % "4.5"
|
||||
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
|
||||
|
|
@ -1,15 +1,10 @@
|
|||
package test
|
||||
package example
|
||||
|
||||
import sbt.*, Keys.*
|
||||
|
||||
object Global {
|
||||
object G:
|
||||
val x = 3
|
||||
}
|
||||
|
||||
object GlobalAutoPlugin extends AutoPlugin {
|
||||
|
||||
object autoImport {
|
||||
object GlobalAutoPlugin extends AutoPlugin:
|
||||
object autoImport:
|
||||
lazy val globalAutoPluginSetting = settingKey[String]("A top level setting declared in a plugin.")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
$ copy-file changes/build.sbt build.sbt
|
||||
> reload
|
||||
|
||||
# ensure that a new global dependency gets picked up
|
||||
$ copy-file changes/global-plugins.sbt global/plugins/plugins.sbt
|
||||
> reload
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import sbt.*
|
||||
|
||||
object Test
|
||||
|
||||
// object Test:
|
||||
// assert(example.G.x == 3)
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import sbt.*
|
||||
|
||||
object Test {
|
||||
assert(test.Global.x == 3);
|
||||
}
|
||||
Loading…
Reference in New Issue