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

bump scalameta to pre-4.9.10 SNAPSHOT (was 4.9.3) #2047

Merged
merged 4 commits into from
Aug 24, 2024
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
13 changes: 9 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Dependencies._
import TargetAxis.TargetProjectMatrix
import sbt.Keys.scalacOptions

inThisBuild(
List(
Expand Down Expand Up @@ -75,6 +74,7 @@ lazy val core = projectMatrix
googleDiff,
metaconfig,
scalametaFor3Use2_13,
semanticdbScalacCore,
collectionCompat
)
)
Expand All @@ -92,11 +92,16 @@ lazy val core3 = project
scalaVersion := scala3LTS,
libraryDependencies ++= Seq(
googleDiff,
metaconfig,
scalametaFor3Use2_13
metaconfig
) ++ Seq(
scalametaFor3Use2_13,
// CrossVersion.for3Use2_13 would only lookup a binary version artifact, but this is published with full version
semanticdbScalacCore.cross(CrossVersion.constant(scala213))
).map { mod =>
mod
.exclude("com.lihaoyi", "sourcecode_2.13")
.exclude("org.scala-lang.modules", "scala-collection-compat_2.13")
)
}
)
.enablePlugins(BuildInfoPlugin)

Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object Dependencies {
val metaconfigV = "0.13.0"
val nailgunV = "0.9.1"
val scalaXmlV = "2.2.0"
val scalametaV = "4.9.3"
val scalametaV = "4.9.9+89-fb896935-SNAPSHOT"
val scalatestV = "3.2.19"
val munitV = "1.0.1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.util.Optional
import scala.{meta => m}

import scala.meta.inputs.Input
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput

import scalafix.interfaces.ScalafixInput

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import scala.util.control.NoStackTrace
import scala.util.control.NonFatal

import scala.meta.inputs.Input
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.internal.semanticdb.TextDocument
import scala.meta.io.AbsolutePath
import scala.meta.parsers.ParseException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package scalafix.internal.v1
import scala.meta.AbsolutePath
import scala.meta.Input
import scala.meta.Source
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.internal.io.FileIO
import scala.meta.internal.symtab.SymbolTable
import scala.meta.io.RelativePath
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scala.meta.internal

import scala.meta._
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.internal.semanticdb.Scala.Descriptor
import scala.meta.internal.semanticdb.Scala.DescriptorParser
import scala.meta.internal.{semanticdb => s}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package scalafix.internal.config

import scala.{meta => m}

import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput

import metaconfig.Conf
import metaconfig.ConfDecoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import scala.collection.mutable.StringBuilder

import scala.meta.Position
import scala.meta.inputs.Input
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput

import scalafix.internal.util.IntervalSet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package scalafix.internal.rule

import scala.meta._
import scala.meta.contrib.AssociatedComments
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.tokens.Tokens

import org.scalameta.FileLine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package scalafix.internal.util

import scala.meta._
import scala.meta.internal.ScalametaInternals
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.internal.{semanticdb => s}

object PositionSyntax {
Expand Down
2 changes: 1 addition & 1 deletion scalafix-core/src/main/scala/scalafix/v0/Database.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scalafix.v0

import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.internal.io.PathIO

final case class Database(documents: Seq[Document]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package scalafix.v1

import scala.meta._
import scala.meta.contrib.AssociatedComments
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.internal.symtab.SymbolTable
import scala.meta.internal.{semanticdb => s}
import scala.meta.io.RelativePath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scala.meta.Source
import scala.meta.Tokens
import scala.meta.Tree
import scala.meta.contrib.AssociatedComments
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.parsers.Parsed

import scalafix.internal.config.ScalaVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package scalafix.internal.v0
import scala.{meta => m}

import scala.meta._
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput
import scala.meta.internal.io._
import scala.meta.internal.symtab.SymbolTable
import scala.meta.internal.{semanticdb => s}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package scalafix.testkit
import scala.util.Try

import scala.meta._
import scala.meta.internal.inputs.XtensionInputSyntaxStructure
import scala.meta.internal.inputs.XtensionInput

import metaconfig.Conf
import metaconfig.internal.ConfGet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
[41:7..41:11]: test/ann2# => class ann2 extends Annotation with StaticAnnotation { +1 decls }
[41:12..41:12]: test/ann2#`<init>`(). => primary ctor <init>()
[43:7..43:8]: test/B# => class B extends AnyRef { +1 decls }
[43:8..43:8]: test/B#`<init>`(). => primary ctor <init>()
[45:7..45:8]: test/C# => class C extends AnyRef { +1 decls }
[45:8..45:8]: test/C#`<init>`(). => primary ctor <init>()
[47:7..47:8]: test/P# => class P extends AnyRef { +4 decls }
[47:9..47:9]: test/P#`<init>`(). => primary ctor <init>()
[48:9..48:10]: test/P#C# => class C extends AnyRef { +1 decls }
Expand Down
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 @@ -312,6 +312,7 @@ class CliSyntacticSuite extends BaseCliSuite {
check(
name = "fix script files",
originalLayout = s"""|/a.sc
|#!/usr/bin/env -S scala-cli shebang
|def foo = { println(s"hello") }
|lazy val bar = project
|""".stripMargin,
Expand All @@ -321,6 +322,7 @@ class CliSyntacticSuite extends BaseCliSuite {
"a.sc"
),
expectedLayout = s"""|/a.sc
|#!/usr/bin/env -S scala-cli shebang
|def foo = { println("hello") }
|lazy val bar = project
|""".stripMargin,
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,15 @@ 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
MavenRepository.of(
// for scalameta SNAPSHOTS
"https://oss.sonatype.org/content/repositories/snapshots"
)
).asJava

test("versions") {
val api = Scalafix.classloadInstance(this.getClass.getClassLoader)
assert(api.scalafixVersion() == Versions.version)
Expand All @@ -45,12 +55,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 +81,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 +124,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