diff --git a/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/build.sbt b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/build.sbt new file mode 100644 index 000000000..5b4e4ab9d --- /dev/null +++ b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/build.sbt @@ -0,0 +1,8 @@ +lazy val root = (project in file(".")) + .enablePlugins(Smithy4sCodegenPlugin) + .settings( + crossScalaVersions := Seq("2.13.15", "3.3.3"), + libraryDependencies ++= Seq( + "com.disneystreaming.smithy4s" %% "smithy4s-core" % smithy4sVersion.value + ) + ) diff --git a/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/project/build.properties b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/project/build.properties new file mode 100644 index 000000000..8b9a0b0ab --- /dev/null +++ b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.8.0 diff --git a/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/project/plugins.sbt b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/project/plugins.sbt new file mode 100644 index 000000000..b8589b92c --- /dev/null +++ b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/src/main/smithy/simple.smithy b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/src/main/smithy/simple.smithy new file mode 100644 index 000000000..522b18cff --- /dev/null +++ b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/src/main/smithy/simple.smithy @@ -0,0 +1,3 @@ +namespace smithy4s.example + +structure Simple {} diff --git a/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/test b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/test new file mode 100644 index 000000000..5543ff904 --- /dev/null +++ b/modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/test @@ -0,0 +1,16 @@ +# generate for Scala 2.13 +> ++ 2.13 +> compile + +$ exists target/scala-2.13/src_managed/main/smithy4s/smithy4s/example/Simple.scala + +> ++ 3 +> compile + +$ exists target/scala-3.3.3/src_managed/main/smithy4s/smithy4s/example/Simple.scala + +# switch back to Scala 2.13 and compile again; codegen should not happen a second time +> ++ 2.13 +> compile + +$ newer target/scala-3.3.3/src_managed/main/smithy4s/smithy4s/example/Simple.scala target/scala-2.13/src_managed/main/smithy4s/smithy4s/example/Simple.scala