From a185397eb8e4c81bb06f3826a30f129bb6fa9470 Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Wed, 13 Dec 2023 17:36:21 +0100 Subject: [PATCH] Allow packaging sources from all managed directories --- .../org/typelevel/sbt/TypelevelSettingsPlugin.scala | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 3be48a4a..7efa62b9 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -338,19 +338,20 @@ object TypelevelSettingsPlugin extends AutoPlugin { } }, packageSrc / mappings ++= { - val base = sourceManaged.value + val bases = managedSourceDirectories.value managedSources.value.map { file => - file.relativeTo(base) match { - case Some(relative) => file -> relative.getPath - case None => + bases + .map(b => file.relativeTo(b)) + .collectFirst { case Some(relative) => file -> relative.getPath } + .getOrElse { throw new RuntimeException( s"""|Expected managed sources in: - |$base + |${bases.mkString("\n")} |But found them here: |$file |""".stripMargin ) - } + } } } )