From 63563d94349b90d9c93f72180abc67241ddebbc6 Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Fri, 10 Jan 2025 12:45:57 +0100 Subject: [PATCH] Patching dynamic dependency to frontends out of `cpg-neo4j` POM (#1927) This PR is a follow-up to #1926 (which did not work). This time we ressort to patching the dependency out of the POM. --- cpg-neo4j/build.gradle.kts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cpg-neo4j/build.gradle.kts b/cpg-neo4j/build.gradle.kts index d9c1e0b4b75..340ba8dfae3 100644 --- a/cpg-neo4j/build.gradle.kts +++ b/cpg-neo4j/build.gradle.kts @@ -1,3 +1,6 @@ +import groovy.util.Node +import groovy.util.NodeList + /* * Copyright (c) 2021, Fraunhofer AISEC. All rights reserved. * @@ -42,6 +45,17 @@ publishing { artifactId = "cpg-neo4j" name.set("Code Property Graph - Neo4j") description.set("An Application to translate and persist specified source code as a Code Property Graph to an installed instance of the Neo4j Graph Database.") + withXml { + // Modify the XML to exclude dependencies that start with "cpg-language-". + // This is necessary because we do not want to "leak" the dependency to our dynamically activated + // frontends to the outside + var dependenciesNode = asNode().children().filterIsInstance().firstOrNull { true && it.name().toString() == "{http://maven.apache.org/POM/4.0.0}dependencies" } + dependenciesNode?.children()?.removeIf { + it is Node && + (it.name().toString() == "{http://maven.apache.org/POM/4.0.0}dependency") && + ((it.get("artifactId") as? NodeList)?.text()?.startsWith("cpg-language-") == true) + } + } } } }