Skip to content

Commit

Permalink
Fix publishDocs, publishExecutable and skipBloop (#1384)
Browse files Browse the repository at this point in the history
publishExecutable was using the binary Scala 3 version, which needs to
be the lowest minor version, currently 3.2 It needs instead use the
latest Scala 3 version.
So this introduces a new list (assemblyCrossScalaVersions) which
contains the last Scala 3 version instead.
The same is used on some modules to skipBloop, since the last Scala 3
version depends on crossFullScalaVersion
  • Loading branch information
lolgab authored Nov 16, 2023
1 parent cf9a7b8 commit 9ccdff7
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 128 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/release1.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Release (1)
name: Release
on:
push:
branches:
- main
- 2.x
jobs:
release1:
release:
strategy:
matrix:
shard: [1, 2, 3, 4, 5]
fail-fast: false
runs-on: ubuntu-latest
env:
SONATYPE_PGP_SECRET: ${{ secrets.SONATYPE_PGP_SECRET }}
Expand All @@ -23,4 +27,4 @@ jobs:
with:
java-version: '8'
- run: test -z "$SONATYPE_PGP_SECRET" || echo "$SONATYPE_PGP_SECRET" | base64 --decode | gpg --import --no-tty --batch --yes
- run: GPG_TTY=$(tty) ./mill -i publishSonatype __.publishArtifacts 1 5
- run: GPG_TTY=$(tty) ./mill -i publishSonatype __.publishArtifacts --shard ${{ matrix.shard }} --divisionCount 5
26 changes: 0 additions & 26 deletions .github/workflows/release2.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/release3.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/release4.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/release5.yml

This file was deleted.

8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ lazy val readme = ScalatexReadme(
url = "https://github.com/com-lihaoyi/Ammonite/tree/master",
source = "Index"
).settings(
scalaVersion := "2.12.3",
scalaVersion := "2.12.18",
libraryDependencies += "com.lihaoyi" %% "fansi" % "0.2.3",
libraryDependencies += "com.lihaoyi" %% "os-lib" % "0.7.3",
envVars in Test := Map(
Test / envVars := Map(
"AMMONITE_ASSEMBLY" -> sys.env("AMMONITE_ASSEMBLY"),
"AMMONITE_SHELL" -> sys.env("AMMONITE_SHELL")
),
fork := true,
baseDirectory in (Compile, run) := (baseDirectory in (Compile, run)).value / "..",
(unmanagedSources in Compile) += file(sys.env("CONSTANTS_FILE"))
Compile / run / baseDirectory := (Compile / run / baseDirectory).value / "..",
(Compile / unmanagedSources) += file(sys.env("CONSTANTS_FILE"))
)
37 changes: 22 additions & 15 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ val scala33Versions = Seq("3.3.0", "3.3.1")
val scala3Versions = scala32Versions ++ scala33Versions

val binCrossScalaVersions = Seq(scala2_12Versions.last, scala2_13Versions.last, scala32Versions.last)
val assemblyCrossScalaVersions = Seq(scala2_12Versions.last, scala2_13Versions.last, scala33Versions.last)
def isScala2_12_10OrLater(sv: String): Boolean = {
(sv.startsWith("2.12.") && sv.stripPrefix("2.12.").length > 1) || sv.startsWith("2.13.")
}
val fullCrossScalaVersions = scala2_12Versions ++ scala2_13Versions ++ scala3Versions

val latestAssemblies = binCrossScalaVersions.map(amm(_).assembly)
val latestAssemblies = assemblyCrossScalaVersions.map(amm(_).assembly)

println("GITHUB REF " + sys.env.get("GITHUB_REF"))

Expand Down Expand Up @@ -116,9 +117,14 @@ object Deps {
}

trait AmmInternalModule extends CrossSbtModule with Bloop.Module with TestModule.Utest{
def skipBloop =
// We need it to be a Boolean, not T[Boolean]
def isCrossFullScalaVersion: Boolean = false
def crossFullScalaVersion = T { isCrossFullScalaVersion }
def skipBloop = {
val versions = if(isCrossFullScalaVersion) assemblyCrossScalaVersions else binCrossScalaVersions
// no need to expose the modules for old Scala versions support in Bloop / Metals
!binCrossScalaVersions.contains(crossScalaVersion)
!versions.contains(crossScalaVersion)
}
def artifactName = T{
"ammonite-" + millOuterCtx.segments.parts.mkString("-").stripPrefix("amm-")
}
Expand Down Expand Up @@ -302,7 +308,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
object runtime extends Cross[RuntimeModule](fullCrossScalaVersions:_*)
class RuntimeModule(val crossScalaVersion: String) extends AmmModule{
def moduleDeps = Seq(amm.util(), interp.api(), amm.repl.api())
def crossFullScalaVersion = true
def isCrossFullScalaVersion = true
def ivyDeps = super.ivyDeps() ++ Agg(
Deps.classPathUtil,
Deps.upickle(crossScalaVersion),
Expand All @@ -315,7 +321,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
object compiler extends Cross[CompilerModule](fullCrossScalaVersions:_*) {
object interface extends Cross[CompilerInterfaceModule](fullCrossScalaVersions:_*)
class CompilerInterfaceModule(val crossScalaVersion: String) extends AmmModule{
def crossFullScalaVersion = true
def isCrossFullScalaVersion = true
def moduleDeps = Seq(amm.util())
def exposedClassPath = T{
runClasspath() ++
Expand All @@ -328,7 +334,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
class CompilerModule(val crossScalaVersion: String) extends AmmModule{
def supports3 = true
def moduleDeps = Seq(amm.compiler.interface(), amm.util(), amm.repl.api())
def crossFullScalaVersion = true
def isCrossFullScalaVersion = true
def ivyDeps = T {
val scalaSpecificDeps =
if (isScala2())
Expand Down Expand Up @@ -362,7 +368,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
object api extends Cross[InterpApiModule](fullCrossScalaVersions:_*)
class InterpApiModule(val crossScalaVersion: String) extends AmmModule with AmmDependenciesResourceFileModule{
def moduleDeps = Seq(amm.compiler.interface(), amm.util())
def crossFullScalaVersion = true
def isCrossFullScalaVersion = true
def dependencyResourceFileName = "amm-interp-api-dependencies.txt"
def ivyDeps = super.ivyDeps() ++ Agg(
Deps.coursierInterface
Expand Down Expand Up @@ -392,7 +398,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
}
class InterpModule(val crossScalaVersion: String) extends AmmModule{
def moduleDeps = Seq(amm.util(), amm.runtime(), amm.compiler.interface())
def crossFullScalaVersion = true
def isCrossFullScalaVersion = true
def ivyDeps = super.ivyDeps() ++ Agg(
Deps.bsp4j,
Deps.fastparse
Expand All @@ -419,7 +425,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){

object api extends Cross[ReplApiModule](fullCrossScalaVersions:_*)
class ReplApiModule(val crossScalaVersion: String) extends AmmModule with AmmDependenciesResourceFileModule{
def crossFullScalaVersion = true
def isCrossFullScalaVersion = true
def dependencyResourceFileName = "amm-dependencies.txt"
def moduleDeps = Seq(amm.util(), interp.api())
def ivyDeps = super.ivyDeps() ++ Agg(
Expand All @@ -442,7 +448,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){

}
class ReplModule(val crossScalaVersion: String) extends AmmModule{
def crossFullScalaVersion = true
def isCrossFullScalaVersion = true
def moduleDeps = Seq(
amm.util(),
amm.runtime(), amm.interp(),
Expand Down Expand Up @@ -491,7 +497,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){

class MainModule(val crossScalaVersion: String) extends AmmModule {

def crossFullScalaVersion = true
def isCrossFullScalaVersion = true

def mainClass = Some("ammonite.AmmoniteMain")

Expand Down Expand Up @@ -660,7 +666,7 @@ class IntegrationModule(val crossScalaVersion: String) extends AmmInternalModule
object sshd extends Cross[SshdModule](fullCrossScalaVersions:_*)
class SshdModule(val crossScalaVersion: String) extends AmmModule{
def moduleDeps = Seq(amm())
def crossFullScalaVersion = true
def isCrossFullScalaVersion = true
def ivyDeps = super.ivyDeps() ++ Agg(
// sshd-core 1.3.0 requires java8
Deps.sshdCore,
Expand Down Expand Up @@ -780,7 +786,7 @@ def publishExecutable() = {
)
}

for ((version, jar) <- binCrossScalaVersions.zip(latestAssemblyJars)) {
for ((version, jar) <- assemblyCrossScalaVersions.zip(latestAssemblyJars)) {
println("MASTER COMMIT: Publishing Executable for Scala " + version)
//Prepare executable

Expand Down Expand Up @@ -810,6 +816,7 @@ def publishExecutable() = {
}

def publishDocs() = {
val ammoniteAssembly = amm(scala2_13Versions.last).assembly
// Disable doc auto-publishing for now, as the recent modularization means we
// need to make significant changes to the readme and that'll time.
if (!isMasterCommit) T.command{
Expand All @@ -820,7 +827,7 @@ def publishDocs() = {
"readme/run",
).call(
env = Map(
"AMMONITE_ASSEMBLY" -> amm(scala2_13Versions.head).assembly().path.toString,
"AMMONITE_ASSEMBLY" -> ammoniteAssembly().path.toString,
"CONSTANTS_FILE" -> generateConstantsFile(returnDirectory = false).toString
)
)
Expand Down Expand Up @@ -876,7 +883,7 @@ def publishDocs() = {

).call(
env = Map(
"AMMONITE_ASSEMBLY" -> amm("2.13.1").assembly().path.toString,
"AMMONITE_ASSEMBLY" -> ammoniteAssembly().path.toString,
"CONSTANTS_FILE" -> constantsFile.toString
)
)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.17
sbt.version=1.9.7
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.3.7")
addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.3.11")

0 comments on commit 9ccdff7

Please sign in to comment.