Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publishing for 2.13.16 and 3.6.3 #1603

Merged
merged 9 commits into from
Jan 28, 2025
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
10 changes: 5 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ jobs:
command: 'terminal.__.test'

- java-version: 11
command: 'sshd[{2.12.20,2.13.15,3.3.4,3.4.3,3.5.1}].__.test'
command: 'sshd[{2.12.20,2.13.16,3.3.4,3.4.3,3.5.1,3.6.3}].__.test'

- java-version: 11
command: 'amm.repl[2.12.{9,14,20}].__.test'
- java-version: 17
command: 'amm.repl[2.13.{4,9,15}].__.test'
command: 'amm.repl[2.13.{4,9,16}].__.test'
- java-version: 21
command: 'amm.repl[{3.3.4,3.4.3,3.5.1}].__.test'
command: 'amm.repl[{3.3.4,3.4.3,3.5.1,3.6.3}].__.test'

- java-version: 11
command: 'amm[2.12.{9,14,20}].__.test'
- java-version: 17
command: 'amm[2.13.{4,9,15}].__.test'
command: 'amm[2.13.{4,9,16}].__.test'
- java-version: 21
command: 'amm[{3.3.4,3.4.3,3.5.1}].__.test'
command: 'amm[{3.3.4,3.4.3,3.5.1,3.6.3}].__.test'

runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions amm/compiler/src/main/scala-2/ammonite/compiler/Pressy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ object Pressy {
}

