Skip to content

Commit

Permalink
Anjay-java 2.8.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
panekk committed Dec 1, 2020
1 parent 8d391a1 commit beba583
Show file tree
Hide file tree
Showing 163 changed files with 435 additions and 490 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,4 @@ CMakeDoxyfile.in
CMakeDoxygenDefaults.cmake
CPackConfig.cmake
CPackSourceConfig.cmake
bindings/distributions/*
bindings/docs/*
bindings/generated/*
bindings/scripts/*
bindings/tmp/*
library/.cxx/
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "deps/anjay"]
path = deps/anjay
[submodule "native-library/deps/anjay"]
path = native-library/deps/anjay
url = https://github.com/AVSystem/Anjay.git
[submodule "deps/jni.hpp"]
path = deps/jni.hpp
[submodule "native-library/deps/jni.hpp"]
path = native-library/deps/jni.hpp
url = https://github.com/mapbox/jni.hpp.git
[submodule "deps/mbedtls"]
path = deps/mbedtls
[submodule "native-library/deps/mbedtls"]
path = native-library/deps/mbedtls
url = https://github.com/ARMmbed/mbedtls
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

## 2.8.0.1 (Dec 1, 2020)

- Update Anjay to 2.8.0
- Reorganize project structure
- Configure publishing of packages to Maven Central

## 2.7.0 (Oct 23, 2020)

- Initial release using Anjay 2.7.0
86 changes: 44 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.avsystem.anjay/anjay-android?label=maven%20central%3A%20anjay-android)](https://search.maven.org/artifact/com.avsystem.anjay/anjay-android)
[![Maven Central](https://img.shields.io/maven-central/v/com.avsystem.anjay/anjay-java?label=maven%20central%3A%20anjay-java)](https://search.maven.org/artifact/com.avsystem.anjay/anjay-java)

# Anjay-java [<img align="right" height="50px" src="https://avsystem.github.io/Anjay-doc/_images/avsystem_logo.png">](http://www.avsystem.com/)

## About
Expand All @@ -9,55 +12,54 @@ This project provides almost 1:1 API bindings between [Anjay](https://github.com
This is a preview release and we don't provide any guarantees about API stability
or library reliability.

## Usage
## Using in Android Studio

This project is released to Maven Central repository as
`com.avsystem.anjay.anjay-android`. Add `mavenCentral()` in `repositories`
section of your build script and `implementation 'com.avsystem.anjay:anjay-android:2.+'` in `dependencies` to use it.

## Using anjay-java package

Although the `anjay-java` package is released on Maven Central repository, it
requires native shared library to be available. See the Compilation guide for
details how to build the native library.

First of all, remember to update all submodules using `git submodule update --init --recursive`.
## Compilation guide

### CMake
First of all, remember to update all submodules using
`git submodule update --init --recursive`.

### Build library

The library, example client and documentation can be built from command line as follows:
```sh
$ cmake .
$ make -j
./gradlew :library:build
```

To run the example client execute:
The `jar` file is placed in `library/build/libs` directory. Note that it doesn't
include the native library, which can be found in `library/build/cmake`
directory.

### Build and run demo

```sh
$ java -Djava.library.path=$PWD/ -jar demo.jar
./gradlew :demo:build
java -Djava.library.path=library/build/cmake/ -jar demo/build/libs/demo.jar
```

By default, the client attempts to connect to `coap://127.0.0.1:5683`, but it
can be customized using command line arguments. Use `--help` to see all available
options.

### Android Studio

1. Start with creating a simple base project (_Empty activity_ for example),
using Java and API 26 or newer.
2. In the left navigator right click on the _app_ and select
_Link C++ Project with Gradle_, set _Build System_ to _CMake_ and choose
_CMakeLists.txt_ file from the root project directory.
3. As of today's version of mbed TLS (2.23.0) there's a problem preventing it
from compiling. A crude and simple workaround for this is to edit
application's `build.gradle` as below:
```
android {
// ...
defaultConfig {
// ...
externalNativeBuild {
cmake {
// Workaround for bad casts within mbed TLS
cFlags "-Wno-pointer-sign"
}
}
}
// ...
}
```
4. The next step is to add Anjay's Java sources to your project so that you can
actually use the bindings. The simplest way to do it is to create a symlink
from `bindings/main/java/com/avsystem` to `app/src/main/java/com/avsystem`.
5. Now you can check
`bindings/src/main/java/com/avsystem/anjay/demo/DemoClient.java` to see
how to use Anjay's Java bindings.
can be customized using command line arguments. Use `--help` to see all
available options.

### Building for Android

```sh
ANDROID_SDK_ROOT=<path to Android SDK> ./gradlew -Pandroid :library:build
```

The `aar` files are in `library/build/outputs/aar` directory.

### Running tests

```sh
./gradlew :testing:check
```
5 changes: 0 additions & 5 deletions bindings/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

1 change: 0 additions & 1 deletion bindings/library/gradle/wrapper/gradle-wrapper.jar

This file was deleted.

185 changes: 0 additions & 185 deletions bindings/library/gradlew

This file was deleted.

Loading

0 comments on commit beba583

Please sign in to comment.