- Notifications
You must be signed in to change notification settings - Fork8
Scala configuration library supporting HOCON for Scala, Java, Scala.js, and Scala Native
License
ekrich/sconfig
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Configuration library written inScala which is a direct translation of the original widely used Java library.
Scala JVM,Scala Native, andScala.jsare supported. Scala JVM is fully supported whereas the other platforms support a subset of the full API.
For motivation and background about this project see thePR to the original project. The TLDR is the library was ported to Scala to support Scala Native soscalafmt which uses HOCON configuration could be compiled into a native application.
Care has been taken to keep the API the same but changes were needed when moving from the Java API. Using Java is also possible as demonstrated by including the working Java examples.
If you are looking for the original Java API, seehttps://github.com/lightbend/config.
libraryDependencies+="org.ekrich"%%"sconfig"%"x.y.z"
To use insbt
, replacex.y.z
with the version from Maven Central badge above.
For non-JVM projects use%%%
but please refer to the guide below forcritical Scala Native and Scala.js usage information. The TLDR is that you must add ajava.time
library dependency to your project. Refer to thesjavatime
home page for the current version or alternativejava.time
libraries.
Scala Native and Scala.js - A guide to using Scala Native and Scala.js.
All available versions can be seen at theMaven Repository.
Scala Version | JVM | Scala.js (1.x) | Native (0.5.x) |
---|---|---|---|
2.12.x | ✅ | ✅ | ✅ |
2.13.x | ✅ | ✅ | ✅ |
3.x.x | ✅ | ✅ | ✅ |
- Scala Native 0.5.x support from 0.7.0.
- Scala 3 support on Scala Native 0.4.3-RC2 or greater.
- Scala 2.11 support through version 1.4.9.
Please refer to the original library documentationhere. This is to reduce the maintenance burden of this library.
The intent is to keep the library in sync with the original but each PR needs to be be ported to maintain feature parity. The documentation could contain features that are not yet implemented in this library.
For specific changes, refer to the releases below.
Migrating an existinglightbend/config project to sconfig
This project publishes ascalafix rule to migrate existing Scala 2 source code that usescom.typesafe.config.Config
to this implementation. Scalafix rules modify in place existing valid Scala code. Think of it as a fancy find-and-replace tool that is aware of the Scala type system and can therefore narrowly tailor the changes being made. (Since scalafix changes the source code on your file system, it's best to commit any changes prior to running the rule, in case something weird happens.)
The rule will replacecom.typesafe.config
package references withorg.ekrich.config
, and remove trailing parens on some methods (where the API changed from the Java implementation).
Complete setup documentation and the currentscalafix
version can be found in thescalafix user guide. At a high level, the process is as follows:
Add scalafix to the project's
project/plugins.sbt
file using the version found above:addSbtPlugin("ch.epfl.scala"%"sbt-scalafix"%"a.b.c")
Add this project to the project's
libraryDependencies
, but don't remove the old one yet!(The old dependency needs to stay on the classpath until after the rule runs, because the code must compile before it will run.)
Run the scalafix sbt command shown below to apply the rule using the version of
sconfig
selected. Replace thex.y.z
below with the version (must be greater than version1.4.5
when scalafix was added):scalafixEnable; scalafixAll dependency:ReplaceTypesafeConfig@org.ekrich:sconfig-scalafix:x.y.x
Remove the old config dependency from the project's
libraryDependencies
Commit the changes
Release1.8.1 - (2024-11-05)
Release1.8.0 - (2024-11-05)
Release1.7.0 - (2023-04-16)
Release1.6.0 - (2023-12-28)
Release1.5.1 - (2023-09-15)
Release1.5.0 - (2022-09-19)
Release1.4.9 - (2022-01-25)
Release1.4.8 - (2022-01-12)
Release1.4.7 - (2022-01-03)
Release1.4.6 - (2021-12-06)
Release1.4.5 - (2021-10-08)
Release1.4.4 - (2021-05-13)
Release1.4.3 - (2021-05-12)
Release1.4.2 - (2021-04-01)
Release1.4.1 - (2021-02-24)
Release1.4.0 - (2021-01-26)
Release1.3.6 - (2020-12-21)
Release1.3.5 - (2020-11-24)
Release1.3.4 - (2020-11-03)
Release1.3.3 - (2020-09-14)
Release1.3.2 - (2020-09-01)
Release1.3.1 - (2020-07-24)
Release1.3.0 - (2020-05-01)
Release1.2.2 - (2020-04-28)
Release1.2.1 - (2020-02-18)
Release1.1.3 - (2019-12-27)
Release1.0.0 - (2019-08-05)
Release0.9.2 - (2019-06-10)
Release0.9.1 - (2019-05-22)
Release0.9.0 - (2019-05-21)
Release0.8.0 - (2019-04-23)
Release0.7.6 - (2019-04-10)
Release0.7.5 - (2019-04-05)
Release0.7.0 - (2018-12-14)
About
Scala configuration library supporting HOCON for Scala, Java, Scala.js, and Scala Native