@@ -3,7 +3,6 @@ package io.appthreat.x2cpg.utils.dependency
3
3
import better .files .File
4
4
import io .appthreat .x2cpg .utils .ExternalCommand
5
5
import io .appthreat .x2cpg .utils .dependency .GradleConfigKeys .GradleConfigKey
6
- import org .slf4j .LoggerFactory
7
6
8
7
import java .nio .file .Path
9
8
import scala .util .{Failure , Success }
@@ -17,10 +16,7 @@ case class DependencyResolverParams(
17
16
)
18
17
19
18
object DependencyResolver :
20
- private val logger = LoggerFactory .getLogger(getClass)
21
- private val defaultGradleProjectName = " app"
22
- private val defaultGradleConfigurationName = " compileClasspath"
23
- private val MaxSearchDepth : Int = 4
19
+ private val MaxSearchDepth : Int = 4
24
20
25
21
def getCoordinates (
26
22
projectDir : Path ,
@@ -31,9 +27,8 @@ object DependencyResolver:
31
27
// TODO: implement
32
28
None
33
29
else if isGradleBuildFile(buildFile) then
34
- getCoordinatesForGradleProject(buildFile.getParent, defaultGradleConfigurationName)
30
+ Nil
35
31
else
36
- logger.debug(s " Found unsupported build file $buildFile" )
37
32
Nil
38
33
}.flatten
39
34
@@ -49,16 +44,10 @@ object DependencyResolver:
49
44
) match
50
45
case Success (lines) => lines
51
46
case Failure (exception) =>
52
- logger.debug(
53
- s " Could not retrieve dependencies for Gradle project at path ` $projectDir` \n " +
54
- exception.getMessage
55
- )
56
47
Seq ()
57
48
58
49
val coordinates = MavenCoordinates .fromGradleOutput(lines)
59
- logger.debug(" Got {} Maven coordinates" , coordinates.size)
60
50
Some (coordinates)
61
- end getCoordinatesForGradleProject
62
51
63
52
def getDependencies (
64
53
projectDir : Path ,
@@ -68,35 +57,13 @@ object DependencyResolver:
68
57
if isMavenBuildFile(buildFile) then
69
58
MavenDependencies .get(buildFile.getParent)
70
59
else if isGradleBuildFile(buildFile) then
71
- getDepsForGradleProject(params, buildFile.getParent)
60
+ Nil
72
61
else
73
- logger.debug(s " Found unsupported build file $buildFile" )
74
62
Nil
75
63
}.flatten
76
64
77
65
Option .when(dependencies.nonEmpty)(dependencies)
78
66
79
- private def getDepsForGradleProject (
80
- params : DependencyResolverParams ,
81
- projectDir : Path
82
- ): Option [collection.Seq [String ]] =
83
- logger.debug(" resolving Gradle dependencies at {}" , projectDir)
84
- val gradleProjectName =
85
- params.forGradle.getOrElse(GradleConfigKeys .ProjectName , defaultGradleProjectName)
86
- val gradleConfiguration =
87
- params.forGradle.getOrElse(
88
- GradleConfigKeys .ConfigurationName ,
89
- defaultGradleConfigurationName
90
- )
91
- GradleDependencies .get(projectDir, gradleProjectName, gradleConfiguration) match
92
- case Some (deps) => Some (deps)
93
- case None =>
94
- logger.debug(
95
- s " Could not download Gradle dependencies for project at path ` $projectDir` "
96
- )
97
- None
98
- end getDepsForGradleProject
99
-
100
67
private def isGradleBuildFile (file : File ): Boolean =
101
68
val pathString = file.pathAsString
102
69
pathString.endsWith(" .gradle" ) || pathString.endsWith(" .gradle.kts" )
@@ -106,7 +73,6 @@ object DependencyResolver:
106
73
107
74
private def findSupportedBuildFiles (currentDir : File , depth : Int = 0 ): List [Path ] =
108
75
if depth >= MaxSearchDepth then
109
- logger.debug(" findSupportedBuildFiles reached max depth before finding build files" )
110
76
Nil
111
77
else
112
78
val (childDirectories, childFiles) = currentDir.children.partition(_.isDirectory)
0 commit comments