[1.x] Respect `scalaOrganization` in compiler bridge resolution (#8732) (#8799)

**Problem**
`scalaOrganization` was ignored during compiler bridge resolution because `ZincLmUtil.getDefaultBridgeModule` hard-coded `ScalaArtifacts.Organization` (`org.scala-lang`).

**Solution**
Add a `scalaOrganization` parameter to `ZincLmUtil` methods, and passing `scalaOrganization` value to those methods.

Generated-by: Claude Opus 4.6

Co-authored-by: Rikito Taniguchi <rikiriki1238@gmail.com>
This commit is contained in:
eugene yokota 2026-02-23 03:12:46 -05:00 committed by GitHub
parent a131470288
commit 97b69bba79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 28 additions and 11 deletions

View File

@ -922,6 +922,7 @@ lazy val zincLmIntegrationProj = (project in file("zinc-lm-integration"))
exclude[IncompatibleMethTypeProblem]("sbt.internal.inc.ZincComponentCompiler*"), exclude[IncompatibleMethTypeProblem]("sbt.internal.inc.ZincComponentCompiler*"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.ZincComponentCompiler*"), exclude[IncompatibleSignatureProblem]("sbt.internal.inc.ZincComponentCompiler*"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.ZincLMHelper.update"), exclude[IncompatibleSignatureProblem]("sbt.internal.inc.ZincLMHelper.update"),
exclude[DirectMissingMethodProblem]("sbt.internal.inc.ZincLmUtil.*"),
), ),
libraryDependencies += launcherInterface, libraryDependencies += launcherInterface,
) )

View File

