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

Update scalafmt-core to 3.8.5 #235

Merged
merged 3 commits into from
Jan 21, 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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.8.5
96a7524502d07116f62614707b009510b4377462
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.8.3"
version = "3.8.5"
runner.dialect = scala212

fileOverride {
Expand Down
68 changes: 44 additions & 24 deletions plugin/src/sbt-test/sbt-avro/basic/build.sbt
Original file line number Diff line number Diff line change
@@ -1,42 +1,62 @@
ThisBuild / scalaVersion := "2.13.11"

lazy val files = Seq(
"A", "B", "C", "D", "E", "_A", "_B", "_C", "_D", "_E", "LogicalTypesTest", "LocalDateTimeTest"
"A",
"B",
"C",
"D",
"E",
"_A",
"_B",
"_C",
"_D",
"_E",
"LogicalTypesTest",
"LocalDateTimeTest"
)

lazy val testFiles = Seq(
"X", "Y", "Z"
"X",
"Y",
"Z"
)

val checkGenerated = TaskKey[Unit]("checkGenerated")
val checkCompiled = TaskKey[Unit]("checkCompiled")

def exists(f: File): Unit = assert(f.exists(), s"$f does not exist")

val checkSettings = inConfig(Compile)(Def.settings(
checkGenerated := {
files.foreach { f =>
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / s"$f.java")
val checkSettings = inConfig(Compile)(
Def.settings(
checkGenerated := {
files.foreach { f =>
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / s"$f.java"
)
}
},
checkCompiled := {
files.foreach { f =>
exists(classDirectory.value / "com" / "github" / "sbt" / "avro" / "test" / s"$f.class")
}
}
},
checkCompiled := {
files.foreach { f =>
exists(classDirectory.value / "com" / "github" / "sbt" / "avro" / "test" / s"$f.class")
}
}
)) ++ inConfig(Test)(Def.settings(
checkGenerated := {
testFiles.foreach { f =>
exists(crossTarget.value / "src_managed" / "compiled_avro" / "test" / "com" / "github" / "sbt" / "avro" / "test" / s"$f.java")
}
},
checkCompiled := {
testFiles.foreach { f =>
exists(classDirectory.value / "com" / "github" / "sbt" / "avro" / "test" / s"$f.class")
)
) ++ inConfig(Test)(
Def.settings(
checkGenerated := {
testFiles.foreach { f =>
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "test" / "com" / "github" / "sbt" / "avro" / "test" / s"$f.java"
)
}
},
checkCompiled := {
testFiles.foreach { f =>
exists(classDirectory.value / "com" / "github" / "sbt" / "avro" / "test" / s"$f.class")
}
}
}
))

)
)

lazy val `basic` = project
.in(file("."))
Expand Down
32 changes: 23 additions & 9 deletions plugin/src/sbt-test/sbt-avro/local-dependency/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lazy val avroOnlySettings = Seq(
Compile / packageAvro / publishArtifact := true,
Compile / packageBin / publishArtifact := false,
Compile / packageSrc / publishArtifact := false,
Compile / packageDoc / publishArtifact := false,
Compile / packageDoc / publishArtifact := false
)

lazy val `external`: Project = project
Expand All @@ -27,7 +27,7 @@ lazy val `external`: Project = project
.settings(avroOnlySettings)
.settings(
name := "external",
version := "0.0.1-SNAPSHOT",
version := "0.0.1-SNAPSHOT"
)

lazy val `transitive`: Project = project
Expand Down Expand Up @@ -55,14 +55,28 @@ lazy val root: Project = project
"org.specs2" %% "specs2-core" % "4.20.9" % Test
),
Compile / checkUnpacked := {
exists((`transitive` / crossTarget).value / "src_managed" / "avro" / "main" / "external-avro" / "avdl.avdl")
exists((`transitive` / crossTarget).value / "src_managed" / "avro" / "main" / "external-avro" / "avpr.avpr")
exists((`transitive` / crossTarget).value / "src_managed" / "avro" / "main" / "external-avro" / "avsc.avsc")
exists(
(`transitive` / crossTarget).value / "src_managed" / "avro" / "main" / "external-avro" / "avdl.avdl"
)
exists(
(`transitive` / crossTarget).value / "src_managed" / "avro" / "main" / "external-avro" / "avpr.avpr"
)
exists(
(`transitive` / crossTarget).value / "src_managed" / "avro" / "main" / "external-avro" / "avsc.avsc"
)
},
Compile / checkGenerated := {
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avdl.java")
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avpr.java")
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avsc.java")
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "transitive" / "Avsc.java")
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avdl.java"
)
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avpr.java"
)
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avsc.java"
)
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "transitive" / "Avsc.java"
)
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ object Main extends App {
transitive.Avsc.newBuilder().setStringField("transitive").build()

println("success")
}
}
33 changes: 23 additions & 10 deletions plugin/src/sbt-test/sbt-avro/publishing/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lazy val avroOnlySettings = Seq(
Compile / packageAvro / publishArtifact := true,
Compile / packageBin / publishArtifact := false,
Compile / packageSrc / publishArtifact := false,
Compile / packageDoc / publishArtifact := false,
Compile / packageDoc / publishArtifact := false
)

