Skip to content

Commit fe1a69a

Browse files
Initial work towards compiler plugin support: Update docs and add test placeholder
1 parent 85fd08b commit fe1a69a

4 files changed

Lines changed: 44 additions & 3 deletions

File tree

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "small-index"]
22
path = small-index
3-
url = git@github.com:scalacenter/scaladex-small-index.git
3+
url = https://github.com/scalacenter/scaladex-small-index.git
44
[submodule "contrib"]
55
path = contrib
6-
url = git@github.com:scalacenter/scaladex-contrib.git
6+
url = https://github.com/scalacenter/scaladex-contrib.git

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@ If your artifact does not have any binary version it is considered a Java artifa
4545
Yet some Java artifact are closely related to Scala.
4646
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.
4747

48-
At the moment we don't support full Scala binary versions, that are often used in Scala compiler plugins.
48+
Scaladex supports various binary version formats:
49+
- Standard Scala versions: `_2.13`, `_3`, `_2.12`
50+
- Scala.js versions: `_sjs1_2.13`, `_sjs1_3`
51+
- Scala Native versions: `_native0.4_2.13`
52+
- SBT plugin versions: `_2.13_1.0`, `_2.12_0.13`
53+
- Mill plugin versions: `_mill0.9_2.13`
54+
55+
Compiler plugins are currently being added to Scaladex. They typically use full Scala binary versions (e.g., `_2.13.10`).
56+
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.
4957

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

modules/core/shared/src/main/scala/scaladex/core/model/BinaryVersion.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ import scaladex.core.util.Parsers
55
import fastparse.*
66
import fastparse.NoWhitespace.*
77

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

modules/core/shared/src/test/scala/scaladex/core/model/BinaryVersionTests.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,20 @@ class BinaryVersionTests extends AnyFunSpec with Matchers with OptionValues with
5454
expected.value shouldBe input
5555
}
5656
}
57+
58+
it("should handle compiler plugin versions (TODO)") {
59+
// This test will be implemented when compiler plugin support is added
60+
// Example test cases:
61+
// val cases = Table(
62+
// ("input", "target"),
63+
// ("_2.13.10", BinaryVersion(CompilerPlugin, Scala(Version(2, 13, 10)))),
64+
// ("_3.3.1", BinaryVersion(CompilerPlugin, Scala(Version(3, 3, 1))))
65+
// )
66+
//
67+
// forAll(cases) { (input, expected) =>
68+
// BinaryVersion.parse(input) should contain(expected)
69+
// expected.value shouldBe input
70+
// }
71+
succeed
72+
}
5773
end BinaryVersionTests

0 commit comments

Comments
 (0)