Skip to content

Commit

Permalink
Move smithy spec files to separate module
Browse files Browse the repository at this point in the history
This will allow the Smithy specs to be consumed from Scala
version-agnostic contexts.
  • Loading branch information
bpholt committed Oct 22, 2024
1 parent 3357d86 commit 0ccf904
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p core/jvm/target core/js/target smithy4s/.js/target smithy4s/.jvm/target project/target
run: mkdir -p core/jvm/target consul-discoverable-smithy-spec/target core/js/target smithy4s/.js/target smithy4s/.jvm/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar core/jvm/target core/js/target smithy4s/.js/target smithy4s/.jvm/target project/target
run: tar cf targets.tar core/jvm/target consul-discoverable-smithy-spec/target core/js/target smithy4s/.js/target smithy4s/.jvm/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand Down
8 changes: 8 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ pull_request_rules:
- '#approved-reviews-by>=1'
actions:
merge: {}
- name: Label consul-discoverable-smithy-spec PRs
conditions:
- files~=^consul-discoverable-smithy-spec/
actions:
label:
add:
- consul-discoverable-smithy-spec
remove: []
- name: Label core PRs
conditions:
- files~=^core/
Expand Down
20 changes: 17 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ lazy val root = tlCrossRootProject.aggregate(
`http4s-consul-middleware`,
`smithy4s-consul-middleware`,
`smithy4s-consul-middleware-tests`,
`consul-discoverable-smithy-spec`,
)

lazy val `http4s-consul-middleware` = crossProject(JSPlatform, JVMPlatform)
Expand Down Expand Up @@ -91,9 +92,25 @@ lazy val `http4s-consul-middleware` = crossProject(JSPlatform, JVMPlatform)
)
)

lazy val `consul-discoverable-smithy-spec` = project
.in(file("consul-discoverable-smithy-spec"))
.settings(
autoScalaLibrary := false,
crossPaths := false,
Compile / packageSrc / mappings := (Compile / packageSrc / mappings).value
.filterNot { case (file, path) =>
path.equalsIgnoreCase("META-INF/smithy/manifest")
},
resolvers += Resolver.mavenLocal,
libraryDependencies += "software.amazon.smithy" % "smithy-model" % "1.50.0",
javacOptions ++= Seq("--release", "8"),
tlVersionIntroduced := Map("3" -> "0.3.4", "2.12" -> "0.3.4", "2.13" -> "0.3.4"),
)

lazy val `smithy4s-consul-middleware` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("smithy4s"))
.configure(_.dependsOn(`consul-discoverable-smithy-spec`))
.settings(
description := "smithy4s middleware to rewrite URLs back to the consul://{service} format expected by http4s-consul-middleware",
tpolecatScalacOptions += ScalacOptions.release("8"),
Expand All @@ -102,9 +119,6 @@ lazy val `smithy4s-consul-middleware` = crossProject(JSPlatform, JVMPlatform)
"org.http4s" %%% "http4s-client" % http4sVersion,
"com.disneystreaming.smithy4s" %%% "smithy4s-core" % smithy4sVersion.value,
),
Compile / smithy4sInputDirs := List(
baseDirectory.value.getParentFile / "src" / "main" / "smithy",
),
)
.jsSettings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ $version: "2.0"

namespace com.dwolla.consul.smithy

use smithy4s.meta#typeclass

string ServiceName

@trait(selector: ":is(service)")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ConsulMiddleware.smithy

0 comments on commit 0ccf904

Please sign in to comment.