Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import $file.project.publish, publish.{ghOrg, ghName, ScalaCliPublishModule, org
import $file.project.settings, settings.{
CliLaunchers,
FormatNativeImageConf,
HasMacroAnnotations,
HasTests,
LocalRepo,
PublishLocalNoFluff,
Expand Down Expand Up @@ -42,14 +41,21 @@ object cli extends Cli

// Publish a bootstrapped, executable jar for a restricted environments
object cliBootstrapped extends ScalaCliPublishModule {
override def jar = cli.assembly()
override def unmanagedClasspath = T(cli.nativeImageClassPath())
override def jar = assembly()

import mill.modules.Assembly

override def assemblyRules = Seq(
Assembly.Rule.ExcludePattern(".*\\.tasty"),
Assembly.Rule.ExcludePattern(".*\\.semanticdb")
) ++ super.assemblyRules
}

object `specification-level` extends Cross[SpecificationLevel](Scala.all: _*)
object `build-macros` extends BuildMacros
object config extends Cross[Config](Scala.all: _*)
object options extends Options
object scalaparse extends ScalaParse
object directives extends Directives
object core extends Core
object `build-module` extends Build
Expand Down Expand Up @@ -449,10 +455,8 @@ trait Directives extends ScalaCliSbtModule with ScalaCliPublishModule with HasTe
def ivyDeps = super.ivyDeps() ++ Agg(
// Deps.asm,
Deps.bloopConfig,
Deps.jsoniterCore213,
Deps.jsoniterCore,
Deps.pprint,
Deps.scalametaTrees,
Deps.scalaparse,
Deps.usingDirectives
)

Expand Down Expand Up @@ -551,11 +555,6 @@ trait Options extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
}
}

trait ScalaParse extends SbtModule with ScalaCliPublishModule {
def ivyDeps = super.ivyDeps() ++ Agg(Deps.scalaparse)
def scalaVersion = Scala.scala213
}

trait Scala3Runtime extends SbtModule with ScalaCliPublishModule {
def ivyDeps = super.ivyDeps()
def scalaVersion = Scala.scala3
Expand Down Expand Up @@ -594,7 +593,6 @@ trait Build extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
def millSourcePath = super.millSourcePath / os.up / "build"
def moduleDeps = Seq(
options,
scalaparse,
directives,
`scala-cli-bsp`,
`test-runner`(Scala.scala213), // Depending on version compiled with Scala 3 pulls older stdlib
Expand All @@ -612,16 +610,16 @@ trait Build extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
Deps.asm,
Deps.collectionCompat,
Deps.javaClassName,
Deps.jsoniterCore213,
Deps.jsoniterCore,
Deps.scalametaTrees,
Deps.nativeTestRunner,
Deps.osLib,
Deps.pprint,
Deps.scalaJsEnvNodeJs,
Deps.scalaJsTestAdapter,
Deps.scalametaTrees,
Deps.swoval,
Deps.zipInputStream
) ++ (if (scalaVersion().startsWith("3")) Agg() else Agg(Deps.shapeless))
)

def repositoriesTask =
T.task(super.repositoriesTask() ++ deps.customRepositories)
Expand Down Expand Up @@ -672,7 +670,7 @@ class SpecificationLevel(val crossScalaVersion: String) extends ScalaCliCrossSbt
}

trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
with HasMacroAnnotations with FormatNativeImageConf {
with FormatNativeImageConf {

def constantsFile = T.persistent {
val dir = T.dest / "constants"
Expand Down Expand Up @@ -775,7 +773,7 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
Deps.coursierPublish.exclude((organization, "config_2.13")),
Deps.jimfs, // scalaJsEnvNodeJs pulls jimfs:1.1, whose class path seems borked (bin compat issue with the guava version it depends on)
Deps.jniUtils,
Deps.jsoniterCore213,
Deps.jsoniterCore,
Deps.libsodiumjni,
Deps.metaconfigTypesafe,
Deps.pythonNativeLibs,
Expand Down Expand Up @@ -856,7 +854,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
Deps.coursier
.exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-macros")),
Deps.dockerClient,
Deps.jsoniterCore213,
Deps.jsoniterCore,
Deps.libsodiumjni,
Deps.pprint,
Deps.scalaAsync,
Expand Down
7 changes: 1 addition & 6 deletions project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ object Deps {
def jgit = ivy"org.eclipse.jgit:org.eclipse.jgit:6.4.0.202211300538-r"
def jimfs = ivy"com.google.jimfs:jimfs:1.2"
def jniUtils = ivy"io.get-coursier.jniutils:windows-jni-utils:0.3.3"
def jsoniterCore213 =
ivy"com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13:${Versions.jsoniterScala}"
def jsoniterCore =
ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-core:${Versions.jsoniterScala}"
def jsoniterCoreJava8 =
Expand Down Expand Up @@ -156,13 +154,10 @@ object Deps {
def scalametaTrees = ivy"org.scalameta:trees_2.13:${Versions.scalaMeta}"
def scalaPackager = ivy"org.virtuslab:scala-packager_2.13:${Versions.scalaPackager}"
def scalaPackagerCli = ivy"org.virtuslab:scala-packager-cli_2.13:${Versions.scalaPackager}"
// Force using of 2.13 - is there a better way?
def scalaparse = ivy"com.lihaoyi:scalaparse_2.13:2.3.3"
def scalaPy = ivy"dev.scalapy::scalapy-core::0.5.3"
def scalaPy = ivy"dev.scalapy::scalapy-core::0.5.3"
def scalaReflect(sv: String) = ivy"org.scala-lang:scala-reflect:$sv"
def semanticDbJavac = ivy"com.sourcegraph:semanticdb-javac:0.7.4"
def semanticDbScalac = ivy"org.scalameta:::semanticdb-scalac:${Versions.scalaMeta}"
def shapeless = ivy"com.chuusai::shapeless:2.3.9"
def signingCliShared =
ivy"org.virtuslab.scala-cli-signing::shared:${Versions.signingCli}"
// to prevent collisions with scala-cli's case-app version
Expand Down
19 changes: 0 additions & 19 deletions project/settings.sc
Original file line number Diff line number Diff line change
Expand Up @@ -689,25 +689,6 @@ trait LocalRepo extends Module {

}

trait HasMacroAnnotations extends ScalaModule {
def scalacOptions = T {
val sv = scalaVersion()
val extra =
if (sv.startsWith("2."))
if (sv.startsWith("2.13.")) Seq("-Ymacro-annotations")
else Nil
else Nil
super.scalacOptions() ++ extra
}
def scalacPluginIvyDeps = T {
val sv = scalaVersion()
val extra =
if (sv.startsWith("2.") && !sv.startsWith("2.13.")) Agg(Deps.macroParadise)
else Agg.empty[Dep]
super.scalacPluginIvyDeps() ++ extra
}
}

private def doFormatNativeImageConf(dir: os.Path, format: Boolean): List[os.Path] = {
val sortByName = Set("jni-config.json", "reflect-config.json")
val files = Seq(
Expand Down