/heraj

Java client framework for aergo

Primary LanguageJavaMIT LicenseMIT

heraj - Java client framework for aergo

MIT License LoC github build codecov.io

The hera is the client-side framework for the aergo. This repository, heraj is java implementation for hera.

Latest

v1.4.2

build with aergo-protobuf 6ce439c7600ae7b167c6c61e66ce2ac38bb2bef9

Compatibility

  • Aergo : v2.2.x
  • Java : JDK 8 or higher
  • Android : Android 3.0 (API 11) or higher

Download

There are 3 kind of library:

  • heraj-transport : minimum library including all of the base
  • heraj-wallet : nonce handling wallet library (depends on heraj-transport)
  • heraj-smart-contract : simple client to call smart contract with a java interface (depends on heraj-wallet)

If you just want a minimum one, use heraj-transport. Or need more feature, use heraj-wallet or heraj-smart-contract.

Module Structure

  • core
    • annotation : Store annotations used within heraj.
    • common : Store models used within heraj.
    • protobuf : Keeps java files generated from *.proto.
    • transport : Transport module interacting with aergo node using grpc.
    • util : Utils used within heraj.
  • client
    • wallet : Provides KeyStore to store aergo key. Provides WalletApi to interacting with KeyStore.
    • smart-contract : Modules for interface-based smart contract interaction.

Maven

...

<dependencies>
  <dependency>
    <groupId>io.aergo</groupId>
    <artifactId>heraj-transport</artifactId>
    <version>${herajVersion}</version>
  </dependency>
  <dependency>
    <groupId>io.aergo</groupId>
    <artifactId>heraj-wallet</artifactId>
    <version>${herajVersion}</version>
  </dependency>
  <dependency>
    <groupId>io.aergo</groupId>
    <artifactId>heraj-smart-contract</artifactId>
    <version>${herajVersion}</version>
  </dependency>
</dependencies>

Gradle

...

dependencies {
  implementation "io.aergo:heraj-transport:${herajVersion}"
  implementation "io.aergo:heraj-wallet:${herajVersion}"
  implementation "io.aergo:heraj-smart-contract:${herajVersion}"
}

Build from source

Prerequisites

Clone

$ git clone --recurse-submodule https://github.com/aergoio/heraj.git

Submodule

Initialize submodule (if not initialized)

$ git submodule init

Update submodule

$ git submodule update

Build

  • Clean: ./gradlew clean
  • Generate protobuf based files: ./gradlew :core:protobuf:build
  • Lint: ./gradlew lint
  • Test: ./gradlew test
    • Coverage (need test task): ./gradlew test coverage (individual), ./gradlew test allcoverage (all)
    • Integration Test: ./test/run-it.sh (need docker running)
    • Benchmark Test: ./gradlew {target_project}:jmh
  • Docs: ./gradlew javadoc (individual), ./gradlew alljavadoc (all)
  • Build (also lint, test): ./gradlew build
  • Shadow Jar: ./gradlew shadowJar (generated in ./assembly/build/libs)
  • Install to local: ./gradlew publishToMavenLocal

Kind of test

Unit test

They are classes with 'Test' suffix.

Integration test

They are classes with 'IT' suffix meaning integration test.

Benchmark test

They are classes with 'Benchmark' suffix, which using jmh.

Contribution

Guidelines for any code contributions:

  1. Any changes should be accompanied by tests. It's guaranteed by travis ci.
  2. Code coverage should be maintained. Any requests dropping down code coverage significantly will be not confirmed.
  3. All contributions must be licensed MIT and all files must have a copy of statement indicating where license is (can be copied from an existing file).
  4. All java files should be formatted according to Google's Java style guide. You can use checkstyle plugin for eclipse or IntelliJ. And you can check by running ./gradlew lint
  5. Please squash all commits for a change into a single commit (this can be done using git rebase -i). Make sure to have a meaningful commit message for the change.