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

scala 2.13.9 #1676

Merged
merged 2 commits into from
Sep 20, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/test-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ cs resolve \
ch.epfl.scala:scalafix-core_2.13:$version \
ch.epfl.scala:scalafix-reflect_2.11.12:$version \
ch.epfl.scala:scalafix-reflect_2.12.17:$version \
ch.epfl.scala:scalafix-reflect_2.13.8:$version \
ch.epfl.scala:scalafix-reflect_2.13.9:$version \
ch.epfl.scala:scalafix-cli_2.11.12:$version \
ch.epfl.scala:scalafix-cli_2.12.17:$version \
ch.epfl.scala:scalafix-cli_2.13.8:$version \
ch.epfl.scala:scalafix-cli_2.13.9:$version \
ch.epfl.scala:scalafix-testkit_2.11.12:$version \
ch.epfl.scala:scalafix-testkit_2.12.17:$version \
ch.epfl.scala:scalafix-testkit_2.13.8:$version \
ch.epfl.scala:scalafix-testkit_2.13.9:$version \
-r sonatype:public
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scala.util.Try
object Dependencies {
val scala211 = "2.11.12"
val scala212 = "2.12.17"
val scala213 = "2.13.8"
val scala213 = "2.13.9"
val scala3 = "3.1.3"

val buildScalaVersions = Seq(scala211, scala212, scala213)
Expand Down
33 changes: 22 additions & 11 deletions project/ScalafixBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import sbt.plugins.JvmPlugin
import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._
import sbtbuildinfo.BuildInfoKey
import sbtbuildinfo.BuildInfoPlugin.autoImport._
import sbtversionpolicy.SbtVersionPolicyPlugin
import sbtversionpolicy.SbtVersionPolicyPlugin.autoImport._
import scalafix.sbt.ScalafixPlugin.autoImport._
import com.typesafe.sbt.sbtghpages.GhpagesKeys
Expand All @@ -15,7 +16,9 @@ import sbt.plugins.IvyPlugin

object ScalafixBuild extends AutoPlugin with GhpagesKeys {
override def trigger = allRequirements
override def requires = JvmPlugin && IvyPlugin
override def requires =
JvmPlugin &&
SbtVersionPolicyPlugin // don't let it override our mimaPreviousArtifacts
Copy link
Collaborator Author

@bjaglin bjaglin Sep 20, 2022

Choose a reason for hiding this comment

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

By changing the order of plugin execution, this had a sneaky effect on publishing releases to sonatype as the (incorrect) publishTo defined in ScalafixBuildPlugin was effectively ignored until now.

