From 364e3325d227e9ac7815d434fc4313990e98e0af Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 22 Apr 2023 00:55:49 +0000 Subject: [PATCH 1/3] Use `crossProjectCrossType` in settings plugin --- .../sbt/TypelevelSettingsPlugin.scala | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 21db86f9..7778b075 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -260,17 +260,18 @@ object TypelevelSettingsPlugin extends AutoPlugin { private val perConfigSettings = Seq( unmanagedSourceDirectories ++= { def extraDirs(suffix: String) = - if (crossProjectPlatform.?.value.isDefined) - List(CrossType.Pure, CrossType.Full).flatMap { - _.sharedSrcDir(baseDirectory.value, Defaults.nameForSrc(configuration.value.name)) + crossProjectCrossType.?.value match { + case Some(crossType) => + crossType + .sharedSrcDir(baseDirectory.value, Defaults.nameForSrc(configuration.value.name)) .toList .map(f => file(f.getPath + suffix)) - } - else - List( - baseDirectory.value / "src" / Defaults.nameForSrc( - configuration.value.name) / s"scala$suffix" - ) + case None => + List( + baseDirectory.value / "src" / + Defaults.nameForSrc(configuration.value.name) / s"scala$suffix" + ) + } CrossVersion.partialVersion(scalaVersion.value) match { case Some((2, y)) if y <= 12 => extraDirs("-2.12-") From 07bc6a73bd50b53d4c69f7fdbdce034354a66ae3 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 22 Apr 2023 01:05:09 +0000 Subject: [PATCH 2/3] Use `crossProjectBaseDirectory` in mergify plugin --- mergify/build.sbt | 1 + .../scala/org/typelevel/sbt/mergify/MergifyPlugin.scala | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/mergify/build.sbt b/mergify/build.sbt index ea579f24..c95f6a4d 100644 --- a/mergify/build.sbt +++ b/mergify/build.sbt @@ -1 +1,2 @@ libraryDependencies += "io.circe" %% "circe-yaml" % "0.14.2" +addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "1.3.1") diff --git a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyPlugin.scala b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyPlugin.scala index 6ace0cf3..360c5120 100644 --- a/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyPlugin.scala +++ b/mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyPlugin.scala @@ -18,6 +18,7 @@ package org.typelevel.sbt.mergify import org.typelevel.sbt.gha._ import sbt._ +import sbtcrossproject.CrossPlugin.autoImport._ import java.nio.file.Path @@ -152,13 +153,7 @@ object MergifyPlugin extends AutoPlugin { } private lazy val projectLabel = Def.setting { - val path = (Compile / sourceDirectories) - .? - .value - .getOrElse(Seq.empty) - .map(_.toPath) - .foldLeft(baseDirectory.value.toPath)(commonAncestor(_, _)) - + val path = crossProjectBaseDirectory.?.value.getOrElse(baseDirectory.value).toPath val label = path.getFileName.toString def isRoot = path == (LocalRootProject / baseDirectory).value.toPath From 4a995ac8e910fe8c00ecad5b0e4e101cd490af52 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 22 Apr 2023 01:21:10 +0000 Subject: [PATCH 3/3] Tidy unused import --- .../main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 7778b075..86126912 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -22,7 +22,6 @@ import org.typelevel.sbt.kernel.GitHelper import org.typelevel.sbt.kernel.V import sbt._ import sbtcrossproject.CrossPlugin.autoImport._ -import sbtcrossproject.CrossType import java.io.File import java.lang.management.ManagementFactory