Repository navigation
Highlights
- Fewer supported targets. Scala 2.12 and the Cats Effect 2 module are gone. Scala.js, Scala Native and the cats module are now published only for Scala 3. See Breaking changes.
- Better Scala 3 derivation.
derives Parser, Helpnow works, and derivation gives clearer errors and handles more cases (see below). - Cats module on Scala Native.
case-app-catsis now published for Scala Native too.
Breaking changes
These changes come from #676, unless noted otherwise.
- Scala 2.12 is no longer supported. case-app 2.2.0 is published for Scala 2.13 and Scala 3 only.
- The
case-app-cats-effect-2module is gone. Usecase-app-cats, which is based on Cats Effect 3. - Scala.js, Scala Native and
case-app-catsare published only for Scala 3. On Scala 2.13, only the JVMcase-appandcase-app-annotationsartifacts are still published. - The
case-app-utilmodule is no longer published. On Scala 2, its macros now ship inside thecase-appJAR. On Scala 3 it had no content. If you depended oncase-app-utildirectly, remove that dependency.case-appalready provides what it contained.
New features and improvements
Scala 3 derivation (#697)
derivesclauses.ParserandHelpcan now be derived with aderivesclause:This replaces the oldcase class Options( foo: Int ) derives Parser, Help
@derives[Parser, Help] object Optionsapproach in the docs.- Clearer compile errors. When an instance is missing, derivation now fails with a message naming the field and the cause, such as
Cannot parse field value of …orCannot derive a parser for field value of …. Previously it could fail with an exception. - Large options classes. Derivation no longer overflows the compiler stack on classes with many fields (about 80 or more).
- Default values.
- Fields whose type has an implicit
caseapp.core.default.Default(Option[T],List[T],Vector[T], counters, …) are now optional even without an explicit default value, as on Scala 2. - Default values now work for classes compiled separately and for case classes nested inside a class.
- Fields whose type has an implicit
- Annotation order. Repeated annotations such as
@ExtraNameand@Tagnow keep their source order. @AppName,@AppVersion,@ProgName,@ArgsNameand@HelpMessageon the options class are read more reliably.- App name for a class named
Options. Such a class now getsOptionsas its app name instead of an empty one.
Scala 3 binary compatibility (#697)
- On Scala 3, case-app now uses a vendored copy of the unroll compiler plugin. It generates the binary-compatible constructor,
applyandcopyoverloads that data-class generates on Scala 2. The plugin is used only at build time and is not published. - The
with…setters fromcaseapp.core.Scala3Helpers, and those generated by@dataon Scala 2, are deprecated. Usecopyinstead, which works on both Scala 2 and Scala 3. For example:You no longer need to import// before helpFormat.withSortedGroups(Some(Seq("Help", "Main"))) // after helpFormat.copy(sortedGroups = Some(Seq("Help", "Main")))
caseapp.core.Scala3Helpers._.
Platforms
case-app-catsis now published for Scala Native (#693).- MiMa binary compatibility checks now also run for the Scala Native modules (#687).
Bug fixes
- "Already specified" error message (#686). When an option that accepts a single value was passed twice, the error read
argument ??? already specified. It now names the argument, as inArgument --foo: specified more than once. - Custom name formatters (#696). A custom name formatter (
Parser#nameFormatter) was applied only to the first field when reporting errors such as a missing required option. The other fields used the default formatter. All fields now use the custom formatter.
Dependency updates
Build, CI and tests
- Build
- CI
- Tests
Full Changelog: v2.1.1...v2.2.0