From da2173aa96b05550c85261fe95648e85e7ab25ee Mon Sep 17 00:00:00 2001 From: Kyle Florence <52473140+solarmosaic-kflorence@users.noreply.github.com> Date: Tue, 19 Jan 2021 07:37:33 -0600 Subject: [PATCH] Fixes #204: require explicitly enabling ScalaPactPlugin on projects. (#210) * Fixes #204: require explicitly enabling ScalaPactPlugin on projects. --- broker-integration-tests/provider/build.sbt | 2 ++ .../scala-pact-consumer_scala-pact-provider.json | 2 +- example/provider/pact.sbt | 2 ++ example/provider_pact-for-verification/build.sbt | 3 ++- example/provider_tests/build.sbt | 1 - .../scala-pact-consumer_scala-pact-provider.json | 2 +- .../main/scala/com/itv/scalapact/plugin/ScalaPactPlugin.scala | 2 +- scripts/test-verifier.sh | 2 ++ 8 files changed, 11 insertions(+), 5 deletions(-) diff --git a/broker-integration-tests/provider/build.sbt b/broker-integration-tests/provider/build.sbt index 1b1a24047..1df96beda 100644 --- a/broker-integration-tests/provider/build.sbt +++ b/broker-integration-tests/provider/build.sbt @@ -4,6 +4,8 @@ name := "provider" scalaVersion := "2.13.3" +enablePlugins(ScalaPactPlugin) + lazy val pactVersionFile: SettingKey[File] = settingKey[File]("location of scala-pact version for these tests") pactVersionFile := baseDirectory.value.getParentFile.getParentFile / "version.sbt" diff --git a/example/provider/delivered_pacts/scala-pact-consumer_scala-pact-provider.json b/example/provider/delivered_pacts/scala-pact-consumer_scala-pact-provider.json index 3d0a8b4a9..50e8043cc 100644 --- a/example/provider/delivered_pacts/scala-pact-consumer_scala-pact-provider.json +++ b/example/provider/delivered_pacts/scala-pact-consumer_scala-pact-provider.json @@ -66,7 +66,7 @@ "version" : "2.0.0" }, "scala-pact" : { - "version" : "2.4.1-SNAPSHOT" + "version" : "3.0.2-SNAPSHOT" } } } \ No newline at end of file diff --git a/example/provider/pact.sbt b/example/provider/pact.sbt index e28bd5298..3456fabbe 100644 --- a/example/provider/pact.sbt +++ b/example/provider/pact.sbt @@ -7,6 +7,8 @@ import com.itv.scalapact.shared.ProviderStateResult import scala.concurrent.duration._ +enablePlugins(ScalaPactPlugin) + scalaPactEnv := ScalaPactEnv.defaults .withPort(8080) diff --git a/example/provider_pact-for-verification/build.sbt b/example/provider_pact-for-verification/build.sbt index 60206d148..c7c9f8ab2 100644 --- a/example/provider_pact-for-verification/build.sbt +++ b/example/provider_pact-for-verification/build.sbt @@ -4,9 +4,10 @@ organization := "com.example" name := "provider_pacts-for-verification" - scalaVersion := "2.13.3" +enablePlugins(ScalaPactPlugin) + lazy val pactVersionFile: SettingKey[File] = settingKey[File]("location of scala-pact version for examples") pactVersionFile := baseDirectory.value.getParentFile.getParentFile / "version.sbt" diff --git a/example/provider_tests/build.sbt b/example/provider_tests/build.sbt index 009a28821..9c4f5ab41 100644 --- a/example/provider_tests/build.sbt +++ b/example/provider_tests/build.sbt @@ -4,7 +4,6 @@ organization := "com.example" name := "provider_tests" - scalaVersion := "2.13.3" lazy val pactVersionFile: SettingKey[File] = settingKey[File]("location of scala-pact version for examples") diff --git a/example/provider_tests/delivered_pacts/scala-pact-consumer_scala-pact-provider.json b/example/provider_tests/delivered_pacts/scala-pact-consumer_scala-pact-provider.json index 3d0a8b4a9..50e8043cc 100644 --- a/example/provider_tests/delivered_pacts/scala-pact-consumer_scala-pact-provider.json +++ b/example/provider_tests/delivered_pacts/scala-pact-consumer_scala-pact-provider.json @@ -66,7 +66,7 @@ "version" : "2.0.0" }, "scala-pact" : { - "version" : "2.4.1-SNAPSHOT" + "version" : "3.0.2-SNAPSHOT" } } } \ No newline at end of file diff --git a/sbt-scalapact/src/main/scala/com/itv/scalapact/plugin/ScalaPactPlugin.scala b/sbt-scalapact/src/main/scala/com/itv/scalapact/plugin/ScalaPactPlugin.scala index 4154a03f9..e9f8d7423 100644 --- a/sbt-scalapact/src/main/scala/com/itv/scalapact/plugin/ScalaPactPlugin.scala +++ b/sbt-scalapact/src/main/scala/com/itv/scalapact/plugin/ScalaPactPlugin.scala @@ -15,7 +15,7 @@ import scala.language.implicitConversions object ScalaPactPlugin extends AutoPlugin { override def requires: JvmPlugin.type = plugins.JvmPlugin - override def trigger: PluginTrigger = allRequirements + override def trigger: PluginTrigger = noTrigger @SuppressWarnings(Array("org.wartremover.warts.ImplicitConversion")) implicit def booleanToProviderStateResult(bool: Boolean): ProviderStateResult = ProviderStateResult(bool) diff --git a/scripts/test-verifier.sh b/scripts/test-verifier.sh index df8c72a57..628b9c5d6 100755 --- a/scripts/test-verifier.sh +++ b/scripts/test-verifier.sh @@ -15,6 +15,8 @@ echo "addSbtPlugin(\"com.itv\" % \"sbt-scalapact\" % \"$CORE_VERSION\")" >> $PLU cat > $PACT_CONFIG_FILE < { println("Injecting key 1234 into the database...")