项目作者: infinum

项目描述 :
Retrofit converter which uses Thrifty for Apache Thrift-compatible serialization
高级语言: Java
项目地址: git://github.com/infinum/thrifty-retrofit-converter.git
创建时间: 2017-07-18T07:59:23Z
项目社区:https://github.com/infinum/thrifty-retrofit-converter

开源协议:Apache License 2.0

下载


Thrifty Retrofit converter

License

A Retrofit converter implementation using Thrifty for
(de)serialization of Apache Thrift requests and responses.

It supports Binary, Compact and Json Thrift protocols.
It supports Thrifty models generated in both Java and Kotlin.

Usage

Add the library as a dependency to your build.gradle to automatically download it from Maven Central.

  1. implementation "com.infinum:retrofit-converter-thrifty:3.0.0"

… and add the converter factory when you create the Retrofit object.

  1. Retrofit retrofit = new Retrofit.Builder()
  2. .baseUrl("https://example.com/api/")
  3. .addConverterFactory(ThriftyConverterFactory.create(ProtocolType.COMPACT))
  4. .build();

We also maintain a changelog.

Contributing

Feedback and code contributions are very much welcome. Just make a pull request with a short description of your changes. By making contributions to this project you give permission for your code to be used under the same license.

Generating new files with the thrifty compiler

In case source files need to be generated from .thrift files using a different version of the thrifty compiler, use these commands:

  1. wget https://repo1.maven.org/maven2/com/microsoft/thrifty/thrifty-compiler/2.1.2/thrifty-compiler-2.1.2-all.jar
  2. java -jar thrifty-compiler-2.1.2-all.jar --out=retrofit-converter-thrifty/src/test/java/ --lang=java retrofit-converter-thrifty/src/test/resources/phone.thrift
  3. java -jar thrifty-compiler-2.1.2-all.jar --out=retrofit-converter-thrifty/src/test/kotlin/ --lang=kotlin --kt-file-per-type retrofit-converter-thrifty/src/test/resources/phone.thrift

Deploying a new version

To publish to Maven Central you first need to set the following Gradle properties:

  1. signing.keyId=<GPG_KEY_ID>
  2. signing.password=<GPG_KEY_PASSWORD>
  3. signing.secretKeyRingFile=<GPG_SECRING_LOCATION>
  4. sonatypeUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
  5. sonatypeUsername=<SONATYPE_USERNAME>
  6. sonatypePassword=<SONATYPE_PASSWORD>

To deploy a new version to Maven Central, use deploy.sh:

  1. ./publish.sh <artifact version> [optional tag message]

The publish.sh script will automatically push a tag with the version name and change the version in the README.

All you need to do after the script runs is to press release in Sonatype OSS.