Merge pull request #6322 from adpi2/fix-disable-ivy

Fix disabling IvyPlugin on root project
This commit is contained in:
eugene yokota 2021-02-21 01:23:07 -05:00 committed by GitHub
commit dffa34c3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 23 deletions

View File

@ -19,6 +19,7 @@ ThisBuild / turbo := true
ThisBuild / usePipelining := false // !(Global / insideCI).value
Global / semanticdbEnabled := !(Global / insideCI).value
Global / semanticdbVersion := "4.4.8"
val excludeLint = SettingKey[Set[Def.KeyedInitialize[_]]]("excludeLintKeys")
Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty)
Global / excludeLint += componentID

View File

@ -661,6 +661,23 @@ object Defaults extends BuildCommon {
sbtBinaryVersion in pluginCrossBuild := binarySbtVersion(
(sbtVersion in pluginCrossBuild).value
),
// Use (sbtVersion in pluginCrossBuild) to pick the sbt module to depend from the plugin.
// Because `sbtVersion in pluginCrossBuild` can be scoped to project level,
// this setting needs to be set here too.
sbtDependency in pluginCrossBuild := {
val app = appConfiguration.value
val id = app.provider.id
val sv = (sbtVersion in pluginCrossBuild).value
val scalaV = (scalaVersion in pluginCrossBuild).value
val binVersion = (scalaBinaryVersion in pluginCrossBuild).value
val cross = id.crossVersionedValue match {
case CrossValue.Disabled => Disabled()
case CrossValue.Full => CrossVersion.full
case CrossValue.Binary => CrossVersion.binary
}
val base = ModuleID(id.groupID, id.name, sv).withCrossVersion(cross)
CrossVersion(scalaV, binVersion)(base).withCrossVersion(Disabled())
},
crossSbtVersions := Vector((sbtVersion in pluginCrossBuild).value),
crossTarget := makeCrossTarget(
target.value,
@ -2512,23 +2529,6 @@ object Defaults extends BuildCommon {
// Missing but core settings
baseDirectory := thisProject.value.base,
target := baseDirectory.value / "target",
// Use (sbtVersion in pluginCrossBuild) to pick the sbt module to depend from the plugin.
// Because `sbtVersion in pluginCrossBuild` can be scoped to project level,
// this setting needs to be set here too.
sbtDependency in pluginCrossBuild := {
val app = appConfiguration.value
val id = app.provider.id
val sv = (sbtVersion in pluginCrossBuild).value
val scalaV = (scalaVersion in pluginCrossBuild).value
val binVersion = (scalaBinaryVersion in pluginCrossBuild).value
val cross = id.crossVersionedValue match {
case CrossValue.Disabled => Disabled()
case CrossValue.Full => CrossVersion.full
case CrossValue.Binary => CrossVersion.binary
}
val base = ModuleID(id.groupID, id.name, sv).withCrossVersion(cross)
CrossVersion(scalaV, binVersion)(base).withCrossVersion(Disabled())
},
bgHashClasspath := !turbo.value,
classLoaderLayeringStrategy := {
if (turbo.value) ClassLoaderLayeringStrategy.AllLibraryJars

View File

@ -26,7 +26,7 @@ object SemanticdbPlugin extends AutoPlugin {
semanticdbEnabled := SysProp.semanticdb,
semanticdbIncludeInJar := false,
semanticdbOptions := List(),
semanticdbVersion := "4.4.0"
semanticdbVersion := "4.4.8"
)
override lazy val projectSettings: Seq[Def.Setting[_]] = Seq(

View File

@ -0,0 +1,6 @@
disablePlugins(plugins.IvyPlugin)
TaskKey[Unit]("check") := {
val pid = projectID.?.value
assert(pid.isEmpty)
}

View File

@ -0,0 +1 @@
> check

View File

@ -28,9 +28,6 @@ lazy val projI = project.enablePlugins(TopC)
// Tests that we can disable an auto-enabled root plugin
lazy val disableAutoNoRequirePlugin = project.disablePlugins(OrgPlugin)
disablePlugins(plugins.IvyPlugin)
check := {
// Ensure organization on root is overridable.
val rorg = (organization).value // Should be None
@ -38,8 +35,7 @@ check := {
// this will pass when the raw disablePlugin works.
val dversion = (projectID in projD).?.value // Should be None
same(dversion, None, "projectID in projD")
val rversion = projectID.?.value // Should be None
same(rversion, None, "projectID")
// Ensure with multiple .sbt files that disabling/enabling works across them
val fDel = (del in Quux in projF).?.value
same(fDel, Some(" Q"), "del in Quux in projF")