Skip to content

Commit c3ce708

Browse files
Merge pull request #81 from neandertech/fix-smithy-setup
Fix smithy protocol setup
2 parents 0e7dd22 + 7d1323c commit c3ce708

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

build.sbt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,28 @@ val fs2 = projectMatrix
7878

7979
val smithy = projectMatrix
8080
.in(file("modules") / "smithy")
81-
.jvmPlatform(jvmScalaVersions)
82-
.jsPlatform(jsScalaVersions)
83-
.nativePlatform(nativeScalaVersions)
81+
.jvmPlatform(false)
8482
.disablePlugins(AssemblyPlugin, MimaPlugin)
8583
.settings(
8684
name := "jsonrpclib-smithy"
8785
)
8886

87+
lazy val buildTimeProtocolDependency =
88+
/** By default, smithy4sInternalDependenciesAsJars doesn't contain the jars in the "smithy4s" configuration. We have
89+
* to add them manually - this is the equivalent of a "% Smithy4s"-scoped dependency.
90+
*
91+
* Ideally, this would be
92+
* {{{
93+
* (Compile / smithy4sInternalDependenciesAsJars) ++=
94+
* Smithy4s / smithy4sInternalDependenciesAsJars).value.map(_.data)
95+
* }}}
96+
*
97+
* but that doesn't work because the Smithy4s configuration doesn't extend from Compile so it doesn't have the
98+
* `internalDependencyAsJars` setting.
99+
*/
100+
Compile / smithy4sInternalDependenciesAsJars ++=
101+
(smithy.jvm(autoScalaLibrary = false) / Compile / fullClasspathAsJars).value.map(_.data)
102+
89103
val smithy4s = projectMatrix
90104
.in(file("modules") / "smithy4s")
91105
.jvmPlatform(jvmScalaVersions)
@@ -94,15 +108,15 @@ val smithy4s = projectMatrix
94108
.disablePlugins(AssemblyPlugin)
95109
.enablePlugins(Smithy4sCodegenPlugin)
96110
.dependsOn(fs2)
97-
.dependsOn(smithy)
98111
.settings(
99112
name := "jsonrpclib-smithy4s",
100113
commonSettings,
101114
mimaPreviousArtifacts := Set.empty,
102115
libraryDependencies ++= Seq(
103116
"co.fs2" %%% "fs2-core" % fs2Version,
104117
"com.disneystreaming.smithy4s" %%% "smithy4s-json" % smithy4sVersion.value
105-
)
118+
),
119+
buildTimeProtocolDependency
106120
)
107121

108122
val exampleServer = projectMatrix
@@ -145,7 +159,8 @@ val exampleSmithyShared = projectMatrix
145159
.enablePlugins(Smithy4sCodegenPlugin)
146160
.settings(
147161
commonSettings,
148-
publish / skip := true
162+
publish / skip := true,
163+
buildTimeProtocolDependency
149164
)
150165
.disablePlugins(MimaPlugin)
151166

0 commit comments

Comments
 (0)