lazy val `external`: Project = project
Expand All @@ -27,7 +27,7 @@ lazy val `external`: Project = project
.settings(avroOnlySettings)
.settings(
name := "external",
version := "0.0.1-SNAPSHOT",
version := "0.0.1-SNAPSHOT"
)

lazy val `transitive`: Project = project
Expand All @@ -45,7 +45,7 @@ lazy val `transitive`: Project = project
),
Compile / avroDependencyIncludeFilter := artifactFilter(classifier = "avro"),
// create a test jar with a schema as resource
Test / packageBin / publishArtifact := true,
Test / packageBin / publishArtifact := true
)

lazy val root: Project = project
Expand All @@ -56,8 +56,11 @@ lazy val root: Project = project
name := "publishing-test",
crossScalaVersions := Seq("2.13.15", "2.12.20"),
libraryDependencies ++= Seq(
("com.github.sbt" % "transitive" % "0.0.1-SNAPSHOT" % "avro").classifier("avro"), // external as transitive
("com.github.sbt" % "transitive" % "0.0.1-SNAPSHOT" % "avro-test").classifier("tests").intransitive(),
("com.github.sbt" % "transitive" % "0.0.1-SNAPSHOT" % "avro")
.classifier("avro"), // external as transitive
("com.github.sbt" % "transitive" % "0.0.1-SNAPSHOT" % "avro-test")
.classifier("tests")
.intransitive(),
"org.specs2" %% "specs2-core" % "4.20.9" % Test
),
// add additional avro source test jar whithout avro classifier
Expand All @@ -72,15 +75,25 @@ lazy val root: Project = project
exists(crossTarget.value / "src_managed" / "avro" / "main" / "transitive-avro" / "avsc.avsc")
},
Compile / checkGenerated := {
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avdl.java")
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avpr.java")
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avsc.java")
exists(crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "transitive" / "Avsc.java")
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avdl.java"
)
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avpr.java"
)
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "external" / "Avsc.java"
)
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "main" / "com" / "github" / "sbt" / "avro" / "test" / "transitive" / "Avsc.java"
)
},
Test / checkUnpacked := {
exists(crossTarget.value / "src_managed" / "avro" / "test" / "transitive-tests" / "test.avsc")
},
Test / checkGenerated := {
exists(crossTarget.value / "src_managed" / "compiled_avro" / "test" / "com" / "github" / "sbt" / "avro" / "test" / "transitive" / "Test.java")
exists(
crossTarget.value / "src_managed" / "compiled_avro" / "test" / "com" / "github" / "sbt" / "avro" / "test" / "transitive" / "Test.java"
)
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ object Main extends App {
transitive.Avsc.newBuilder().setStringField("transitive").build()

println("success")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ object AvroTest extends App {
Test.newBuilder().setStringField("external").build()

println("success")
}
}
4 changes: 3 additions & 1 deletion plugin/src/sbt-test/sbt-avro/settings/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ name := "settings-test"
scalaVersion := "2.13.11"
libraryDependencies ++= Seq(
// depend on test jar to get some generated records in the build
("org.apache.avro" % "avro" % avroVersion.value % "avro-compiler").classifier("tests").intransitive(),
("org.apache.avro" % "avro" % avroVersion.value % "avro-compiler")
.classifier("tests")
.intransitive(),
"org.specs2" %% "specs2-core" % "4.20.9" % Test
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class SettingsSpec extends Specification {
}

"avroFieldVisibility setting should be respected for recompiled record" >> {
!classOf[TestRecordWithLogicalTypes].getDeclaredField("s").isAnnotationPresent(classOf[Deprecated])
!classOf[TestRecordWithLogicalTypes]
.getDeclaredField("s")
.isAnnotationPresent(classOf[Deprecated])
}

// avroCreateSetters
Expand Down Expand Up @@ -77,7 +79,9 @@ class SettingsSpec extends Specification {
}

"avroOptionalGetters setting should be respected for recompiled record" >> {
classOf[TestRecordWithLogicalTypes].getDeclaredMethod("getS").getReturnType === classOf[Optional[String]]
classOf[TestRecordWithLogicalTypes]
.getDeclaredMethod("getS")
.getReturnType === classOf[Optional[String]]
}

// avroEnableDecimalLogicalType
Expand Down
Loading