Skip to content

Commit 999124c

Browse files
authored
switch over to use interfaces library to make life better (disneystreaming#1977)
* switch over to use interfaces library to make life better * add additional modularity for testability * bump smithy build version * add mima exclusion * address comments
1 parent d4a0ee8 commit 999124c

29 files changed

Lines changed: 101 additions & 333 deletions

File tree

build.sbt

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import com.typesafe.tools.mima.core._
12
import software.amazon.smithy.model.traits.TraitService
23
import _root_.java.util.stream.Collectors
34
import java.nio.file.Files
@@ -253,7 +254,15 @@ lazy val core = projectMatrix
253254
scalacOptions ++= Seq(
254255
"-Wconf:msg=value noInlineDocumentSupport in class ProtocolDefinition is deprecated:silent"
255256
),
256-
mimaBinaryIssueFilters ++= Seq.empty
257+
// smithy-waiters 1.72.0 added a new `message` field to the `Acceptor` structure
258+
// (see waiters.smithy upstream), which shifted the arity of the generated
259+
// `smithy.waiters.Acceptor.apply` case class constructor. This is generated
260+
// prelude code for the built-in waiters trait, not hand-authored API.
261+
mimaBinaryIssueFilters ++= Seq(
262+
ProblemFilters.exclude[DirectMissingMethodProblem](
263+
"smithy.waiters.Acceptor.apply"
264+
)
265+
)
257266
)
258267
.jvmPlatform(allJvmScalaVersions, jvmDimSettings)
259268
.jsPlatform(allJsScalaVersions, jsDimSettings)
@@ -418,8 +427,7 @@ lazy val codegen = projectMatrix
418427
Dependencies.Circe.core.value,
419428
Dependencies.Circe.parser.value,
420429
Dependencies.Circe.generic.value,
421-
("io.get-coursier" %% "coursier" % "2.1.24")
422-
.cross(CrossVersion.for3Use2_13),
430+
Dependencies.CoursierInterface.core,
423431
Dependencies.Mima.core % Test
424432
),
425433
libraryDependencies ++= {
@@ -430,18 +438,6 @@ lazy val codegen = projectMatrix
430438
)
431439
else Seq.empty
432440
},
433-
// For Scala 3, exclude transitive Scala 2.13 deps from coursier that conflict with Scala 3 cross versions.
434-
// Note: scala-xml_2.13 is NOT excluded because coursier needs it at runtime.
435-
excludeDependencies ++= {
436-
if (scalaVersion.value.startsWith("3."))
437-
Seq(
438-
ExclusionRule(
439-
"org.scala-lang.modules",
440-
"scala-collection-compat_2.13"
441-
)
442-
)
443-
else Seq.empty
444-
},
445441
libraryDependencies ++= munitDeps.value,
446442
scalacOptions := scalacOptions.value
447443
.filterNot(Seq("-Ywarn-value-discard", "-Wvalue-discard").contains) ++ {
@@ -523,18 +519,7 @@ lazy val codegenPlugin = (projectMatrix in file("modules/codegen-plugin"))
523519
List(Scala38),
524520
Seq.empty[VirtualAxis],
525521
(p: Project) =>
526-
p.settings(
527-
jvmDimSettings,
528-
// When cross-building for Scala 3 / sbt 2, the codegen dependency brings in
529-
// coursier with Scala 2.13 variants that conflict with Scala 3 variants.
530-
excludeDependencies ++= Seq(
531-
ExclusionRule(
532-
"org.scala-lang.modules",
533-
"scala-collection-compat_2.13"
534-
),
535-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
536-
)
537-
).dependsOn(codegen.jvm(Scala3))
522+
p.settings(jvmDimSettings).dependsOn(codegen.jvm(Scala3))
538523
)
539524
.settings(
540525
name := "sbt-codegen",

modules/codegen-plugin/src/sbt-test/codegen-plugin/aws-newtype-flatten/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

modules/codegen-plugin/src/sbt-test/codegen-plugin/aws-open-enums/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

modules/codegen-plugin/src/sbt-test/codegen-plugin/aws-specs/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

modules/codegen-plugin/src/sbt-test/codegen-plugin/cross-builds/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

modules/codegen-plugin/src/sbt-test/codegen-plugin/custom-settings/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

modules/codegen-plugin/src/sbt-test/codegen-plugin/defaults/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

modules/codegen-plugin/src/sbt-test/codegen-plugin/dependencies-only/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

modules/codegen-plugin/src/sbt-test/codegen-plugin/extra-configs/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

modules/codegen-plugin/src/sbt-test/codegen-plugin/multimodule-aws/project/plugins.sbt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ sys.props.get("plugin.version") match {
77
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
88
)
99
}
10-
11-
// When running under sbt 2 (Scala 3), exclude Scala 2.13 variants that
12-
// conflict with Scala 3 variants brought in transitively by coursier.
13-
excludeDependencies ++= {
14-
if (scalaBinaryVersion.value == "3")
15-
Seq(
16-
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
17-
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13")
18-
)
19-
else Seq.empty
20-
}

0 commit comments

Comments
 (0)