Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid explicitly naming the meta file #1520

Draft
wants to merge 1 commit into
base: series/0.18
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,13 @@ lazy val codegen = projectMatrix
"smithyOrg" -> Dependencies.Smithy.org,
"smithyVersion" -> Dependencies.Smithy.smithyVersion,
"alloyOrg" -> Dependencies.Alloy.org,
"alloyVersion" -> Dependencies.Alloy.alloyVersion
"alloyVersion" -> Dependencies.Alloy.alloyVersion,
"protocolArtifact" ->
List(
(protocol.jvm(autoScalaLibrary = false) / organization).value,
(protocol.jvm(autoScalaLibrary = false) / moduleName).value,
version.value
).mkString(":")
),
buildInfoPackage := "smithy4s.codegen",
libraryDependencies ++= Seq(
Expand Down
15 changes: 8 additions & 7 deletions modules/codegen/src/smithy4s/codegen/internals/ModelLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ private[codegen] object ModelLoader {
localJars: List[os.Path]
): (ClassLoader, Model) = {
val currentClassLoader = this.getClass().getClassLoader()
val deps = resolveDependencies(dependencies, localJars, repositories)
val deps = resolveDependencies(
BuildInfo.protocolArtifact :: dependencies,
localJars,
repositories
)

val modelsInJars = deps.flatMap { file =>
Using.resource(
Expand Down Expand Up @@ -178,13 +182,10 @@ private[codegen] object ModelLoader {
classLoader: ClassLoader,
discoverModels: Boolean
): ModelAssembler = {
val smithy4sResources = List(
"META-INF/smithy/smithy4s.meta.smithy"
).map(classLoader.getResource)

if (discoverModels) {
if (discoverModels)
assembler.discoverModels(classLoader)
} else addImports(smithy4sResources)
else
assembler
}
}

Expand Down
Loading