Skip to content

Initial work towards compiler plugin support: Update docs and add test placeholder #1573

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "small-index"]
path = small-index
url = git@github.com:scalacenter/scaladex-small-index.git
url = https://github.com/scalacenter/scaladex-small-index.git
[submodule "contrib"]
path = contrib
url = git@github.com:scalacenter/scaladex-contrib.git
url = https://github.com/scalacenter/scaladex-contrib.git
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ If your artifact does not have any binary version it is considered a Java artifa
Yet some Java artifact are closely related to Scala.
In that case you can force its indexing by updating the [non-standard.json](https://github.com/scalacenter/scaladex-contrib/blob/master/non-standard.json) file in the [scaladex-contrib](https://github.com/scalacenter/scaladex-contrib) repository.

At the moment we don't support full Scala binary versions, that are often used in Scala compiler plugins.
Scaladex supports various binary version formats:
- Standard Scala versions: `_2.13`, `_3`, `_2.12`
- Scala.js versions: `_sjs1_2.13`, `_sjs1_3`
- Scala Native versions: `_native0.4_2.13`
- SBT plugin versions: `_2.13_1.0`, `_2.12_0.13`
- Mill plugin versions: `_mill0.9_2.13`

Compiler plugins are currently being added to Scaladex. They typically use full Scala binary versions (e.g., `_2.13.10`).
If you have a compiler plugin that needs to be indexed, please open an issue in the [scaladex-contrib](https://github.com/scalacenter/scaladex-contrib) repository.

#### Does the pom file contain the `scm` attribute and does it points to a public Github repository?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ import scaladex.core.util.Parsers
import fastparse.*
import fastparse.NoWhitespace.*

/** Represents a binary version of a Scala artifact.
*
* The binary version consists of two parts:
* 1. platform: The runtime platform (JVM, Scala.js, Scala Native, SBT plugin, Mill plugin)
* 2. language: The programming language (Java, Scala with version)
*
* Examples:
* - JVM Scala 2.13: BinaryVersion(Jvm, Scala(Version(2, 13, 0)))
* - Scala.js 1.0 with Scala 2.13: BinaryVersion(ScalaJs(Version(1, 0, 0)), Scala(Version(2, 13, 0)))
* - SBT plugin 1.0 with Scala 2.13: BinaryVersion(SbtPlugin(Version(1, 0, 0)), Scala(Version(2, 13, 0)))
*
* TODO: Add support for compiler plugins which use full Scala versions (e.g., 2.13.10)
* This will require:
* 1. Extending the Platform type to include CompilerPlugin
* 2. Updating the Parser to handle full version numbers
* 3. Modifying the artifact indexing logic to recognize compiler plugin artifacts
*/
final case class BinaryVersion(platform: Platform, language: Language):
def isValid: Boolean = platform.isValid && language.isValid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,20 @@ class BinaryVersionTests extends AnyFunSpec with Matchers with OptionValues with
expected.value shouldBe input
}
}

it("should handle compiler plugin versions (TODO)") {
// This test will be implemented when compiler plugin support is added
// Example test cases:
// val cases = Table(
// ("input", "target"),
// ("_2.13.10", BinaryVersion(CompilerPlugin, Scala(Version(2, 13, 10)))),
// ("_3.3.1", BinaryVersion(CompilerPlugin, Scala(Version(3, 3, 1))))
// )
//
// forAll(cases) { (input, expected) =>
// BinaryVersion.parse(input) should contain(expected)
// expected.value shouldBe input
// }
succeed
}
end BinaryVersionTests