From beba583fb13f767c682bf5ba5344aac4b79dd59e Mon Sep 17 00:00:00 2001 From: Kamil Panek Date: Tue, 1 Dec 2020 17:40:11 +0100 Subject: [PATCH] Anjay-java 2.8.0.1 --- .gitignore | 6 +- .gitmodules | 12 +- CHANGELOG.md | 11 ++ README.md | 86 ++++---- .../gradle/wrapper/gradle-wrapper.properties | 5 - .../library/gradle/wrapper/gradle-wrapper.jar | 1 - bindings/library/gradlew | 185 ------------------ bindings/library/gradlew.bat | 89 --------- {bindings => demo}/build.gradle | 18 +- .../build.gradle => demo/settings.gradle | 15 +- .../com/avsystem/anjay/demo/DemoArgs.java | 0 .../com/avsystem/anjay/demo/DemoClient.java | 0 .../com/avsystem/anjay/demo/DemoCommands.java | 0 .../com/avsystem/anjay/demo/DemoObject.java | 0 .../java/com/avsystem/anjay/demo/Test.java | 0 deps/anjay | 1 - gradle.properties | 17 ++ .../wrapper/gradle-wrapper.jar | Bin .../wrapper/gradle-wrapper.properties | 2 +- bindings/gradlew => gradlew | 0 bindings/gradlew.bat => gradlew.bat | 0 library/build.gradle | 52 +++++ library/scripts/android.gradle | 110 +++++++++++ library/scripts/native.gradle | 81 ++++++++ {bindings/library => library}/settings.gradle | 9 - library/src/main/AndroidManifest.xml | 20 ++ .../main/java/com/avsystem/anjay/Anjay.java | 0 .../anjay/AnjayAbstractSecurityConfig.java | 0 .../com/avsystem/anjay/AnjayAttrStorage.java | 0 .../com/avsystem/anjay/AnjayAttributes.java | 0 .../com/avsystem/anjay/AnjayBytesContext.java | 0 .../com/avsystem/anjay/AnjayDownload.java | 0 .../avsystem/anjay/AnjayDownloadHandlers.java | 0 .../com/avsystem/anjay/AnjayException.java | 0 .../avsystem/anjay/AnjayFirmwareUpdate.java | 0 .../anjay/AnjayFirmwareUpdateException.java | 0 .../anjay/AnjayFirmwareUpdateHandlers.java | 0 .../com/avsystem/anjay/AnjayInputContext.java | 0 .../java/com/avsystem/anjay/AnjayObject.java | 0 .../anjay/AnjayObjectAttrHandlers.java | 0 .../avsystem/anjay/AnjayOutputContext.java | 0 .../avsystem/anjay/AnjaySecurityConfig.java | 0 .../anjay/AnjaySecurityConfigFromDm.java | 0 .../com/avsystem/anjay/AnjaySecurityInfo.java | 0 .../avsystem/anjay/AnjaySecurityInfoCert.java | 0 .../avsystem/anjay/AnjaySecurityInfoPsk.java | 0 .../avsystem/anjay/AnjaySecurityObject.java | 0 .../com/avsystem/anjay/AnjayServerObject.java | 0 .../com/avsystem/anjay/impl/NativeAnjay.java | 0 .../anjay/impl/NativeAnjayDownload.java | 0 .../anjay/impl/NativeAnjayObject.java | 0 .../anjay/impl/NativeAttrStorage.java | 0 .../anjay/impl/NativeBytesContext.java | 0 .../anjay/impl/NativeBytesContextPointer.java | 0 .../anjay/impl/NativeFirmwareUpdate.java | 0 .../impl/NativeFirmwareUpdateHandlers.java | 0 .../anjay/impl/NativeInputContext.java | 0 .../anjay/impl/NativeInputContextPointer.java | 0 .../com/avsystem/anjay/impl/NativeLog.java | 0 .../anjay/impl/NativeOutputContext.java | 0 .../impl/NativeOutputContextPointer.java | 0 .../anjay/impl/NativeSecurityObject.java | 0 .../anjay/impl/NativeServerObject.java | 0 .../anjay/impl/NativeSocketEntry.java | 0 .../anjay/impl/NativeTransportSet.java | 0 .../com/avsystem/anjay/impl/NativeUtils.java | 0 .../java/com/avsystem/anjay/impl/Utils.java | 0 .../CMakeLists.txt | 31 +-- native-library/deps/anjay | 1 + {deps => native-library/deps}/jni.hpp | 0 {deps => native-library/deps}/mbedtls | 0 .../src}/compat/avs_net_socket.hpp | 0 .../src}/compat/net_impl.cpp | 49 ----- {src => native-library/src}/compat/socket.hpp | 0 .../src}/compat/socket_address.hpp | 0 .../src}/compat/socket_channel.hpp | 0 .../src}/compat/socket_error.hpp | 0 .../src}/global_context.cpp | 0 .../src}/global_context.hpp | 0 {src => native-library/src}/jni_wrapper.hpp | 0 {src => native-library/src}/main.cpp | 0 {src => native-library/src}/native_anjay.cpp | 0 {src => native-library/src}/native_anjay.hpp | 0 .../src}/native_anjay_download.cpp | 0 .../src}/native_anjay_download.hpp | 0 .../src}/native_anjay_object_adapter.cpp | 1 + .../src}/native_anjay_object_adapter.hpp | 0 .../src}/native_attr_storage.cpp | 1 + .../src}/native_attr_storage.hpp | 0 .../src}/native_bytes_context.cpp | 0 .../src}/native_bytes_context.hpp | 0 .../src}/native_firmware_update.cpp | 1 + .../src}/native_firmware_update.hpp | 0 .../src}/native_input_context.cpp | 0 .../src}/native_input_context.hpp | 0 {src => native-library/src}/native_log.cpp | 0 {src => native-library/src}/native_log.hpp | 0 .../src}/native_output_context.cpp | 0 .../src}/native_output_context.hpp | 0 .../src}/native_security_object.cpp | 1 + .../src}/native_security_object.hpp | 1 + .../src}/native_server_object.cpp | 1 + .../src}/native_server_object.hpp | 1 + .../src}/util_classes/accessor_base.hpp | 0 .../src}/util_classes/attributes.hpp | 0 .../src}/util_classes/byte_buffer.hpp | 0 .../src}/util_classes/coap_udp_tx_params.hpp | 0 .../src}/util_classes/configuration.hpp | 2 + .../src}/util_classes/construct.hpp | 0 .../util_classes/download_configuration.hpp | 1 + .../src}/util_classes/download_handlers.hpp | 0 .../src}/util_classes/download_result.hpp | 0 .../util_classes/download_result_details.hpp | 0 .../util_classes/dtls_handshake_timeouts.hpp | 0 .../src}/util_classes/dtls_version.hpp | 0 .../src}/util_classes/duration.hpp | 0 .../src}/util_classes/etag.hpp | 0 .../src}/util_classes/exception.cpp | 0 .../src}/util_classes/exception.hpp | 0 .../util_classes/firmware_update_handlers.hpp | 0 .../firmware_update_initial_result.hpp | 0 .../firmware_update_initial_state.hpp | 1 + .../util_classes/firmware_update_result.hpp | 0 .../src}/util_classes/hash_map.hpp | 0 .../src}/util_classes/input_stream.hpp | 0 .../integer_array_by_reference.hpp | 0 .../src}/util_classes/level.hpp | 0 .../src}/util_classes/logger.hpp | 0 .../src}/util_classes/map.hpp | 0 .../src}/util_classes/native_anjay_object.hpp | 0 .../native_bytes_context_pointer.hpp | 0 .../native_input_context_pointer.hpp | 0 .../native_output_context_pointer.hpp | 0 .../src}/util_classes/native_pointer.hpp | 0 .../src}/util_classes/native_socket_entry.hpp | 0 .../util_classes/native_transport_set.hpp | 1 + .../src}/util_classes/native_utils.hpp | 0 .../src}/util_classes/objlnk.hpp | 0 .../src}/util_classes/optional.hpp | 0 .../src}/util_classes/optional_tag.hpp | 0 .../src}/util_classes/output_stream.hpp | 0 .../src}/util_classes/resource_def.hpp | 0 .../resource_def_array_by_reference.hpp | 0 .../src}/util_classes/resource_kind.hpp | 0 .../src}/util_classes/security_config.hpp | 0 .../src}/util_classes/security_info_cert.hpp | 0 .../src}/util_classes/security_info_psk.hpp | 0 .../src}/util_classes/selectable_channel.hpp | 0 .../src}/util_classes/transport.hpp | 0 .../tests}/CMakeLists.txt | 0 .../tests}/integration/CMakeLists.txt | 8 +- .../tests}/integration/framework | 0 .../tests}/integration/jni_test.py | 7 +- .../tests}/integration/runtest.py | 0 .../tests}/integration/suites/__init__.py | 0 .../integration/suites/default/__init__.py | 0 .../integration/suites/default/downloader.py | 0 .../suites/default/firmware_update.py | 0 .../integration/suites/default/object.py | 27 --- .../integration/suites/default/register.py | 0 bindings/settings.gradle => settings.gradle | 14 +- testing/build.gradle | 39 ++++ testing/settings.gradle | 17 ++ 163 files changed, 435 insertions(+), 490 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 bindings/gradle/wrapper/gradle-wrapper.properties delete mode 120000 bindings/library/gradle/wrapper/gradle-wrapper.jar delete mode 100755 bindings/library/gradlew delete mode 100644 bindings/library/gradlew.bat rename {bindings => demo}/build.gradle (82%) rename bindings/library/build.gradle => demo/settings.gradle (83%) rename {bindings => demo}/src/main/java/com/avsystem/anjay/demo/DemoArgs.java (100%) rename {bindings => demo}/src/main/java/com/avsystem/anjay/demo/DemoClient.java (100%) rename {bindings => demo}/src/main/java/com/avsystem/anjay/demo/DemoCommands.java (100%) rename {bindings => demo}/src/main/java/com/avsystem/anjay/demo/DemoObject.java (100%) rename {bindings => demo}/src/main/java/com/avsystem/anjay/demo/Test.java (100%) delete mode 160000 deps/anjay create mode 100644 gradle.properties rename {bindings/gradle => gradle}/wrapper/gradle-wrapper.jar (100%) rename {bindings/library/gradle => gradle}/wrapper/gradle-wrapper.properties (92%) rename bindings/gradlew => gradlew (100%) rename bindings/gradlew.bat => gradlew.bat (100%) create mode 100644 library/build.gradle create mode 100644 library/scripts/android.gradle create mode 100644 library/scripts/native.gradle rename {bindings/library => library}/settings.gradle (66%) create mode 100644 library/src/main/AndroidManifest.xml rename {bindings/library => library}/src/main/java/com/avsystem/anjay/Anjay.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayAbstractSecurityConfig.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayAttrStorage.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayAttributes.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayBytesContext.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayDownload.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayDownloadHandlers.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayException.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdate.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateException.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateHandlers.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayInputContext.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayObject.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayObjectAttrHandlers.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayOutputContext.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjaySecurityConfig.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjaySecurityConfigFromDm.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjaySecurityInfo.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjaySecurityInfoCert.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjaySecurityInfoPsk.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjaySecurityObject.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/AnjayServerObject.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeAnjay.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeAnjayDownload.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeAnjayObject.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeAttrStorage.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeBytesContext.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeBytesContextPointer.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdate.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdateHandlers.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeInputContext.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeInputContextPointer.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeLog.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeOutputContext.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeOutputContextPointer.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeSecurityObject.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeServerObject.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeSocketEntry.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeTransportSet.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/NativeUtils.java (100%) rename {bindings/library => library}/src/main/java/com/avsystem/anjay/impl/Utils.java (100%) rename CMakeLists.txt => native-library/CMakeLists.txt (84%) create mode 160000 native-library/deps/anjay rename {deps => native-library/deps}/jni.hpp (100%) rename {deps => native-library/deps}/mbedtls (100%) rename {src => native-library/src}/compat/avs_net_socket.hpp (100%) rename {src => native-library/src}/compat/net_impl.cpp (89%) rename {src => native-library/src}/compat/socket.hpp (100%) rename {src => native-library/src}/compat/socket_address.hpp (100%) rename {src => native-library/src}/compat/socket_channel.hpp (100%) rename {src => native-library/src}/compat/socket_error.hpp (100%) rename {src => native-library/src}/global_context.cpp (100%) rename {src => native-library/src}/global_context.hpp (100%) rename {src => native-library/src}/jni_wrapper.hpp (100%) rename {src => native-library/src}/main.cpp (100%) rename {src => native-library/src}/native_anjay.cpp (100%) rename {src => native-library/src}/native_anjay.hpp (100%) rename {src => native-library/src}/native_anjay_download.cpp (100%) rename {src => native-library/src}/native_anjay_download.hpp (100%) rename {src => native-library/src}/native_anjay_object_adapter.cpp (99%) rename {src => native-library/src}/native_anjay_object_adapter.hpp (100%) rename {src => native-library/src}/native_attr_storage.cpp (99%) rename {src => native-library/src}/native_attr_storage.hpp (100%) rename {src => native-library/src}/native_bytes_context.cpp (100%) rename {src => native-library/src}/native_bytes_context.hpp (100%) rename {src => native-library/src}/native_firmware_update.cpp (99%) rename {src => native-library/src}/native_firmware_update.hpp (100%) rename {src => native-library/src}/native_input_context.cpp (100%) rename {src => native-library/src}/native_input_context.hpp (100%) rename {src => native-library/src}/native_log.cpp (100%) rename {src => native-library/src}/native_log.hpp (100%) rename {src => native-library/src}/native_output_context.cpp (100%) rename {src => native-library/src}/native_output_context.hpp (100%) rename {src => native-library/src}/native_security_object.cpp (99%) rename {src => native-library/src}/native_security_object.hpp (99%) rename {src => native-library/src}/native_server_object.cpp (99%) rename {src => native-library/src}/native_server_object.hpp (99%) rename {src => native-library/src}/util_classes/accessor_base.hpp (100%) rename {src => native-library/src}/util_classes/attributes.hpp (100%) rename {src => native-library/src}/util_classes/byte_buffer.hpp (100%) rename {src => native-library/src}/util_classes/coap_udp_tx_params.hpp (100%) rename {src => native-library/src}/util_classes/configuration.hpp (99%) rename {src => native-library/src}/util_classes/construct.hpp (100%) rename {src => native-library/src}/util_classes/download_configuration.hpp (99%) rename {src => native-library/src}/util_classes/download_handlers.hpp (100%) rename {src => native-library/src}/util_classes/download_result.hpp (100%) rename {src => native-library/src}/util_classes/download_result_details.hpp (100%) rename {src => native-library/src}/util_classes/dtls_handshake_timeouts.hpp (100%) rename {src => native-library/src}/util_classes/dtls_version.hpp (100%) rename {src => native-library/src}/util_classes/duration.hpp (100%) rename {src => native-library/src}/util_classes/etag.hpp (100%) rename {src => native-library/src}/util_classes/exception.cpp (100%) rename {src => native-library/src}/util_classes/exception.hpp (100%) rename {src => native-library/src}/util_classes/firmware_update_handlers.hpp (100%) rename {src => native-library/src}/util_classes/firmware_update_initial_result.hpp (100%) rename {src => native-library/src}/util_classes/firmware_update_initial_state.hpp (99%) rename {src => native-library/src}/util_classes/firmware_update_result.hpp (100%) rename {src => native-library/src}/util_classes/hash_map.hpp (100%) rename {src => native-library/src}/util_classes/input_stream.hpp (100%) rename {src => native-library/src}/util_classes/integer_array_by_reference.hpp (100%) rename {src => native-library/src}/util_classes/level.hpp (100%) rename {src => native-library/src}/util_classes/logger.hpp (100%) rename {src => native-library/src}/util_classes/map.hpp (100%) rename {src => native-library/src}/util_classes/native_anjay_object.hpp (100%) rename {src => native-library/src}/util_classes/native_bytes_context_pointer.hpp (100%) rename {src => native-library/src}/util_classes/native_input_context_pointer.hpp (100%) rename {src => native-library/src}/util_classes/native_output_context_pointer.hpp (100%) rename {src => native-library/src}/util_classes/native_pointer.hpp (100%) rename {src => native-library/src}/util_classes/native_socket_entry.hpp (100%) rename {src => native-library/src}/util_classes/native_transport_set.hpp (99%) rename {src => native-library/src}/util_classes/native_utils.hpp (100%) rename {src => native-library/src}/util_classes/objlnk.hpp (100%) rename {src => native-library/src}/util_classes/optional.hpp (100%) rename {src => native-library/src}/util_classes/optional_tag.hpp (100%) rename {src => native-library/src}/util_classes/output_stream.hpp (100%) rename {src => native-library/src}/util_classes/resource_def.hpp (100%) rename {src => native-library/src}/util_classes/resource_def_array_by_reference.hpp (100%) rename {src => native-library/src}/util_classes/resource_kind.hpp (100%) rename {src => native-library/src}/util_classes/security_config.hpp (100%) rename {src => native-library/src}/util_classes/security_info_cert.hpp (100%) rename {src => native-library/src}/util_classes/security_info_psk.hpp (100%) rename {src => native-library/src}/util_classes/selectable_channel.hpp (100%) rename {src => native-library/src}/util_classes/transport.hpp (100%) rename {tests => native-library/tests}/CMakeLists.txt (100%) rename {tests => native-library/tests}/integration/CMakeLists.txt (90%) rename {tests => native-library/tests}/integration/framework (100%) rename {tests => native-library/tests}/integration/jni_test.py (92%) rename {tests => native-library/tests}/integration/runtest.py (100%) rename {tests => native-library/tests}/integration/suites/__init__.py (100%) rename {tests => native-library/tests}/integration/suites/default/__init__.py (100%) rename {tests => native-library/tests}/integration/suites/default/downloader.py (100%) rename {tests => native-library/tests}/integration/suites/default/firmware_update.py (100%) rename {tests => native-library/tests}/integration/suites/default/object.py (55%) rename {tests => native-library/tests}/integration/suites/default/register.py (100%) rename bindings/settings.gradle => settings.gradle (64%) create mode 100644 testing/build.gradle create mode 100644 testing/settings.gradle diff --git a/.gitignore b/.gitignore index 37547d3..f1b6c71 100644 --- a/.gitignore +++ b/.gitignore @@ -276,8 +276,4 @@ CMakeDoxyfile.in CMakeDoxygenDefaults.cmake CPackConfig.cmake CPackSourceConfig.cmake -bindings/distributions/* -bindings/docs/* -bindings/generated/* -bindings/scripts/* -bindings/tmp/* +library/.cxx/ diff --git a/.gitmodules b/.gitmodules index 94262b5..2886ad1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..19d367a --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index e8ecab8..ecf8fbe 100644 --- a/README.md +++ b/README.md @@ -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 [](http://www.avsystem.com/) ## About @@ -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= ./gradlew -Pandroid :library:build +``` + +The `aar` files are in `library/build/outputs/aar` directory. + +### Running tests + +```sh +./gradlew :testing:check +``` diff --git a/bindings/gradle/wrapper/gradle-wrapper.properties b/bindings/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 12d38de..0000000 --- a/bindings/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/bindings/library/gradle/wrapper/gradle-wrapper.jar b/bindings/library/gradle/wrapper/gradle-wrapper.jar deleted file mode 120000 index b4214b8..0000000 --- a/bindings/library/gradle/wrapper/gradle-wrapper.jar +++ /dev/null @@ -1 +0,0 @@ -../../../gradle/wrapper/gradle-wrapper.jar \ No newline at end of file diff --git a/bindings/library/gradlew b/bindings/library/gradlew deleted file mode 100755 index 4f906e0..0000000 --- a/bindings/library/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/bindings/library/gradlew.bat b/bindings/library/gradlew.bat deleted file mode 100644 index 107acd3..0000000 --- a/bindings/library/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/bindings/build.gradle b/demo/build.gradle similarity index 82% rename from bindings/build.gradle rename to demo/build.gradle index be8e086..57df287 100644 --- a/bindings/build.gradle +++ b/demo/build.gradle @@ -17,7 +17,7 @@ plugins { id 'java' id 'application' - id 'com.diffplug.spotless' version '5.6.1' + id 'com.github.sherter.google-java-format' version '0.9' } repositories { @@ -46,18 +46,6 @@ jar { } } -spotless { - java { - googleJavaFormat().aosp() - } -} - -subprojects { - apply plugin: 'com.diffplug.spotless' - - spotless { - java { - googleJavaFormat().aosp() - } - } +googleJavaFormat { + options style: 'AOSP' } diff --git a/bindings/library/build.gradle b/demo/settings.gradle similarity index 83% rename from bindings/library/build.gradle rename to demo/settings.gradle index eecd35b..1d55ae6 100644 --- a/bindings/library/build.gradle +++ b/demo/settings.gradle @@ -14,17 +14,4 @@ * limitations under the License. */ -plugins { - id 'java-library' -} - -repositories { - jcenter() -} - -dependencies { -} - -javadoc { - exclude '**/impl/**' -} +rootProject.name = 'demo' diff --git a/bindings/src/main/java/com/avsystem/anjay/demo/DemoArgs.java b/demo/src/main/java/com/avsystem/anjay/demo/DemoArgs.java similarity index 100% rename from bindings/src/main/java/com/avsystem/anjay/demo/DemoArgs.java rename to demo/src/main/java/com/avsystem/anjay/demo/DemoArgs.java diff --git a/bindings/src/main/java/com/avsystem/anjay/demo/DemoClient.java b/demo/src/main/java/com/avsystem/anjay/demo/DemoClient.java similarity index 100% rename from bindings/src/main/java/com/avsystem/anjay/demo/DemoClient.java rename to demo/src/main/java/com/avsystem/anjay/demo/DemoClient.java diff --git a/bindings/src/main/java/com/avsystem/anjay/demo/DemoCommands.java b/demo/src/main/java/com/avsystem/anjay/demo/DemoCommands.java similarity index 100% rename from bindings/src/main/java/com/avsystem/anjay/demo/DemoCommands.java rename to demo/src/main/java/com/avsystem/anjay/demo/DemoCommands.java diff --git a/bindings/src/main/java/com/avsystem/anjay/demo/DemoObject.java b/demo/src/main/java/com/avsystem/anjay/demo/DemoObject.java similarity index 100% rename from bindings/src/main/java/com/avsystem/anjay/demo/DemoObject.java rename to demo/src/main/java/com/avsystem/anjay/demo/DemoObject.java diff --git a/bindings/src/main/java/com/avsystem/anjay/demo/Test.java b/demo/src/main/java/com/avsystem/anjay/demo/Test.java similarity index 100% rename from bindings/src/main/java/com/avsystem/anjay/demo/Test.java rename to demo/src/main/java/com/avsystem/anjay/demo/Test.java diff --git a/deps/anjay b/deps/anjay deleted file mode 160000 index e50f1ca..0000000 --- a/deps/anjay +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e50f1ca6fa187bd3221cc8b9f05da892b27f5626 diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..69ad1fb --- /dev/null +++ b/gradle.properties @@ -0,0 +1,17 @@ +/* + * Copyright 2020 AVSystem + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +org.gradle.logging.level=info diff --git a/bindings/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from bindings/gradle/wrapper/gradle-wrapper.jar rename to gradle/wrapper/gradle-wrapper.jar diff --git a/bindings/library/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 92% rename from bindings/library/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties index 12d38de..be52383 100644 --- a/bindings/library/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/bindings/gradlew b/gradlew similarity index 100% rename from bindings/gradlew rename to gradlew diff --git a/bindings/gradlew.bat b/gradlew.bat similarity index 100% rename from bindings/gradlew.bat rename to gradlew.bat diff --git a/library/build.gradle b/library/build.gradle new file mode 100644 index 0000000..2f91572 --- /dev/null +++ b/library/build.gradle @@ -0,0 +1,52 @@ +/* + * Copyright 2020 AVSystem + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +buildscript { + repositories { + jcenter() + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:4.1.0' + } +} + +plugins { + id 'net.freudasoft.gradle-cmake-plugin' version '0.0.4' + id 'com.palantir.git-version' version '0.12.3' + id 'com.github.sherter.google-java-format' version '0.9' +} + +version gitVersion() + +if (project.hasProperty('android')) { + apply from: 'scripts/android.gradle' +} else { + apply from: 'scripts/native.gradle' +} + +googleJavaFormat { + options style: 'AOSP' +} + +allprojects { + repositories { + jcenter() + google() + } +} + diff --git a/library/scripts/android.gradle b/library/scripts/android.gradle new file mode 100644 index 0000000..b4613f3 --- /dev/null +++ b/library/scripts/android.gradle @@ -0,0 +1,110 @@ +/* + * Copyright 2020 AVSystem + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'com.android.library' +apply plugin: 'maven-publish' +apply plugin: 'signing' + +ext.getVersionCode = { version -> + def code = 0 + if (versionDetails().isCleanTag) { + String[] split = version.split('[.]') + assert split.length == 3 || split.length == 4 + + def multiplier = 1000000 + for (String value : split) { + code += multiplier * (value as int) + multiplier = multiplier.intdiv(100) + } + } + return code +} + +android { + compileSdkVersion 26 + + defaultConfig { + externalNativeBuild { + cmake { + // Workaround for bad casts within Mbed TLS + cFlags '-Wno-pointer-sign' + } + } + minSdkVersion 26 + versionName gitVersion() + versionCode getVersionCode(versionName) + } + + externalNativeBuild { + cmake { + path '$projectDir/../../native-library/CMakeLists.txt' + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + lintOptions { + tasks.lint.enabled = false + } +} + +signing { + sign publishing.publications +} + +project.afterEvaluate { + publishing { + repositories { + maven { + url 'https://oss.sonatype.org/service/local/staging/deploy/maven2' + credentials(PasswordCredentials) + } + } + + publications { + maven(MavenPublication) { + groupId 'com.avsystem.anjay' + artifactId 'anjay-android' + from components.release + + pom { + name = 'Anjay' + description = 'Anjay LwM2M library' + url = 'https://www.avsystem.com/products/anjay/' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + name = 'AVSystem' + email = 'avsystem@avsystem.com' + } + } + scm { + connection = 'scm:git:git://github.com/AVSystem/Anjay-java.git' + url = 'https://github.com/AVSystem/Anjay-java' + } + } + } + } + } +} diff --git a/library/scripts/native.gradle b/library/scripts/native.gradle new file mode 100644 index 0000000..b31ec2e --- /dev/null +++ b/library/scripts/native.gradle @@ -0,0 +1,81 @@ +/* + * Copyright 2020 AVSystem + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'java-library' +apply plugin: 'net.freudasoft.gradle-cmake-plugin' +apply plugin: 'maven-publish' +apply plugin: 'signing' + +javadoc { + exclude '**/impl/**' +} + +cmake { + sourceFolder = file('$projectDir/../../native-library/') + buildConfig = 'Release' + buildClean = false +} + +tasks.build.dependsOn(cmakeBuild) +tasks.compileJava.dependsOn(cmakeBuild) + +signing { + sign publishing.publications +} + +java { + withSourcesJar() + withJavadocJar() +} + +publishing { + repositories { + maven { + url 'https://oss.sonatype.org/service/local/staging/deploy/maven2' + credentials(PasswordCredentials) + } + } + + publications { + maven(MavenPublication) { + groupId 'com.avsystem.anjay' + artifactId 'anjay-java' + from components.java + + pom { + name = 'Anjay' + description = 'Anjay LwM2M library' + url = 'https://www.avsystem.com/products/anjay/' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + name = 'AVSystem' + email = 'avsystem@avsystem.com' + } + } + scm { + connection = 'scm:git:git://github.com/AVSystem/Anjay-java.git' + url = 'https://github.com/AVSystem/Anjay-java' + } + } + } + } +} diff --git a/bindings/library/settings.gradle b/library/settings.gradle similarity index 66% rename from bindings/library/settings.gradle rename to library/settings.gradle index 875d117..f27f23b 100644 --- a/bindings/library/settings.gradle +++ b/library/settings.gradle @@ -14,13 +14,4 @@ * limitations under the License. */ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/6.6.1/userguide/multi_project_builds.html - */ - rootProject.name = 'library' diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml new file mode 100644 index 0000000..784ce01 --- /dev/null +++ b/library/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + diff --git a/bindings/library/src/main/java/com/avsystem/anjay/Anjay.java b/library/src/main/java/com/avsystem/anjay/Anjay.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/Anjay.java rename to library/src/main/java/com/avsystem/anjay/Anjay.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayAbstractSecurityConfig.java b/library/src/main/java/com/avsystem/anjay/AnjayAbstractSecurityConfig.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayAbstractSecurityConfig.java rename to library/src/main/java/com/avsystem/anjay/AnjayAbstractSecurityConfig.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayAttrStorage.java b/library/src/main/java/com/avsystem/anjay/AnjayAttrStorage.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayAttrStorage.java rename to library/src/main/java/com/avsystem/anjay/AnjayAttrStorage.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayAttributes.java b/library/src/main/java/com/avsystem/anjay/AnjayAttributes.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayAttributes.java rename to library/src/main/java/com/avsystem/anjay/AnjayAttributes.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayBytesContext.java b/library/src/main/java/com/avsystem/anjay/AnjayBytesContext.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayBytesContext.java rename to library/src/main/java/com/avsystem/anjay/AnjayBytesContext.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayDownload.java b/library/src/main/java/com/avsystem/anjay/AnjayDownload.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayDownload.java rename to library/src/main/java/com/avsystem/anjay/AnjayDownload.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayDownloadHandlers.java b/library/src/main/java/com/avsystem/anjay/AnjayDownloadHandlers.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayDownloadHandlers.java rename to library/src/main/java/com/avsystem/anjay/AnjayDownloadHandlers.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayException.java b/library/src/main/java/com/avsystem/anjay/AnjayException.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayException.java rename to library/src/main/java/com/avsystem/anjay/AnjayException.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdate.java b/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdate.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdate.java rename to library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdate.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateException.java b/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateException.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateException.java rename to library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateException.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateHandlers.java b/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateHandlers.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateHandlers.java rename to library/src/main/java/com/avsystem/anjay/AnjayFirmwareUpdateHandlers.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayInputContext.java b/library/src/main/java/com/avsystem/anjay/AnjayInputContext.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayInputContext.java rename to library/src/main/java/com/avsystem/anjay/AnjayInputContext.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayObject.java b/library/src/main/java/com/avsystem/anjay/AnjayObject.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayObject.java rename to library/src/main/java/com/avsystem/anjay/AnjayObject.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayObjectAttrHandlers.java b/library/src/main/java/com/avsystem/anjay/AnjayObjectAttrHandlers.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayObjectAttrHandlers.java rename to library/src/main/java/com/avsystem/anjay/AnjayObjectAttrHandlers.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayOutputContext.java b/library/src/main/java/com/avsystem/anjay/AnjayOutputContext.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayOutputContext.java rename to library/src/main/java/com/avsystem/anjay/AnjayOutputContext.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityConfig.java b/library/src/main/java/com/avsystem/anjay/AnjaySecurityConfig.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityConfig.java rename to library/src/main/java/com/avsystem/anjay/AnjaySecurityConfig.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityConfigFromDm.java b/library/src/main/java/com/avsystem/anjay/AnjaySecurityConfigFromDm.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityConfigFromDm.java rename to library/src/main/java/com/avsystem/anjay/AnjaySecurityConfigFromDm.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfo.java b/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfo.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfo.java rename to library/src/main/java/com/avsystem/anjay/AnjaySecurityInfo.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfoCert.java b/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfoCert.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfoCert.java rename to library/src/main/java/com/avsystem/anjay/AnjaySecurityInfoCert.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfoPsk.java b/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfoPsk.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityInfoPsk.java rename to library/src/main/java/com/avsystem/anjay/AnjaySecurityInfoPsk.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityObject.java b/library/src/main/java/com/avsystem/anjay/AnjaySecurityObject.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjaySecurityObject.java rename to library/src/main/java/com/avsystem/anjay/AnjaySecurityObject.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/AnjayServerObject.java b/library/src/main/java/com/avsystem/anjay/AnjayServerObject.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/AnjayServerObject.java rename to library/src/main/java/com/avsystem/anjay/AnjayServerObject.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeAnjay.java b/library/src/main/java/com/avsystem/anjay/impl/NativeAnjay.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeAnjay.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeAnjay.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeAnjayDownload.java b/library/src/main/java/com/avsystem/anjay/impl/NativeAnjayDownload.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeAnjayDownload.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeAnjayDownload.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeAnjayObject.java b/library/src/main/java/com/avsystem/anjay/impl/NativeAnjayObject.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeAnjayObject.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeAnjayObject.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeAttrStorage.java b/library/src/main/java/com/avsystem/anjay/impl/NativeAttrStorage.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeAttrStorage.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeAttrStorage.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeBytesContext.java b/library/src/main/java/com/avsystem/anjay/impl/NativeBytesContext.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeBytesContext.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeBytesContext.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeBytesContextPointer.java b/library/src/main/java/com/avsystem/anjay/impl/NativeBytesContextPointer.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeBytesContextPointer.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeBytesContextPointer.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdate.java b/library/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdate.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdate.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdate.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdateHandlers.java b/library/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdateHandlers.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdateHandlers.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeFirmwareUpdateHandlers.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeInputContext.java b/library/src/main/java/com/avsystem/anjay/impl/NativeInputContext.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeInputContext.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeInputContext.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeInputContextPointer.java b/library/src/main/java/com/avsystem/anjay/impl/NativeInputContextPointer.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeInputContextPointer.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeInputContextPointer.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeLog.java b/library/src/main/java/com/avsystem/anjay/impl/NativeLog.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeLog.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeLog.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeOutputContext.java b/library/src/main/java/com/avsystem/anjay/impl/NativeOutputContext.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeOutputContext.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeOutputContext.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeOutputContextPointer.java b/library/src/main/java/com/avsystem/anjay/impl/NativeOutputContextPointer.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeOutputContextPointer.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeOutputContextPointer.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeSecurityObject.java b/library/src/main/java/com/avsystem/anjay/impl/NativeSecurityObject.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeSecurityObject.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeSecurityObject.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeServerObject.java b/library/src/main/java/com/avsystem/anjay/impl/NativeServerObject.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeServerObject.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeServerObject.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeSocketEntry.java b/library/src/main/java/com/avsystem/anjay/impl/NativeSocketEntry.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeSocketEntry.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeSocketEntry.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeTransportSet.java b/library/src/main/java/com/avsystem/anjay/impl/NativeTransportSet.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeTransportSet.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeTransportSet.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/NativeUtils.java b/library/src/main/java/com/avsystem/anjay/impl/NativeUtils.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/NativeUtils.java rename to library/src/main/java/com/avsystem/anjay/impl/NativeUtils.java diff --git a/bindings/library/src/main/java/com/avsystem/anjay/impl/Utils.java b/library/src/main/java/com/avsystem/anjay/impl/Utils.java similarity index 100% rename from bindings/library/src/main/java/com/avsystem/anjay/impl/Utils.java rename to library/src/main/java/com/avsystem/anjay/impl/Utils.java diff --git a/CMakeLists.txt b/native-library/CMakeLists.txt similarity index 84% rename from CMakeLists.txt rename to native-library/CMakeLists.txt index 0f3220a..46efc3b 100644 --- a/CMakeLists.txt +++ b/native-library/CMakeLists.txt @@ -21,17 +21,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(DEFAULT_BUILD_JAR OFF) -set(DEFAULT_BUILD_DOC OFF) -set(DEFAULT_WITH_TEST OFF) if(NOT ANDROID) # Android has JNI in default include paths, however it does not have # AWT nor JVM libraries, which CMake unnecessarily tries to find. find_package(JNI) include_directories(${JNI_INCLUDE_DIRS}) - set(DEFAULT_BUILD_JAR ON) - set(DEFAULT_BUILD_DOC ON) - set(DEFAULT_WITH_TEST ON) else() # This overrides CMake install() command with a no-op. This is required for # add_subdirectory(deps/mbedtls) to work, because otherwise install() calls in @@ -56,9 +50,7 @@ set(WITH_HTTP_DOWNLOAD ON CACHE INTERNAL "") set(WITH_POSIX_AVS_SOCKET OFF CACHE INTERNAL "") add_subdirectory(deps/anjay EXCLUDE_FROM_ALL) -option(BUILD_JAR "Build JAR containing example application using Anjay" ${DEFAULT_BUILD_JAR}) -option(BUILD_DOC "Build docs using javadoc" ${DEFAULT_BUILD_DOC}) -option(WITH_INTEGRATION_TEST "Enables/disables integration tests target" ${DEFAULT_WITH_TEST}) +option(WITH_INTEGRATION_TEST "Enables/disables integration tests target" OFF) include_directories(${CMAKE_CURRENT_SOURCE_DIR} deps/jni.hpp/include) @@ -135,23 +127,12 @@ add_library(${PROJECT_NAME} SHARED target_link_libraries(${PROJECT_NAME} ${JAVA_JVM_LIBRARY} anjay) -if(BUILD_JAR) - add_custom_target(demo ALL - COMMAND ./gradlew build -PbuildDir=${CMAKE_BINARY_DIR}/bindings - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bindings/libs/demo.jar ${CMAKE_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bindings/libs/library.jar ${CMAKE_BINARY_DIR} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bindings) - add_dependencies(demo ${PROJECT_NAME}) -endif() - -if(BUILD_DOC) - add_custom_target(javadoc ALL - COMMAND ./gradlew javadoc -PbuildDir=${CMAKE_BINARY_DIR}/bindings - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bindings/docs ${CMAKE_BINARY_DIR}/doc - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bindings) -endif() - if(WITH_INTEGRATION_TEST) + add_custom_target(demo ALL + COMMAND cd ${CMAKE_SOURCE_DIR}/../ && ./gradlew :demo:build -PbuildDir=${CMAKE_BINARY_DIR} && cd - + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/libs/demo.jar ${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/cmake/libanjay-jni.so ${CMAKE_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/) enable_testing() add_custom_target(check) add_subdirectory(tests) diff --git a/native-library/deps/anjay b/native-library/deps/anjay new file mode 160000 index 0000000..7042222 --- /dev/null +++ b/native-library/deps/anjay @@ -0,0 +1 @@ +Subproject commit 704222249f5f4993b62d8fb49396ad34356b9a58 diff --git a/deps/jni.hpp b/native-library/deps/jni.hpp similarity index 100% rename from deps/jni.hpp rename to native-library/deps/jni.hpp diff --git a/deps/mbedtls b/native-library/deps/mbedtls similarity index 100% rename from deps/mbedtls rename to native-library/deps/mbedtls diff --git a/src/compat/avs_net_socket.hpp b/native-library/src/compat/avs_net_socket.hpp similarity index 100% rename from src/compat/avs_net_socket.hpp rename to native-library/src/compat/avs_net_socket.hpp diff --git a/src/compat/net_impl.cpp b/native-library/src/compat/net_impl.cpp similarity index 89% rename from src/compat/net_impl.cpp rename to native-library/src/compat/net_impl.cpp index 3abb66e..93cf97a 100644 --- a/src/compat/net_impl.cpp +++ b/native-library/src/compat/net_impl.cpp @@ -375,53 +375,4 @@ avs_error_t avs_net_local_address_for_target_host(const char *, # define IPV6_AVAILABLE 0 #endif -static int get_af(avs_net_af_t addr_family) { - switch (addr_family) { -#ifdef AVS_COMMONS_NET_WITH_IPV4 - case AVS_NET_AF_INET4: - return AF_INET; -#endif /* AVS_COMMONS_NET_WITH_IPV4 */ - -#ifdef AVS_COMMONS_NET_WITH_IPV6 - case AVS_NET_AF_INET6: - return AF_INET6; -#endif /* AVS_COMMONS_NET_WITH_IPV6 */ - - case AVS_NET_AF_UNSPEC: - default: - return AF_UNSPEC; - } -} - -static int validate_ip_address(avs_net_af_t family, const char *ip_address) { - union { -#ifdef AVS_COMMONS_NET_WITH_IPV4 - struct in_addr sa4; -#endif /* AVS_COMMONS_NET_WITH_IPV4 */ - -#ifdef AVS_COMMONS_NET_WITH_IPV6 - struct in6_addr sa6; -#endif /* AVS_COMMONS_NET_WITH_IPV6 */ - } sa; - if (inet_pton(get_af(family), ip_address, &sa) < 1) { - return -1; - } - return 0; -} - -int avs_net_validate_ip_address(avs_net_af_t family, const char *ip_address) { - if ((IPV4_AVAILABLE && (family == AVS_NET_AF_INET4)) - || ((IPV6_AVAILABLE && (family == AVS_NET_AF_INET6)))) { - return validate_ip_address(family, ip_address); - } else { - return ((IPV4_AVAILABLE - && (validate_ip_address(AVS_NET_AF_INET4, ip_address) == 0)) - || (IPV6_AVAILABLE - && (validate_ip_address(AVS_NET_AF_INET6, ip_address) - == 0))) - ? 0 - : -1; - } -} - } // extern "C" diff --git a/src/compat/socket.hpp b/native-library/src/compat/socket.hpp similarity index 100% rename from src/compat/socket.hpp rename to native-library/src/compat/socket.hpp diff --git a/src/compat/socket_address.hpp b/native-library/src/compat/socket_address.hpp similarity index 100% rename from src/compat/socket_address.hpp rename to native-library/src/compat/socket_address.hpp diff --git a/src/compat/socket_channel.hpp b/native-library/src/compat/socket_channel.hpp similarity index 100% rename from src/compat/socket_channel.hpp rename to native-library/src/compat/socket_channel.hpp diff --git a/src/compat/socket_error.hpp b/native-library/src/compat/socket_error.hpp similarity index 100% rename from src/compat/socket_error.hpp rename to native-library/src/compat/socket_error.hpp diff --git a/src/global_context.cpp b/native-library/src/global_context.cpp similarity index 100% rename from src/global_context.cpp rename to native-library/src/global_context.cpp diff --git a/src/global_context.hpp b/native-library/src/global_context.hpp similarity index 100% rename from src/global_context.hpp rename to native-library/src/global_context.hpp diff --git a/src/jni_wrapper.hpp b/native-library/src/jni_wrapper.hpp similarity index 100% rename from src/jni_wrapper.hpp rename to native-library/src/jni_wrapper.hpp diff --git a/src/main.cpp b/native-library/src/main.cpp similarity index 100% rename from src/main.cpp rename to native-library/src/main.cpp diff --git a/src/native_anjay.cpp b/native-library/src/native_anjay.cpp similarity index 100% rename from src/native_anjay.cpp rename to native-library/src/native_anjay.cpp diff --git a/src/native_anjay.hpp b/native-library/src/native_anjay.hpp similarity index 100% rename from src/native_anjay.hpp rename to native-library/src/native_anjay.hpp diff --git a/src/native_anjay_download.cpp b/native-library/src/native_anjay_download.cpp similarity index 100% rename from src/native_anjay_download.cpp rename to native-library/src/native_anjay_download.cpp diff --git a/src/native_anjay_download.hpp b/native-library/src/native_anjay_download.hpp similarity index 100% rename from src/native_anjay_download.hpp rename to native-library/src/native_anjay_download.hpp diff --git a/src/native_anjay_object_adapter.cpp b/native-library/src/native_anjay_object_adapter.cpp similarity index 99% rename from src/native_anjay_object_adapter.cpp rename to native-library/src/native_anjay_object_adapter.cpp index 0fbc993..d5ea615 100644 --- a/src/native_anjay_object_adapter.cpp +++ b/native-library/src/native_anjay_object_adapter.cpp @@ -313,3 +313,4 @@ int NativeAnjayObjectAdapter::resource_write_attrs( avs_log_and_clear_exception(DEBUG); return -1; } + diff --git a/src/native_anjay_object_adapter.hpp b/native-library/src/native_anjay_object_adapter.hpp similarity index 100% rename from src/native_anjay_object_adapter.hpp rename to native-library/src/native_anjay_object_adapter.hpp diff --git a/src/native_attr_storage.cpp b/native-library/src/native_attr_storage.cpp similarity index 99% rename from src/native_attr_storage.cpp rename to native-library/src/native_attr_storage.cpp index 9d38c0b..5b1ded9 100644 --- a/src/native_attr_storage.cpp +++ b/native-library/src/native_attr_storage.cpp @@ -100,6 +100,7 @@ void NativeAttrStorage::set_resource_attrs( } } + jni::jint NativeAttrStorage::get_attr_period_none(jni::JNIEnv &, jni::Class &) { diff --git a/src/native_attr_storage.hpp b/native-library/src/native_attr_storage.hpp similarity index 100% rename from src/native_attr_storage.hpp rename to native-library/src/native_attr_storage.hpp diff --git a/src/native_bytes_context.cpp b/native-library/src/native_bytes_context.cpp similarity index 100% rename from src/native_bytes_context.cpp rename to native-library/src/native_bytes_context.cpp diff --git a/src/native_bytes_context.hpp b/native-library/src/native_bytes_context.hpp similarity index 100% rename from src/native_bytes_context.hpp rename to native-library/src/native_bytes_context.hpp diff --git a/src/native_firmware_update.cpp b/native-library/src/native_firmware_update.cpp similarity index 99% rename from src/native_firmware_update.cpp rename to native-library/src/native_firmware_update.cpp index d059840..bd1a1db 100644 --- a/src/native_firmware_update.cpp +++ b/native-library/src/native_firmware_update.cpp @@ -163,6 +163,7 @@ NativeFirmwareUpdate::NativeFirmwareUpdate( state.resume_etag = resume_etag->data; } + if (auto locked = anjay_.lock()) { if (anjay_fw_update_install(locked.get(), &handlers_, this, &state)) { avs_throw(std::runtime_error( diff --git a/src/native_firmware_update.hpp b/native-library/src/native_firmware_update.hpp similarity index 100% rename from src/native_firmware_update.hpp rename to native-library/src/native_firmware_update.hpp diff --git a/src/native_input_context.cpp b/native-library/src/native_input_context.cpp similarity index 100% rename from src/native_input_context.cpp rename to native-library/src/native_input_context.cpp diff --git a/src/native_input_context.hpp b/native-library/src/native_input_context.hpp similarity index 100% rename from src/native_input_context.hpp rename to native-library/src/native_input_context.hpp diff --git a/src/native_log.cpp b/native-library/src/native_log.cpp similarity index 100% rename from src/native_log.cpp rename to native-library/src/native_log.cpp diff --git a/src/native_log.hpp b/native-library/src/native_log.hpp similarity index 100% rename from src/native_log.hpp rename to native-library/src/native_log.hpp diff --git a/src/native_output_context.cpp b/native-library/src/native_output_context.cpp similarity index 100% rename from src/native_output_context.cpp rename to native-library/src/native_output_context.cpp diff --git a/src/native_output_context.hpp b/native-library/src/native_output_context.hpp similarity index 100% rename from src/native_output_context.hpp rename to native-library/src/native_output_context.hpp diff --git a/src/native_security_object.cpp b/native-library/src/native_security_object.cpp similarity index 99% rename from src/native_security_object.cpp rename to native-library/src/native_security_object.cpp index 46480d4..ac73421 100644 --- a/src/native_security_object.cpp +++ b/native-library/src/native_security_object.cpp @@ -92,6 +92,7 @@ jni::jint NativeSecurityObject::add_instance(jni::JNIEnv &env, sec.server_sms_number = server_sms_number->c_str(); } + if (preferred_iid < 0 || preferred_iid > ANJAY_ID_INVALID) { avs_throw(std::runtime_error("preferred iid out of anjay_iid_t range")); } diff --git a/src/native_security_object.hpp b/native-library/src/native_security_object.hpp similarity index 99% rename from src/native_security_object.hpp rename to native-library/src/native_security_object.hpp index 0cd54c5..b4a9fbb 100644 --- a/src/native_security_object.hpp +++ b/native-library/src/native_security_object.hpp @@ -139,6 +139,7 @@ class NativeSecurityObject { return to_optional_std_string( get_optional_value("serverSmsNumber")); } + }; }; diff --git a/src/native_server_object.cpp b/native-library/src/native_server_object.cpp similarity index 99% rename from src/native_server_object.cpp rename to native-library/src/native_server_object.cpp index 6bf5672..9bf0ad4 100644 --- a/src/native_server_object.cpp +++ b/native-library/src/native_server_object.cpp @@ -59,6 +59,7 @@ jni::jint NativeServerObject::add_instance(jni::JNIEnv &env, serv.notification_storing = accessor.get_notification_storing(); + if (preferred_iid < 0 || preferred_iid > ANJAY_ID_INVALID) { avs_throw(std::runtime_error("preferred iid out of anjay_iid_t range")); } diff --git a/src/native_server_object.hpp b/native-library/src/native_server_object.hpp similarity index 99% rename from src/native_server_object.hpp rename to native-library/src/native_server_object.hpp index d6d6fb1..4c77a49 100644 --- a/src/native_server_object.hpp +++ b/native-library/src/native_server_object.hpp @@ -70,6 +70,7 @@ class NativeServerObject { bool get_notification_storing() { return get_value("notificationStoring"); } + }; }; diff --git a/src/util_classes/accessor_base.hpp b/native-library/src/util_classes/accessor_base.hpp similarity index 100% rename from src/util_classes/accessor_base.hpp rename to native-library/src/util_classes/accessor_base.hpp diff --git a/src/util_classes/attributes.hpp b/native-library/src/util_classes/attributes.hpp similarity index 100% rename from src/util_classes/attributes.hpp rename to native-library/src/util_classes/attributes.hpp diff --git a/src/util_classes/byte_buffer.hpp b/native-library/src/util_classes/byte_buffer.hpp similarity index 100% rename from src/util_classes/byte_buffer.hpp rename to native-library/src/util_classes/byte_buffer.hpp diff --git a/src/util_classes/coap_udp_tx_params.hpp b/native-library/src/util_classes/coap_udp_tx_params.hpp similarity index 100% rename from src/util_classes/coap_udp_tx_params.hpp rename to native-library/src/util_classes/coap_udp_tx_params.hpp diff --git a/src/util_classes/configuration.hpp b/native-library/src/util_classes/configuration.hpp similarity index 99% rename from src/util_classes/configuration.hpp rename to native-library/src/util_classes/configuration.hpp index 0e063df..a6625f0 100644 --- a/src/util_classes/configuration.hpp +++ b/native-library/src/util_classes/configuration.hpp @@ -81,6 +81,7 @@ struct Configuration { return get_value("useConnectionId"); } + std::optional get_udp_tx_params() { auto value = get_optional_value("udpTxParams"); if (value) { @@ -90,6 +91,7 @@ struct Configuration { return {}; } + std::optional get_udp_dtls_hs_tx_params() { auto value = get_optional_value( diff --git a/src/util_classes/construct.hpp b/native-library/src/util_classes/construct.hpp similarity index 100% rename from src/util_classes/construct.hpp rename to native-library/src/util_classes/construct.hpp diff --git a/src/util_classes/download_configuration.hpp b/native-library/src/util_classes/download_configuration.hpp similarity index 99% rename from src/util_classes/download_configuration.hpp rename to native-library/src/util_classes/download_configuration.hpp index 62a5d39..65e5200 100644 --- a/src/util_classes/download_configuration.hpp +++ b/native-library/src/util_classes/download_configuration.hpp @@ -62,6 +62,7 @@ struct DownloadConfiguration { } return {}; } + }; }; diff --git a/src/util_classes/download_handlers.hpp b/native-library/src/util_classes/download_handlers.hpp similarity index 100% rename from src/util_classes/download_handlers.hpp rename to native-library/src/util_classes/download_handlers.hpp diff --git a/src/util_classes/download_result.hpp b/native-library/src/util_classes/download_result.hpp similarity index 100% rename from src/util_classes/download_result.hpp rename to native-library/src/util_classes/download_result.hpp diff --git a/src/util_classes/download_result_details.hpp b/native-library/src/util_classes/download_result_details.hpp similarity index 100% rename from src/util_classes/download_result_details.hpp rename to native-library/src/util_classes/download_result_details.hpp diff --git a/src/util_classes/dtls_handshake_timeouts.hpp b/native-library/src/util_classes/dtls_handshake_timeouts.hpp similarity index 100% rename from src/util_classes/dtls_handshake_timeouts.hpp rename to native-library/src/util_classes/dtls_handshake_timeouts.hpp diff --git a/src/util_classes/dtls_version.hpp b/native-library/src/util_classes/dtls_version.hpp similarity index 100% rename from src/util_classes/dtls_version.hpp rename to native-library/src/util_classes/dtls_version.hpp diff --git a/src/util_classes/duration.hpp b/native-library/src/util_classes/duration.hpp similarity index 100% rename from src/util_classes/duration.hpp rename to native-library/src/util_classes/duration.hpp diff --git a/src/util_classes/etag.hpp b/native-library/src/util_classes/etag.hpp similarity index 100% rename from src/util_classes/etag.hpp rename to native-library/src/util_classes/etag.hpp diff --git a/src/util_classes/exception.cpp b/native-library/src/util_classes/exception.cpp similarity index 100% rename from src/util_classes/exception.cpp rename to native-library/src/util_classes/exception.cpp diff --git a/src/util_classes/exception.hpp b/native-library/src/util_classes/exception.hpp similarity index 100% rename from src/util_classes/exception.hpp rename to native-library/src/util_classes/exception.hpp diff --git a/src/util_classes/firmware_update_handlers.hpp b/native-library/src/util_classes/firmware_update_handlers.hpp similarity index 100% rename from src/util_classes/firmware_update_handlers.hpp rename to native-library/src/util_classes/firmware_update_handlers.hpp diff --git a/src/util_classes/firmware_update_initial_result.hpp b/native-library/src/util_classes/firmware_update_initial_result.hpp similarity index 100% rename from src/util_classes/firmware_update_initial_result.hpp rename to native-library/src/util_classes/firmware_update_initial_result.hpp diff --git a/src/util_classes/firmware_update_initial_state.hpp b/native-library/src/util_classes/firmware_update_initial_state.hpp similarity index 99% rename from src/util_classes/firmware_update_initial_state.hpp rename to native-library/src/util_classes/firmware_update_initial_state.hpp index e0ffef9..264cae1 100644 --- a/src/util_classes/firmware_update_initial_state.hpp +++ b/native-library/src/util_classes/firmware_update_initial_state.hpp @@ -66,6 +66,7 @@ struct FirmwareUpdateInitialState { return ANJAY_FW_UPDATE_INITIAL_NEUTRAL; } } + }; }; diff --git a/src/util_classes/firmware_update_result.hpp b/native-library/src/util_classes/firmware_update_result.hpp similarity index 100% rename from src/util_classes/firmware_update_result.hpp rename to native-library/src/util_classes/firmware_update_result.hpp diff --git a/src/util_classes/hash_map.hpp b/native-library/src/util_classes/hash_map.hpp similarity index 100% rename from src/util_classes/hash_map.hpp rename to native-library/src/util_classes/hash_map.hpp diff --git a/src/util_classes/input_stream.hpp b/native-library/src/util_classes/input_stream.hpp similarity index 100% rename from src/util_classes/input_stream.hpp rename to native-library/src/util_classes/input_stream.hpp diff --git a/src/util_classes/integer_array_by_reference.hpp b/native-library/src/util_classes/integer_array_by_reference.hpp similarity index 100% rename from src/util_classes/integer_array_by_reference.hpp rename to native-library/src/util_classes/integer_array_by_reference.hpp diff --git a/src/util_classes/level.hpp b/native-library/src/util_classes/level.hpp similarity index 100% rename from src/util_classes/level.hpp rename to native-library/src/util_classes/level.hpp diff --git a/src/util_classes/logger.hpp b/native-library/src/util_classes/logger.hpp similarity index 100% rename from src/util_classes/logger.hpp rename to native-library/src/util_classes/logger.hpp diff --git a/src/util_classes/map.hpp b/native-library/src/util_classes/map.hpp similarity index 100% rename from src/util_classes/map.hpp rename to native-library/src/util_classes/map.hpp diff --git a/src/util_classes/native_anjay_object.hpp b/native-library/src/util_classes/native_anjay_object.hpp similarity index 100% rename from src/util_classes/native_anjay_object.hpp rename to native-library/src/util_classes/native_anjay_object.hpp diff --git a/src/util_classes/native_bytes_context_pointer.hpp b/native-library/src/util_classes/native_bytes_context_pointer.hpp similarity index 100% rename from src/util_classes/native_bytes_context_pointer.hpp rename to native-library/src/util_classes/native_bytes_context_pointer.hpp diff --git a/src/util_classes/native_input_context_pointer.hpp b/native-library/src/util_classes/native_input_context_pointer.hpp similarity index 100% rename from src/util_classes/native_input_context_pointer.hpp rename to native-library/src/util_classes/native_input_context_pointer.hpp diff --git a/src/util_classes/native_output_context_pointer.hpp b/native-library/src/util_classes/native_output_context_pointer.hpp similarity index 100% rename from src/util_classes/native_output_context_pointer.hpp rename to native-library/src/util_classes/native_output_context_pointer.hpp diff --git a/src/util_classes/native_pointer.hpp b/native-library/src/util_classes/native_pointer.hpp similarity index 100% rename from src/util_classes/native_pointer.hpp rename to native-library/src/util_classes/native_pointer.hpp diff --git a/src/util_classes/native_socket_entry.hpp b/native-library/src/util_classes/native_socket_entry.hpp similarity index 100% rename from src/util_classes/native_socket_entry.hpp rename to native-library/src/util_classes/native_socket_entry.hpp diff --git a/src/util_classes/native_transport_set.hpp b/native-library/src/util_classes/native_transport_set.hpp similarity index 99% rename from src/util_classes/native_transport_set.hpp rename to native-library/src/util_classes/native_transport_set.hpp index 81b1cda..05fea7f 100644 --- a/src/util_classes/native_transport_set.hpp +++ b/native-library/src/util_classes/native_transport_set.hpp @@ -42,6 +42,7 @@ struct NativeTransportSet { bool get_tcp() { return get_value("tcp"); } + }; static anjay_transport_set_t diff --git a/src/util_classes/native_utils.hpp b/native-library/src/util_classes/native_utils.hpp similarity index 100% rename from src/util_classes/native_utils.hpp rename to native-library/src/util_classes/native_utils.hpp diff --git a/src/util_classes/objlnk.hpp b/native-library/src/util_classes/objlnk.hpp similarity index 100% rename from src/util_classes/objlnk.hpp rename to native-library/src/util_classes/objlnk.hpp diff --git a/src/util_classes/optional.hpp b/native-library/src/util_classes/optional.hpp similarity index 100% rename from src/util_classes/optional.hpp rename to native-library/src/util_classes/optional.hpp diff --git a/src/util_classes/optional_tag.hpp b/native-library/src/util_classes/optional_tag.hpp similarity index 100% rename from src/util_classes/optional_tag.hpp rename to native-library/src/util_classes/optional_tag.hpp diff --git a/src/util_classes/output_stream.hpp b/native-library/src/util_classes/output_stream.hpp similarity index 100% rename from src/util_classes/output_stream.hpp rename to native-library/src/util_classes/output_stream.hpp diff --git a/src/util_classes/resource_def.hpp b/native-library/src/util_classes/resource_def.hpp similarity index 100% rename from src/util_classes/resource_def.hpp rename to native-library/src/util_classes/resource_def.hpp diff --git a/src/util_classes/resource_def_array_by_reference.hpp b/native-library/src/util_classes/resource_def_array_by_reference.hpp similarity index 100% rename from src/util_classes/resource_def_array_by_reference.hpp rename to native-library/src/util_classes/resource_def_array_by_reference.hpp diff --git a/src/util_classes/resource_kind.hpp b/native-library/src/util_classes/resource_kind.hpp similarity index 100% rename from src/util_classes/resource_kind.hpp rename to native-library/src/util_classes/resource_kind.hpp diff --git a/src/util_classes/security_config.hpp b/native-library/src/util_classes/security_config.hpp similarity index 100% rename from src/util_classes/security_config.hpp rename to native-library/src/util_classes/security_config.hpp diff --git a/src/util_classes/security_info_cert.hpp b/native-library/src/util_classes/security_info_cert.hpp similarity index 100% rename from src/util_classes/security_info_cert.hpp rename to native-library/src/util_classes/security_info_cert.hpp diff --git a/src/util_classes/security_info_psk.hpp b/native-library/src/util_classes/security_info_psk.hpp similarity index 100% rename from src/util_classes/security_info_psk.hpp rename to native-library/src/util_classes/security_info_psk.hpp diff --git a/src/util_classes/selectable_channel.hpp b/native-library/src/util_classes/selectable_channel.hpp similarity index 100% rename from src/util_classes/selectable_channel.hpp rename to native-library/src/util_classes/selectable_channel.hpp diff --git a/src/util_classes/transport.hpp b/native-library/src/util_classes/transport.hpp similarity index 100% rename from src/util_classes/transport.hpp rename to native-library/src/util_classes/transport.hpp diff --git a/tests/CMakeLists.txt b/native-library/tests/CMakeLists.txt similarity index 100% rename from tests/CMakeLists.txt rename to native-library/tests/CMakeLists.txt diff --git a/tests/integration/CMakeLists.txt b/native-library/tests/integration/CMakeLists.txt similarity index 90% rename from tests/integration/CMakeLists.txt rename to native-library/tests/integration/CMakeLists.txt index 31542aa..f3850b8 100644 --- a/tests/integration/CMakeLists.txt +++ b/native-library/tests/integration/CMakeLists.txt @@ -27,7 +27,8 @@ foreach(DEMO_TEST ${DEMO_TESTS}) if (NOT DEMO_TEST MATCHES "__init__$") add_test(${INTEGRATION_TEST_PREFIX}${DEMO_TEST} ${CMAKE_CURRENT_SOURCE_DIR}/runtest.py "^${DEMO_TEST}\\\$" - --client=${CMAKE_BINARY_DIR}/demo.jar) + --client=${CMAKE_BINARY_DIR}/demo.jar + --target-logs-path=${CMAKE_CURRENT_BINARY_DIR}/log) # Tell python tests where to look for pymbedtls*.so set_property(TEST ${INTEGRATION_TEST_PREFIX}${DEMO_TEST} @@ -63,6 +64,11 @@ unset(_MISSING_PYTHON_MSG) add_custom_target(pymbedtls COMMAND python3 "${CMAKE_CURRENT_SOURCE_DIR}/framework/nsh-lwm2m/pymbedtls/setup.py" install --install-lib ${PYMBEDTLS_MODULE_DIR}) +include(ProcessorCount) +ProcessorCount(ANJAY_DEFAULT_NPROC) + +set(NPROC "${ANJAY_DEFAULT_NPROC}" CACHE STRING "Number of threads for multi-threaded build/test operations") + add_custom_target(integration_check COMMAND ${CMAKE_CTEST_COMMAND} -j ${NPROC} --output-on-failure DEPENDS demo pymbedtls) diff --git a/tests/integration/framework b/native-library/tests/integration/framework similarity index 100% rename from tests/integration/framework rename to native-library/tests/integration/framework diff --git a/tests/integration/jni_test.py b/native-library/tests/integration/jni_test.py similarity index 92% rename from tests/integration/jni_test.py rename to native-library/tests/integration/jni_test.py index 0f7c78d..119b1f3 100644 --- a/tests/integration/jni_test.py +++ b/native-library/tests/integration/jni_test.py @@ -71,9 +71,8 @@ def filter_args(args): if timeout_s is not None: # wait until demo process starts - if read_until_match(self.demo_process.log_file, - regex=re.escape( - b'*** DEMO STARTUP FINISHED ***'), - timeout_s=timeout_s) is None: + if self.read_log_until_match(regex=re.escape( + b'*** DEMO STARTUP FINISHED ***'), + timeout_s=timeout_s) is None: raise self.failureException( 'demo executable did not start in time') diff --git a/tests/integration/runtest.py b/native-library/tests/integration/runtest.py similarity index 100% rename from tests/integration/runtest.py rename to native-library/tests/integration/runtest.py diff --git a/tests/integration/suites/__init__.py b/native-library/tests/integration/suites/__init__.py similarity index 100% rename from tests/integration/suites/__init__.py rename to native-library/tests/integration/suites/__init__.py diff --git a/tests/integration/suites/default/__init__.py b/native-library/tests/integration/suites/default/__init__.py similarity index 100% rename from tests/integration/suites/default/__init__.py rename to native-library/tests/integration/suites/default/__init__.py diff --git a/tests/integration/suites/default/downloader.py b/native-library/tests/integration/suites/default/downloader.py similarity index 100% rename from tests/integration/suites/default/downloader.py rename to native-library/tests/integration/suites/default/downloader.py diff --git a/tests/integration/suites/default/firmware_update.py b/native-library/tests/integration/suites/default/firmware_update.py similarity index 100% rename from tests/integration/suites/default/firmware_update.py rename to native-library/tests/integration/suites/default/firmware_update.py diff --git a/tests/integration/suites/default/object.py b/native-library/tests/integration/suites/default/object.py similarity index 55% rename from tests/integration/suites/default/object.py rename to native-library/tests/integration/suites/default/object.py index d6e4b85..e9a4186 100644 --- a/tests/integration/suites/default/object.py +++ b/native-library/tests/integration/suites/default/object.py @@ -18,7 +18,6 @@ from framework.lwm2m.messages import * from framework import test_suite from framework.test_utils import * -from framework.lwm2m.senml_cbor import * class OID: Test = 1337 @@ -54,29 +53,3 @@ def runTest(self): self.test_read_write(rid=RID.Test.Objlnk, value='22:38') self.test_read_write(rid=RID.Test.Bytes, value='YWJjZGUK') # abcde in base64 - -class TestObjectExecute(jni_test.LocalSingleServerTest, - test_suite.Lwm2mDmOperations): - def runTest(self): - self.execute_resource(self.serv, oid=OID.Test, iid=1, rid=RID.Test.Executable, content=b"0='3',1='5'") - self.assertEquals(self.read_resource_instance(self.serv, oid=OID.Test, iid=1, rid=RID.Test.LastExecuteArgs, riid=0).content, b'3') - self.assertEquals(self.read_resource_instance(self.serv, oid=OID.Test, iid=1, rid=RID.Test.LastExecuteArgs, riid=1).content, b'5') - - -class TestObjectMultipleResourceInstance(jni_test.LocalSingleServerTest, - test_suite.Lwm2mDmOperations): - def runTest(self): - request = [ - { - SenmlLabel.NAME: '/%d/1/%d/0' % (OID.Test, RID.Test.MultipleResource), - SenmlLabel.VALUE: 32 - }, - { - SenmlLabel.NAME: '/%d/1/%d/10' % (OID.Test, RID.Test.MultipleResource), - SenmlLabel.VALUE: 31 - } - ] - self.write_resource(self.serv, oid=OID.Test, iid=1, rid=RID.Test.MultipleResource, content=CBOR.serialize(request), format=coap.ContentFormat.APPLICATION_LWM2M_SENML_CBOR) - self.assertEquals(self.read_resource_instance(self.serv, oid=OID.Test, iid=1, rid=RID.Test.MultipleResource, riid=0).content, b'32') - self.assertEquals(self.read_resource_instance(self.serv, oid=OID.Test, iid=1, rid=RID.Test.MultipleResource, riid=10).content, b'31') - diff --git a/tests/integration/suites/default/register.py b/native-library/tests/integration/suites/default/register.py similarity index 100% rename from tests/integration/suites/default/register.py rename to native-library/tests/integration/suites/default/register.py diff --git a/bindings/settings.gradle b/settings.gradle similarity index 64% rename from bindings/settings.gradle rename to settings.gradle index 2307c9b..d04e0d2 100644 --- a/bindings/settings.gradle +++ b/settings.gradle @@ -14,15 +14,7 @@ * limitations under the License. */ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/6.6.1/userguide/multi_project_builds.html - */ - -rootProject.name = 'demo' - +rootProject.name = 'anjay-java' include 'library' +include 'demo' +include 'testing' diff --git a/testing/build.gradle b/testing/build.gradle new file mode 100644 index 0000000..d58ed9e --- /dev/null +++ b/testing/build.gradle @@ -0,0 +1,39 @@ +/* + * Copyright 2020 AVSystem + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id 'net.freudasoft.gradle-cmake-plugin' version '0.0.4' +} + +repositories { + jcenter() +} + +cmake { + sourceFolder = file('$projectDir/../../native-library/') + buildConfig = 'Debug' + buildClean = false + buildTarget = 'check' + def.WITH_INTEGRATION_TEST = 'ON' +} + +task check { + doLast { + println 'All tests passed' + } +} + +check.dependsOn cmakeBuild diff --git a/testing/settings.gradle b/testing/settings.gradle new file mode 100644 index 0000000..1a02554 --- /dev/null +++ b/testing/settings.gradle @@ -0,0 +1,17 @@ +/* + * Copyright 2020 AVSystem + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +rootProject.name = 'testing'