From e8547378c2baa5f74995a188b25c6830700059ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marks?= Date: Tue, 26 Mar 2024 13:56:28 +0100 Subject: [PATCH] Stop node duplication in pom files --- project/Build.scala | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index a7107d1f139d..aaf284c8b139 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1,5 +1,6 @@ import java.io.File import java.nio.file._ +import scala.xml.{Elem, Node as XmlNode} import Process._ import Modes._ @@ -2009,10 +2010,20 @@ object Build { "scm:git:git@github.com:scala/scala3.git" ) ), - pomExtra := - - {versionLine} - , + pomPostProcess := { + case node: Elem => + if ((node\"properties").isEmpty) + node.copy(child = node.child :+ {versionLine}) + else { + val newChildren = node.child.map { + case elem: Elem if elem.label == "properties" => + elem.copy(child = elem.child :+ {versionLine}) + case other => + other + } + node.copy(child = newChildren) + } + }, developers := List( Developer( id = "odersky",