From 1a09888927f36fefe3505ef08fc2053ab13bc7f5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:12:30 +0100 Subject: [PATCH] Update CPG packages to v8 (major) (#791) * Update CPG packages to v8 * Made it compile, but test fail * Remove obsolete CLI option * Update to latest CPG release * Update repositories for CPG v8.x --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian Banse Co-authored-by: Wendland, Florian --- buildSrc/src/main/kotlin/module.gradle.kts | 2 +- code-coverage-report/build.gradle.kts | 2 +- .../aisec/codyze/backends/cpg/CPGBackend.kt | 1 - .../aisec/codyze/backends/cpg/CPGConfiguration.kt | 1 - .../aisec/codyze/backends/cpg/CPGOptionGroup.kt | 11 ----------- .../aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt | 1 - .../aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt | 1 - .../backends/cpg/coko/evaluators/OrderEvaluator.kt | 4 ++-- .../aisec/codyze/backends/cpg/CPGConfigurationTest.kt | 3 --- .../aisec/codyze/backends/cpg/CpgOptionGroupTest.kt | 9 +++------ .../fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt | 1 - .../coko/dsl/CokoCpgIntegrationTest.kt | 1 - gradle/libs.versions.toml | 2 +- 13 files changed, 8 insertions(+), 31 deletions(-) diff --git a/buildSrc/src/main/kotlin/module.gradle.kts b/buildSrc/src/main/kotlin/module.gradle.kts index f2d3cd753..25c56ca3e 100644 --- a/buildSrc/src/main/kotlin/module.gradle.kts +++ b/buildSrc/src/main/kotlin/module.gradle.kts @@ -38,7 +38,7 @@ repositories { // Eclipse CDT repo --> needed for CPG ivy { - setUrl("https://download.eclipse.org/tools/cdt/releases/11.0/cdt-11.0.0/plugins") + setUrl("https://download.eclipse.org/tools/cdt/releases/11.3/cdt-11.3.1/plugins") metadataSources { artifact() } diff --git a/code-coverage-report/build.gradle.kts b/code-coverage-report/build.gradle.kts index 43855ff89..a1bff7c6e 100644 --- a/code-coverage-report/build.gradle.kts +++ b/code-coverage-report/build.gradle.kts @@ -10,7 +10,7 @@ repositories { // Eclipse CDT repo --> needed when adding the CPG as an included build ivy { - setUrl("https://download.eclipse.org/tools/cdt/releases/11.0/cdt-11.0.0/plugins") + setUrl("https://download.eclipse.org/tools/cdt/releases/11.3/cdt-11.3.1/plugins") metadataSources { artifact() } diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt index b57f52d64..8f37c367b 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt @@ -67,7 +67,6 @@ open class CPGBackend(config: BackendConfiguration) : Backend { .processAnnotations(processAnnotations) .failOnError(failOnError) .useParallelFrontends(useParallelFrontends) - .typeSystemActiveInFrontend(typeSystemActiveInFrontend) .sourceLocations(source.map { (it.toFile()) }) .symbols(symbols) .useUnityBuild(useUnityBuild) diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfiguration.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfiguration.kt index 2621ab588..d7780e252 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfiguration.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfiguration.kt @@ -34,7 +34,6 @@ private val logger = KotlinLogging.logger {} data class CPGConfiguration( val source: List, val useUnityBuild: Boolean, - val typeSystemActiveInFrontend: Boolean, val debugParser: Boolean, val disableCleanup: Boolean, val codeInNodes: Boolean, diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGOptionGroup.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGOptionGroup.kt index 3a8c9552c..c77aa418b 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGOptionGroup.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGOptionGroup.kt @@ -82,17 +82,6 @@ class CPGOptionGroup : BackendOptions(helpName = "CPG Backend Options") { help = "Enables unity builds (C++ only) for files in the path." ) .flag("--no-unity", "--disable-unity", default = false) - val typeSystemActiveInFrontend: Boolean by option( - "--type-system-in-frontend", - help = "If deactivated, the type listener system starts after the frontends " + - "are done building the initial AST structure." - ) - .flag( - "--no-type-system-in-frontend", - "--disable-type-system-in-frontend", - default = true, - defaultForHelp = "enable" - ) val debugParser: Boolean by option("--debug-parser", help = "Generate debug output for the cpg parser.") .flag("--no-debug-parser", default = false) val disableCleanup: Boolean by option( diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt index f9bfc5739..c082e65e0 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt @@ -33,7 +33,6 @@ class BaseCpgBackend : BackendCommand("cpg") { CPGConfiguration( source = source, useUnityBuild = useUnityBuild, - typeSystemActiveInFrontend = typeSystemActiveInFrontend, debugParser = debugParser, disableCleanup = disableCleanup, codeInNodes = codeInNodes, diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt index f755db75c..b86ea74f6 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt @@ -34,7 +34,6 @@ class CokoCpgBackend : BackendCommand("cokoCpg") { CPGConfiguration( source = source, useUnityBuild = useUnityBuild, - typeSystemActiveInFrontend = typeSystemActiveInFrontend, debugParser = debugParser, disableCleanup = disableCleanup, codeInNodes = codeInNodes, diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/coko/evaluators/OrderEvaluator.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/coko/evaluators/OrderEvaluator.kt index 45de71d39..c85abf253 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/coko/evaluators/OrderEvaluator.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/coko/evaluators/OrderEvaluator.kt @@ -30,7 +30,7 @@ import de.fraunhofer.aisec.codyze.specificationLanguages.coko.core.dsl.Order import de.fraunhofer.aisec.codyze.specificationLanguages.coko.core.ordering.* import de.fraunhofer.aisec.cpg.graph.* import de.fraunhofer.aisec.cpg.graph.declarations.VariableDeclaration -import de.fraunhofer.aisec.cpg.graph.statements.expressions.DeclaredReferenceExpression +import de.fraunhofer.aisec.cpg.graph.statements.expressions.Reference import io.github.oshai.kotlinlogging.KotlinLogging import kotlin.reflect.full.createType import kotlin.reflect.full.declaredMemberFunctions @@ -164,7 +164,7 @@ class OrderEvaluator(val baseNodes: Collection, val order: Order) : Evalua nodeToRelevantMethod = nodesToOp, consideredBases = baseNodes.flatMap { node -> node.followNextDFGEdgesUntilHit { next -> - next is VariableDeclaration || next is DeclaredReferenceExpression + next is VariableDeclaration || next is Reference }.fulfilled.mapNotNull { path -> path.lastOrNull() } diff --git a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfigurationTest.kt b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfigurationTest.kt index d3563cde2..65553f2fc 100644 --- a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfigurationTest.kt +++ b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfigurationTest.kt @@ -25,7 +25,6 @@ class CPGConfigurationTest { val expectedCpgConfiguration = CPGConfiguration( source = listOf(), useUnityBuild = true, - typeSystemActiveInFrontend = false, debugParser = false, disableCleanup = false, codeInNodes = true, @@ -46,7 +45,6 @@ class CPGConfigurationTest { val cpgConfiguration = CPGConfiguration( source = listOf(), useUnityBuild = true, - typeSystemActiveInFrontend = false, debugParser = false, disableCleanup = false, codeInNodes = true, @@ -74,7 +72,6 @@ class CPGConfigurationTest { val expectedCpgConfiguration = CPGConfiguration( source = listOf(), useUnityBuild = false, - typeSystemActiveInFrontend = false, debugParser = false, disableCleanup = false, codeInNodes = true, diff --git a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CpgOptionGroupTest.kt b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CpgOptionGroupTest.kt index 0f3fa74df..7ebfdfbea 100644 --- a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CpgOptionGroupTest.kt +++ b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CpgOptionGroupTest.kt @@ -20,10 +20,7 @@ import com.github.ajalt.clikt.core.MultiUsageError import com.github.ajalt.clikt.core.NoOpCliktCommand import com.github.ajalt.clikt.parameters.groups.provideDelegate import de.fraunhofer.aisec.codyze.core.config.combineSources -import de.fraunhofer.aisec.cpg.passes.CallResolver -import de.fraunhofer.aisec.cpg.passes.EdgeCachePass -import de.fraunhofer.aisec.cpg.passes.FilenameMapper -import de.fraunhofer.aisec.cpg.passes.Pass +import de.fraunhofer.aisec.cpg.passes.* import io.github.oshai.kotlinlogging.KotlinLogging import org.junit.jupiter.api.* import org.junit.jupiter.api.Test @@ -86,7 +83,7 @@ class CpgOptionGroupTest { fun passesTest() { val edgeCachePassName = EdgeCachePass::class.qualifiedName val filenameMapperName = FilenameMapper::class.qualifiedName - val callResolverName = CallResolver::class.qualifiedName + val callResolverName = SymbolResolver::class.qualifiedName assertNotNull(edgeCachePassName) assertNotNull(filenameMapperName) assertNotNull(callResolverName) @@ -106,7 +103,7 @@ class CpgOptionGroupTest { ) val expectedPassesNames = - listOf(EdgeCachePass::class, FilenameMapper::class, CallResolver::class).map { p -> + listOf(EdgeCachePass::class, FilenameMapper::class, SymbolResolver::class).map { p -> p.qualifiedName } val actualPassesNames = cli.cpgOptions.passes.map { p -> p.qualifiedName } diff --git a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt index a3cea8180..32e22d705 100644 --- a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt +++ b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt @@ -25,7 +25,6 @@ fun createCpgConfiguration(vararg sourceFile: Path) = CPGConfiguration( source = listOf(*sourceFile), useUnityBuild = false, - typeSystemActiveInFrontend = true, debugParser = false, disableCleanup = false, codeInNodes = true, diff --git a/codyze-specification-languages/coko/coko-dsl/src/test/kotlin/de/fraunhofer/aisec/codyze/specificationLanguages/coko/dsl/CokoCpgIntegrationTest.kt b/codyze-specification-languages/coko/coko-dsl/src/test/kotlin/de/fraunhofer/aisec/codyze/specificationLanguages/coko/dsl/CokoCpgIntegrationTest.kt index 0f710d243..10a603410 100644 --- a/codyze-specification-languages/coko/coko-dsl/src/test/kotlin/de/fraunhofer/aisec/codyze/specificationLanguages/coko/dsl/CokoCpgIntegrationTest.kt +++ b/codyze-specification-languages/coko/coko-dsl/src/test/kotlin/de/fraunhofer/aisec/codyze/specificationLanguages/coko/dsl/CokoCpgIntegrationTest.kt @@ -45,7 +45,6 @@ class CokoCpgIntegrationTest { CPGConfiguration( source = sourceFiles, useUnityBuild = false, - typeSystemActiveInFrontend = true, debugParser = false, disableCleanup = false, codeInNodes = true, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b5914294b..ba670724e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] kotlin = "1.9.23" -cpg = "7.1.2" +cpg = "8.1.2" koin = "3.5.3" koin-test = "3.5.3" detekt = "1.23.5"