Skip to content

Commit

Permalink
Merge pull request #180 from gemini-hlsw/pr/fix-deps
Browse files Browse the repository at this point in the history
Use `%%%`
  • Loading branch information
armanbilge authored Nov 15, 2022
2 parents 1c3a01a + c84f7b0 commit f12e11a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
19 changes: 10 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
val clueVersion = "0.23.1"
val lucumaCoreVersion2 = "0.45.0"
val lucumaCoreVersion = "0.58.0"
val fs2Version = "3.3.0"
val munitVersion = "0.7.29"
val munitCatsEffectVersion = "1.0.7"
val kittensVersion = "3.0.0"
Expand All @@ -15,11 +16,6 @@ ThisBuild / scalafixDependencies += "edu.gemini" %% "clue-ge
ThisBuild / scalafixScalaBinaryVersion := "2.13"
ThisBuild / ScalafixConfig / bspEnabled.withRank(KeyRanks.Invisible) := false

val schemasDependencies = List(
"org.scalameta" %% "munit" % munitVersion % Test,
"org.typelevel" %% "munit-cats-effect-3" % munitCatsEffectVersion % Test
)

lazy val root = tlCrossRootProject.aggregate(lucumaSchemas)

val templates =
Expand All @@ -40,11 +36,13 @@ val lucumaSchemas =
.settings(
moduleName := "lucuma-schemas",
libraryDependencies ++= Seq(
"edu.gemini" %% "clue-core" % clueVersion,
"edu.gemini" %% "lucuma-core" % lucumaCoreVersion,
"org.typelevel" %% "kittens" % kittensVersion
"edu.gemini" %%% "clue-core" % clueVersion,
"edu.gemini" %%% "lucuma-core" % lucumaCoreVersion,
"org.typelevel" %%% "kittens" % kittensVersion,
"co.fs2" %%% "fs2-io" % fs2Version % Test,
"org.scalameta" %%% "munit" % munitVersion % Test,
"org.typelevel" %%% "munit-cats-effect-3" % munitCatsEffectVersion % Test
),
libraryDependencies ++= schemasDependencies,
Compile / sourceGenerators += Def.taskDyn {
val root = (ThisBuild / baseDirectory).value.toURI.toString
val from = (templates / Compile / sourceDirectory).value
Expand All @@ -61,3 +59,6 @@ val lucumaSchemas =
// Include schema files from templates in jar.
Compile / unmanagedResourceDirectories += (templates / Compile / resourceDirectory).value
)
.jsSettings(
Test / scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package lucuma.schemas.decoders

import cats.effect._
import fs2.io.file._
import io.circe.Decoder
import io.circe.Json
import io.circe.parser._
Expand All @@ -14,22 +15,12 @@ import java.io.FileInputStream
import java.nio.file.Paths

trait InputStreamSuite extends CatsEffectSuite {
def inputStream(f: File): Resource[IO, FileInputStream] =
Resource.make {
IO.blocking(new FileInputStream(f)) // build
} { inStream =>
IO.blocking(inStream.close()).handleErrorWith(_ => IO.unit) // release
}

def jsonResult(jsonFile: String): IO[Json] = {
val url = getClass.getResource(jsonFile)
val file = Paths.get(url.toURI).toFile

inputStream(file).use { inStream =>
for {
str <- IO.blocking(scala.io.Source.fromInputStream(inStream).mkString)
json <- IO.fromEither(parse(str))
} yield json
val path = Path(s"lucuma-schemas/src/test/resources") / jsonFile

Files[IO].readUtf8(path).compile.string.flatMap { str =>
IO.fromEither(parse(str))
}
}

Expand Down

0 comments on commit f12e11a

Please sign in to comment.