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

smithy4sUpdateLSPConfig not adding dependency to smithy-build.json #1504

Open
devonsams opened this issue Apr 26, 2024 · 2 comments
Open

smithy4sUpdateLSPConfig not adding dependency to smithy-build.json #1504

devonsams opened this issue Apr 26, 2024 · 2 comments

Comments

@devonsams
Copy link

devonsams commented Apr 26, 2024

I have a project that defines some smithy shapes which I have published as a library locally. The project looks like:

modules/core/src/main/smithy/core.smithy

$version: "2"

namespace my.test

use alloy#uuidFormat

@uuidFormat
string UserId

build.sbt

lazy val core = project
  .in(file("modules/core"))
  .enablePlugins(Smithy4sCodegenPlugin)
  .settings(
    organization := "my.test"
    name := "core-types",
    libraryDependencies ++= Seq(
      "com.disneystreaming.smithy4s" %% "smithy4s-core" % smithy4sVersion.value,
    ),
    Compile / run / fork := true
  )

I am publishing with sbt publishM2.

When I add this dependency to another project like:

libraryDependencies += "my.test" %% "core-types" % "0.1.0-SNAPSHOT"

along with:

resolvers += Resolver.mavenLocal,

and then run sbt smithy4sUpdateLSPConfig, my dependency is not automatically added to the smithy-build.json.

And so in vscode with the disneystreaming smithy plugin, the editor is not aware of the shapes from my library. In .smithy.lsp.log, there are errors like Use statement refers to undefined shape about the shapes from my library.

If I manually add the dependency to the smithy-build.json file like my.test:core-types_2.13:0.1.0-SNAPSHOT, it works.

@daddykotex
Copy link
Contributor

If memory serves me correctly, this task uses dependencies defined in the Smithy4s configuration. Something like the following, if you don't use that, then the task won't see the dependencies.

libraryDependencies += "software.amazon.smithy" % "smithy-aws-iam-traits" % "1.14.1" % Smithy4s

Source:
https://disneystreaming.github.io/smithy4s/docs/overview/sharing-specs#sbt-2

Please close if that works for you, otherwise we can keep looking

@kubukoz
Copy link
Member

kubukoz commented May 14, 2024

I think we should capture these dependencies too. The sbt plugin makes their smithy specs available at build-time, so it's fair game to want them in smithy-build.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants