Skip to content

Commit 80d6817

Browse files
authored
Merge pull request #2017 from romanowski/smaller-cli-assembly
Clean up build
2 parents 79f7bce + ccd25b6 commit 80d6817

File tree

3 files changed

+17
-43
lines changed

3 files changed

+17
-43
lines changed

build.sc

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import $file.project.publish, publish.{ghOrg, ghName, ScalaCliPublishModule, org
66
import $file.project.settings, settings.{
77
CliLaunchers,
88
FormatNativeImageConf,
9-
HasMacroAnnotations,
109
HasTests,
1110
LocalRepo,
1211
PublishLocalNoFluff,
@@ -42,14 +41,21 @@ object cli extends Cli
4241

4342
// Publish a bootstrapped, executable jar for a restricted environments
4443
object cliBootstrapped extends ScalaCliPublishModule {
45-
override def jar = cli.assembly()
44+
override def unmanagedClasspath = T(cli.nativeImageClassPath())
45+
override def jar = assembly()
46+
47+
import mill.modules.Assembly
48+
49+
override def assemblyRules = Seq(
50+
Assembly.Rule.ExcludePattern(".*\\.tasty"),
51+
Assembly.Rule.ExcludePattern(".*\\.semanticdb")
52+
) ++ super.assemblyRules
4653
}
4754

4855
object `specification-level` extends Cross[SpecificationLevel](Scala.all: _*)
4956
object `build-macros` extends BuildMacros
5057
object config extends Cross[Config](Scala.all: _*)
5158
object options extends Options
52-
object scalaparse extends ScalaParse
5359
object directives extends Directives
5460
object core extends Core
5561
object `build-module` extends Build
@@ -449,10 +455,8 @@ trait Directives extends ScalaCliSbtModule with ScalaCliPublishModule with HasTe
449455
def ivyDeps = super.ivyDeps() ++ Agg(
450456
// Deps.asm,
451457
Deps.bloopConfig,
452-
Deps.jsoniterCore213,
458+
Deps.jsoniterCore,
453459
Deps.pprint,
454-
Deps.scalametaTrees,
455-
Deps.scalaparse,
456460
Deps.usingDirectives
457461
)
458462

@@ -551,11 +555,6 @@ trait Options extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
551555
}
552556
}
553557

554-
trait ScalaParse extends SbtModule with ScalaCliPublishModule {
555-
def ivyDeps = super.ivyDeps() ++ Agg(Deps.scalaparse)
556-
def scalaVersion = Scala.scala213
557-
}
558-
559558
trait Scala3Runtime extends SbtModule with ScalaCliPublishModule {
560559
def ivyDeps = super.ivyDeps()
561560
def scalaVersion = Scala.scala3
@@ -594,7 +593,6 @@ trait Build extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
594593
def millSourcePath = super.millSourcePath / os.up / "build"
595594
def moduleDeps = Seq(
596595
options,
597-
scalaparse,
598596
directives,
599597
`scala-cli-bsp`,
600598
`test-runner`(Scala.scala213), // Depending on version compiled with Scala 3 pulls older stdlib
@@ -612,16 +610,16 @@ trait Build extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
612610
Deps.asm,
613611
Deps.collectionCompat,
614612
Deps.javaClassName,
615-
Deps.jsoniterCore213,
613+
Deps.jsoniterCore,
614+
Deps.scalametaTrees,
616615
Deps.nativeTestRunner,
617616
Deps.osLib,
618617
Deps.pprint,
619618
Deps.scalaJsEnvNodeJs,
620619
Deps.scalaJsTestAdapter,
621-
Deps.scalametaTrees,
622620
Deps.swoval,
623621
Deps.zipInputStream
624-
) ++ (if (scalaVersion().startsWith("3")) Agg() else Agg(Deps.shapeless))
622+
)
625623

626624
def repositoriesTask =
627625
T.task(super.repositoriesTask() ++ deps.customRepositories)
@@ -672,7 +670,7 @@ class SpecificationLevel(val crossScalaVersion: String) extends ScalaCliCrossSbt
672670
}
673671

