Skip to content

Support Scala 3 (by dropping madgag-compress for zip4j?) #18

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

Merged
merged 1 commit into from
Aug 18, 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
19 changes: 13 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,40 @@ import ReleaseTransformations.*
import sbtversionpolicy.withsbtrelease.ReleaseVersion
import Dependencies.*

ThisBuild / scalaVersion := "3.3.6"
ThisBuild / crossScalaVersions := Seq(
scalaVersion.value,
"2.13.16"
)
ThisBuild / scalacOptions := Seq("-deprecation", "-release:11")

lazy val artifactProducingProjectSettings = Seq(
scalaVersion := "2.13.16",
organization := "com.madgag.scala-git",
licenses := Seq(License.Apache2),
scalacOptions ++= Seq("-deprecation", "-unchecked", "-release:11"),
libraryDependencies ++= Seq(madgagCompress % Test, scalatest % Test)
libraryDependencies ++= Seq(scalatest % Test)
)

lazy val `scala-git` = project.settings(artifactProducingProjectSettings *).dependsOn(`scala-git-test` % Test).settings(
libraryDependencies ++= Seq(
jgit,
"com.madgag" %% "scala-collection-plus" % "1.0.0",
scalatest % Test
)
),
Test / fork := true
)

lazy val `scala-git-test` = project.in(file("scala-git-test")).settings(artifactProducingProjectSettings *).settings(
libraryDependencies ++= guava :+ madgagCompress :+ jgit
libraryDependencies ++= guava :+ zip4j :+ jgit
)

ThisBuild / Test / testOptions +=
Tests.Argument(TestFrameworks.ScalaTest, "-u", s"test-results/scala-${scalaVersion.value}", "-o")

lazy val root = (project in file(".")).aggregate(`scala-git`, `scala-git-test`).settings(
publish / skip := true,
releaseVersion := ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease().value,
// releaseCrossBuild := true, // true if you cross-build the project for multiple Scala versions
// releaseVersion := ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease().value,
releaseCrossBuild := true, // true if you cross-build the project for multiple Scala versions
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Dependencies {

val scalatest = "org.scalatest" %% "scalatest" % "3.2.19"

val madgagCompress = "com.madgag" % "util-compress" % "1.35"
Copy link
Owner Author

@rtyley rtyley Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This artifact is old - from October 2017. Is there something about this artifact in particular that's the problem?

val zip4j = "net.lingala.zip4j" % "zip4j" % "2.11.5"

val guava = Seq("com.google.guava" % "guava" % "33.4.8-jre", "com.google.code.findbugs" % "jsr305" % "3.0.2")

Expand Down
13 changes: 7 additions & 6 deletions scala-git-test/src/main/scala/com/madgag/git/test/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

package com.madgag.git

import net.lingala.zip4j.ZipFile

import java.io.File
import java.io.File.separatorChar
import java.net.URL
import com.madgag.compress.CompressUtil._
import org.eclipse.jgit.internal.storage.file.FileRepository
import org.eclipse.jgit.storage.file.FileRepositoryBuilder

Expand All @@ -32,18 +33,18 @@ package object test {
FileRepositoryBuilder.create(resolvedGitDir).asInstanceOf[FileRepository]
}

def unpackRepoAndGetGitDir(fileName: String) = {
def unpackRepoAndGetGitDir(fileName: String): File = {
val resource: URL = getClass.getResource(fileName)
assert(resource != null, s"Resource for $fileName is null.")
val rawZipFileInputStream = resource.openStream()
assert(rawZipFileInputStream != null, s"Stream for $fileName is null.")

val file = new File(resource.toURI)
assert(file.exists(), s"File $file does not exist.")

val repoParentFolder = new File(createTempDirectory("test").toFile, fileName.replace(separatorChar, '_') + "-unpacked")
repoParentFolder.mkdir()

unzip(rawZipFileInputStream, repoParentFolder)
rawZipFileInputStream.close
new ZipFile(file.getAbsolutePath).extractAll(repoParentFolder.getAbsolutePath)

repoParentFolder
}
}