diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33ad77a..3329c3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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') diff --git a/.mergify.yml b/.mergify.yml index e223374..30bec7c 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -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/ diff --git a/build.sbt b/build.sbt index a853ea1..2a17d33 100644 --- a/build.sbt +++ b/build.sbt @@ -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) @@ -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"), @@ -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)), diff --git a/smithy4s/src/main/smithy/ConsulMiddleware.smithy b/consul-discoverable-smithy-spec/src/main/resources/META-INF/smithy/ConsulMiddleware.smithy similarity index 85% rename from smithy4s/src/main/smithy/ConsulMiddleware.smithy rename to consul-discoverable-smithy-spec/src/main/resources/META-INF/smithy/ConsulMiddleware.smithy index 207976e..2a3f959 100644 --- a/smithy4s/src/main/smithy/ConsulMiddleware.smithy +++ b/consul-discoverable-smithy-spec/src/main/resources/META-INF/smithy/ConsulMiddleware.smithy @@ -2,8 +2,6 @@ $version: "2.0" namespace com.dwolla.consul.smithy -use smithy4s.meta#typeclass - string ServiceName @trait(selector: ":is(service)") diff --git a/consul-discoverable-smithy-spec/src/main/resources/META-INF/smithy/manifest b/consul-discoverable-smithy-spec/src/main/resources/META-INF/smithy/manifest new file mode 100644 index 0000000..0c60f45 --- /dev/null +++ b/consul-discoverable-smithy-spec/src/main/resources/META-INF/smithy/manifest @@ -0,0 +1 @@ +ConsulMiddleware.smithy