Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

querydb: cleanup/simplify dependency tree, move classes into querydb namespace #2758

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion console/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ val ZeroturnaroundVersion = "1.15"

dependsOn(
Projects.semanticcpg,
Projects.macros,
Projects.javasrc2cpg,
Projects.jssrc2cpg,
Projects.pysrc2cpg,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.joern.console.scan

import io.joern.console.Query
import io.joern.querydb.Query
import io.shiftleft.codepropertygraph.Cpg
import io.shiftleft.passes.ConcurrentWriterCpgPass

Expand Down
2 changes: 1 addition & 1 deletion console/src/main/scala/io/joern/console/scan/package.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.joern.console

import io.joern.console.Query
import io.joern.querydb.Query
import io.shiftleft.codepropertygraph.Cpg
import io.shiftleft.codepropertygraph.generated.NodeTypes
import io.shiftleft.codepropertygraph.generated.nodes._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.joern.console
package io.joern.querydb

import io.shiftleft.codepropertygraph.Cpg
import io.shiftleft.codepropertygraph.generated.nodes.StoredNode
Expand Down
5 changes: 3 additions & 2 deletions joern-cli/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name := "joern-cli"

dependsOn(
Projects.console,
Projects.console % "test->test",
Projects.macros,
Projects.dataflowengineoss,
Projects.x2cpg
Projects.x2cpg,
Projects.console % "test->test"
)

libraryDependencies ++= Seq(
Expand Down
3 changes: 2 additions & 1 deletion joern-cli/src/main/scala/io/joern/joerncli/JoernScan.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package io.joern.joerncli

import better.files._
import io.joern.console.scan.{ScanPass, outputFindings}
import io.joern.console.{BridgeBase, DefaultArgumentProvider, JoernProduct, Query, QueryDatabase}
import io.joern.console.{BridgeBase, JoernProduct}
import io.joern.querydb.{DefaultArgumentProvider, Query, QueryDatabase}
import io.joern.dataflowengineoss.queryengine.{EngineConfig, EngineContext}
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.joerncli.JoernScan.getQueriesFromQueryDb
Expand Down
5 changes: 4 additions & 1 deletion macros/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name := "macros"
scalaVersion := "2.13.8"
crossScalaVersions := Seq("2.13.8", "3.2.2")

dependsOn(Projects.semanticcpg % Test)
dependsOn(
Projects.console,
Projects.semanticcpg % Test
)

libraryDependencies ++= Seq(
"io.shiftleft" %% "codepropertygraph" % Versions.cpg,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.joern.console;
package io.joern.querydb;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
Expand Down
2 changes: 1 addition & 1 deletion macros/src/main/scala-2/io/joern/macros/QueryMacros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.joern.macros

import io.shiftleft.codepropertygraph.Cpg
import io.shiftleft.codepropertygraph.generated.nodes.StoredNode
import io.joern.console.TraversalWithStrRep
import io.joern.querydb.TraversalWithStrRep
import overflowdb.traversal.Traversal

import scala.language.experimental.macros
Expand Down
2 changes: 1 addition & 1 deletion macros/src/main/scala-3/io/joern/macros/QueryMacros.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.joern.macros

import io.joern.console.TraversalWithStrRep
import io.joern.querydb.TraversalWithStrRep
import io.shiftleft.codepropertygraph.Cpg
import io.shiftleft.codepropertygraph.generated.nodes.StoredNode
import overflowdb.traversal.Traversal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.joern.console
package io.joern.querydb

import org.reflections8.Reflections
import org.reflections8.util.{ClasspathHelper, ConfigurationBuilder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.scalatest.wordspec.AnyWordSpec

import io.joern.macros.QueryMacros.withStrRep
import io.joern.console._
import io.joern.querydb._
import io.shiftleft.semanticcpg.language._

class QueryMacroTests extends AnyWordSpec with Matchers {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.joern.console
package io.joern.querydb

import io.shiftleft.codepropertygraph.Cpg
import io.shiftleft.semanticcpg.language._
Expand Down Expand Up @@ -36,13 +36,13 @@ object InvalidBundle extends QueryBundle {
class QueryDatabaseTests extends AnyWordSpec with should.Matchers {
"QueryDatabase" should {
"contain Metrics bundle" in {
new QueryDatabase(namespace = "io.joern.console").allBundles.count { bundle =>
new QueryDatabase(namespace = "io.joern.querydb").allBundles.count { bundle =>
bundle.getName.endsWith("TestBundle$")
} shouldBe 1
}

"contain `foo` query" in {
val qdb = new QueryDatabase(namespace = "io.joern.console")
val qdb = new QueryDatabase(namespace = "io.joern.querydb")
val testBundles = qdb.allBundles.filter { bundle =>
bundle.getName.endsWith("TestBundle$")
}
Expand All @@ -67,7 +67,7 @@ class QueryDatabaseTests extends AnyWordSpec with should.Matchers {
}

"throw exception when trying to fetch queries from invalid bundle" in {
val qdb = new QueryDatabase(namespace = "io.joern.console")
val qdb = new QueryDatabase(namespace = "io.joern.querydb")
val testBundles = qdb.allBundles.filter { bundle =>
bundle.getName.endsWith("InvalidBundle$")
}
Expand Down
2 changes: 1 addition & 1 deletion querydb/src/main/scala/io/joern/dumpq/Main.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.joern.dumpq

import io.joern.console.{DefaultArgumentProvider, QueryDatabase}
import io.joern.querydb.{DefaultArgumentProvider, QueryDatabase}
import io.joern.dataflowengineoss.queryengine.{EngineConfig, EngineContext}
import io.joern.dataflowengineoss.semanticsloader.Semantics
import org.json4s.{Formats, NoTypeHints}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.android

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.macros.QueryMacros._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.android

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.macros.QueryMacros._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.android

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.macros.QueryMacros._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.android

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.macros.QueryMacros._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.android

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.android

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.macros.QueryMacros._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.android

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.language.toExtendedCfgNode
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.android

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.macros.QueryMacros._
Expand Down
1 change: 1 addition & 0 deletions querydb/src/main/scala/io/joern/scanners/c/CopyLoops.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.c

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.c

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.shiftleft.semanticcpg.language._
import io.joern.macros.QueryMacros._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.c

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.shiftleft.semanticcpg.language._
import io.joern.macros.QueryMacros._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.c
import io.joern.scanners.{Crew, QueryTags}
import io.shiftleft.codepropertygraph.generated.nodes._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.shiftleft.semanticcpg.language._
import io.joern.macros.QueryMacros._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import io.joern.dataflowengineoss.queryengine.EngineContext
import io.shiftleft.semanticcpg.language._
import io.joern.dataflowengineoss.language._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.macros.QueryMacros._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.c
import io.joern.scanners._
import io.shiftleft.semanticcpg.language._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._

object IntegerTruncations extends QueryBundle {
Expand Down
1 change: 1 addition & 0 deletions querydb/src/main/scala/io/joern/scanners/c/Metrics.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.c

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.shiftleft.semanticcpg.language._
import io.joern.macros.QueryMacros._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.c
import io.shiftleft.semanticcpg.language.{ICallResolver, NoResolve}
import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.shiftleft.codepropertygraph.generated.nodes
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.shiftleft.semanticcpg.language._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.joern.scanners.{Crew, QueryTags}
import io.shiftleft.semanticcpg.language._
import io.joern.dataflowengineoss.language._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.macros.QueryMacros._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.joern.scanners.c

import io.joern.querydb._
import io.shiftleft.codepropertygraph.generated.nodes
import io.shiftleft.semanticcpg.language._
import overflowdb.traversal.Traversal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.c

import io.joern.scanners.{Crew, QueryTags}
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._
import QueryLangExtensions._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.c
import io.joern.scanners._
import io.shiftleft.codepropertygraph.generated.Operators
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._

Expand Down
1 change: 1 addition & 0 deletions querydb/src/main/scala/io/joern/scanners/c/SocketApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.c

import io.joern.scanners.{Crew, QueryTags}
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.joern.scanners.{Crew, QueryTags}
import io.shiftleft.codepropertygraph.generated.Operators
import io.shiftleft.codepropertygraph.generated.nodes._
import io.joern.console._
import io.joern.querydb._
import io.shiftleft.semanticcpg.language._
import io.joern.dataflowengineoss.language._
import io.joern.dataflowengineoss.queryengine.EngineContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.ghidra

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.ghidra

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._
import io.joern.dataflowengineoss.language._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.java
import io.joern.scanners.{Crew, QueryTags}
import io.shiftleft.codepropertygraph.generated._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._
import overflowdb.traversal.Traversal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.java
import io.joern.scanners._
import io.shiftleft.semanticcpg.language._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.joern.dataflowengineoss.language._
import io.joern.dataflowengineoss.queryengine.EngineContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.java
import io.joern.scanners._
import io.shiftleft.semanticcpg.language._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.joern.dataflowengineoss.language._
import io.joern.dataflowengineoss.queryengine.EngineContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.java
import io.joern.scanners._
import io.shiftleft.semanticcpg.language._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._

object DangerousFunctions extends QueryBundle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.java
import io.joern.scanners._
import io.shiftleft.semanticcpg.language._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.joern.dataflowengineoss.language._
import io.joern.dataflowengineoss.queryengine.EngineContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.kotlin

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.dataflowengineoss.language._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.joern.scanners.kotlin
import io.joern.scanners.{Crew, QueryTags}
import io.shiftleft.codepropertygraph.generated._
import io.joern.console._
import io.joern.querydb._
import io.joern.macros.QueryMacros._
import io.shiftleft.semanticcpg.language._
import overflowdb.traversal.Traversal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.joern.scanners.kotlin

import io.joern.scanners._
import io.joern.console._
import io.joern.querydb._
import io.joern.dataflowengineoss.queryengine.EngineContext
import io.joern.dataflowengineoss.semanticsloader.Semantics
import io.joern.dataflowengineoss.language._
Expand Down
Loading