@ -747,13 +747,15 @@ object Defaults extends BuildCommon {
fetchBridgeBinaryJarTask(sv) fetchBridgeBinaryJarTask(sv)
else Def.task[Option[File]](None) else Def.task[Option[File]](None)
}.value, }.value,
scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule(scalaVersion.value), scalaCompilerBridgeSource := ZincLmUtil
.getDefaultBridgeSourceModule(scalaOrganization.value, scalaVersion.value),
auxiliaryClassFiles ++= { auxiliaryClassFiles ++= {
if (ScalaArtifacts.isScala3(scalaVersion.value)) List(TastyFiles.instance) if (ScalaArtifacts.isScala3(scalaVersion.value)) List(TastyFiles.instance)
else Nil else Nil
}, },
consoleProject / scalaCompilerBridgeBinaryJar := None, consoleProject / scalaCompilerBridgeBinaryJar := None,
consoleProject / scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule( consoleProject / scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule(
ScalaArtifacts.Organization,
appConfiguration.value.provider.scalaProvider.version appConfiguration.value.provider.scalaProvider.version
), ),
classpathOptions := ClasspathOptionsUtil.noboot(scalaVersion.value), classpathOptions := ClasspathOptionsUtil.noboot(scalaVersion.value),
@ -842,6 +844,7 @@ object Defaults extends BuildCommon {
private def fetchBridgeBinaryJarTask(scalaVersion: String): Initialize[Task[Option[File]]] = private def fetchBridgeBinaryJarTask(scalaVersion: String): Initialize[Task[Option[File]]] =
Def.task { Def.task {
val bridgeJar = ZincLmUtil.fetchDefaultBridgeModule( val bridgeJar = ZincLmUtil.fetchDefaultBridgeModule(
scalaOrganization.value,
scalaVersion, scalaVersion,
dependencyResolution.value, dependencyResolution.value,
updateConfiguration.value, updateConfiguration.value,

View File

@ -25,7 +25,7 @@ import sbt.internal.util.Types.const
import sbt.internal.util.{ Attributed, Settings, ~> } import sbt.internal.util.{ Attributed, Settings, ~> }
import sbt.io.{ GlobFilter, IO, Path } import sbt.io.{ GlobFilter, IO, Path }
import sbt.librarymanagement.ivy.{ InlineIvyConfiguration, IvyDependencyResolution, IvyPaths } import sbt.librarymanagement.ivy.{ InlineIvyConfiguration, IvyDependencyResolution, IvyPaths }
import sbt.librarymanagement.{ Configuration, Configurations, Resolver } import sbt.librarymanagement.{ Configuration, Configurations, Resolver, ScalaArtifacts }
import sbt.nio.Settings import sbt.nio.Settings
import sbt.util.{ Logger, Show } import sbt.util.{ Logger, Show }
import xsbti.compile.{ ClasspathOptionsUtil, Compilers } import xsbti.compile.{ ClasspathOptionsUtil, Compilers }
@ -87,7 +87,8 @@ private[sbt] object Load {
componentProvider = app.provider.components, componentProvider = app.provider.components,
secondaryCacheDir = Option(zincDir), secondaryCacheDir = Option(zincDir),
dependencyResolution = dependencyResolution, dependencyResolution = dependencyResolution,
compilerBridgeSource = ZincLmUtil.getDefaultBridgeSourceModule(scalaProvider.version), compilerBridgeSource =
ZincLmUtil.getDefaultBridgeSourceModule(ScalaArtifacts.Organization, scalaProvider.version),
scalaJarsTarget = zincDir, scalaJarsTarget = zincDir,
state.get(BasicKeys.classLoaderCache), state.get(BasicKeys.classLoaderCache),
log = log log = log

View File

@ -0,0 +1 @@
object A

View File

@ -0,0 +1,4 @@
ThisBuild / scalaOrganization := "io.github.scala-wasm"
ThisBuild / scalaVersion := "3.8.3-RC1-wasm-bin-SNAPSHOT"
ThisBuild / resolvers += "Sonatype Central Snapshots" at "https://central.sonatype.com/repository/maven-snapshots/"

View File

@ -0,0 +1 @@
> compile

View File

@ -71,7 +71,12 @@ private[sbt] object ZincComponentCompiler {
override def fetchCompiledBridge(scalaInstance: XScalaInstance, logger: Logger): File = { override def fetchCompiledBridge(scalaInstance: XScalaInstance, logger: Logger): File = {
val scalaVersion = scalaInstance.actualVersion() val scalaVersion = scalaInstance.actualVersion()
val bridgeSources = userProvidedBridgeSources val bridgeSources = userProvidedBridgeSources
.getOrElse(ZincLmUtil.getDefaultBridgeSourceModule(scalaVersion)) .getOrElse(
ZincLmUtil.getDefaultBridgeSourceModule(
sbt.librarymanagement.ScalaArtifacts.Organization,
scalaVersion
)
)
compiledBridge(bridgeSources, scalaInstance, logger) compiledBridge(bridgeSources, scalaInstance, logger)
} }

View File

@ -62,13 +62,14 @@ object ZincLmUtil {
} }
def fetchDefaultBridgeModule( def fetchDefaultBridgeModule(
scalaOrganization: String,
scalaVersion: String, scalaVersion: String,
dependencyResolution: DependencyResolution, dependencyResolution: DependencyResolution,
updateConfiguration: UpdateConfiguration, updateConfiguration: UpdateConfiguration,
warningConfig: UnresolvedWarningConfiguration, warningConfig: UnresolvedWarningConfiguration,
logger: Logger logger: Logger
): File = { ): File = {
val bridgeModule = getDefaultBridgeModule(scalaVersion) val bridgeModule = getDefaultBridgeModule(scalaOrganization, scalaVersion)
val descriptor = dependencyResolution.wrapDependencyInModule(bridgeModule) val descriptor = dependencyResolution.wrapDependencyInModule(bridgeModule)
dependencyResolution dependencyResolution
.update(descriptor, updateConfiguration, warningConfig, logger) .update(descriptor, updateConfiguration, warningConfig, logger)
@ -86,14 +87,14 @@ object ZincLmUtil {
.getOrElse(throw new MessageOnlyException(s"Missing $bridgeModule")) .getOrElse(throw new MessageOnlyException(s"Missing $bridgeModule"))
} }
def getDefaultBridgeModule(scalaVersion: String): ModuleID = { def getDefaultBridgeModule(scalaOrganization: String, scalaVersion: String): ModuleID = {
if (ScalaArtifacts.isScala3(scalaVersion)) { if (ScalaArtifacts.isScala3(scalaVersion)) {
ModuleID(ScalaArtifacts.Organization, "scala3-sbt-bridge", scalaVersion) ModuleID(scalaOrganization, "scala3-sbt-bridge", scalaVersion)
.withConfigurations(Some(Compile.name)) .withConfigurations(Some(Compile.name))
} else if (VersionNumber(scalaVersion).matchesSemVer( } else if (VersionNumber(scalaVersion).matchesSemVer(
SemanticSelector(s"=2.13 >=$scala2SbtBridgeStart") SemanticSelector(s"=2.13 >=$scala2SbtBridgeStart")
)) { )) {
ModuleID(ScalaArtifacts.Organization, "scala2-sbt-bridge", scalaVersion) ModuleID(scalaOrganization, "scala2-sbt-bridge", scalaVersion)
.withConfigurations(Some(Compile.name)) .withConfigurations(Some(Compile.name))
} else { } else {
val compilerBridgeId = scalaVersion match { val compilerBridgeId = scalaVersion match {
@ -108,6 +109,6 @@ object ZincLmUtil {
} }
} }
def getDefaultBridgeSourceModule(scalaVersion: String): ModuleID = def getDefaultBridgeSourceModule(scalaOrganization: String, scalaVersion: String): ModuleID =
getDefaultBridgeModule(scalaVersion).sources() getDefaultBridgeModule(scalaOrganization, scalaVersion).sources()
} }

View File

@ -64,7 +64,7 @@ abstract class IvyBridgeProviderSpecification
case Some(v: String) => v case Some(v: String) => v
case _ => throw new IllegalStateException("No zinc version specified") case _ => throw new IllegalStateException("No zinc version specified")
} }
val bridge0 = ZincLmUtil.getDefaultBridgeSourceModule(scalaVersion) val bridge0 = ZincLmUtil.getDefaultBridgeSourceModule(ScalaArtifacts.Organization, scalaVersion)
// redefine the compiler bridge version // redefine the compiler bridge version
// using the version of zinc used during testing // using the version of zinc used during testing
// this way when building with zinc as a source dependency // this way when building with zinc as a source dependency