Skip to content

Commit

Permalink
Support Scala3 (#349)
Browse files Browse the repository at this point in the history
* EnumMacros

* ValueEnumMacros

* Update coreJVMTests

* Update build & tests

* Fix scalacheck for Scala 3

* Update more modules for Scala3 compatibility

* Update play modules

* Update doobie/quill

* Fix

* Disable Slick

* Disable JSON4S

* Fix test dependencies

* Review

* Review & rebase

* * Use match instead of straight cast

Signed-off-by: lloydmeta <[email protected]>

* Add Scala3 mention in Readme

Signed-off-by: Lloyd <[email protected]>

Signed-off-by: lloydmeta <[email protected]>
Signed-off-by: Lloyd <[email protected]>
Co-authored-by: lloydmeta <[email protected]>
  • Loading branch information
cchantep and lloydmeta authored Dec 3, 2022
1 parent e61f1b6 commit 6ac99af
Show file tree
Hide file tree
Showing 99 changed files with 2,571 additions and 1,444 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ jobs:
- java: 11
scala: 2.11.12
- java: 11
scala: 2.12.14
scala: 2.12.17
- java: 11
scala: 2.13.6
scala: 2.13.10
- java: 11
scala: 3.2.1
runs-on: ubuntu-latest
env:
SCALAJS_TEST_OPT: full
# define Java options for both official sbt and sbt-extras
JAVA_OPTS: -Xms6G -Xmx6G -Xss4M -XX:ReservedCodeCacheSize=256M -XX:MaxMetaspaceSize=1G -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8
JVM_OPTS: -Xms6G -Xmx6G -Xss4M -XX:ReservedCodeCacheSize=256M -XX:MaxMetaspaceSize=1G -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8
SBT_OPTS: -Denumeratum.useLocalVersion
steps:
- name: Checkout
uses: actions/checkout@v1
Expand All @@ -39,26 +42,23 @@ jobs:
sbt -v ++${{ matrix.scala }} scalafmtCheck scalafmtSbtCheck scala_2_11/test:compile scala_2_11/test:doc
sbt -v ++${{ matrix.scala }} scala_2_11/test
;;
2.12.14)
2.12.17)
sbt -v ++${{ matrix.scala }} test:compile test:doc
sbt -v ++${{ matrix.scala }} coverage test coverageReport
sbt -v ++${{ matrix.scala }} coverageAggregate
;;
2.13.6)
*)
sbt -v ++${{ matrix.scala }} test:compile test:doc
sbt -v ++${{ matrix.scala }} test
;;
*)
echo unknown Scala Version ${{ matrix.scala }}
exit 1
esac
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
- name: Upload coverage to Codecov
if: ${{ matrix.scala == '2.12.14' }}
if: ${{ matrix.scala == '2.12.17' }}
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
9 changes: 8 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
version = 3.0.0-RC6
version = 3.5.8
runner.dialect = Scala213Source3
style = defaultWithAlign
maxColumn = 100

fileOverride {
"glob:**/src/*/scala-3/**/*.scala" {
runner.dialect = scala3
}
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ Enumeratum has the following niceties:
- All magic happens at compile-time so you know right away when things go awry
- Comprehensive automated testing to make sure everything is in tip-top shape

Enumeratum is published for Scala 2.11.x, 2.12.x, 2.13.x as well as ScalaJS.
Enumeratum is published for Scala 2.11.x, 2.12.x, 2.13.x, 3.x as well as ScalaJS.

Note that there are a couple of limitations for 3.x:
* All "immediate" parent types of enum entries need to be `sealed` (reasoning [here](https://github.com/lloydmeta/enumeratum/pull/349#discussion_r1034715979))
* The `-Yretain-trees` Scalac option must be set when using ValueEnums

Integrations are available for:

Expand Down
Loading

0 comments on commit 6ac99af

Please sign in to comment.