 [info] publishTo
-[info] Some(FileRepository(sonatype-local-bundle, Patterns(ivyPatterns=Vector(), artifactPatterns=Vector(/home/brice/git/opensource/scalafix/target/sonatype-staging/0.10.2/[organisation]/[module](_[scalaVersion])(_[sbtVersion])/[revision]/[artifact]-[revision](-[classifier]).[ext]), isMavenCompatible=true, descriptorOptional=false, skipConsistencyCheck=false), FileConfiguration(true, None)))
+[info] Some(sonatype-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2)

This prevents publishing releases

2022-09-20 22:12:38.036Z  info [SonatypeService] sonatypeRepository  : https://oss.sonatype.org/service/local  - (SonatypeService.scala:26)
2022-09-20 22:12:38.041Z  info [SonatypeService] sonatypeProfileName : ch.epfl.scala  - (SonatypeService.scala:27)
[info] Preparing a new staging repository for [sbt-sonatype] scalafix 0.10.3
2022-09-20 22:12:38.043Z  info [SonatypeClient] Reading staging repository profiles...  - (SonatypeClient.scala:108)
2022-09-20 22:12:40.251Z  info [SonatypeClient] Reading staging profiles...  - (SonatypeClient.scala:120)
2022-09-20 22:12:43.932Z  info [SonatypeClient] Creating a staging repository in profile ch.epfl.scala with a description key: [sbt-sonatype] scalafix 0.10.3  - (SonatypeClient.scala:126)
2022-09-20 22:12:51.705Z  info [SonatypeClient] Created successfully: chepflscala-2407  - (SonatypeClient.scala:139)
2022-09-20 22:13:00.349Z  info [SonatypeService] Found a previous staging repository [chepflscala-2405] status:open, profile:ch.epfl.scala(17f10a3293d844) description: [sbt-sonatype] scalafix 0.10.3  - (SonatypeService.scala:103)
2022-09-20 22:13:00.350Z  info [SonatypeClient] Dropping staging repository [chepflscala-2405] status:open, profile:ch.epfl.scala(17f10a3293d844) description: [sbt-sonatype] scalafix 0.10.3  - (SonatypeClient.scala:229)
2022-09-20 22:13:00.430Z  info [SonatypeService] Dropped successfully: chepflscala-2405  - (SonatypeService.scala:175)
2022-09-20 22:13:00.454Z error [Sonatype] 
java.io.IOException: Supplied file /home/runner/work/scalafix/scalafix/target/sonatype-staging/0.10.3 is a not an existing directory!
	at org.sonatype.spice.zapper.fs.AbstractDirectory.<init>(AbstractDirectory.java:32)

https://github.com/scalacenter/scalafix/actions/runs/3093699216/jobs/5006465269

#1678 (review) should address that

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it’s a problem that comes from sbt-version-policy? Please let me know if I need to fix something there :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, thanks for chiming in! The publishTo issue was unrelated, the build was clearly wrong, and the change in plugin order accidentally made it visible. We can follow up on scalacenter/sbt-version-policy#138 though.

object autoImport {
lazy val stableVersion =
settingKey[String]("Version of latest release to Maven.")
Expand Down Expand Up @@ -55,8 +58,9 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
else Nil
}
lazy val targetJvm = Def.setting {
if (isScala3.value) "-Xtarget:8"
else "-target:jvm-1.8"
if (isScala3.value) Seq("-Xtarget:8")
else if (isScala213.value) Seq("-release", "8")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

else Seq("-target:jvm-1.8")
}
val warnAdaptedArgs = Def.setting {
if (isScala3.value) Nil
Expand All @@ -80,8 +84,8 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
}
lazy val compilerOptions = Def.setting(
warnUnusedImports.value ++
targetJvm.value ++
Seq(
targetJvm.value,
"-encoding",
"UTF-8",
"-feature",
Expand Down Expand Up @@ -174,6 +178,7 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
)

private val PreviousScalaVersion: Map[String, String] = Map(
"2.13.9" -> "2.13.8"
)

override def buildSettings: Seq[Setting[_]] = List(
Expand All @@ -191,6 +196,19 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
)

override def projectSettings: Seq[Def.Setting[_]] = List(
// avoid "missing dependency" on artifacts with full scala version when bumping scala
versionPolicyIgnored ++= {
PreviousScalaVersion.get(scalaVersion.value) match {
case Some(previous) =>
// all transitive dependencies with full scala version we know about
Seq(
"org.scalameta" % s"semanticdb-scalac-core_$previous",
"ch.epfl.scala" % s"scalafix-cli_$previous",
"ch.epfl.scala" % s"scalafix-reflect_$previous"
)
case None => Seq()
}
},
// don't publish scala 3 artifacts for now
publish / skip := (if ((publish / skip).value) true
else scalaBinaryVersion.value == "3"),
Expand Down Expand Up @@ -235,13 +253,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
organizationName.value % previousScalaVCrossName % stableVersion.value
)
},
mimaDependencyResolution := {
// effectively reverts https://github.com/lightbend/mima/pull/508 since the
// Coursier resolution ignores/overrides the explicit scala full version set
// in mimaPreviousArtifacts
val ivy = sbt.Keys.ivySbt.value
IvyDependencyResolution(ivy.configuration)
},
mimaBinaryIssueFilters ++= Mima.ignoredABIProblems
) ++ Seq(Compile, Test).flatMap(conf => inConfig(conf)(configSettings))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
[116:12..116:22]: test/Test.C#ByNameType. => final object ByNameType extends AnyRef { +1 decls }
[117:11..117:13]: test/Test.C#ByNameType.m1(). => method m1(x: => Int): Int
[117:14..117:15]: test/Test.C#ByNameType.m1().(x) => param x: => Int
[120:16..120:28]: test/Test.C#RepeatedType# => case class RepeatedType extends AnyRef with Product with Serializable { +12 decls }
[120:16..120:28]: test/Test.C#RepeatedType# => case class RepeatedType extends AnyRef with Product with Serializable { +11 decls }
[120:28..120:28]: test/Test.C#RepeatedType#`<init>`(). => primary ctor <init>(val s: String*)
[120:29..120:30]: test/Test.C#RepeatedType#s. => val method s: String*
[121:11..121:13]: test/Test.C#RepeatedType#m1(). => method m1(x: Int*): Int
Expand Down