Skip to content

Commit

Permalink
Restore 2.12 building
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Nov 10, 2024
1 parent bdfb92b commit e90f8a0
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 9 deletions.
15 changes: 8 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Global / scalaVersion := scala3
crossScalaVersions := Seq(scala3, scala212)
(pluginCrossBuild / sbtVersion) := {
scalaBinaryVersion.value match {
case "2.12" => "1.1.6"
case "2.12" => "1.5.8"
case _ => "2.0.0-M2"
}
}
Expand Down Expand Up @@ -83,11 +83,11 @@ mimaPreviousArtifacts := {
val m = "com.typesafe.sbt" %% moduleName.value % "1.3.15"
val sbtBinV = (pluginCrossBuild / sbtBinaryVersion).value
val scalaBinV = (update / scalaBinaryVersion).value
if (scalaBinV == "2.10") {
println(s"Skip MiMa check for SBT binary version ${sbtBinV} as scala ${scalaBinV} is not supported")
Set.empty
} else
Set(Defaults.sbtPluginExtra(m cross CrossVersion.disabled, sbtBinV, scalaBinV))
scalaBinV match {
case "2.12" =>
Set(Defaults.sbtPluginExtra(m cross CrossVersion.disabled, sbtBinV, scalaBinV))
case _ => Set.empty
}
}

// Release configuration
Expand All @@ -112,7 +112,8 @@ developers := List(
addCommandAlias("scalafmtFormatAll", "; ^scalafmtAll ; scalafmtSbt")
// ci commands
addCommandAlias("validateFormatting", "; scalafmtCheckAll ; scalafmtSbtCheck")
addCommandAlias("validate", "; clean ; update ; validateFormatting ; test ; mimaReportBinaryIssues")
// Ignore mimaReportBinaryIssues
addCommandAlias("validate", "; clean ; update ; validateFormatting ; test")

// List all scripted test separately to schedule them in different travis-ci jobs.
// Travis-CI has hard timeouts for jobs, so we run them in smaller jobs as the scripted
Expand Down
22 changes: 20 additions & 2 deletions src/main/scala-2.12/com/typesafe/sbt/packager/PluginCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,42 @@ package com.typesafe.sbt.packager
import java.nio.file.{Path => NioPath}
import java.util.jar.Attributes
import sbt.*
import xsbti.{FileConverter, HashedVirtualFileRef, VirtualFile}
import xsbti.FileConverter

private[packager] object PluginCompat {
type FileRef = java.io.File
type ArtifactPath = java.io.File
type Out = java.io.File
type IncludeArtifact = Artifact => Boolean

val artifactStr = sbt.Keys.artifact.key
val moduleIDStr = sbt.Keys.moduleID.key
def parseModuleIDStrAttribute(m: ModuleID): ModuleID = m
def moduleIDToStr(m: ModuleID): ModuleID = m
def parseArtifactStrAttribute(a: Artifact): Artifact = a
def artifactToStr(art: Artifact): Artifact = art

def toNioPath(a: Attributed[File])(implicit conv: FileConverter): NioPath =
a.data.toPath()
def toNioPath(ref: File)(implicit conv: FileConverter): NioPath =
ref.toPath()
def toFile(a: Attributed[File])(implicit conv: FileConverter): File =
a.data
def toFile(ref: File)(implicit conv: FileConverter): File =
ref
def artifactPathToFile(ref: File)(implicit conv: FileConverter): File =
ref
def toArtifactPath(f: File)(implicit conv: FileConverter): ArtifactPath = f
def toNioPaths(cp: Seq[Attributed[File]])(implicit conv: FileConverter): Vector[NioPath] =
cp.map(_.data.toPath()).toVector
def toFiles(cp: Seq[Attributed[File]])(implicit conv: FileConverter): Vector[File] =
cp.map(_.data).toVector

def toFileRef(x: File)(implicit conv: FileConverter): FileRef =
x
def getName(ref: File): String =
ref.getName()
def getArtifactPathName(ref: File): String =
ref.getName()
def classpathAttr = Attributes.Name.CLASS_PATH
def mainclassAttr = Attributes.Name.MAIN_CLASS
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import sbt.{*, given}
import sbt.Keys.*
import sbt.librarymanagement.{IvyFileConfiguration, PublishConfiguration}
import com.typesafe.sbt.packager.Compat.*
import xsbti.FileConverter

/**
* - TODO write tests for the SettingsHelper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.packager.archetypes.{JavaAppPackaging, TemplateWriter}
import sbt.Keys.*
import sbt.{*, given}
import xsbti.FileConverter

/**
* ==Bash StartScript Plugin==
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.typesafe.sbt.packager.archetypes.{JavaAppPackaging, TemplateWriter}
import com.typesafe.sbt.packager.windows.NameHelper
import sbt.Keys.*
import sbt.{*, given}
import xsbti.FileConverter

/**
* ==Bat StartScript Plugin==
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import java.util.UUID
import java.util.concurrent.atomic.AtomicBoolean
import scala.sys.process.Process
import scala.util.Try
import xsbti.FileConverter

/**
* ==Docker Plugin==
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.typesafe.sbt.SbtNativePackager.Universal
import com.typesafe.sbt.packager.Keys.*
import com.typesafe.sbt.packager.universal.UniversalPlugin
import com.typesafe.sbt.packager.archetypes.TemplateWriter
import xsbti.FileConverter

/**
* Plugin containing all the generic values used for packaging linux software.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.typesafe.sbt.packager.Keys.*
import com.typesafe.sbt.packager.linux.*
import com.typesafe.sbt.packager.Compat.*
import com.typesafe.sbt.packager.validation.*
import xsbti.FileConverter

/**
* Plugin containing all generic values used for packaging rpms.
Expand Down

0 comments on commit e90f8a0

Please sign in to comment.