Skip to content

Commit

Permalink
support SNAPSHOTs of scalameta
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Aug 24, 2024
1 parent 1350a9f commit b609e5e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import coursier.Fetch
import coursier.Module
import coursier.ModuleName
import coursier.Organization
import coursier.maven.MavenRepository
import scalafix.tests.BuildInfo

object SemanticdbPlugin {
Expand All @@ -21,6 +22,11 @@ object SemanticdbPlugin {
)
val paths = Fetch()
.addDependencies(dep)
.addRepositories(
MavenRepository(
"https://oss.sonatype.org/content/repositories/snapshots"
)
)
.run()
val semanticdbscalac = paths.collectFirst {
case path if path.toString.contains("semanticdb-scalac_") =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.nio.file.Path

import scala.jdk.CollectionConverters._

import coursierapi.MavenRepository
import coursierapi.Repository
import org.scalatest.funsuite.AnyFunSuite
import scalafix.Versions
Expand All @@ -26,6 +27,11 @@ class ScalafixSuite extends AnyFunSuite {

val scalaVersion: String = BuildInfo.scalaVersion

val repositories: java.util.List[Repository] = Seq[Repository](
Repository.ivy2Local(), // for scalafix-*
Repository.central() // for scala libs
).asJava

test("versions") {
val api = Scalafix.classloadInstance(this.getClass.getClassLoader)
assert(api.scalafixVersion() == Versions.version)
Expand All @@ -45,12 +51,12 @@ class ScalafixSuite extends AnyFunSuite {
}

test("classload Scala 3 LTS as a fallback for pre-LTS versions") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.0.0")
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.0.0", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3LTS)
}

test("classload Scala 3 Next as a fallback for post-LTS versions") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.4.0")
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.4.0", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3Next)
}

Expand All @@ -71,10 +77,7 @@ class ScalafixSuite extends AnyFunSuite {
test(s"fetch & load cli for $scalaVersion") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance(
scalaVersion,
Seq[Repository](
Repository.ivy2Local(), // for scalafix-*
Repository.central() // for scala libs
).asJava
repositories
)
val args = scalafixAPI.newArguments

Expand Down Expand Up @@ -117,7 +120,10 @@ class ScalafixSuite extends AnyFunSuite {
}

test(s"fetch & load cli for $scalaVersion with external dependencies") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance(scalaVersion)
val scalafixAPI = Scalafix.fetchAndClassloadInstance(
scalaVersion,
repositories
)

val ruleForDependency = Map(
// built against scalafix 0.9.16
Expand Down

0 comments on commit b609e5e

Please sign in to comment.