-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scala 3 without Scala 2.13 toolchain (#1383)
## Motivation Until now Ammonite for Scala 3 was compiled using a mix of the Scala 2.13 and the Scala 3 compiler. This was great since it allowed us to have Ammonite on Scala 3 before `fastparse`, `mainargs` and other libraries were even supported on Scala 3, or they were not on par with their Scala 2.13 counterpart. Now that the ecosystem has caught up with Scala 3, we can avoid using Scala 2.13 and do everything with Scala 3. This has the benefit that now all the classpath contains only Scala 3 libraries and we can finally invoke Scala 3 macros in the included libraries like `upickle`. Also, the build gets much simpler since we don't have to do tricks to swap dependencies at runtime and manually remove transitive dependencies. The only dependency that still is on Scala 2.13 is scalameta `common`, for which we still force the Scala 3 version of its `sourcecode` dependency to avoid double dependencies at runtime. ## uPickle macros on Scala 3 <img width="867" alt="upickle" src="https://github.com/com-lihaoyi/Ammonite/assets/5793054/05817a4a-58f7-4e33-9fb5-f829590911df"> ## Breaking changes - Drop support for Scala 3.1 - Drop support for Scala 2.13.0 - Scala 3 artifacts don't have the `-cross` naming convention anymore but are just like Scala 2 artifacts except for the `_3` or `_3.x.y` suffix - `ammonite.util.Bind` now depends on [typename](https://github.com/tpolecat/typename) instead of scala-reflect (which doesn't have a Scala 3 counterpart - `scala-java8-compat` updated to `1.0.2` - `mainargs` updated to `0.5.4` - `requests` updated to `0.8.0` - `interp.api.APIHolder.value` is now `final` - `typeOf` removed from Scala 3 API (was not supported already) - Vararg command line arguments now use `mainargs.Leftover`
- Loading branch information
Showing
70 changed files
with
422 additions
and
696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ out | |
.bloop | ||
.vscode | ||
.metals | ||
.bsp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.10.11 | ||
0.10.13 |
11 changes: 0 additions & 11 deletions
11
amm/compiler/src/main/scala-3.0-3.1/ammonite/compiler/CompatibilityParser.scala
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
amm/compiler/src/main/scala-3.0-only/ammonite/compiler/internal/CompilerHelper.scala
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
amm/compiler/src/main/scala-3.0.0-3.1.2/dotty/ammonite/compiler/AmmCompletionExtras.scala
This file was deleted.
Oops, something went wrong.
73 changes: 0 additions & 73 deletions
73
amm/compiler/src/main/scala-3.0.0/ammonite/compiler/DottyParser.scala
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
amm/repl/api/src/main/scala-2/ammonite/repl/FullReplAPIScalaVersionSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ammonite.repl | ||
|
||
import scala.reflect.runtime.universe._ | ||
|
||
trait FullReplAPIScalaVersionSpecific { | ||
|
||
def typeOf[T: WeakTypeTag] = scala.reflect.runtime.universe.weakTypeOf[T] | ||
def typeOf[T: WeakTypeTag](t: => T) = scala.reflect.runtime.universe.weakTypeOf[T] | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
amm/repl/api/src/main/scala-2/ammonite/repl/api/ReplAPIScalaVersionSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package ammonite.repl.api | ||
|
||
import scala.reflect.runtime.universe._ | ||
|
||
trait ReplAPIScalaVersionSpecific { | ||
|
||
/** | ||
* Get the `Type` object of [[T]]. Useful for finding | ||
* what its methods are and what you can do with it | ||
*/ | ||
def typeOf[T: WeakTypeTag]: Type | ||
|
||
/** | ||
* Get the `Type` object representing the type of `t`. Useful | ||
* for finding what its methods are and what you can do with it | ||
* | ||
*/ | ||
def typeOf[T: WeakTypeTag](t: => T): Type | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
amm/repl/api/src/main/scala-3/ammonite/repl/FullReplAPIScalaVersionSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package ammonite.repl | ||
|
||
trait FullReplAPIScalaVersionSpecific |
3 changes: 3 additions & 0 deletions
3
amm/repl/api/src/main/scala-3/ammonite/repl/api/ReplAPIScalaVersionSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package ammonite.repl.api | ||
|
||
trait ReplAPIScalaVersionSpecific |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
amm/repl/src/main/scala-2/ammonite/main/DefaultsScalaVersionSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ammonite.main | ||
|
||
import ammonite.util.{ImportData, Imports} | ||
|
||
private[main] trait DefaultsScalaVersionSpecific { | ||
val replImports = Imports( | ||
ImportData("""ammonite.repl.ReplBridge.value.{ | ||
codeColorsImplicit, | ||
tprintColorsImplicit, | ||
show, | ||
typeOf | ||
}""") | ||
) | ||
} |
13 changes: 13 additions & 0 deletions
13
amm/repl/src/main/scala-3/ammonite/main/DefaultsScalaVersionSpecific.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ammonite.main | ||
|
||
import ammonite.util.{ImportData, Imports} | ||
|
||
private[main] trait DefaultsScalaVersionSpecific { | ||
val replImports = Imports( | ||
ImportData("""ammonite.repl.ReplBridge.value.{ | ||
codeColorsImplicit, | ||
tprintColorsImplicit, | ||
show | ||
}""") | ||
) | ||
} |
Oops, something went wrong.