{"id":21948178,"url":"https://github.com/evolution-gaming/kryo-macros","last_synced_at":"2025-07-22T06:31:45.246Z","repository":{"id":12252243,"uuid":"71260660","full_name":"evolution-gaming/kryo-macros","owner":"evolution-gaming","description":"Scala macros for compile-time generation of Kryo serializers","archived":true,"fork":false,"pushed_at":"2024-07-14T14:33:35.000Z","size":129,"stargazers_count":63,"open_issues_count":30,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-13T09:06:07.297Z","etag":null,"topics":["kryo","macros","scala","scala-macros"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evolution-gaming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-18T15:07:18.000Z","updated_at":"2025-04-19T08:36:34.000Z","dependencies_parsed_at":"2023-02-10T10:45:20.157Z","dependency_job_id":null,"html_url":"https://github.com/evolution-gaming/kryo-macros","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/evolution-gaming/kryo-macros","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolution-gaming%2Fkryo-macros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolution-gaming%2Fkryo-macros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolution-gaming%2Fkryo-macros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolution-gaming%2Fkryo-macros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evolution-gaming","download_url":"https://codeload.github.com/evolution-gaming/kryo-macros/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolution-gaming%2Fkryo-macros/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266439230,"owners_count":23928628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kryo","macros","scala","scala-macros"],"created_at":"2024-11-29T05:12:17.845Z","updated_at":"2025-07-22T06:31:44.946Z","avatar_url":"https://github.com/evolution-gaming.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kryo Macros [![Build Status](https://travis-ci.org/evolution-gaming/kryo-macros.svg)](https://travis-ci.org/evolution-gaming/kryo-macros) [![license](http://img.shields.io/:license-Apache%202-green.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt) [ ![version](https://api.bintray.com/packages/evolutiongaming/maven/kryo-macros/images/download.svg) ](https://bintray.com/evolutiongaming/maven/kryo-macros/_latestVersion)\n\nScala macros that generate `com.esotericsoftware.kryo.Serializer` implementations in compile time, based on compile time reflection.\n\n## Features and limitations\n\n- On top level only case classes are supported\n- Fields of case classes can be other case classes, Scala collections, options, primitive or `AnyVal` types \u0026 classes, \n  tuples, Scala enums, standard types \u0026 classes: `String`, `Either`, `BigDecimal`, `java.time.Instant`, \n  `scala.concurrent.duration.FiniteDuration`, `org.joda.time.DateTime`\n- Fields can be annotated as transient or just be not defined in constructor to avoid parsing and serializing \n- For nested structures need to generate serializers for all case classes \n- Implicitly defined mapping helpers are supported for ADT structures, simple alternative mappings, etc.\n- Manual serializers can be used in generated code when defined as implicits\n\n## How to use\n\nAdd the following resolver\n```sbt\nresolvers += Resolver.bintrayRepo(\"evolutiongaming\", \"maven\")\n```\n\nAdd the library to your dependencies list\n```sbt\nlibraryDependencies += \"com.evolutiongaming\" %% \"kryo-macros\" % \"1.3.0\"\n```\n\nGenerate some serializers for your case classes\n```scala\nimport com.evolutiongaming.kryo.Serializer\n\ncase class Player(name: String)\n\nval serializer = Serializer.make[Player]\n```\n \nThat's it! You have generated a `com.esotericsoftware.kryo.Serializer` implementation for your `Player`.\nYou must know what to do with it if you are here :)\n\nTo serialize objects that extends sealed traits/class use `Serializer.makeCommon` call: \n```scala\nimport com.evolutiongaming.kryo.{ConstSerializer, Serializer}\n \nsealed trait Reason\n \nobject Reason {\n  case object Close extends Reason\n  case object Pause extends Reason       \n}\n\nval reasonSerializer = Serializer.makeCommon[Reason] {\n  case 0 =\u003e ConstSerializer(Reason.Close)\n  case 1 =\u003e ConstSerializer(Reason.Pause)\n}\n\nsealed abstract class Message(val text: String)\n\nobject Message {\n  case object Common extends Message(\"common\")\n  case object Notification extends Message(\"notification\")\n}\n\nprivate implicit val messageSerializer = Serializer.makeMapping[Message] {\n  case 0 =\u003e Message.Common   \n  case 1 =\u003e Message.Notification\n}\n```\n\nTo see generated code just add the following line to your sbt build file \n```sbt\nscalacOptions += \"-Xmacro-settings:print-serializers\"\n```\n\nFor more examples, please, check out \n[SerializerMacroSpec](https://github.com/evolution-gaming/kryo-macros/tree/master/macros/src/test/scala/com/evolutiongaming/kryo/SerializerMacroSpec.scala)\n\n## How to develop\n\n### Run tests, check coverage \u0026 binary compatibility for both supported Scala versions\n```sh\nsbt clean +coverage +test +coverageReport +mimaReportBinaryIssues\n```\n\n### Run benchmarks\n```sh\nsbt -no-colors clean 'benchmark/jmh:run -prof gc .*SerializerBenchmark.*' \u003eresults.txt\n```\n\n### Release\n\nFor version numbering use [Recommended Versioning Scheme](http://docs.scala-lang.org/overviews/core/binary-compatibility-for-library-authors.html#recommended-versioning-scheme)\nthat is widely adopted in the Scala ecosystem.\n\nDouble-check binary \u0026 source compatibility and release using following command (credentials required):\n\n```sh\nsbt release\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevolution-gaming%2Fkryo-macros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevolution-gaming%2Fkryo-macros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevolution-gaming%2Fkryo-macros/lists"}