def complete(snippetIndex: Int, previousImports: String, snippet: String) = {
val prefix = previousImports + newLine + "object AutocompleteWrapper{" + newLine
val suffix = newLine + "}"
val prefix = previousImports + newLine + "object AutocompleteWrapper{def main(args: Array[String])={" + newLine
val suffix = newLine + "()" + newLine + "}" + "}"
val allCode = prefix + snippet + suffix
val index = snippetIndex + prefix.length

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package ammonite.compiler

import dotty.tools.dotc
import dotc.ast.untpd
import dotc.core.Contexts.Context
import dotc.core.Flags
import dotc.core.StdNames.nme
import dotc.parsing.Parsers.{Location, Parser}
import dotc.parsing.Tokens
import dotc.reporting.IllegalStartOfStatement
import dotc.util.SourceFile

import scala.collection.mutable

class DottyParser(source: SourceFile)(using Context) extends Parser(source) with CompatibilityParser {

// From
// https://github.com/lampepfl/dotty/blob/3.0.0-M3/
// compiler/src/dotty/tools/dotc/parsing/Parsers.scala/#L67-L71
extension (buf: mutable.ListBuffer[untpd.Tree])
def +++=(x: untpd.Tree) = x match {
case x: untpd.Thicket => buf ++= x.trees
case x => buf += x
}

private val oursLocalModifierTokens = Tokens.localModifierTokens + Tokens.PRIVATE

override def localDef(
start: Int,
implicitMods: untpd.Modifiers = untpd.EmptyModifiers
): untpd.Tree = {
var mods = defAnnotsMods(oursLocalModifierTokens)
for (imod <- implicitMods.mods) mods = addMod(mods, imod)
if (mods.is(Flags.Final))
// A final modifier means the local definition is "class-like".
// FIXME: Deal with modifiers separately
tmplDef(start, mods)
else
defOrDcl(start, mods)
}

// Adapted from
// https://github.com/lampepfl/dotty/blob/3.2.0/
// compiler/src/dotty/tools/dotc/parsing/Parsers.scala#L4075-L4094
// Unlike it, we accept private modifiers for top-level definitions.
override def blockStatSeq(outermost: Boolean = false): List[untpd.Tree] = checkNoEscapingPlaceholders {
val stats = new mutable.ListBuffer[untpd.Tree]
while
var empty = false
if (in.token == Tokens.IMPORT)
stats ++= compatibilityImportClause()
else if (isExprIntro)
stats += expr(Location.InBlock)
else if in.token == Tokens.IMPLICIT && !in.inModifierPosition() then
stats += closure(
in.offset,
Location.InBlock,
modifiers(scala.collection.immutable.BitSet(Tokens.IMPLICIT))
)
else if isIdent(nme.extension) && followingIsExtension() then
stats += extension()
else if isDefIntro(oursLocalModifierTokens, excludedSoftModifiers = Set(nme.`opaque`)) then
stats +++= localDef(in.offset)
else
empty = true
statSepOrEnd(stats, noPrevStat = empty, altEnd = Tokens.CASE)
do ()
stats.toList
}
}
19 changes: 14 additions & 5 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@ val commitsSinceTaggedVersion = latestTaggedVersion match {
val scala2_12Versions = 9.to(20)
// .dropWhile(v => isJava21 && v < 18)
.map(v => s"2.12.${v}")
val scala2_13Versions = 2.to(15)
val scala2_13Versions = 2.to(16)
// .dropWhile(v => isJava21 && v < 11)
.map(v => s"2.13.${v}")
// TODO: We can't have 3.4.0 & 3.4.1 until we solve https://github.com/com-lihaoyi/Ammonite/issues/1395
val scala33Versions = Seq("3.3.4")
val scala34Versions = Seq("3.4.2", "3.4.3")
val scala35Versions = Seq("3.5.0", "3.5.1")
val scala36Versions = Seq("3.6.2", "3.6.3")

val scala2Versions = scala2_12Versions ++ scala2_13Versions
val scala3Versions = scala33Versions ++ scala34Versions ++ scala35Versions
val scala3Versions = scala33Versions ++ scala34Versions ++ scala35Versions ++ scala36Versions

val binCrossScalaVersions =
Seq(scala2_12Versions.last, scala2_13Versions.last, scala33Versions.last)
Expand All @@ -81,7 +82,8 @@ val assemblyCrossScalaVersions = Seq(
scala2_13Versions.last,
scala33Versions.last,
scala34Versions.last,
scala35Versions.last
scala35Versions.last,
scala36Versions.last
)
def isScala2_12_10OrLater(sv: String): Boolean = {
(sv.startsWith("2.12.") && sv.stripPrefix("2.12.").length > 1) || sv.startsWith("2.13.")
Expand Down Expand Up @@ -238,7 +240,7 @@ trait AmmInternalModule extends CrossSbtModule with Bloop.Module {
Seq(PathRef(millSourcePath / "src" / "main" / "scala-2.13-or-3"))
else Nil
val extraDir5 =
if (sv.startsWith("3.5"))
if (sv.startsWith("3.5") || sv.startsWith("3.6"))
Seq(PathRef(millSourcePath / "src" / "main" / "scala-3.5.0+"))
else if (sv.startsWith("3.4"))
if (sv.stripPrefix("3.4.").toInt < 2)
Expand All @@ -250,8 +252,15 @@ trait AmmInternalModule extends CrossSbtModule with Bloop.Module {
else if (sv.startsWith("3"))
Seq(PathRef(millSourcePath / "src" / "main" / "scala-3.0.0-3.3.1"))
else Nil
val extraDir6 =
if (sv.startsWith("3"))
if (sv.startsWith("3.6.") && sv.stripPrefix("3.6.").toInt >= 3)
Seq(PathRef(millSourcePath / "src" / "main" / "scala-3.6.3+"))
else
Seq(PathRef(millSourcePath / "src" / "main" / "scala-3.0.0-3.6.2"))
else Nil

super.sources() ++ extraDir ++ extraDir2 ++ extraDir3 ++ extraDir4 ++ extraDir5
super.sources() ++ extraDir ++ extraDir2 ++ extraDir3 ++ extraDir4 ++ extraDir5 ++ extraDir6
}
def externalSources = T {
resolveDeps(allBoundIvyDeps, sources = true)()
Expand Down
4 changes: 4 additions & 0 deletions readme/Footer.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@


@sect{Changelog}
@sect{3.0.1}
@ul
@li
Support for Scala 2.13.16, 3.3.4
@sect{3.0.0}
@ul
@li
Expand Down
12 changes: 0 additions & 12 deletions readme/Index.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,6 @@
want to run it later, save it into some @sect.ref{Scala Scripts} and run
those later.

@p
For a video overview of the project and it's motivation, check out this talk:

@iframe(
src := "https://player.vimeo.com/video/148552858",
width := 800,
height := 600,
attr("frameborder") := 0,
attr("webkitallowfullscreen") := 1,
attr("mozallowfullscreen") := 1,
attr("allowfullscreen") := 1
)
@p
If you are already working in Scala,
you no longer have to drop down to Python or Bash for your scripting needs:
Expand Down
Loading