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

cli_3.x.y: support external 2.13 rules along rules_3.x.y & publish #2034

Merged
merged 10 commits into from
Aug 22, 2024

Conversation

bjaglin
Copy link
Collaborator

@bjaglin bjaglin commented Aug 13, 2024

Towards #1680

See commit messages (the most important is ecf27f8)

Follow ups

  • introduce MiMa checks for Scala 3 artefacts in post-0.12.2 PR Post 0.13.0 release #2028
  • remove hack in RuleSuite once ExplicitResultTypes is added

@bjaglin bjaglin force-pushed the integration3 branch 8 times, most recently from 502fcbe to e13cc8d Compare August 14, 2024 00:30
@bjaglin bjaglin changed the title Refactor integration tests to run more with Scala 3 Overhaul integration tests to enable more on Scala 3 Aug 14, 2024
@bjaglin bjaglin force-pushed the integration3 branch 11 times, most recently from 3519cdb to 6aa8071 Compare August 16, 2024 22:50
@bjaglin bjaglin force-pushed the integration3 branch 2 times, most recently from be66960 to 97f58a0 Compare August 18, 2024 08:21
@bjaglin bjaglin changed the title Overhaul integration tests to enable more on Scala 3 Support rules built against core_2.13 in cli_3 Aug 18, 2024
@bjaglin bjaglin force-pushed the integration3 branch 2 times, most recently from e640545 to bb9db52 Compare August 18, 2024 08:33
@bjaglin bjaglin changed the title Support rules built against core_2.13 in cli_3 Support classloading rules built against core_2.13 in cli_3 Aug 18, 2024
Only java classes are exercised by this test, so it's enough to do test cli_X via
expectX (not because cli_X is in the classpath but because it covers all possible
values of X). Also, run test on Windows by fixing URI generation.
- Remove cosmetic need for sourcecode in internal classes
- Inline metaprint & metaprint-pprint Scala 3 macros to front-run
  Scala 2 ones in the Scala 3 compilation classpath, without other
  classes so that the synthetic code compiles against the Scala 2.13
  bytecode of metaconfig
- Keep building core3 to avoid introducing changes that will make it
  harder to publish it later
Stop cross-testing Scala 3 projects with Scala 2.13 artifacts, since
clients should now classload for their Scala binary version.
- avoid side effects & input duplication in ScalafixArgumentsSuite by using
  a fixture function
- ExplicitResultsTypes -> RemoveUnused (available in Scala 3)
- ProcedureSyntax (syntax not even supported in 3) -> RedundantSyntax
- remove tests no longer relevant (Scala 3 is tested everywhere else)
- run tests on windows by removing custom target root (tested elsewhere)
@bjaglin bjaglin force-pushed the integration3 branch 6 times, most recently from f7079d6 to 0433009 Compare August 21, 2024 22:15
@bjaglin bjaglin changed the title cli_3.x: support external 2.13 rules along rules_3.x & publish cli_3.x.y: support external 2.13 rules along rules_3.x.y & publish Aug 21, 2024
Comment on lines +101 to +104
// alongside Scala 2 community rules. Since cli3 does not bring Scala 3
// artifacts other than rule3, the Scalafix runtime and the compiler
// itself, there is almost no risk for conflicts between 2.13 and 3
// versions for artifacts brought by the user tool classpath.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

➜  ~ cs resolve ch.epfl.scala:scalafix-cli_3.3.4-RC1:0.12.1+76-1b25d3fb+20240821-1602-SNAPSHOT | grep _3
ch.epfl.scala:scalafix-cli_3.3.4-RC1:0.12.1+76-1b25d3fb+20240821-1602-SNAPSHOT:compile
ch.epfl.scala:scalafix-reflect_3.3.4-RC1:0.12.1+76-1b25d3fb+20240821-1602-SNAPSHOT:compile
ch.epfl.scala:scalafix-rules_3:0.12.1+76-1b25d3fb+20240821-1602-SNAPSHOT:compile
org.scala-lang:scala3-compiler_3:3.3.4-RC1:default
org.scala-lang:scala3-library_3:3.3.4-RC1:default
org.scala-lang:tasty-core_3:3.3.4-RC1:default

s"all cli2_12/publishLocalTransitive cli2_13/publishLocalTransitive interfaces/publishLocal" ::
def asSuffix(scalaVersion: String) = scalaVersion.replace(".", "_")

s"all cli${asSuffix(scala212)}/publishLocalTransitive cli${asSuffix(scala213)}/publishLocalTransitive interfaces/publishLocal" ::
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

to be updated later, when sbt-scalafix loads cli_3.x.y

@bjaglin bjaglin marked this pull request as ready for review August 21, 2024 22:29
- External rule had to be bumped since code expanded by the quasiquote macros is
  not backward-compatible.
- ToolClasspathSuite assertions relied on scalatest being in the classpath, which
  is no longer the case (at least not the same binary version). This takes the
  opportunity to honor the toolclasspath both at compilation time and at runtime
  for compiled rules.
@bjaglin bjaglin force-pushed the integration3 branch 3 times, most recently from 7feccff to dd1b0a6 Compare August 22, 2024 07:29
This changes the cross-publishing strategy for rules from binary to full, in
order to have different artifacts for Scala 3. This will allow
ExplicitResultTypes to bring in a different presentation compiler since there
is no guarantee that LTS supports recent source syntax, nor that Next supports
old one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant