Repository navigation
🔄 synced file(s) with halotukozak-com/.github #80
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
f292942
🔄 synced local '.mima/bin-compat-check.scala' with remote '.mima/bin-…
halotukozak 09c9f56
🔄 created local '.mima/tasty-compat-check.scala' from remote '.mima/t…
halotukozak c50edbc
🔄 synced local '.github/workflows/mima.yml' with remote 'shared/mima.…
halotukozak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| //> using scala 3.9.0 | ||
| //> using dep ch.epfl.scala::tasty-mima:1.4.1 | ||
| // tasty-mima 1.4.1 pulls tasty-query 1.6.1, which can't read Scala 3.8+/3.9 | ||
| // TASTy. tasty-query 1.9.0 can, and stays binary compatible within 1.x, so | ||
| // pin it explicitly. Drop this once a tasty-mima release depends on >= 1.9.0. | ||
| //> using dep ch.epfl.scala::tasty-query:1.9.0 | ||
|
|
||
| // TASTy-compatibility check between a released artifact and the current | ||
| // build, via tasty-mima's core API (there is no scala-cli/Mill plugin; the | ||
| // only build integration is sbt-tasty-mima). | ||
| // | ||
| // MiMa (bin-compat-check.scala) checks that already-linked classfiles still | ||
| // link. This checks the other half of a Scala 3 library's contract: that | ||
| // TASTy compiled against the old release — notably `inline` / macro bodies | ||
| // that get re-typechecked when a user inlines them — still re-typechecks | ||
| // against the new one. | ||
| // | ||
| // Usage: scala-cli run .mima/tasty-compat-check.scala -- <oldJar> <oldClasspath> <newJar> <newClasspath> | ||
| // oldJar the previously released library JAR | ||
| // oldClasspath pathSeparator-joined dependency classpath of the old JAR | ||
| // newJar the freshly built library JAR | ||
| // newClasspath pathSeparator-joined dependency classpath of the new JAR | ||
| // Either classpath may include its JAR or not; the JDK's java.base is added. | ||
| // | ||
| // Optional `.mima/tasty-private-packages` (one package per line, `#` comments): skipped by | ||
| // tasty-mima. List only packages no downstream TASTy can reference (types, defaults, aliases). | ||
| // | ||
| // Exit code: 0 compatible, 2 incompatible, anything else = the check failed to run. | ||
|
|
||
| import java.io.File | ||
| import java.net.URI | ||
| import java.nio.file.{Files, FileSystems, Path, Paths} | ||
|
|
||
| import scala.jdk.CollectionConverters.* | ||
|
|
||
| import tastymima.TastyMiMa | ||
| import tastymima.intf.Config | ||
|
|
||
| @main def tastyCompatCheck(oldJar: String, oldCp: String, newJar: String, newCp: String): Unit = | ||
| val javaBase = FileSystems.getFileSystem(URI.create("jrt:/")).getPath("modules", "java.base") | ||
|
|
||
| def classpath(jar: Path, cp: String): List[Path] = | ||
| val deps = cp.split(File.pathSeparator).iterator.filter(_.nonEmpty).map(Paths.get(_).toAbsolutePath).toList | ||
| (javaBase :: jar :: deps).distinct | ||
|
|
||
| val oldEntry = Paths.get(oldJar).toAbsolutePath | ||
| val newEntry = Paths.get(newJar).toAbsolutePath | ||
| for jar <- List(oldEntry, newEntry) do require(Files.isRegularFile(jar), s"not a file: $jar") | ||
|
|
||
| val privatePackagesFile = Paths.get(".mima/tasty-private-packages") | ||
| val privatePackages = | ||
| if !Files.exists(privatePackagesFile) then Nil | ||
| else | ||
| Files.readAllLines(privatePackagesFile).asScala.toList | ||
| .map(_.takeWhile(_ != '#').trim) | ||
| .filter(_.nonEmpty) | ||
| if privatePackages.nonEmpty then | ||
| println(s"[tasty-mima] treating as private (from $privatePackagesFile): ${privatePackages.mkString(", ")}") | ||
|
|
||
| val config = new Config().withMoreArtifactPrivatePackages(privatePackages.asJava) | ||
|
|
||
| val problems = new TastyMiMa(config) | ||
| .analyze(classpath(oldEntry, oldCp), oldEntry, classpath(newEntry, newCp), newEntry) | ||
|
|
||
| if problems.isEmpty then println("[tasty-mima] backward (TASTy built against the release vs the new JAR): OK") | ||
| else | ||
| println(s"[tasty-mima] backward (TASTy built against the release vs the new JAR): ${problems.size} problem(s)") | ||
| problems.foreach(p => println(s" - ${p.getDescription}")) | ||
| sys.exit(2) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: halotukozak-com/mrpc
Length of output: 7262
🏁 Script executed:
Repository: halotukozak-com/mrpc
Length of output: 15167
🏁 Script executed:
Repository: halotukozak-com/mrpc
Length of output: 6561
🌐 Web query:
Scala CLI official documentation publish.computeVersion git:tag version computation tag prefix v💡 Result:
Restrict both baseline candidates to version tags.
On a push to
main, a tag such asv999can pass the hyphen filter and sort ahead of a real release such asv1.2.3. The publishing workflow triggers forv*tags, butpublish.computeVersion git:tagconsiders only semantic-version tags, so it will not publish version999fromv999. Baseline resolution or the following artifact-pathgrepcan then fail before the report is written.The stable regex in the proposed fix does not constrain the fallback. Filter the tag list first so the fallback still selects a prerelease when no stable release exists, but cannot select a non-version tag.
Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents