Skip to content

Commit

Permalink
Support maven.repositories / maven.dependencies (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Nov 23, 2022
1 parent 3af4dc6 commit 1744f91
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
13 changes: 13 additions & 0 deletions modules/core/src/main/smithy/self.smithy
Expand Up @@ -5,6 +5,7 @@ namespace playground
structure BuildConfig {
mavenDependencies: Strings = [],
mavenRepositories: Strings = [],
maven: MavenConfig,
imports: Strings = [],
plugins: Plugins
}
Expand All @@ -19,3 +20,15 @@ structure SmithyPlaygroundPluginConfig {
}

list Strings { member: String }

structure MavenConfig {
dependencies: Strings = [],
repositories: Repositories = []
}

list Repositories { member: Repository }

structure Repository {
@required
url: String
}
8 changes: 6 additions & 2 deletions modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala
Expand Up @@ -92,8 +92,12 @@ object BuildLoader {
.toFile()
)
.toSet,
dependencies = loaded.config.mavenDependencies,
repositories = loaded.config.mavenRepositories,
dependencies =
loaded.config.mavenDependencies ++ loaded.config.maven.foldMap(_.dependencies),
repositories =
loaded
.config
.mavenRepositories ++ loaded.config.maven.foldMap(_.repositories).map(_.url),
transformers = Nil,
// this should be false really
// https://github.com/kubukoz/smithy-playground/pull/140
Expand Down
Expand Up @@ -26,7 +26,7 @@ trait PluginResolver[F[_]] {
.plugins
.flatMap(_.smithyPlayground)
.foldMap(_.extensions),
config.mavenRepositories,
config.mavenRepositories ++ config.maven.foldMap(_.repositories).map(_.url),
)

}
Expand Down Expand Up @@ -60,7 +60,7 @@ object PluginResolver {

(depsF, reposF)
.mapN { (deps, repos) =>
Fetch(FileCache[Task]().noCredentials.withTtl(1.hour))
Fetch(FileCache[Task]().withTtl(1.hour))
.addDependencies(deps: _*)
.addRepositories(repos: _*)
}
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
@@ -1,7 +1,7 @@
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.1")

addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.16.8")
addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.16.10")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1")

Expand Down

0 comments on commit 1744f91

Please sign in to comment.