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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1717,9 +1717,6 @@ jobs:
- name: Check native-image config format
if: env.SHOULD_RUN == 'true'
run: ./mill -i __.checkNativeImageConfFormat
- name: Check Ammonite availability
if: env.SHOULD_RUN == 'true'
run: ./mill -i 'dummy.amm[_].resolvedRunMvnDeps'
- name: Check for cross Scala version conflicts
if: env.SHOULD_RUN == 'true'
run: .github/scripts/check-cross-version-deps.sc
Expand Down
25 changes: 1 addition & 24 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,7 @@ trait GenerateReferenceDoc extends CrossSbtModule
}

object dummy extends LocatedInModules {
// dummy projects to get scala steward updates for Ammonite and scalafmt, whose
// versions are used in the fmt and repl commands, and ensure Ammonite is available
// for all Scala versions we support.
object amm extends Cross[Amm](Scala.listMaxAmmoniteScalaVersion)
trait Amm extends Cross.Module[String] with CrossScalaModule {
override def crossScalaVersion: String = crossValue
override def mvnDeps: T[Seq[Dep]] = {
val ammoniteDep =
if (crossValue == Scala.scala3Lts) Deps.ammoniteForScala3Lts
else Deps.ammonite
Seq(ammoniteDep)
}
}
// dummy project to get scala-steward updates for scalafmt, whose version is used in the fmt command
object scalafmt extends ScalaModule {
override def scalaVersion: T[String] = Scala.defaultInternal
override def mvnDeps: T[Seq[Dep]] = Seq(
Expand Down Expand Up @@ -516,8 +504,6 @@ trait Core extends ScalaCliCrossSbtModule
| def jmhCoreModule = "${Deps.jmhCore.dep.module.name.value}"
| def jmhGeneratorBytecodeModule = "${Deps.jmhGeneratorBytecode.dep.module.name.value}"
|
| def ammoniteVersion = "${Deps.Versions.ammonite}"
| def ammoniteVersionForScala3Lts = "${Deps.Versions.ammoniteForScala3Lts}"
| def millVersion = "${BuildInfo.millVersion}"
| def maxScalaNativeForMillExport = "${Deps.Versions.maxScalaNativeForMillExport}"
|
Expand Down Expand Up @@ -858,8 +844,6 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers
| def pythonInterfaceVersion = "${Deps.pythonInterface.dep.versionConstraint.asString}"
| def launcherTypeResourcePath = "${launcherTypeResourcePath.toString}"
| def defaultFilesResourcePath = "$defaultFilesResourcePath"
| def maxAmmoniteScala3Version = "${Scala.maxAmmoniteScala3Version}"
| def maxAmmoniteScala3LtsVersion = "${Scala.maxAmmoniteScala3LtsVersion}"
|}
|""".stripMargin
if (!os.isFile(dest) || os.read(dest) != code)
Expand All @@ -881,8 +865,6 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers
| def scalaJsVersion = "${Scala.scalaJs}"
| def scalaJsCliVersion = "${Scala.scalaJsCli}"
| def scalaNativeVersion = "${Deps.nativeTools.dep.versionConstraint.asString}"
| def ammoniteVersion = "${Deps.Versions.ammonite}"
| def ammoniteVersionForScala3Lts = "${Deps.Versions.ammoniteForScala3Lts}"
| def defaultScalafmtVersion = "${Deps.scalafmtCli.dep.versionConstraint.asString}"
| def defaultGraalVMJavaVersion = "${deps.graalVmJavaVersion}"
| def defaultGraalVMVersion = "${deps.graalVmCommunityVersion}"
Expand Down Expand Up @@ -1095,10 +1077,6 @@ trait CliIntegration extends SbtModule
.mkString(", ")})
| def scala38MinJavaVersion = ${Java.minimumScala38Java}
| def defaultScalafmtVersion = "${Deps.scalafmtCli.dep.versionConstraint.asString}"
| def maxAmmoniteScala212Version = "${Scala.maxAmmoniteScala212Version}"
| def maxAmmoniteScala213Version = "${Scala.maxAmmoniteScala213Version}"
| def maxAmmoniteScala3Version = "${Scala.maxAmmoniteScala3Version}"
| def maxAmmoniteScala3LtsVersion = "${Scala.maxAmmoniteScala3LtsVersion}"
| def legacyScala3Versions = Seq(${Scala.legacyScala3Versions.map(p =>
s"\"$p\""
).mkString(", ")})
Expand All @@ -1108,7 +1086,6 @@ trait CliIntegration extends SbtModule
| def scalaNativeVersion04 = "${Deps.Versions.scalaNative04}"
| def scalaNativeVersion05 = "${Deps.Versions.scalaNative05}"
| def semanticDbJavacPluginVersion = "${Deps.semanticDbJavac.dep.versionConstraint.asString}"
| def ammoniteVersion = "${Deps.ammonite.dep.versionConstraint.asString}"
| def defaultGraalVMJavaVersion = "${deps.graalVmJavaVersion}"
| def defaultGraalVMVersion = "${deps.graalVmCommunityVersion}"
| def runnerScala30LegacyVersion = "${Cli.runnerScala30LegacyVersion}"
Expand Down
52 changes: 0 additions & 52 deletions modules/build/src/main/scala/scala/build/ReplArtifacts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,58 +31,6 @@ final case class ReplArtifacts(
}

object ReplArtifacts {
// TODO In order to isolate more Ammonite dependencies, we'd need to get two class paths:
// - a shared one, with ammonite-repl-api, ammonite-compiler, and dependencies
// - an Ammonite-specific one, with the other ammonite JARs
// Then, use the coursier-bootstrap library to generate a launcher creating to class loaders,
// with each of those class paths, and run Ammonite with this launcher.
// This requires to change this line in Ammonite, https://github.com/com-lihaoyi/Ammonite/blob/0f0d597f04e62e86cbf76d3bd16deb6965331470/amm/src/main/scala/ammonite/Main.scala#L99,
// to
// val contextClassLoader = classOf[ammonite.repl.api.ReplAPI].getClassLoader
// so that only the first loader is exposed to users in Ammonite.
def ammonite(
scalaParams: ScalaParameters,
ammoniteVersion: String,
dependencies: Seq[AnyDependency],
extraClassPath: Seq[os.Path],
extraSourceJars: Seq[os.Path],
extraRepositories: Seq[Repository],
logger: Logger,
cache: FileCache[Task],
addScalapy: Option[String]
): Either[BuildException, ReplArtifacts] = either {
val scalapyDeps =
addScalapy.map(ver => dep"${Artifacts.scalaPyOrganization(ver)}::scalapy-core::$ver").toSeq
val allDeps = dependencies ++ Seq(dep"com.lihaoyi:::ammonite:$ammoniteVersion") ++ scalapyDeps
val replArtifacts = Artifacts.artifacts(
allDeps.map(Positioned.none),
extraRepositories,
Some(scalaParams),
logger,
cache.withMessage(s"Downloading Ammonite $ammoniteVersion")
)
val replSourceArtifacts = Artifacts.artifacts(
allDeps.map(Positioned.none),
extraRepositories,
Some(scalaParams),
logger,
cache.withMessage(s"Downloading Ammonite $ammoniteVersion sources"),
classifiersOpt = Some(Set("sources"))
)
ReplArtifacts(
replArtifacts = value(replArtifacts) ++ value(replSourceArtifacts),
depArtifacts =
Nil, // amm does not support a -cp option, deps are passed directly to Ammonite cp
extraClassPath = extraClassPath,
extraSourceJars = extraSourceJars,
replMainClass = "ammonite.Main",
replJavaOpts = Nil,
addSourceJars = true,
includeExtraCpOnReplCp =
true // extra cp & source jars have to be passed directly to Ammonite cp
)
}

def default(
scalaParams: ScalaParameters,
dependencies: Seq[AnyDependency],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class SourcesTests extends TestUtil.ScalaCliBuildSuite {
test("dependencies in .scala - using URL with query parameters") {
val testInputs = TestInputs(
os.rel / "something.scala" ->
"""| //> using file http://github.com/VirtusLab/scala-cli/blob/main/modules/dummy/amm/src/main/scala/AmmDummy.scala?version=3
"""| //> using file http://github.com/VirtusLab/scala-cli/blob/main/modules/core/src/main/scala/scala/build/internals/Name.scala?version=3
|
|object Main {
|}
Expand All @@ -159,7 +159,7 @@ class SourcesTests extends TestUtil.ScalaCliBuildSuite {

expect(sources.paths.length == 1)
expect(sources.inMemory.length == 1)
expect(sources.inMemory.head.generatedRelPath.last == "AmmDummy.scala")
expect(sources.inMemory.head.generatedRelPath.last == "Name.scala")
}
}

Expand Down
Loading
Loading