Skip to content

Commit

Permalink
Enable buildInfoStaticCompiled on ScalaJSModule and ScalaNativeModu…
Browse files Browse the repository at this point in the history
…le (#2562)

Status quo fails linking with a cryptic error message where previous
version was working out of the box.
This sets the default to the static behavior on Scala.js and Scala
Native so users don't need to care.

---------

Co-authored-by: Your Name <[email protected]>
  • Loading branch information
lolgab and lihaoyi authored Jun 4, 2023
1 parent c9e2e07 commit 87cd32a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,7 @@ object contrib extends Module {
}

object buildinfo extends ContribModule {
def compileModuleDeps = Seq(scalalib)
def testModuleDeps = super.testModuleDeps ++ Seq(scalalib)
def moduleDeps = Seq(scalalib, scalajslib, scalanativelib)
}

object proguard extends ContribModule {
Expand Down
8 changes: 7 additions & 1 deletion contrib/buildinfo/src/mill/contrib/buildinfo/BuildInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package mill.contrib.buildinfo

import mill.{PathRef, T}
import mill.scalalib.{JavaModule, ScalaModule}
import mill.scalanativelib.ScalaNativeModule
import mill.scalajslib.ScalaJSModule

trait BuildInfo extends JavaModule {

Expand All @@ -20,7 +22,11 @@ trait BuildInfo extends JavaModule {
* rather than the default behavior of storing them as a JVM resource. Needed
* to use BuildInfo on Scala.js which does not support JVM resources
*/
def buildInfoStaticCompiled: Boolean = false
def buildInfoStaticCompiled: Boolean = this match {
case _: ScalaJSModule => true
case _: ScalaNativeModule => true
case _ => false
}

/**
* A mapping of key-value pairs to pass from the Build script to the
Expand Down

0 comments on commit 87cd32a

Please sign in to comment.