-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f19081
commit 86abe22
Showing
1 changed file
with
61 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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,39 +19,36 @@ lazy val root = (project in file(".")).aggregate( | |
odbConvert, | ||
testSchemas, | ||
testSchemasDomainClasses, | ||
tests, | ||
tests | ||
) | ||
|
||
lazy val core = project | ||
.in(file("core")) | ||
.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, | ||
"net.oneandone.reflections8" % "reflections8" % "0.11.7", | ||
"com.lihaoyi" %% "ujson" % "3.3.1", | ||
"com.github.luben" % "zstd-jni" % "1.5.6-3", | ||
"org.slf4j" % "slf4j-api" % slf4jVersion, | ||
"net.oneandone.reflections8" % "reflections8" % "0.11.7" | ||
) | ||
) | ||
|
||
lazy val help = project | ||
.in(file("help")) | ||
.dependsOn(core) | ||
.settings( | ||
name := "flatgraph-help", | ||
libraryDependencies += "de.vandermeer" % "asciitable" % "0.3.2", | ||
) | ||
.settings(name := "flatgraph-help", libraryDependencies += "de.vandermeer" % "asciitable" % "0.3.2") | ||
|
||
lazy val formats = project | ||
.in(file("formats")) | ||
.dependsOn(core) | ||
.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" | ||
) | ||
) | ||
|
||
|
@@ -62,54 +59,50 @@ 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 | ||
.in(file("sbt-flatgraph")) | ||
.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 | ||
|
@@ -118,52 +111,47 @@ 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.193", "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 { | ||
streams.value.log.info("no need to regenerate domain classes for test schemas") | ||
} | ||
} 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 | ||
|
@@ -186,26 +174,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 | ||
|
@@ -215,12 +193,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:[email protected]:joernio/flatgraph.git") | ||
) | ||
ThisBuild / homepage := Some(url("https://github.com/joernio/flatgraph/")) | ||
ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/joernio/flatgraph"), "scm:[email protected]: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( | ||
|