Skip to content

Commit

Permalink
Merge pull request #230 from Mingun/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade all dependencies to the latest versions
  • Loading branch information
generalmimon authored Oct 23, 2023
2 parents 746d773 + 0fe8b69 commit 9247f44
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 177 deletions.
20 changes: 9 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ lazy val root = project.in(file(".")).
publishLocal := {}
)

lazy val compiler = crossProject.in(file(".")).
lazy val compiler = crossProject(JSPlatform, JVMPlatform).
in(file(".")).
enablePlugins(JavaAppPackaging).
settings(
organization := "io.kaitai",
Expand Down Expand Up @@ -70,17 +71,19 @@ lazy val compiler = crossProject.in(file(".")).
Compile / sourceGenerators += generateVersionTask.taskValue, // update automatically on every rebuild

libraryDependencies ++= Seq(
"com.github.scopt" %%% "scopt" % "3.6.0",
"com.lihaoyi" %%% "fastparse" % "1.0.0",
"org.yaml" % "snakeyaml" % "1.28"
"com.github.scopt" %%% "scopt" % "4.1.0",
"com.lihaoyi" %%% "fastparse" % "2.3.3",
"org.yaml" % "snakeyaml" % "2.0"
)
).
jvmSettings(
name := NAME,

Compile / mainClass := Some("io.kaitai.struct.JavaMain"),
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.12" % "test"
"org.scalatest" %% "scalatest-funspec" % "3.2.15" % "test",
"org.scalatest" %% "scalatest-funsuite" % "3.2.15" % "test",
"org.scalatest" %% "scalatest-shouldmatchers" % "3.2.15" % "test",
),

Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-u", "target/test_out"),
Expand Down Expand Up @@ -228,13 +231,8 @@ lazy val buildNpmJsFileTask = Def.task {
| }
|}(typeof self !== 'undefined' ? self : this, function () {
|
|var exports = {};
|var __ScalaJSEnv = { exportsNamespace: exports };
|
|$compiledFileContents
|
|return exports.MainJs;
|
|return MainJs;
|}));
|""".stripMargin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object JavaScriptKSYParser {
val yamlScala = yamlJavascriptToScala(yaml)
val firstSpec = ClassSpec.fromYaml(yamlScala, None)
val specs = new JavaScriptClassSpecs(importer, firstSpec)
Main.importAndPrecompile(specs, config).map{ problems =>
Main.importAndPrecompile(specs, config).map { problems =>
// throw the first (if any) severe (not a warning) problem as an exception
problems.find(p => p.severity != ProblemSeverity.Warning) match {
case Some(problem) => throw problem.toException
Expand Down
2 changes: 1 addition & 1 deletion jvm/src/main/scala/io/kaitai/struct/JavaMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object JavaMain {

def parseCommandLine(args: Array[String]): Option[CLIConfig] = {
val parser = new scopt.OptionParser[CLIConfig](Version.name) {
override def showUsageOnError = true
override def showUsageOnError = Some(true)

head(Version.name, Version.version)

Expand Down
11 changes: 2 additions & 9 deletions jvm/src/main/scala/io/kaitai/struct/formats/JavaKSYParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import io.kaitai.struct.JavaMain.CLIConfig
import io.kaitai.struct.format.{ClassSpec, ClassSpecs}
import io.kaitai.struct.problems.{CompilationProblem, CompilationProblemException, ProblemCoords, ProblemSeverity, YAMLParserError}
import io.kaitai.struct.{Log, Main}
import org.yaml.snakeyaml.constructor.SafeConstructor
import org.yaml.snakeyaml.error.MarkedYAMLException
import org.yaml.snakeyaml.representer.Representer
import org.yaml.snakeyaml.{DumperOptions, LoaderOptions, Yaml}
import org.yaml.snakeyaml.{LoaderOptions, Yaml}

import scala.collection.JavaConverters._
import scala.concurrent.Await
Expand Down Expand Up @@ -71,12 +69,7 @@ object JavaKSYParser {
def getYamlLoader: Yaml = {
val loaderOptions = new LoaderOptions
loaderOptions.setAllowDuplicateKeys(false)
new Yaml(
new SafeConstructor,
new Representer,
new DumperOptions,
loaderOptions
)
new Yaml(loaderOptions)
}

def readerToYaml(reader: Reader): Any = {
Expand Down
5 changes: 3 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
logLevel := Level.Warn

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.12")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.33")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
Loading

0 comments on commit 9247f44

Please sign in to comment.