Skip to content

Commit

Permalink
SBT: shade only for JVM (fix) (#3283)
Browse files Browse the repository at this point in the history
The previous attempt would incorrectly enable the ShadingPlugin even if
no shading was expected to occur, which led to it being run with default
parameters and erroring out.
  • Loading branch information
kitbellew committed Jul 26, 2023
1 parent 749e424 commit cf1f477
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ lazy val common = crossProject(JSPlatform, JVMPlatform, NativePlatform)

lazy val trees = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("scalameta/trees"))
.enablePlugins(ShadingPlugin)
.settings(
sharedSettings,
description := "Scalameta abstract syntax trees",
Expand All @@ -203,7 +202,7 @@ lazy val trees = crossProject(JSPlatform, JVMPlatform, NativePlatform)
})
)
.configureCross(crossPlatformPublishSettings)
.jvmSettings(shadingSettings)
.configureCross(crossPlatformShading)
.jsSettings(
commonJsSettings
)
Expand All @@ -212,7 +211,6 @@ lazy val trees = crossProject(JSPlatform, JVMPlatform, NativePlatform)

lazy val parsers = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("scalameta/parsers"))
.enablePlugins(ShadingPlugin)
.settings(
sharedSettings,
description := "Scalameta APIs for parsing and their baseline implementation",
Expand All @@ -225,7 +223,7 @@ lazy val parsers = crossProject(JSPlatform, JVMPlatform, NativePlatform)
})
)
.configureCross(crossPlatformPublishSettings)
.jvmSettings(shadingSettings)
.configureCross(crossPlatformShading)
.jsConfigure(
_.enablePlugins(NpmPackagePlugin)
)
Expand Down Expand Up @@ -269,7 +267,6 @@ def mergedModule(projects: File => List[File]): List[Setting[_]] = List(

lazy val scalameta = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("scalameta/scalameta"))
.enablePlugins(ShadingPlugin)
.settings(
sharedSettings,
description := "Scalameta umbrella module that includes all public APIs",
Expand All @@ -291,8 +288,8 @@ lazy val scalameta = crossProject(JSPlatform, JVMPlatform, NativePlatform)
})
)
.configureCross(crossPlatformPublishSettings)
.configureCross(crossPlatformShading)
.jvmSettings(
shadingSettings,
Compile / unmanagedSourceDirectories ++= List(
(ThisBuild / baseDirectory).value / "semanticdb" / "metacp",
(ThisBuild / baseDirectory).value / "semanticdb" / "symtab"
Expand Down Expand Up @@ -885,4 +882,9 @@ def crossPlatformPublishSettings(project: sbtcrossproject.CrossProject) =
if (settings.isEmpty) res else res.configurePlatform(platform)(_.settings(settings))
}

def crossPlatformShading(project: sbtcrossproject.CrossProject) =
project.jvmConfigure(
_.enablePlugins(ShadingPlugin).settings(shadingSettings)
)

val publishJVMSettings = platformPublishSettings(JVMPlatform)

0 comments on commit cf1f477

Please sign in to comment.