674672
trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
675-
with HasMacroAnnotations with FormatNativeImageConf {
673+
with FormatNativeImageConf {
676674

677675
def constantsFile = T.persistent {
678676
val dir = T.dest / "constants"
@@ -775,7 +773,7 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
775773
Deps.coursierPublish.exclude((organization, "config_2.13")),
776774
Deps.jimfs, // scalaJsEnvNodeJs pulls jimfs:1.1, whose class path seems borked (bin compat issue with the guava version it depends on)
777775
Deps.jniUtils,
778-
Deps.jsoniterCore213,
776+
Deps.jsoniterCore,
779777
Deps.libsodiumjni,
780778
Deps.metaconfigTypesafe,
781779
Deps.pythonNativeLibs,
@@ -856,7 +854,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
856854
Deps.coursier
857855
.exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-macros")),
858856
Deps.dockerClient,
859-
Deps.jsoniterCore213,
857+
Deps.jsoniterCore,
860858
Deps.libsodiumjni,
861859
Deps.pprint,
862860
Deps.scalaAsync,

project/deps.sc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ object Deps {
117117
def jgit = ivy"org.eclipse.jgit:org.eclipse.jgit:6.4.0.202211300538-r"
118118
def jimfs = ivy"com.google.jimfs:jimfs:1.2"
119119
def jniUtils = ivy"io.get-coursier.jniutils:windows-jni-utils:0.3.3"
120-
def jsoniterCore213 =
121-
ivy"com.github.plokhotnyuk.jsoniter-scala:jsoniter-scala-core_2.13:${Versions.jsoniterScala}"
122120
def jsoniterCore =
123121
ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-core:${Versions.jsoniterScala}"
124122
def jsoniterCoreJava8 =
@@ -156,13 +154,10 @@ object Deps {
156154
def scalametaTrees = ivy"org.scalameta:trees_2.13:${Versions.scalaMeta}"
157155
def scalaPackager = ivy"org.virtuslab:scala-packager_2.13:${Versions.scalaPackager}"
158156
def scalaPackagerCli = ivy"org.virtuslab:scala-packager-cli_2.13:${Versions.scalaPackager}"
159-
// Force using of 2.13 - is there a better way?
160-
def scalaparse = ivy"com.lihaoyi:scalaparse_2.13:2.3.3"
161-
def scalaPy = ivy"dev.scalapy::scalapy-core::0.5.3"
157+
def scalaPy = ivy"dev.scalapy::scalapy-core::0.5.3"
162158
def scalaReflect(sv: String) = ivy"org.scala-lang:scala-reflect:$sv"
163159
def semanticDbJavac = ivy"com.sourcegraph:semanticdb-javac:0.7.4"
164160
def semanticDbScalac = ivy"org.scalameta:::semanticdb-scalac:${Versions.scalaMeta}"
165-
def shapeless = ivy"com.chuusai::shapeless:2.3.9"
166161
def signingCliShared =
167162
ivy"org.virtuslab.scala-cli-signing::shared:${Versions.signingCli}"
168163
// to prevent collisions with scala-cli's case-app version

project/settings.sc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -689,25 +689,6 @@ trait LocalRepo extends Module {
689689

690690
}
691691

692-
trait HasMacroAnnotations extends ScalaModule {
693-
def scalacOptions = T {
694-
val sv = scalaVersion()
695-
val extra =
696-
if (sv.startsWith("2."))
697-
if (sv.startsWith("2.13.")) Seq("-Ymacro-annotations")
698-
else Nil
699-
else Nil
700-
super.scalacOptions() ++ extra
701-
}
702-
def scalacPluginIvyDeps = T {
703-
val sv = scalaVersion()
704-
val extra =
705-
if (sv.startsWith("2.") && !sv.startsWith("2.13.")) Agg(Deps.macroParadise)
706-
else Agg.empty[Dep]
707-
super.scalacPluginIvyDeps() ++ extra
708-
}
709-
}
710-
711692
private def doFormatNativeImageConf(dir: os.Path, format: Boolean): List[os.Path] = {
712693
val sortByName = Set("jni-config.json", "reflect-config.json")
713694
val files = Seq(

0 commit comments

Comments
 (0)