diff --git a/build.sbt b/build.sbt index a25d0c24..28345943 100644 --- a/build.sbt +++ b/build.sbt @@ -1,14 +1,14 @@ -name := "flatgraph" +name := "flatgraph" ThisBuild / organization := "io.joern" ThisBuild / scalaVersion := scala3 val slf4jVersion = "2.0.7" -val scala3 = "3.4.2" -val scala2_12 = "2.12.18" +val scala3 = "3.4.2" +val scala2_12 = "2.12.18" -/** Only the below listed projects are included in things like `sbt compile`. - * We explicitly want to exclude `benchmarks` which requires qwiet.ai / shiftleft - * internal repositories. */ +/** Only the below listed projects are included in things like `sbt compile`. We explicitly want to exclude `benchmarks` which requires + * qwiet.ai / shiftleft internal repositories. + */ lazy val root = (project in file(".")).aggregate( core, help, @@ -19,7 +19,7 @@ lazy val root = (project in file(".")).aggregate( odbConvert, testSchemas, testSchemasDomainClasses, - tests, + tests ) lazy val core = project @@ -27,9 +27,9 @@ lazy val core = project .settings( name := "flatgraph-core", libraryDependencies ++= Seq( - "com.lihaoyi" %% "ujson" % "3.3.1", - "com.github.luben" % "zstd-jni" % "1.5.6-3", - "org.slf4j" % "slf4j-api" % slf4jVersion, + "com.lihaoyi" %% "ujson" % "4.0.2", + "com.github.luben" % "zstd-jni" % "1.5.6-3", + "org.slf4j" % "slf4j-api" % slf4jVersion ) ) @@ -38,10 +38,7 @@ lazy val help = project .dependsOn(core) .settings( name := "flatgraph-help", - libraryDependencies ++= Seq( - "de.vandermeer" % "asciitable" % "0.3.2", - "net.oneandone.reflections8" % "reflections8" % "0.11.7", - ) + libraryDependencies ++= Seq("de.vandermeer" % "asciitable" % "0.3.2", "net.oneandone.reflections8" % "reflections8" % "0.11.7") ) lazy val formats = project @@ -50,10 +47,10 @@ lazy val formats = project .settings( name := "flatgraph-formats", libraryDependencies ++= Seq( - "com.github.tototoshi" %% "scala-csv" % "1.4.0", - "org.scala-lang.modules" %% "scala-xml" % "2.3.0", - "io.spray" %% "spray-json" % "1.3.6", - "com.github.scopt" %% "scopt" % "4.1.0", + "com.github.tototoshi" %% "scala-csv" % "1.4.0", + "org.scala-lang.modules" %% "scala-xml" % "2.3.0", + "io.spray" %% "spray-json" % "1.3.6", + "com.github.scopt" %% "scopt" % "4.1.0" ) ) @@ -64,43 +61,39 @@ lazy val tests = project .in(file("tests")) .dependsOn(core, formats, help, testSchemasDomainClasses) .settings( - name := "flatgraph-tests", + name := "flatgraph-tests", publish / skip := true, - libraryDependencies ++= Seq( - "com.github.pathikrit" %% "better-files" % "3.9.2" % Test, - "org.scalamock" %% "scalamock" % "6.0.0" % Test - ), + libraryDependencies ++= Seq("com.github.pathikrit" %% "better-files" % "3.9.2" % Test, "org.scalamock" %% "scalamock" % "6.0.0" % Test) ) - lazy val domainClassesGenerator_3 = project .in(file("domain-classes-generator_3")) .settings( - name := "flatgraph-domain-classes-generator", + name := "flatgraph-domain-classes-generator", sourceDirectory := baseDirectory.value / "../domain-classes-generator/src", libraryDependencies ++= Seq( - "org.slf4j" % "slf4j-simple" % slf4jVersion % Optional, - "com.lihaoyi" %% "os-lib" % "0.9.1", - "org.apache.commons" % "commons-text" % "1.10.0", - "com.github.scopt" %% "scopt" % "4.1.0", - ("org.scalameta" %% "scalafmt-dynamic" % "3.7.17").cross(CrossVersion.for3Use2_13), - ), + "org.slf4j" % "slf4j-simple" % slf4jVersion % Optional, + "com.lihaoyi" %% "os-lib" % "0.9.1", + "org.apache.commons" % "commons-text" % "1.10.0", + "com.github.scopt" %% "scopt" % "4.1.0", + ("org.scalameta" %% "scalafmt-dynamic" % "3.7.17").cross(CrossVersion.for3Use2_13) + ) ) lazy val domainClassesGenerator_2_12 = project .in(file("domain-classes-generator_2.12")) .settings( - name := "flatgraph-domain-classes-generator", + name := "flatgraph-domain-classes-generator", sourceDirectory := baseDirectory.value / "../domain-classes-generator/src", - scalaVersion := scala2_12, - scalacOptions := scalacOptionsFor2_12, + scalaVersion := scala2_12, + scalacOptions := scalacOptionsFor2_12, libraryDependencies ++= Seq( - "org.slf4j"% "slf4j-simple" % slf4jVersion % Optional, - "com.lihaoyi" %% "os-lib" % "0.9.1", - "org.apache.commons" % "commons-text" % "1.10.0", - "com.github.scopt" %% "scopt" % "4.1.0", - "org.scalameta" %% "scalafmt-dynamic" % "3.7.17", - ), + "org.slf4j" % "slf4j-simple" % slf4jVersion % Optional, + "com.lihaoyi" %% "os-lib" % "0.9.1", + "org.apache.commons" % "commons-text" % "1.10.0", + "com.github.scopt" %% "scopt" % "4.1.0", + "org.scalameta" %% "scalafmt-dynamic" % "3.7.17" + ) ) lazy val sbtPlugin = project @@ -108,10 +101,10 @@ lazy val sbtPlugin = project .dependsOn(domainClassesGenerator_2_12) .enablePlugins(SbtPlugin) .settings( - name := "sbt-flatgraph", - scalaVersion := scala2_12, + name := "sbt-flatgraph", + scalaVersion := scala2_12, scalacOptions := scalacOptionsFor2_12, - addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") ) lazy val odbConvert = project @@ -120,31 +113,26 @@ lazy val odbConvert = project .enablePlugins(JavaAppPackaging) .settings( name := "flatgraph-odb-convert", - libraryDependencies ++= Seq( - "io.shiftleft" %% "overflowdb-core" % "1.181", - "org.slf4j" % "slf4j-simple" % slf4jVersion % Optional - ) + libraryDependencies ++= Seq("io.shiftleft" %% "overflowdb-core" % "1.181", "org.slf4j" % "slf4j-simple" % slf4jVersion % Optional) ) lazy val testSchemas = project .in(file("test-schemas")) .dependsOn(domainClassesGenerator_3) .settings( - name := "test-schemas", - scalaVersion := scala3, + name := "test-schemas", + scalaVersion := scala3, publish / skip := true, generateDomainClassesForTestSchemas := Def.taskDyn { - /** invoking the codegen and scalafmt is expensive, so we only want to do so if the hashsum of the - * inputs (codegen implementation, build setup, test schemas, scalafmt config) is unknown or different to the - * last known one. We persist the hashsum to preserve it between sbt sessions. - */ - val lastKnownHashsumFile = target.value / "codegen-inputs-hash.md5" + + /** invoking the codegen and scalafmt is expensive, so we only want to do so if the hashsum of the inputs (codegen implementation, + * build setup, test schemas, scalafmt config) is unknown or different to the last known one. We persist the hashsum to preserve it + * between sbt sessions. + */ + val lastKnownHashsumFile = target.value / "codegen-inputs-hash.md5" def lastKnownHashsum: Option[String] = scala.util.Try(IO.read(lastKnownHashsumFile)).toOption - val inputsHashsum = FileUtils.md5( - sourceDirectory.value, - file("build.sbt"), - (ThisBuild / baseDirectory).value / "domain-classes-generator/src", - ) + val inputsHashsum = + FileUtils.md5(sourceDirectory.value, file("build.sbt"), (ThisBuild / baseDirectory).value / "domain-classes-generator/src") if (lastKnownHashsum == Some(inputsHashsum)) { Def.task { @@ -152,20 +140,20 @@ lazy val testSchemas = project } } else { Def.task { - (Compile/runMain).toTask(s" flatgraph.testdomains.GenerateDomainClasses").value + (Compile / runMain).toTask(s" flatgraph.testdomains.GenerateDomainClasses").value IO.write(lastKnownHashsumFile, inputsHashsum) } } - }.value, + }.value ) lazy val testSchemasDomainClasses = project .in(file("test-schemas-domain-classes")) .dependsOn(core, help) .settings( - name := "test-schemas-domain-classes", - Compile/compile := (Compile/compile).dependsOn(testSchemas/generateDomainClassesForTestSchemas).value, - publish / skip := true, + name := "test-schemas-domain-classes", + Compile / compile := (Compile / compile).dependsOn(testSchemas / generateDomainClassesForTestSchemas).value, + publish / skip := true ) // currently relies on a self-published version of codepropertygraph and joern based on the respective `michael/flatgraph` branches @@ -188,26 +176,16 @@ lazy val benchmarks = project ), publish / skip := true ) -*/ - + */ ThisBuild / libraryDependencies ++= Seq( - "org.slf4j" % "slf4j-simple" % slf4jVersion % Test, - "org.scalatest" %% "scalatest" % "3.2.18" % Test, + "org.slf4j" % "slf4j-simple" % slf4jVersion % Test, + "org.scalatest" %% "scalatest" % "3.2.18" % Test ) -ThisBuild / scalacOptions ++= Seq( - "-deprecation", - "-feature", - "--release", "8", - "-language:implicitConversions" -) +ThisBuild / scalacOptions ++= Seq("-deprecation", "-feature", "--release", "8", "-language:implicitConversions") -val scalacOptionsFor2_12 = Seq( - "-deprecation", - "-feature", - "-language:implicitConversions" -) +val scalacOptionsFor2_12 = Seq("-deprecation", "-feature", "-language:implicitConversions") ThisBuild / compile / javacOptions ++= Seq( "-g", // debug symbols @@ -217,12 +195,10 @@ ThisBuild / compile / javacOptions ++= Seq( Global / cancelable := true Global / onChangedBuildSource := ReloadOnSourceChanges -ThisBuild / publishTo := sonatypePublishToBundle.value +ThisBuild / publishTo := sonatypePublishToBundle.value sonatypeCredentialHost := "s01.oss.sonatype.org" -ThisBuild / scmInfo := Some( - ScmInfo(url("https://github.com/joernio/flatgraph"), "scm:git@github.com:joernio/flatgraph.git") -) -ThisBuild / homepage := Some(url("https://github.com/joernio/flatgraph/")) +ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/joernio/flatgraph"), "scm:git@github.com:joernio/flatgraph.git")) +ThisBuild / homepage := Some(url("https://github.com/joernio/flatgraph/")) ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) ThisBuild / developers := List(