diff options
author | Dirk Huss <dirk_huss@mentor.com> | 2015-12-09 14:36:53 +0100 |
---|---|---|
committer | Dirk Huss <dirk_huss@mentor.com> | 2015-12-09 14:37:06 +0100 |
commit | 6b1eb79629cd188e6d1384854adfbfb5b35df14f (patch) | |
tree | 39253caa09f7dab72b3c517b07d4c2f10ccb6209 | |
parent | ee0a7727239fb3087fb0a25b41f55d907b935a2c (diff) | |
download | genivi-common-api-runtime-6b1eb79629cd188e6d1384854adfbfb5b35df14f.tar.gz |
CommonAPI-Tools 3.1.53.1.5
53 files changed, 844 insertions, 611 deletions
diff --git a/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt b/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt index 1b2ef2b..c295ad7 100644 --- a/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt +++ b/CommonAPI-Examples/E01HelloWorld/CMakeLists.txt @@ -29,11 +29,11 @@ OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}") if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON") - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) else() - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) endif() message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") @@ -61,8 +61,8 @@ else() endif() # SOME/IP -find_package (CommonAPI-SomeIP 3.1.4 REQUIRED) -find_package (vsomeip 2.0.0 REQUIRED) +find_package (CommonAPI-SomeIP 3.1.5 REQUIRED) +find_package (vsomeip 2.0.1 REQUIRED) # Source Files set(PRJ_SRC_PATH src) diff --git a/CommonAPI-Examples/E02Attributes/CMakeLists.txt b/CommonAPI-Examples/E02Attributes/CMakeLists.txt index a3cd270..edb5c19 100644 --- a/CommonAPI-Examples/E02Attributes/CMakeLists.txt +++ b/CommonAPI-Examples/E02Attributes/CMakeLists.txt @@ -29,11 +29,11 @@ OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}") if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON") - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) else() - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) endif() message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") @@ -61,8 +61,8 @@ else() endif() # SOME/IP -find_package (CommonAPI-SomeIP 3.1.4 REQUIRED) -find_package (vsomeip 2.0.0 REQUIRED) +find_package (CommonAPI-SomeIP 3.1.5 REQUIRED) +find_package (vsomeip 2.0.1 REQUIRED) # Source Files set(PRJ_SRC_PATH src) @@ -77,10 +77,9 @@ set(PRJ_NAME_SERVICE ${PRJ_NAME}Service) # Application FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/*Proxy.cpp) FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/*Stub*.cpp) -FILE(GLOB PRJ_TYPES_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/CommonTypes.cpp) FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_COMMONAPI_PATH}/*Stub*.cpp) -set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS} ${PRJ_TYPES_GEN_SRCS}) -set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_SRC_PATH}/${PRJ_NAME}StubImpl.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS} ${PRJ_TYPES_GEN_SRCS}) +set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS}) +set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_SRC_PATH}/${PRJ_NAME}StubImpl.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS}) # Boost find_package( Boost 1.54 COMPONENTS system thread log REQUIRED ) diff --git a/CommonAPI-Examples/E02Attributes/src/AttributeCacheExtension.hpp b/CommonAPI-Examples/E02Attributes/src/AttributeCacheExtension.hpp deleted file mode 100644 index 85e414a..0000000 --- a/CommonAPI-Examples/E02Attributes/src/AttributeCacheExtension.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include <CommonAPI/CommonAPI.hpp> - -template<typename _AttributeType> -class AttributeCacheExtension: public CommonAPI::AttributeExtension<_AttributeType> { - typedef CommonAPI::AttributeExtension<_AttributeType> __baseClass_t; - - public: - typedef typename _AttributeType::ValueType value_t; - typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback; - - AttributeCacheExtension(_AttributeType& baseAttribute) : - CommonAPI::AttributeExtension<_AttributeType>(baseAttribute), - isCacheValid_(false) { - } - - ~AttributeCacheExtension() {} - - bool getCachedValue(value_t& value) { - - if (isCacheValid_) { - - value = cachedValue_; - - } else { - - __baseClass_t::getBaseAttribute().getChangedEvent().subscribe(std::bind( - &AttributeCacheExtension<_AttributeType>::onValueUpdate, - this, - std::placeholders::_1)); - - CommonAPI::CallStatus callStatus; - - __baseClass_t::getBaseAttribute().getValue(callStatus, value); - } - - return isCacheValid_; - } - - private: - - void onValueUpdate(const value_t& t) { - isCacheValid_ = true; - cachedValue_ = t; - } - - mutable bool isCacheValid_; - mutable value_t cachedValue_; - -}; diff --git a/CommonAPI-Examples/E03Methods/CMakeLists.txt b/CommonAPI-Examples/E03Methods/CMakeLists.txt index 8d9c5bd..ac9e809 100644 --- a/CommonAPI-Examples/E03Methods/CMakeLists.txt +++ b/CommonAPI-Examples/E03Methods/CMakeLists.txt @@ -31,11 +31,11 @@ OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}") if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON") - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) else() - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) endif() message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") @@ -63,8 +63,8 @@ else() endif() # SOME/IP -find_package (CommonAPI-SomeIP 3.1.4 REQUIRED) -find_package (vsomeip 2.0.0 REQUIRED) +find_package (CommonAPI-SomeIP 3.1.5 REQUIRED) +find_package (vsomeip 2.0.1 REQUIRED) # Source Files set(PRJ_SRC_PATH src) @@ -80,16 +80,15 @@ set(PRJ_NAME_SERVICE ${PRJ_NAME}Service) FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/*Proxy.cpp) FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/*Stub*.cpp) FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_COMMONAPI_PATH}/*Stub*.cpp) -FILE(GLOB PRJ_TYPES_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/E03Methods.cpp) set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS}) -set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_SRC_PATH}/${PRJ_NAME}StubImpl.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS} ${PRJ_TYPES_GEN_SRCS}) +set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_SRC_PATH}/${PRJ_NAME}StubImpl.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS}) # Boost find_package( Boost 1.54 COMPONENTS system thread log REQUIRED ) include_directories( ${Boost_INCLUDE_DIR} ) # DBus library -FILE(GLOB PRJ_DBUS_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_DBUS_PATH}/*cpp ${PRJ_TYPES_GEN_SRCS}) +FILE(GLOB PRJ_DBUS_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_DBUS_PATH}/*cpp) # SOME/IP library FILE(GLOB PRJ_SOMEIP_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH}/*cpp) diff --git a/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt b/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt index 750dec7..d0b9706 100644 --- a/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt +++ b/CommonAPI-Examples/E04PhoneBook/CMakeLists.txt @@ -31,11 +31,11 @@ OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}") if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON") - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) else() - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) endif() message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") @@ -63,8 +63,8 @@ else() endif() # SOME/IP -find_package (CommonAPI-SomeIP 3.1.4 REQUIRED) -find_package (vsomeip 2.0.0 REQUIRED) +find_package (CommonAPI-SomeIP 3.1.5 REQUIRED) +find_package (vsomeip 2.0.1 REQUIRED) # Source Files set(PRJ_SRC_PATH src) diff --git a/CommonAPI-Examples/E05Manager/CMakeLists.txt b/CommonAPI-Examples/E05Manager/CMakeLists.txt index 1bad474..4eeb3b7 100644 --- a/CommonAPI-Examples/E05Manager/CMakeLists.txt +++ b/CommonAPI-Examples/E05Manager/CMakeLists.txt @@ -29,11 +29,11 @@ OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}") if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON") - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) else() - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) endif() message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") @@ -61,8 +61,8 @@ else() endif() # SOME/IP -find_package (CommonAPI-SomeIP 3.1.4 REQUIRED) -find_package (vsomeip 2.0.0 REQUIRED) +find_package (CommonAPI-SomeIP 3.1.5 REQUIRED) +find_package (vsomeip 2.0.1 REQUIRED) # Source Files set(PRJ_SRC_PATH src) diff --git a/CommonAPI-Examples/E06Unions/CMakeLists.txt b/CommonAPI-Examples/E06Unions/CMakeLists.txt index 193f805..b356387 100644 --- a/CommonAPI-Examples/E06Unions/CMakeLists.txt +++ b/CommonAPI-Examples/E06Unions/CMakeLists.txt @@ -31,11 +31,11 @@ OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}") if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON") - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) else() - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) endif() message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") @@ -63,8 +63,8 @@ else() endif() # SOME/IP -find_package (CommonAPI-SomeIP 3.1.4 REQUIRED) -find_package (vsomeip 2.0.0 REQUIRED) +find_package (CommonAPI-SomeIP 3.1.5 REQUIRED) +find_package (vsomeip 2.0.1 REQUIRED) # Source Files set(PRJ_SRC_PATH src) diff --git a/CommonAPI-Examples/E07Mainloop/CMakeLists.txt b/CommonAPI-Examples/E07Mainloop/CMakeLists.txt index 2cb7923..e8ad1e8 100644 --- a/CommonAPI-Examples/E07Mainloop/CMakeLists.txt +++ b/CommonAPI-Examples/E07Mainloop/CMakeLists.txt @@ -30,11 +30,11 @@ OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}") if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON") - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) else() - FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - FIND_PACKAGE(CommonAPI-DBus 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + FIND_PACKAGE(CommonAPI-DBus 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) endif() message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") @@ -62,8 +62,8 @@ else() endif() # SOME/IP -find_package (CommonAPI-SomeIP 3.1.4 REQUIRED) -find_package (vsomeip 2.0.0 REQUIRED) +find_package (CommonAPI-SomeIP 3.1.5 REQUIRED) +find_package (vsomeip 2.0.1 REQUIRED) # GLib if (MSVC) diff --git a/org.genivi.commonapi.console.feature/feature.xml b/org.genivi.commonapi.console.feature/feature.xml index 8d891f3..774357c 100644 --- a/org.genivi.commonapi.console.feature/feature.xml +++ b/org.genivi.commonapi.console.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.genivi.commonapi.console.feature" label="Command Line Feature" - version="3.1.4.qualifier" + version="3.1.5.qualifier" provider-name="BMW AG"> <description url="http://www.example.com/description"> @@ -18,7 +18,7 @@ </license> <requires> - <import feature="org.genivi.commonapi.console.franca.feature" version="3.1.4" match="compatible"/> + <import feature="org.genivi.commonapi.console.franca.feature" version="3.1.5" match="compatible"/> </requires> <plugin diff --git a/org.genivi.commonapi.console.feature/pom.xml b/org.genivi.commonapi.console.feature/pom.xml index 7604571..1227275 100644 --- a/org.genivi.commonapi.console.feature/pom.xml +++ b/org.genivi.commonapi.console.feature/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.releng</relativePath> </parent> </project>
\ No newline at end of file diff --git a/org.genivi.commonapi.console.franca.feature/feature.xml b/org.genivi.commonapi.console.franca.feature/feature.xml index 4717d56..4ef5f13 100644 --- a/org.genivi.commonapi.console.franca.feature/feature.xml +++ b/org.genivi.commonapi.console.franca.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.genivi.commonapi.console.franca.feature" label="Franca Core Dependencies Feature" - version="3.1.4.qualifier" + version="3.1.5.qualifier" provider-name="BMW AG"> <description url="http://www.example.com/description"> diff --git a/org.genivi.commonapi.console.franca.feature/pom.xml b/org.genivi.commonapi.console.franca.feature/pom.xml index 1abc70e..0725a67 100644 --- a/org.genivi.commonapi.console.franca.feature/pom.xml +++ b/org.genivi.commonapi.console.franca.feature/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.releng</relativePath> </parent> </project>
\ No newline at end of file diff --git a/org.genivi.commonapi.console/META-INF/MANIFEST.MF b/org.genivi.commonapi.console/META-INF/MANIFEST.MF index 2a85533..a4f38ca 100644 --- a/org.genivi.commonapi.console/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.console/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: CommonAPI Console Bundle-SymbolicName: org.genivi.commonapi.console;singleton:=true -Bundle-Version: 3.1.4.qualifier +Bundle-Version: 3.1.5.qualifier Bundle-Vendor: BMW AG Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)";visibility:=reexport, org.apache.commons.cli;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, diff --git a/org.genivi.commonapi.console/about.mappings b/org.genivi.commonapi.console/about.mappings index 87f1e7d..894b548 100644 --- a/org.genivi.commonapi.console/about.mappings +++ b/org.genivi.commonapi.console/about.mappings @@ -1,3 +1,3 @@ -0=3.1.4 -1=20151109 +0=3.1.5 +1=20151204 2=$sun.arch.data.model$ diff --git a/org.genivi.commonapi.console/pom.xml b/org.genivi.commonapi.console/pom.xml index 0446e11..7a0087d 100644 --- a/org.genivi.commonapi.console/pom.xml +++ b/org.genivi.commonapi.console/pom.xml @@ -8,7 +8,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.releng</relativePath> </parent> diff --git a/org.genivi.commonapi.core.cli.feature/feature.xml b/org.genivi.commonapi.core.cli.feature/feature.xml index fa14b71..6dffdac 100644 --- a/org.genivi.commonapi.core.cli.feature/feature.xml +++ b/org.genivi.commonapi.core.cli.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.genivi.commonapi.core.cli.feature" label="CommonAPI Generator Feature" - version="3.1.4.qualifier" + version="3.1.5.qualifier" provider-name="BMW AG"> <plugin diff --git a/org.genivi.commonapi.core.cli.feature/pom.xml b/org.genivi.commonapi.core.cli.feature/pom.xml index e9fe1b2..57d099f 100644 --- a/org.genivi.commonapi.core.cli.feature/pom.xml +++ b/org.genivi.commonapi.core.cli.feature/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core.cli.product/category.xml b/org.genivi.commonapi.core.cli.product/category.xml index d015774..ae7c9e3 100644 --- a/org.genivi.commonapi.core.cli.product/category.xml +++ b/org.genivi.commonapi.core.cli.product/category.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <site> - <feature url="features/org.genivi.commonapi.console.feature_3.1.4.qualifier.jar" id="org.genivi.commonapi.console.feature" version="3.1.4.qualifier"> + <feature url="features/org.genivi.commonapi.console.feature_3.1.5.qualifier.jar" id="org.genivi.commonapi.console.feature" version="3.1.5.qualifier"> <category name="GENIVI CommonAPI Console"/> </feature> - <feature url="features/org.genivi.commonapi.console.franca.feature_3.1.4.qualifier.jar" id="org.genivi.commonapi.console.franca.feature" version="3.1.4.qualifier"> + <feature url="features/org.genivi.commonapi.console.franca.feature_3.1.5.qualifier.jar" id="org.genivi.commonapi.console.franca.feature" version="3.1.5.qualifier"> <category name="GENIVI CommonAPI Console"/> </feature> <category-def name="GENIVI CommonAPI Console" label="GENIVI CommonAPI Console Generators"> diff --git a/org.genivi.commonapi.core.cli.product/commonapi_console.product b/org.genivi.commonapi.core.cli.product/commonapi_console.product index 870d24c..bccbd5a 100644 --- a/org.genivi.commonapi.core.cli.product/commonapi_console.product +++ b/org.genivi.commonapi.core.cli.product/commonapi_console.product @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?pde version="3.5"?> -<product name="CommonAPI Code Generator" uid="org.genivi.commonapi.core.cli.product" id="org.genivi.commonapi.console.product" application="org.genivi.commonapi.console.application" version="3.1.4" useFeatures="true" includeLaunchers="true"> +<product name="CommonAPI Code Generator" uid="org.genivi.commonapi.core.cli.product" id="org.genivi.commonapi.console.product" application="org.genivi.commonapi.console.application" version="3.1.5" useFeatures="true" includeLaunchers="true"> <configIni use="default"> </configIni> diff --git a/org.genivi.commonapi.core.cli.product/pom.xml b/org.genivi.commonapi.core.cli.product/pom.xml index f52b7e1..b0a297e 100644 --- a/org.genivi.commonapi.core.cli.product/pom.xml +++ b/org.genivi.commonapi.core.cli.product/pom.xml @@ -73,7 +73,7 @@ <copy file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator" tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86" /> - <chmod file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86" perm="777" /> + <chmod file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86" perm="755" /> <copy file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator.ini" tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86.ini" /> @@ -90,7 +90,7 @@ <copy file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator" tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64" /> - <chmod file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64" perm="777" /> + <chmod file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64" perm="755" /> <copy file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator.ini" tofile="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64.ini" /> @@ -115,10 +115,10 @@ excludes="commonapi-generator-linux-x86,commonapi-generator-linux-x86_64,commonapi-generator-windows-x86.exe,commonapi-generator-windows-x86_64.exe" destfile="${project.build.directory}/products/commonapi-generator.zip" basedir="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all"> - <zipfileset file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/commonapi-generator-linux-x86" filemode="777"/> - <zipfileset file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/commonapi-generator-linux-x86_64" filemode="777"/> - <zipfileset file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/commonapi-generator-windows-x86.exe" filemode="777"/> - <zipfileset file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/commonapi-generator-windows-x86_64.exe" filemode="777"/> + <zipfileset file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/commonapi-generator-linux-x86" filemode="755"/> + <zipfileset file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/commonapi-generator-linux-x86_64" filemode="755"/> + <zipfileset file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/commonapi-generator-windows-x86.exe" filemode="755"/> + <zipfileset file="${project.build.directory}/products/org.genivi.commonapi.core.cli.product/all/commonapi-generator-windows-x86_64.exe" filemode="755"/> </zip> </target> </configuration> @@ -133,7 +133,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF index f58939d..37b8659 100644 --- a/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: commonapi generator Console Interface Bundle-SymbolicName: org.genivi.commonapi.core.cli;singleton:=true -Bundle-Version: 3.1.4.qualifier +Bundle-Version: 3.1.5.qualifier Bundle-Activator: org.genivi.commonapi.core.cli.Activator Require-Bundle: org.eclipse.core.runtime, org.eclipse.xtext;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, org.franca.core.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, org.franca.deploymodel.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, - org.genivi.commonapi.core;bundle-version="3.1.4";visibility:=reexport, - org.genivi.commonapi.console;bundle-version="3.1.4" + org.genivi.commonapi.core;bundle-version="3.1.5";visibility:=reexport, + org.genivi.commonapi.console;bundle-version="3.1.5" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-Vendor: BMW AG diff --git a/org.genivi.commonapi.core.cli/pom.xml b/org.genivi.commonapi.core.cli/pom.xml index 0f871c3..691f201 100644 --- a/org.genivi.commonapi.core.cli/pom.xml +++ b/org.genivi.commonapi.core.cli/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core.feature/feature.xml b/org.genivi.commonapi.core.feature/feature.xml index 53c2e15..dc0f00b 100644 --- a/org.genivi.commonapi.core.feature/feature.xml +++ b/org.genivi.commonapi.core.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.genivi.commonapi.core.feature" label="%featureName" - version="3.1.4.qualifier" + version="3.1.5.qualifier" provider-name="%providerName"> <copyright> diff --git a/org.genivi.commonapi.core.feature/pom.xml b/org.genivi.commonapi.core.feature/pom.xml index fcfc7fa..252fee9 100644 --- a/org.genivi.commonapi.core.feature/pom.xml +++ b/org.genivi.commonapi.core.feature/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core.releng/pom.xml b/org.genivi.commonapi.core.releng/pom.xml index a84574f..97195e3 100644 --- a/org.genivi.commonapi.core.releng/pom.xml +++ b/org.genivi.commonapi.core.releng/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core.target/pom.xml b/org.genivi.commonapi.core.target/pom.xml index 5331992..ccf3a81 100644 --- a/org.genivi.commonapi.core.target/pom.xml +++ b/org.genivi.commonapi.core.target/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project>
\ No newline at end of file diff --git a/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF index 2b81942..3ddfd50 100644 --- a/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API UI Bundle-SymbolicName: org.genivi.commonapi.core.ui;singleton:=true -Bundle-Version: 3.1.4.qualifier +Bundle-Version: 3.1.5.qualifier Bundle-Activator: org.genivi.commonapi.core.ui.CommonApiUiPlugin Bundle-Vendor: BMW AG Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.10.0,4.0.0)";visibility:=reexport, @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.10.0,4.0.0)";visibil org.eclipse.xtext.builder;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, org.eclipse.xtext.generator;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, com.google.inject;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, - org.genivi.commonapi.core;bundle-version="3.1.4";visibility:=reexport, + org.genivi.commonapi.core;bundle-version="3.1.5";visibility:=reexport, org.franca.core.dsl.ui;bundle-version="0.9.1", org.franca.deploymodel.dsl.ui;bundle-version="0.9.1", org.eclipse.ui.console;bundle-version="[3.5.0,4.0.0)" diff --git a/org.genivi.commonapi.core.ui/pom.xml b/org.genivi.commonapi.core.ui/pom.xml index f74ba1a..58ae688 100644 --- a/org.genivi.commonapi.core.ui/pom.xml +++ b/org.genivi.commonapi.core.ui/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java index 2b0af48..866144f 100644 --- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java +++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/handler/GenerationCommand.java @@ -113,16 +113,18 @@ public class GenerationCommand extends AbstractHandler { final Resource r = rs.getResource(uri, true); project = file.getProject(); + fileSystemAccess.setProject(project); setupPreferences(file); - + // define output directories from the preferences just set before + setupOutputDirectories(fileSystemAccess); + // Clear any already existing output from a previous command execution (e.g. errors) from the Franca console // by creating a new one or initializing an already existing one. // final SpecificConsole francaConsole = new SpecificConsole("Franca"); francaConsole.getOut().println("Loading " + file.getFullPath().toPortableString()); - fileSystemAccess.setProject(project); Job job = new Job("validation and generation") { @Override @@ -190,6 +192,10 @@ public class GenerationCommand extends AbstractHandler { } } + protected void setupOutputDirectories(EclipseResourceFileSystemAccess2 fileSystemAccess) { + fileSystemAccess.setOutputConfigurations(FPreferences.getInstance().getOutputpathConfiguration()); + } + protected boolean validate(URI resourcePathUri, SpecificConsole francaConsole) { // Load the FIDL and all imported FIDL files, or the FDEPL and all imported FDEPL/FIDL files. @@ -514,8 +520,6 @@ public class GenerationCommand extends AbstractHandler { final EclipseResourceFileSystemAccess2 fsa = fileAccessProvider.get(); - fsa.setOutputConfigurations(FPreferences.getInstance().getOutputpathConfiguration()); - fsa.setMonitor(new NullProgressMonitor()); return fsa; diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java index 21eba9a..851fbfa 100644 --- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java +++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/CommonAPIPreferencePage.java @@ -88,23 +88,22 @@ public class CommonAPIPreferencePage extends FieldEditorOverlayPage implements I @Override protected void performDefaults() { - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_COMMON, "true"); - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_PROXY, "true"); - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_STUB, "true"); - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_SKELETON, "false"); - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_SKELETONPOSTFIX, "Default"); - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_ENUMPREFIX, ""); - - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_OUTPUT_PROXIES, - PreferenceConstants.DEFAULT_OUTPUT); - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE) - .put(PreferenceConstants.P_OUTPUT_STUBS, PreferenceConstants.DEFAULT_OUTPUT); - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE) - .put(PreferenceConstants.P_OUTPUT_COMMON, PreferenceConstants.DEFAULT_OUTPUT); - DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE) - .put(PreferenceConstants.P_OUTPUT_SKELETON, PreferenceConstants.DEFAULT_OUTPUT); - - super.performDefaults(); + if(!projectSettingIsActive) { + DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_SKELETON, "false"); + DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_SKELETONPOSTFIX, "Default"); + DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_ENUMPREFIX, ""); + + DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_OUTPUT_PROXIES, + PreferenceConstants.DEFAULT_OUTPUT); + DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE) + .put(PreferenceConstants.P_OUTPUT_STUBS, PreferenceConstants.DEFAULT_OUTPUT); + DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE) + .put(PreferenceConstants.P_OUTPUT_COMMON, PreferenceConstants.DEFAULT_OUTPUT); + DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE) + .put(PreferenceConstants.P_OUTPUT_SKELETON, PreferenceConstants.DEFAULT_OUTPUT); + + super.performDefaults(); + } } @Override @@ -153,5 +152,14 @@ public class CommonAPIPreferencePage extends FieldEditorOverlayPage implements I // will be disposed from FieldEditorPreferencePage ! } + @Override + public boolean performOk() + { + if(!projectSettingIsActive) { + boolean result = super.performOk(); + return result; + } + return true; + } } diff --git a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java index 4504cf6..169abf6 100755 --- a/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java +++ b/org.genivi.commonapi.core.ui/src/org/genivi/commonapi/core/ui/preferences/FieldEditorOverlayPage.java @@ -13,7 +13,9 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -59,6 +61,10 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i // Stores owning element of properties private IAdaptable element; + private IProject eclipseProject; + // If the P_USEPROJECTSETTINGS state from the eclipse project is active, + // disable all controls of the property page for files of this project. + protected boolean projectSettingIsActive = false; // Overlay preference store for property pages private IPreferenceStore overlayStore; @@ -115,12 +121,25 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i /** * Receives the object that owns the properties shown in this property page. + * check, if the project settings (P_USEPROJECTSETTINGS) of this file are active. * * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable) */ public void setElement(IAdaptable element) { this.element = element; + if(element instanceof IFile) { + eclipseProject = ((IFile) element).getProject(); + if(eclipseProject != null) { + try { + QualifiedName projectSettingActive = new QualifiedName(getPageId(), PreferenceConstants.P_USEPROJECTSETTINGS); + projectSettingIsActive = eclipseProject.getPersistentProperty(projectSettingActive).equals(TRUE); + } catch (Exception e) { + // failed to access the project property P_USEPROJECTSETTINGS. + projectSettingIsActive = false; + } + } + } } /** @@ -192,7 +211,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i super.createControl(parent); // Update state of all subclass controls if (isPropertyPage()) - enableControls(); + enableControls(projectSettingIsActive == false); } } @@ -205,7 +224,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i protected Control createContents(Composite parent) { createButtons(parent); - enableControls(); + enableControls(projectSettingIsActive == false); return super.createContents(parent); } @@ -217,27 +236,27 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - Composite radioGroup = new Composite(comp, SWT.BOTTOM); - radioGroup.setLayout(new GridLayout()); - radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + Composite checkboxGroup = new Composite(comp, SWT.BOTTOM); + checkboxGroup.setLayout(new GridLayout()); + checkboxGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - Group settingsGroup = new Group(radioGroup, SWT.SHADOW_IN); + Group projectSettingsGroup = new Group(checkboxGroup, SWT.SHADOW_IN); //settingsGroup.setText("Scope of properties: "); - settingsGroup.setLayout(new GridLayout()); - settingsGroup.setLayoutData(new GridData()); + projectSettingsGroup.setLayout(new GridLayout()); + projectSettingsGroup.setLayoutData(new GridData()); - checkboxProject = new Button(settingsGroup, SWT.CHECK); + checkboxProject = new Button(projectSettingsGroup, SWT.CHECK); checkboxProject.setText("Enable project specific settings"); - checkboxcommon = new Button(radioGroup, SWT.CHECK); + checkboxcommon = new Button(checkboxGroup, SWT.CHECK); checkboxcommon.setText(Messages.getString("OverlayPage.Generate_Common")); - checkboxproxy = new Button(radioGroup, SWT.CHECK); + checkboxproxy = new Button(checkboxGroup, SWT.CHECK); checkboxproxy.setText(Messages.getString("OverlayPage.Generate_Proxy")); - checkboxstub = new Button(radioGroup, SWT.CHECK); + checkboxstub = new Button(checkboxGroup, SWT.CHECK); checkboxstub.setText(Messages.getString("OverlayPage.Generate_Stub")); - checkboxIncludes = new Button(radioGroup, SWT.CHECK); + checkboxIncludes = new Button(checkboxGroup, SWT.CHECK); checkboxIncludes.setText(Messages.getString("OverlayPage.Generate_Includes")); - checkboxSyncCalls = new Button(radioGroup, SWT.CHECK); + checkboxSyncCalls = new Button(checkboxGroup, SWT.CHECK); checkboxSyncCalls.setText(Messages.getString("OverlayPage.Generate_SyncCalls")); buttons.add(checkboxcommon); @@ -274,7 +293,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i } catch (CoreException e) { - // failed to access this resource... + System.out.println("failed to access properties of this file."); } // Not all properties are set for this resource if (genCommon == null) { @@ -320,7 +339,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i checkboxcommon.setSelection(TRUE.equals(genCommon)); checkboxproxy.setSelection(TRUE.equals(genProxy)); checkboxstub.setSelection(TRUE.equals(genStub)); - checkboxProject.setSelection(TRUE.equals(project)); + checkboxProject.setSelection(projectSettingIsActive || TRUE.equals(project)); checkboxIncludes.setSelection(TRUE.equals(dependencies)); checkboxSyncCalls.setSelection(TRUE.equals(syncCalls)); } @@ -342,18 +361,18 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i /** * Enables the field editors and buttons of this page */ - protected void enableControls() + protected void enableControls(boolean state) { Composite parent = getFieldEditorParent(); Iterator<FieldEditor> it = editors.iterator(); while (it.hasNext()) { FieldEditor editor = it.next(); - editor.setEnabled(true, parent); + editor.setEnabled(state, parent); } for (Button button : buttons) { - button.setEnabled(true); + button.setEnabled(state); } } @@ -406,18 +425,18 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i */ protected void performDefaults() { - enableControls(); + enableControls(projectSettingIsActive == false); checkboxcommon.setSelection(true); checkboxproxy.setSelection(true); checkboxstub.setSelection(true); checkboxProject.setSelection(false); checkboxIncludes.setSelection(true); InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_COMMON, TRUE); - InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_PROXY, TRUE); - InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_STUB, TRUE); - InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_USEPROJECTSETTINGS, FALSE); - InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_DEPENDENCIES, TRUE); - InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_SYNC_CALLS, TRUE); + InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_PROXY, TRUE); + InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_STUB, TRUE); + InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_USEPROJECTSETTINGS, FALSE); + InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_DEPENDENCIES, TRUE); + InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE).put(PreferenceConstants.P_GENERATE_SYNC_CALLS, TRUE); super.performDefaults(); } diff --git a/org.genivi.commonapi.core.updatesite/category.xml b/org.genivi.commonapi.core.updatesite/category.xml index a02e9be..7f08f8f 100644 --- a/org.genivi.commonapi.core.updatesite/category.xml +++ b/org.genivi.commonapi.core.updatesite/category.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <site> - <feature url="features/org.genivi.commonapi.core.validator.feature_3.1.4.qualifier.jar" id="org.genivi.commonapi.core.validator.feature" version="3.1.4.qualifier"> + <feature url="features/org.genivi.commonapi.core.validator.feature_3.1.5.qualifier.jar" id="org.genivi.commonapi.core.validator.feature" version="3.1.5.qualifier"> <category name="GENIVI CommonAPI"/> </feature> - <feature url="features/org.genivi.commonapi.core.feature_3.1.4.qualifier.jar" id="org.genivi.commonapi.core.feature" version="3.1.4.qualifier"> + <feature url="features/org.genivi.commonapi.core.feature_3.1.5.qualifier.jar" id="org.genivi.commonapi.core.feature" version="3.1.5.qualifier"> <category name="GENIVI CommonAPI"/> </feature> <category-def name="GENIVI CommonAPI" label="GENIVI CommonAPI Generators"> diff --git a/org.genivi.commonapi.core.updatesite/pom.xml b/org.genivi.commonapi.core.updatesite/pom.xml index 049d5bc..78fbaee 100644 --- a/org.genivi.commonapi.core.updatesite/pom.xml +++ b/org.genivi.commonapi.core.updatesite/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project>
\ No newline at end of file diff --git a/org.genivi.commonapi.core.validator.feature/feature.xml b/org.genivi.commonapi.core.validator.feature/feature.xml index 372bd13..349e225 100644 --- a/org.genivi.commonapi.core.validator.feature/feature.xml +++ b/org.genivi.commonapi.core.validator.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.genivi.commonapi.core.validator.feature" label="%featureName" - version="3.1.4.qualifier" + version="3.1.5.qualifier" provider-name="%providerName"> <copyright> @@ -14,7 +14,7 @@ </license> <requires> - <import plugin="org.genivi.commonapi.core.ui" version="3.1.4" match="compatible"/> + <import plugin="org.genivi.commonapi.core.ui" version="3.1.5" match="compatible"/> </requires> <plugin diff --git a/org.genivi.commonapi.core.validator.feature/pom.xml b/org.genivi.commonapi.core.validator.feature/pom.xml index e5bcdac..72936ff 100644 --- a/org.genivi.commonapi.core.validator.feature/pom.xml +++ b/org.genivi.commonapi.core.validator.feature/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF index 6a58373..ad7f998 100644 --- a/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF @@ -3,15 +3,15 @@ Bundle-ManifestVersion: 2 Bundle-Name: General Bundle-Vendor: BMW AG Bundle-SymbolicName: org.genivi.commonapi.core.validator;singleton:=true -Bundle-Version: 3.1.4.qualifier +Bundle-Version: 3.1.5.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: org.eclipse.ui, org.eclipse.core.expressions;bundle-version="3.4.400", org.eclipse.core.resources, org.eclipse.core.runtime, com.google.inject;bundle-version="3.0.0", - org.genivi.commonapi.core;bundle-version="3.1.4", - org.genivi.commonapi.core.ui;bundle-version="3.1.4", + org.genivi.commonapi.core;bundle-version="3.1.5", + org.genivi.commonapi.core.ui;bundle-version="3.1.5", org.franca.core.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, org.eclipse.xtext;bundle-version="[2.7.0,3.0.0)";visibility:=reexport Export-Package: org.genivi.commonapi.core.validator diff --git a/org.genivi.commonapi.core.validator/pom.xml b/org.genivi.commonapi.core.validator/pom.xml index ea128fb..61ed6ef 100644 --- a/org.genivi.commonapi.core.validator/pom.xml +++ b/org.genivi.commonapi.core.validator/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core.verification/CMakeLists.txt b/org.genivi.commonapi.core.verification/CMakeLists.txt index 1b02928..e72ac95 100644 --- a/org.genivi.commonapi.core.verification/CMakeLists.txt +++ b/org.genivi.commonapi.core.verification/CMakeLists.txt @@ -270,8 +270,7 @@ if (NOT ${TESTS_BAT}) add_executable(DTAdvanced src/DTAdvanced.cpp src/stub/DTAdvancedStub.cpp - src-gen/v1/commonapi/datatypes/advanced/TestInterfaceStubDefault.cpp - src-gen/v1/commonapi/datatypes/advanced/TestInterface.cpp) + src-gen/v1/commonapi/datatypes/advanced/TestInterfaceStubDefault.cpp) target_link_libraries(DTAdvanced ${TEST_LINK_LIBRARIES}) add_executable(DTDerived @@ -284,7 +283,6 @@ if (NOT ${TESTS_BAT}) add_executable(DTCombined src/DTCombined.cpp src/stub/DTCombinedStub.cpp - src-gen/v1/commonapi/datatypes/combined/TestInterface.cpp src-gen/v1/commonapi/datatypes/combined/TestInterfaceStubDefault.cpp) target_link_libraries(DTCombined ${TEST_LINK_LIBRARIES}) @@ -316,7 +314,6 @@ if (NOT ${TESTS_BAT}) src/PFComplex.cpp src/stub/PFComplexStub.cpp src/utils/StopWatch.cpp - src-gen/v1/commonapi/performance/complex/TestInterface.cpp src-gen/v1/commonapi/performance/complex/TestInterfaceStubDefault.cpp) target_link_libraries(PFComplex ${TEST_LINK_LIBRARIES} ${USE_RT}) diff --git a/org.genivi.commonapi.core.verification/fidl/ti_datatypes_primitive.fidl b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_primitive.fidl index 0766bf2..d922244 100644 --- a/org.genivi.commonapi.core.verification/fidl/ti_datatypes_primitive.fidl +++ b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_primitive.fidl @@ -18,7 +18,7 @@ interface TestInterface { attribute Float aFloat attribute Double aDouble attribute String aString - //attribute ByteBuffer aByteBuffer + attribute ByteBuffer aByteBuffer method fTest { in { @@ -34,7 +34,7 @@ interface TestInterface { Float floatIn Double doubleIn String stringIn - //ByteBuffer byteBufferIn + ByteBuffer byteBufferIn } out { UInt8 uint8Out @@ -49,7 +49,7 @@ interface TestInterface { Float floatOut Double doubleOut String stringOut - //ByteBuffer byteBufferOut + ByteBuffer byteBufferOut } } @@ -70,7 +70,7 @@ interface TestInterface { Float floatOut Double doubleOut String stringOut - //ByteBuffer byteBufferOut + ByteBuffer byteBufferOut } } diff --git a/org.genivi.commonapi.core.verification/src/CMBroadcasts.cpp b/org.genivi.commonapi.core.verification/src/CMBroadcasts.cpp index 8e99b1d..4377f46 100644 --- a/org.genivi.commonapi.core.verification/src/CMBroadcasts.cpp +++ b/org.genivi.commonapi.core.verification/src/CMBroadcasts.cpp @@ -113,12 +113,12 @@ TEST_F(CMBroadcasts, NormalBroadcast) { ) { result = y; }); - + // send value '1' via a method call - this tells stub to broadcast uint8_t in_ = 1; uint8_t out_ = 0; - testProxy_->testMethod(in_, callStatus, out_); - + testProxy_->testMethod(in_, callStatus, out_); + // check that value was correctly received for (int i = 0; i < 100; i++) { if (result == 1) break; @@ -142,11 +142,11 @@ TEST_F(CMBroadcasts, SelectiveBroadcastRejected) { uint8_t result = 0; uint8_t in_ = 0; uint8_t out_ = 0; - + // send value '2' via a method call - this tells stub to stop accepting subs in_ = 2; - testProxy_->testMethod(in_, callStatus, out_); - + testProxy_->testMethod(in_, callStatus, out_); + // subscribe subStatus = CommonAPI::CallStatus::UNKNOWN; testProxy_->getBTestSelectiveSelectiveEvent().subscribe([&]( @@ -158,8 +158,8 @@ TEST_F(CMBroadcasts, SelectiveBroadcastRejected) { const CommonAPI::CallStatus &status ) { subStatus = status; - }); - + }); + // check that subscription failed correctly for (int i = 0; i < 100; i++) { if (subStatus != CommonAPI::CallStatus::UNKNOWN) break; @@ -171,9 +171,9 @@ TEST_F(CMBroadcasts, SelectiveBroadcastRejected) { // send value '3' via a method call - this tells stub to broadcast through the selective bc result = 0; in_ = 3; - out_ = 0; - testProxy_->testMethod(in_, callStatus, out_); - + out_ = 0; + testProxy_->testMethod(in_, callStatus, out_); + // check that no value was correctly received for (int i = 0; i < 100; i++) { if (result != 0) break; @@ -200,9 +200,9 @@ TEST_F(CMBroadcasts, SelectiveBroadcast) { uint8_t out_ = 0; // send value '4' via a method call - this tells stub to start accepting subs - in_ = 4; + in_ = 4; testProxy_->testMethod(in_, callStatus, out_); - + // subscribe subStatus = CommonAPI::CallStatus::UNKNOWN; testProxy_->getBTestSelectiveSelectiveEvent().subscribe([&]( @@ -215,18 +215,18 @@ TEST_F(CMBroadcasts, SelectiveBroadcast) { ) { subStatus = status; }); - + // check that no error was received for (int i = 0; i < 100; i++) { if (subStatus != CommonAPI::CallStatus::UNKNOWN) break; usleep(10000); } EXPECT_EQ(subStatus, CommonAPI::CallStatus::UNKNOWN); - + // send value '3' via a method call - this tells stub to broadcast through the selective bc result = 0; in_ = 3; - out_ = 0; + out_ = 0; testProxy_->testMethod(in_, callStatus, out_); // check that value was correctly received @@ -237,6 +237,204 @@ TEST_F(CMBroadcasts, SelectiveBroadcast) { EXPECT_EQ(result, 1); } +/** +* @test Test BroadcastStubGoesOfflineOnlineAgain. +* - service offline +* - subscribe to broadcast +* - service online +* - fire broadcast -> proxy should receive +* - service offline +* - service online +* - fire again -> proxy should receive again +*/ +TEST_F(CMBroadcasts, BroadcastStubGoesOfflineOnlineAgain) { + CommonAPI::CallStatus callStatus; + uint8_t result = 0; + + runtime_->unregisterService(domain, CMBroadcastsStub::StubInterface::getInterface(), + testAddress); + + // wait that proxy is not available + int counter = 0; // counter for avoiding endless loop + while ( testProxy_->isAvailable() && counter < 10 ) { + usleep(100000); + counter++; + } + ASSERT_FALSE(testProxy_->isAvailable()); + + // subscribe to broadcast + testProxy_->getBTestEvent().subscribe([&]( + const uint8_t &y + ) { + result = y; + }); + + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + // wait that proxy is available + counter = 0; // counter for avoiding endless loop + while ( !testProxy_->isAvailable() && counter < 10 ) { + usleep(100000); + counter++; + } + ASSERT_TRUE(testProxy_->isAvailable()); + + // send value '1' via a method call - this tells stub to broadcast + uint8_t in_ = 1; + uint8_t out_ = 0; + testProxy_->testMethod(in_, callStatus, out_); + + // check that value was correctly received + for (int i = 0; i < 100; i++) { + if (result == 1) break; + usleep(10000); + } + EXPECT_EQ(result, 1); + + runtime_->unregisterService(domain, CMBroadcastsStub::StubInterface::getInterface(), + testAddress); + + // wait that proxy is not available + counter = 0; // counter for avoiding endless loop + while ( testProxy_->isAvailable() && counter < 10 ) { + usleep(100000); + counter++; + } + + ASSERT_FALSE(testProxy_->isAvailable()); + + serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + // wait that proxy is available + counter = 0; // counter for avoiding endless loop + while ( !testProxy_->isAvailable() && counter < 10 ) { + usleep(100000); + counter++; + } + ASSERT_TRUE(testProxy_->isAvailable()); + + result = 0; + // send value '1' via a method call - this tells stub to broadcast + in_ = 1; + out_ = 0; + testProxy_->testMethod(in_, callStatus, out_); + + // check that value was correctly received + for (int i = 0; i < 100; i++) { + if (result == 1) break; + usleep(10000); + } + EXPECT_EQ(result, 1); +} + +/** +* @test Test SelectiveBroadcastStubGoesOfflineOnlineAgain. +* - service offline +* - subscribe to selective broadcast +* - service online +* - fire selective broadcast -> proxy should receive +* - service offline +* - service online +* - fire again -> proxy should receive again +*/ +TEST_F(CMBroadcasts, SelectiveBroadcastStubGoesOfflineOnlineAgain) { + CommonAPI::CallStatus callStatus; + uint8_t result = 0; + uint8_t in_ = 1; + uint8_t out_ = 0; + + // send value '4' via a method call - this tells stub to start accepting subs + in_ = 4; + testProxy_->testMethod(in_, callStatus, out_); + + runtime_->unregisterService(domain, CMBroadcastsStub::StubInterface::getInterface(), + testAddress); + + // wait that proxy is not available + int counter = 0; // counter for avoiding endless loop + while ( testProxy_->isAvailable() && counter < 10 ) { + usleep(100000); + counter++; + } + ASSERT_FALSE(testProxy_->isAvailable()); + + // subscribe to broadcast + testProxy_->getBTestSelectiveSelectiveEvent().subscribe([&]( + const uint8_t &y + ) { + result = y; + }, + [&]( + const CommonAPI::CallStatus &status + ) { + std::cout << "error handler called: " << (uint32_t)status << std::endl; + }); + + bool serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + // wait that proxy is available + counter = 0; // counter for avoiding endless loop + while ( !testProxy_->isAvailable() && counter < 10 ) { + usleep(100000); + counter++; + } + ASSERT_TRUE(testProxy_->isAvailable()); + + // send value '3' via a method call - this tells stub to broadcast selective + in_ = 3; + out_ = 0; + testProxy_->testMethod(in_, callStatus, out_); + + // check that value was correctly received + for (int i = 0; i < 100; i++) { + if (result == 1) break; + usleep(10000); + } + EXPECT_EQ(result, 1); + + runtime_->unregisterService(domain, CMBroadcastsStub::StubInterface::getInterface(), + testAddress); + + // wait that proxy is not available + counter = 0; // counter for avoiding endless loop + while ( testProxy_->isAvailable() && counter < 10 ) { + usleep(100000); + counter++; + } + ASSERT_FALSE(testProxy_->isAvailable()); + + serviceRegistered = runtime_->registerService(domain, testAddress, testStub_, serviceId); + ASSERT_TRUE(serviceRegistered); + + // wait that proxy is available + counter = 0; // counter for avoiding endless loop + while ( !testProxy_->isAvailable() && counter < 10 ) { + usleep(100000); + counter++; + } + ASSERT_TRUE(testProxy_->isAvailable()); + + // send value '4' via a method call - this tells stub to start accepting subs + in_ = 4; + testProxy_->testMethod(in_, callStatus, out_); + + result = 0; + // send value '3' via a method call - this tells stub to broadcast selective + in_ = 3; + out_ = 0; + testProxy_->testMethod(in_, callStatus, out_); + + // check that value was correctly received + for (int i = 0; i < 100; i++) { + if (result == 1) break; + usleep(10000); + } + EXPECT_EQ(result, 1); +} + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ::testing::AddGlobalTestEnvironment(new Environment()); diff --git a/org.genivi.commonapi.core.verification/src/DTDerived.cpp b/org.genivi.commonapi.core.verification/src/DTDerived.cpp index b69d2b2..22083f0 100644 --- a/org.genivi.commonapi.core.verification/src/DTDerived.cpp +++ b/org.genivi.commonapi.core.verification/src/DTDerived.cpp @@ -161,8 +161,6 @@ TEST_F(DTDerived, AttributeSet) { structExtTestValue.setBaseMember(42); structExtTestValue.setExtendedMember("Hello World"); - enumExtTestValue = v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt::VALUE2; - std::string u = "Hello World"; unionExtTestValue = u; @@ -180,7 +178,7 @@ TEST_F(DTDerived, AttributeSet) { EXPECT_EQ(structExtTestValue, structExtResultValue); // check initial value of enumeration attribute - enumExtTestValue = v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt::VALUE2; // this is the expected default value + enumExtTestValue = v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt::VALUE1; // this is the expected default value EXPECT_EQ(enumExtTestValue, enumExtResultValue); // the uninitialized enumExtResultValue should have the default value enumExtResultValue = v1_0::commonapi::datatypes::derived::TestInterface::tEnumExt::VALUE3; // set to some other value testProxy_->getAEnumExtAttribute().getValue(callStatus, enumExtResultValue); // get value of attribute diff --git a/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp b/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp index eb38760..9d80f1d 100644 --- a/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp +++ b/org.genivi.commonapi.core.verification/src/DTPrimitive.cpp @@ -111,7 +111,7 @@ TEST_F(DTPrimitive, SendAndReceive) { float floatTestValue = 1.01f; double doubleTestValue = 12345.12345; std::string stringTestValue = "∃y ∀x ¬(x ≺ y)"; - //ByteBuffer byteBufferTestValue + CommonAPI::ByteBuffer byteBufferTestValue(5, 0); uint8_t uint8ResultValue = 0; int8_t int8ResultValue = 0; @@ -125,7 +125,7 @@ TEST_F(DTPrimitive, SendAndReceive) { float floatResultValue = 0.0; double doubleResultValue = 0; std::string stringResultValue = ""; - //ByteBuffer byteBufferTestValue + CommonAPI::ByteBuffer byteBufferResultValue; testProxy_->fTest( uint8TestValue, @@ -140,6 +140,7 @@ TEST_F(DTPrimitive, SendAndReceive) { floatTestValue, doubleTestValue, stringTestValue, + byteBufferTestValue, callStatus, uint8ResultValue, int8ResultValue, @@ -152,7 +153,8 @@ TEST_F(DTPrimitive, SendAndReceive) { booleanResultValue, floatResultValue, doubleResultValue, - stringResultValue + stringResultValue, + byteBufferResultValue ); ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); @@ -169,6 +171,7 @@ TEST_F(DTPrimitive, SendAndReceive) { EXPECT_EQ(floatTestValue, floatResultValue); EXPECT_EQ(doubleTestValue, doubleResultValue); EXPECT_EQ(stringTestValue, stringResultValue); + EXPECT_EQ(byteBufferTestValue, byteBufferResultValue); } /** @@ -192,7 +195,7 @@ TEST_F(DTPrimitive, AttributeSet) { float floatTestValue = 1.01f; double doubleTestValue = 12345.12345; std::string stringTestValue = "∃y ∀x ¬(x ≺ y)"; - //ByteBuffer byteBufferTestValue + CommonAPI::ByteBuffer byteBufferTestValue(5, 0); uint8_t uint8ResultValue = 0; int8_t int8ResultValue = 0; @@ -206,7 +209,7 @@ TEST_F(DTPrimitive, AttributeSet) { float floatResultValue = 0.0; double doubleResultValue = 0; std::string stringResultValue = ""; - //ByteBuffer byteBufferTestValue + CommonAPI::ByteBuffer byteBufferResultValue; testProxy_->getAUint8Attribute().setValue(uint8TestValue, callStatus, uint8ResultValue); ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); @@ -255,6 +258,10 @@ TEST_F(DTPrimitive, AttributeSet) { testProxy_->getAStringAttribute().setValue(stringTestValue, callStatus, stringResultValue); ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); EXPECT_EQ(stringTestValue, stringResultValue); + + testProxy_->getAByteBufferAttribute().setValue(byteBufferTestValue, callStatus, byteBufferResultValue); + ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); + EXPECT_EQ(byteBufferTestValue, byteBufferResultValue); } /** @@ -279,7 +286,7 @@ TEST_F(DTPrimitive, BroadcastReceive) { float floatTestValue = 1.01f; double doubleTestValue = 12345.12345; std::string stringTestValue = "∃y ∀x ¬(x ≺ y)"; - //ByteBuffer byteBufferTestValue + CommonAPI::ByteBuffer byteBufferTestValue(5, 0); uint8_t uint8ResultValue = 0; int8_t int8ResultValue = 0; @@ -293,7 +300,7 @@ TEST_F(DTPrimitive, BroadcastReceive) { float floatResultValue = 0.0; double doubleResultValue = 0; std::string stringResultValue = ""; - //ByteBuffer byteBufferTestValue + CommonAPI::ByteBuffer byteBufferResultValue; received_ = false; testProxy_->getBTestEvent().subscribe([&]( @@ -308,7 +315,8 @@ TEST_F(DTPrimitive, BroadcastReceive) { const bool& booleanResultValue, const float& floatResultValue, const double& doubleResultValue, - const std::string& stringResultValue + const std::string& stringResultValue, + const CommonAPI::ByteBuffer byteBufferResultValue ) { received_ = true; EXPECT_EQ(uint8TestValue, uint8ResultValue); @@ -323,6 +331,8 @@ TEST_F(DTPrimitive, BroadcastReceive) { EXPECT_EQ(floatTestValue, floatResultValue); EXPECT_EQ(doubleTestValue, doubleResultValue); EXPECT_EQ(stringTestValue, stringResultValue); + EXPECT_EQ(stringTestValue, stringResultValue); + EXPECT_EQ(byteBufferTestValue, byteBufferResultValue); }); testProxy_->fTest( @@ -338,6 +348,7 @@ TEST_F(DTPrimitive, BroadcastReceive) { floatTestValue, doubleTestValue, stringTestValue, + byteBufferTestValue, callStatus, uint8ResultValue, int8ResultValue, @@ -350,7 +361,8 @@ TEST_F(DTPrimitive, BroadcastReceive) { booleanResultValue, floatResultValue, doubleResultValue, - stringResultValue + stringResultValue, + byteBufferResultValue ); usleep(100000); diff --git a/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.cpp b/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.cpp index 7ef9dcf..0cc77bf 100644 --- a/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.cpp +++ b/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.cpp @@ -34,6 +34,7 @@ void DTPrimitiveStub::fTest(const std::shared_ptr<CommonAPI::ClientId> _client, float _floatIn, double _doubleIn, std::string _stringIn, + CommonAPI::ByteBuffer _byteBufferIn, fTestReply_t _reply) { (void)_client; @@ -48,7 +49,8 @@ void DTPrimitiveStub::fTest(const std::shared_ptr<CommonAPI::ClientId> _client, _booleanIn, _floatIn, _doubleIn, - _stringIn); + _stringIn, + _byteBufferIn); fireBTestEvent( _uint8In, @@ -62,7 +64,8 @@ void DTPrimitiveStub::fTest(const std::shared_ptr<CommonAPI::ClientId> _client, _booleanIn, _floatIn, _doubleIn, - _stringIn + _stringIn, + _byteBufferIn ); } diff --git a/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.h b/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.h index aeed539..4343ebc 100644 --- a/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.h +++ b/org.genivi.commonapi.core.verification/src/stub/DTPrimitiveStub.h @@ -19,7 +19,7 @@ public: DTPrimitiveStub(); virtual ~DTPrimitiveStub(); - virtual void fTest(const std::shared_ptr<CommonAPI::ClientId> _client, uint8_t _uint8In, int8_t _int8In, uint16_t _uint16In, int16_t _int16In, uint32_t _uint32In, int32_t _int32In, uint64_t _uint64In, int64_t _int64In, bool _booleanIn, float _floatIn, double _doubleIn, std::string _stringIn, fTestReply_t _reply); + virtual void fTest(const std::shared_ptr<CommonAPI::ClientId> _client, uint8_t _uint8In, int8_t _int8In, uint16_t _uint16In, int16_t _int16In, uint32_t _uint32In, int32_t _int32In, uint64_t _uint64In, int64_t _int64In, bool _booleanIn, float _floatIn, double _doubleIn, std::string _stringIn, CommonAPI::ByteBuffer _byteBufferIn, fTestReply_t _reply); virtual void fTestEmptyBroadcast(const std::shared_ptr<CommonAPI::ClientId> _client, fTestEmptyBroadcastReply_t _reply); }; diff --git a/org.genivi.commonapi.core/META-INF/MANIFEST.MF b/org.genivi.commonapi.core/META-INF/MANIFEST.MF index 367178f..b950faf 100644 --- a/org.genivi.commonapi.core/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API Generator Bundle-Vendor: BMW AG -Bundle-Version: 3.1.4.qualifier +Bundle-Version: 3.1.5.qualifier Bundle-SymbolicName: org.genivi.commonapi.core;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)";visibility:=reexport, diff --git a/org.genivi.commonapi.core/pom.xml b/org.genivi.commonapi.core/pom.xml index 2a7b647..68ef324 100644 --- a/org.genivi.commonapi.core/pom.xml +++ b/org.genivi.commonapi.core/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.core.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <relativePath>../org.genivi.commonapi.core.releng</relativePath> </parent> </project> diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java index 91417f5..8a78adc 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java @@ -97,6 +97,12 @@ public class FDeployManager { absURI.fileExtension()).importsIterator(model); it.hasNext();) { String importURIStr = it.next(); if (importURIStr != null) { + if(!importURIStr.startsWith("platform")) { + String[] splitted = importURIStr.split(":"); + // there may be a drive letter "C:" under Windows, + // remove it, to get it resolved + importURIStr = splitted[splitted.length -1]; + } URI importURI = URI.createURI(importURIStr); URI resolvedURI = importURI.resolve(absURI); // add this pair to URI converter so that others can get the URI diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend index 7fa63a7..6816559 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend @@ -18,6 +18,8 @@ import org.genivi.commonapi.core.deployment.PropertyAccessor import org.genivi.commonapi.core.preferences.FPreferences import org.genivi.commonapi.core.preferences.PreferenceConstants import java.util.List +import org.franca.core.franca.FType +import org.franca.core.franca.FStructType class FInterfaceGenerator { @Inject private extension FTypeGenerator @@ -157,7 +159,9 @@ class FInterfaceGenerator { «ENDFOR» «FOR type : fInterface.types» - «FTypeGenerator::generateComments(type,false)» + «IF(type.needsSourceComment)» + «FTypeGenerator::generateComments(type,false)» + «ENDIF» «type.generateFTypeImplementation(fInterface, _accessor)» «ENDFOR» @@ -189,7 +193,13 @@ class FInterfaceGenerator { def private hasSourceFile(FInterface fInterface) { val hasTypeWithImplementation = fInterface.types.exists[hasImplementation] - val hasMethodWithError = fInterface.methods.exists[hasError] - return (hasTypeWithImplementation || hasMethodWithError) + return (hasTypeWithImplementation) + } + + def private needsSourceComment(FType _type) { + if (_type instanceof FStructType) { + return _type.isPolymorphic + } + return false } } diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend index 14e414a..140590c 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend @@ -393,11 +393,6 @@ class FInterfaceStubGenerator { «IF !fInterface.managedInterfaces.empty» autoInstanceCounter_(0), «ENDIF» - «FOR attribute : fInterface.attributes» - «IF attribute.supportsInitialValue» - «attribute.stubDefaultClassVariableName»(«attribute.initialValue(fInterface)»), - «ENDIF» - «ENDFOR» interfaceVersion_(«fInterface.elementName»::getInterfaceVersion()) { } @@ -620,16 +615,4 @@ class FInterfaceStubGenerator { def private getStubDefaultClassVariableName(FAttribute fAttribute) { fAttribute.elementName.toFirstLower + 'AttributeValue_' } - - def private supportsInitialValue(FAttribute fAttribute) { - fAttribute.type.derived instanceof FEnumerationType && !fAttribute.array - } - def private initialValue(FAttribute fAttribute, FInterface fInterface) { - if (fAttribute.type.derived instanceof FEnumerationType) { - val FEnumerationType _enumeration = fAttribute.type.derived as FEnumerationType; - fAttribute.getTypeName(fInterface, true) + '::Literal::' + _enumeration.enumerators.get(0).elementName; - } - else "0" - } - } diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend index 94397f5..bde7608 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend @@ -7,8 +7,10 @@ package org.genivi.commonapi.core.generator import java.util.Collection +import java.util.HashSet import java.util.LinkedList import java.util.List +import java.util.Set import javax.inject.Inject import org.eclipse.emf.common.util.EList import org.franca.core.franca.FAnnotationBlock @@ -30,6 +32,7 @@ import org.franca.core.franca.FUnionType import org.genivi.commonapi.core.deployment.PropertyAccessor import static com.google.common.base.Preconditions.* + import static extension org.genivi.commonapi.core.generator.FrancaGeneratorExtensions.* class FTypeGenerator { @@ -356,7 +359,14 @@ class FTypeGenerator { inline void set«element.elementName.toFirstUpper»(const «typeName» «IF typeName.isComplex»&«ENDIF»_value) { std::get<«k»>(values_) = _value; } «ENDFOR» «ENDIF» - bool operator==(const «fStructType.name» &_other) const; + inline bool operator==(const «fStructType.name»& _other) const { + «IF fStructType.allElements.size > 0» + «FOR element : fStructType.allElements BEFORE + 'return (' SEPARATOR ' && ' AFTER ');'»get«element.elementName.toFirstUpper»() == _other.get«element.elementName.toFirstUpper»()«ENDFOR» + «ELSE» + (void) _other; + return true; + «ENDIF» } inline bool operator!=(const «fStructType.name» &_other) const { return !((*this) == _other); } @@ -368,6 +378,31 @@ class FTypeGenerator { generateDeclaration(fEnumerationType, fEnumerationType, deploymentAccessor) } + def String getInitialValue(FEnumerationType _enumeration) { + if (_enumeration.base != null) + return _enumeration.base.getInitialValue() + return "Literal::" + _enumeration.enumerators.head.elementName + } + + def String generateLiterals(FEnumerationType _enumeration) { + var String literals = new String() + if (_enumeration.base != null) + literals += _enumeration.base.generateLiterals + ",\n" + for (enumerator : _enumeration.enumerators) { + literals += enumPrefix + enumerator.elementName + " = " + enumerator.value.enumeratorValue + if (enumerator != _enumeration.enumerators.last) literals += ",\n" + } + return literals + } + + def String generateLiteralValidation(FEnumerationType _enumeration, String backingType, Set<String> _values) ''' + «IF _enumeration.base!=null»«_enumeration.base.generateLiteralValidation(backingType, _values)»«ENDIF» + «FOR enumerator : _enumeration.enumerators» + «IF _values.contains(enumerator.value.enumeratorValue)»//«ENDIF»case static_cast<«backingType»>(Literal::«enumPrefix»«enumerator.elementName»): + «{_values.add(enumerator.value.enumeratorValue) ""}» + «ENDFOR» + ''' + def generateDeclaration(FEnumerationType _enumeration, FModelElement _parent, PropertyAccessor _accessor) ''' «_enumeration.setEnumerationValues» «IF _enumeration.name == null» @@ -378,28 +413,25 @@ class FTypeGenerator { «ENDIF» «ENDIF» «val backingType = _enumeration.getBackingType(_accessor).primitiveTypeName» - «val baseTypeName = _enumeration.getBaseType(backingType)» - struct «_enumeration.name» : «baseTypeName» { + struct «_enumeration.name» : CommonAPI::Enumeration<«backingType»> { enum Literal : «backingType» { - «FOR enumerator : _enumeration.enumerators» - «enumPrefix»«enumerator.elementName» = «enumerator.value.enumeratorValue»«IF enumerator != _enumeration.enumerators.last»,«ENDIF» - «ENDFOR» + «_enumeration.generateLiterals» }; - «_enumeration.name»() - : «baseTypeName»(static_cast<«IF _enumeration.base == null»«backingType»«ELSE»«baseTypeName»::Literal«ENDIF»>(Literal::«_enumeration.enumerators.get(0).elementName»)) {} - «generateEnumBaseTypeConstructor(_enumeration, _enumeration.name, baseTypeName, backingType)» - «_enumeration.generateBaseTypeAssignmentOperator(_accessor)» + «_enumeration.name»() + : CommonAPI::Enumeration<«backingType»>(static_cast<«backingType»>(«_enumeration.initialValue»)) {} + «_enumeration.name»(Literal _literal) + : CommonAPI::Enumeration<«backingType»>(static_cast<«backingType»>(_literal)) {} + «_enumeration.generateBaseTypeAssignmentOperator(_enumeration, _accessor)» inline bool validate() const { switch (value_) { - «FOR enumerator : _enumeration.enumerators» - case static_cast<«backingType»>(Literal::«enumPrefix»«enumerator.elementName»): - «ENDFOR» + «var Set<String> values = new HashSet<String>» + «_enumeration.generateLiteralValidation(backingType, values)» return true; default: - return «IF _enumeration.base == null»false;«ELSE»«baseTypeName»::validate();«ENDIF» + return false; } } @@ -432,15 +464,15 @@ class FTypeGenerator { «ENDIF» ''' - def CharSequence generateBaseTypeAssignmentOperator(FEnumerationType _enumeration, PropertyAccessor _accessor) ''' - «IF _enumeration.base != null» + def CharSequence generateBaseTypeAssignmentOperator(FEnumerationType _enumeration, FEnumerationType _other, PropertyAccessor _accessor) ''' + «IF _other.base != null» «val backingType = _enumeration.getBackingType(_accessor).primitiveTypeName» - «val baseTypeName = _enumeration.getBaseType(backingType)» + «val baseTypeName = _other.getBaseType(backingType)» «_enumeration.name» &operator=(const «baseTypeName»::Literal &_value) { value_ = static_cast<«backingType»>(_value); return (*this); } - «_enumeration.base.generateBaseTypeAssignmentOperator(_accessor)» + «_enumeration.generateBaseTypeAssignmentOperator(_other.base, _accessor)» «ENDIF» ''' @@ -482,6 +514,9 @@ class FTypeGenerator { ''' def dispatch generateFTypeImplementation(FStructType fStructType, FModelElement parent, PropertyAccessor _accessor) ''' + «IF fStructType.isStructEmpty» + static_assert(false, "struct «fStructType.name» must not be empty !"); + «ENDIF» «IF fStructType.polymorphic || (fStructType.hasPolymorphicBase() && fStructType.hasDerivedTypes())» std::shared_ptr<«fStructType.getClassNamespace(parent)»> «fStructType.getClassNamespace(parent)»::create(CommonAPI::Serial _serial) { switch (_serial) { @@ -502,22 +537,16 @@ class FTypeGenerator { } «ENDIF» - bool «fStructType.getClassNamespace(parent)»::operator==(const «parent.elementName»::«fStructType.name»& _other) const { - «IF fStructType.allElements.size > 0» - «FOR element : fStructType.allElements BEFORE 'return (' SEPARATOR ' && ' AFTER ');'»get«element.elementName.toFirstUpper»() == _other.get«element.elementName.toFirstUpper»()«ENDFOR» - «ELSE» - (void) _other; - return true; - «ENDIF» - } - ''' def dispatch generateFTypeImplementation(FUnionType fUnionType, FModelElement parent, PropertyAccessor _accessor) ''' ''' def hasImplementation(FType fType) { - return ((fType instanceof FStructType) || (fType instanceof FEnumerationType)) + if (fType instanceof FStructType) { + return fType.isPolymorphic + } + return false } def void generateInheritanceIncludes(FInterface fInterface, Collection<String> generatedHeaders, Collection<String> libraryHeaders) { diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend index c371b19..f631d6a 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend @@ -111,10 +111,15 @@ class FrancaGenerator implements IGenerator { IResource _res) { val String deploymentName = _deployments.entrySet.filter[it.value == _deployment].head.key - - var String basePath = deploymentName.substring( - 0, deploymentName.lastIndexOf(File.separatorChar)) + var int lastIndex = deploymentName.lastIndexOf(File.separatorChar) + if (lastIndex == -1) { + lastIndex = deploymentName.lastIndexOf('/') + } + + var String basePath = deploymentName.substring( + 0, lastIndex) + var Set<String> itsImports = new HashSet<String>() for (anImport : _deployment.imports) { val String canonical = getCanonical(basePath, anImport.importURI) diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend index 8773d58..887d887 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend @@ -22,11 +22,8 @@ import java.util.List import java.util.Map import java.util.Set import java.util.jar.Manifest -import org.eclipse.core.resources.IResource import org.eclipse.core.resources.ResourcesPlugin import org.eclipse.core.runtime.Path -import org.eclipse.core.runtime.preferences.DefaultScope -import org.eclipse.core.runtime.preferences.InstanceScope import org.eclipse.emf.ecore.EObject import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.util.EcoreUtil @@ -76,8 +73,8 @@ import static com.google.common.base.Preconditions.* import static extension java.lang.Integer.* class FrancaGeneratorExtensions { - - def boolean isComplex(String _typeName) { + + def boolean isComplex(String _typeName) { if (_typeName == "bool" || _typeName == "int8" || _typeName == "int16" || @@ -119,14 +116,14 @@ class FrancaGeneratorExtensions { def String getFullyQualifiedCppName(FModelElement fModelElement) { if (fModelElement.eContainer instanceof FModel) { - val containerName = (fModelElement.eContainer as FModel).name - var prefix = "::" - if (fModelElement instanceof FTypeCollection) { - val FVersion itsVersion = fModelElement.version - if (itsVersion != null) { - prefix = fModelElement.versionPrefix - } - } + val containerName = (fModelElement.eContainer as FModel).name + var prefix = "::" + if (fModelElement instanceof FTypeCollection) { + val FVersion itsVersion = fModelElement.version + if (itsVersion != null) { + prefix = fModelElement.versionPrefix + } + } return (prefix + containerName + "::" + fModelElement.elementName).replace(".", "::") } return ((fModelElement.eContainer as FModelElement).fullyQualifiedCppName + "::" + fModelElement.elementName).replace(".", "::") @@ -169,12 +166,17 @@ class FrancaGeneratorExtensions { } def String getDefineName(FModelElement fModelElement) { + var definePrefix = "" + if (fModelElement instanceof FTypeCollection) + if (fModelElement.version != null) + definePrefix = "V" + fModelElement.version.major.toString() + "_" + val defineSuffix = '_' + fModelElement.elementName.splitCamelCase.join('_') if (fModelElement.eContainer instanceof FModelElement) - return (fModelElement.eContainer as FModelElement).defineName + defineSuffix + return definePrefix + (fModelElement.eContainer as FModelElement).defineName + defineSuffix - return (fModelElement.eContainer as FModel).defineName + defineSuffix + return definePrefix + (fModelElement.eContainer as FModel).defineName + defineSuffix } def getDefineName(FModel fModel) { @@ -277,19 +279,19 @@ class FrancaGeneratorExtensions { fInterface.elementName + "Stub" + skeletonNamePostfix + ".hpp" } - def getSkeletonNamePostfix() { - FPreferences::instance.getPreference(PreferenceConstants::P_SKELETONPOSTFIX, "Default") - } - - def getHeaderDefineName(FInterface fInterface) { - fInterface.defineName + "_STUB_" + skeletonNamePostfix.toUpperCase() - } + def getSkeletonNamePostfix() { + FPreferences::instance.getPreference(PreferenceConstants::P_SKELETONPOSTFIX, "Default") + } + + def getHeaderDefineName(FInterface fInterface) { + fInterface.defineName + "_STUB_" + skeletonNamePostfix.toUpperCase() + } def getStubDefaultHeaderPath(FInterface fInterface) { fInterface.versionPathPrefix + fInterface.model.directoryPath + '/' + fInterface.stubDefaultHeaderFile } - def getStubDefaultClassName(FInterface fInterface) { + def getStubDefaultClassName(FInterface fInterface) { fInterface.elementName + "Stub" + skeletonNamePostfix } @@ -344,7 +346,7 @@ class FrancaGeneratorExtensions { } def getStubFullClassName(FInterface fInterface) { - fInterface.getFullName + 'Stub' + fInterface.getFullName + 'Stub' } def hasAttributes(FInterface fInterface) { @@ -359,29 +361,29 @@ class FrancaGeneratorExtensions { !fInterface.broadcasts.filter[selective].empty } - def Collection<FMethod> getMethodsWithError(FInterface _interface) { - val Map<String, FMethod> itsMethods = new HashMap<String, FMethod>() - for (method : _interface.methods.filter[errors != null]) { - var existing = itsMethods.get(method.name) - if (existing == null) { - itsMethods.put(method.name, method) - } else { - val List<FEnumerator> itsAdditionals = new ArrayList<FEnumerator>() - for (e : method.errors.enumerators) { - var found = false - for (f : existing.errors.enumerators) { - if (f.name == e.name) { - found = true - } - } - if (!found) - itsAdditionals.add(e) - } - existing.errors.enumerators.addAll(itsAdditionals) - } - } - return itsMethods.values - } + def Collection<FMethod> getMethodsWithError(FInterface _interface) { + val Map<String, FMethod> itsMethods = new HashMap<String, FMethod>() + for (method : _interface.methods.filter[errors != null]) { + var existing = itsMethods.get(method.name) + if (existing == null) { + itsMethods.put(method.name, method) + } else { + val List<FEnumerator> itsAdditionals = new ArrayList<FEnumerator>() + for (e : method.errors.enumerators) { + var found = false + for (f : existing.errors.enumerators) { + if (f.name == e.name) { + found = true + } + } + if (!found) + itsAdditionals.add(e) + } + existing.errors.enumerators.addAll(itsAdditionals) + } + } + return itsMethods.values + } def generateDefinition(FMethod fMethod, boolean _isDefault) { fMethod.generateDefinitionWithin(null, _isDefault) @@ -430,9 +432,9 @@ class FrancaGeneratorExtensions { signature = signature + fMethod.inArgs.map[getTypeName(fMethod, true) + ' _' + elementName].join(', ') if (!fMethod.isFireAndForget) { - if (signature != "") - signature = signature + ", "; - signature = signature + fMethod.elementName + "Reply_t _reply"; + if (signature != "") + signature = signature + ", "; + signature = signature + fMethod.elementName + "Reply_t _reply"; } return signature @@ -447,9 +449,9 @@ class FrancaGeneratorExtensions { signature = signature + fMethod.inArgs.map[getTypeName(fMethod, true) + ' _' + elementName].join(', ') if (!fMethod.isFireAndForget) { - if (signature != "") - signature = signature + ", "; - signature = signature + methodName + "Reply_t _reply"; + if (signature != "") + signature = signature + ", "; + signature = signature + methodName + "Reply_t _reply"; } return signature @@ -538,15 +540,15 @@ class FrancaGeneratorExtensions { return definition } - def generateDummyArgumentList(FMethod fMethod) { + def generateDummyArgumentList(FMethod fMethod) { var arguments = '' if (fMethod.hasError) arguments = "error" - if (!fMethod.outArgs.empty) { - if (arguments != '') - arguments = arguments + ', ' + if (!fMethod.outArgs.empty) { + if (arguments != '') + arguments = arguments + ', ' arguments = arguments + fMethod.outArgs.map[elementName].join(', ') - } + } return arguments } @@ -594,7 +596,7 @@ class FrancaGeneratorExtensions { var arguments = ' _client' if (!fMethod.inArgs.empty) - arguments = arguments + ', ' + fMethod.inArgs.map[elementName].join(', ') + arguments = arguments + ', ' + fMethod.inArgs.map[elementName].join(', ') if ((fMethod.hasError || !fMethod.outArgs.empty)) arguments = arguments + ', ' @@ -652,7 +654,7 @@ class FrancaGeneratorExtensions { signature += fMethod.asyncCallbackClassName + ' _callback' if (_isDefault) - signature += " = nullptr" + signature += " = nullptr" signature += ", const CommonAPI::CallInfo *_info" if (_isDefault) signature += " = nullptr" @@ -661,32 +663,32 @@ class FrancaGeneratorExtensions { } def getErrorType(FMethod _method) { - var errorType = "" - if (_method.hasError) { - errorType = _method.getErrorNameReference(_method.eContainer) - } - return errorType + var errorType = "" + if (_method.hasError) { + errorType = _method.getErrorNameReference(_method.eContainer) + } + return errorType } - def getInTypeList(FMethod _method) { - return _method.inArgs.map[getTypeName(_method, true)].join(', ') - } + def getInTypeList(FMethod _method) { + return _method.inArgs.map[getTypeName(_method, true)].join(', ') + } - def getOutTypeList(FMethod _method) { - return _method.outArgs.map[getTypeName(_method, true)].join(', ') - } - - def getErrorAndOutTypeList(FMethod _method) { - val errorType = _method.errorType - val outTypes = _method.outTypeList - - var errorAndOutTypes = errorType - if (errorType != "" && outTypes != "") - errorAndOutTypes = errorAndOutTypes + ", " - errorAndOutTypes = errorAndOutTypes + outTypes - - return errorAndOutTypes - } + def getOutTypeList(FMethod _method) { + return _method.outArgs.map[getTypeName(_method, true)].join(', ') + } + + def getErrorAndOutTypeList(FMethod _method) { + val errorType = _method.errorType + val outTypes = _method.outTypeList + + var errorAndOutTypes = errorType + if (errorType != "" && outTypes != "") + errorAndOutTypes = errorAndOutTypes + ", " + errorAndOutTypes = errorAndOutTypes + outTypes + + return errorAndOutTypes + } def private String getBasicMangledName(FBasicTypeId basicType) { switch (basicType) { @@ -716,9 +718,9 @@ class FrancaGeneratorExtensions { return "s" case FBasicTypeId::BYTE_BUFFER: return "au8" - default: { - return null - } + default: { + return null + } } } @@ -773,7 +775,7 @@ class FrancaGeneratorExtensions { for (outArg : fMethod.outArgs) { mangledName = mangledName + outArg.type.mangledName } - mangledName = mangledName + fMethod.errorEnum?.name + mangledName = mangledName + fMethod.errorEnum?.name return baseName + mangledName.int16Hash } @@ -883,7 +885,7 @@ class FrancaGeneratorExtensions { } def String getTypes(FBroadcast _broadcast) { - return _broadcast.outArgs.map[getTypeName(_broadcast, true)].join(', ') + return _broadcast.outArgs.map[getTypeName(_broadcast, true)].join(', ') } def generateGetMethodDefinitionWithin(FBroadcast fBroadcast, String parentClassName) { @@ -938,8 +940,8 @@ class FrancaGeneratorExtensions { } def String getTypeName(FTypedElement _element, FModelElement _source, boolean _isOther) { - var String typeName = _element.type.getElementType(_source, _isOther) - + var String typeName = _element.type.getElementType(_source, _isOther) + if (_element.type.derived instanceof FStructType && (_element.type.derived as FStructType).hasPolymorphicBase) typeName = 'std::shared_ptr<' + typeName + '>' @@ -951,13 +953,13 @@ class FrancaGeneratorExtensions { } def String getElementType(FTypeRef _typeRef, FModelElement _container, boolean _isOther) { - var String typeName - if (_typeRef.derived != null) { - typeName = _typeRef.derived.getElementName(_container, _isOther) - } else if (_typeRef.predefined != null) { - typeName = _typeRef.predefined.primitiveTypeName - } - return typeName + var String typeName + if (_typeRef.derived != null) { + typeName = _typeRef.derived.getElementName(_container, _isOther) + } else if (_typeRef.predefined != null) { + typeName = _typeRef.predefined.primitiveTypeName + } + return typeName } def boolean isPolymorphic(FTypeRef typeRef) { @@ -1015,9 +1017,9 @@ class FrancaGeneratorExtensions { return FBasicTypeId::INT32 case EnumBackingType::Int64: return FBasicTypeId::INT64 - default: { - return FBasicTypeId::INT32 - } + default: { + return FBasicTypeId::INT32 + } } } @@ -1031,57 +1033,57 @@ class FrancaGeneratorExtensions { return baseType } - def private getMaximumEnumerationValue(FEnumerationType _enumeration) { - var int maximum = 0; - for (literal : _enumeration.enumerators) { - if (literal.value != null && literal.value != "") { - val int literalValue = Integer.parseInt(literal.value.enumeratorValue) - if (maximum < literalValue) - maximum = literalValue - } - } - return maximum - } - - def void setEnumerationValues(FEnumerationType _enumeration) { - var int currentValue = 0 - val predefineEnumValues = new ArrayList<String>() - - // collect all predefined enum values - for (literal : _enumeration.enumerators) { - if (literal.value != null) { - predefineEnumValues.add(literal.value.enumeratorValue) - } - } - if (_enumeration.base != null) { - setEnumerationValues(_enumeration.base) - currentValue = getMaximumEnumerationValue(_enumeration.base) + 1 - } - - for (literal : _enumeration.enumerators) { - if (literal.value == null || literal.value == "") { - // not predefined - while (predefineEnumValues.contains(String.valueOf(currentValue))) { - // increment it, if this was found in the list of predefined values - currentValue += 1 - } - literal.setValue(toExpression(Integer.toString(currentValue))) - } else { - var enumValue = literal.value.enumeratorValue - if (enumValue != null) { - try { - val int literalValue = Integer.parseInt(enumValue) - literal.setValue(toExpression(Integer.toString(literalValue))) - } catch (NumberFormatException e) { - literal.setValue(toExpression(Integer.toString(currentValue))) - } - } else { - literal.setValue(toExpression(Integer.toString(currentValue))) - } - } - currentValue += 1 - } - } + def private getMaximumEnumerationValue(FEnumerationType _enumeration) { + var int maximum = 0; + for (literal : _enumeration.enumerators) { + if (literal.value != null && literal.value != "") { + val int literalValue = Integer.parseInt(literal.value.enumeratorValue) + if (maximum < literalValue) + maximum = literalValue + } + } + return maximum + } + + def void setEnumerationValues(FEnumerationType _enumeration) { + var int currentValue = 0 + val predefineEnumValues = new ArrayList<String>() + + // collect all predefined enum values + for (literal : _enumeration.enumerators) { + if (literal.value != null) { + predefineEnumValues.add(literal.value.enumeratorValue) + } + } + if (_enumeration.base != null) { + setEnumerationValues(_enumeration.base) + currentValue = getMaximumEnumerationValue(_enumeration.base) + 1 + } + + for (literal : _enumeration.enumerators) { + if (literal.value == null || literal.value == "") { + // not predefined + while (predefineEnumValues.contains(String.valueOf(currentValue))) { + // increment it, if this was found in the list of predefined values + currentValue += 1 + } + literal.setValue(toExpression(Integer.toString(currentValue))) + } else { + var enumValue = literal.value.enumeratorValue + if (enumValue != null) { + try { + val int literalValue = Integer.parseInt(enumValue) + literal.setValue(toExpression(Integer.toString(literalValue))) + } catch (NumberFormatException e) { + literal.setValue(toExpression(Integer.toString(currentValue))) + } + } else { + literal.setValue(toExpression(Integer.toString(currentValue))) + } + } + currentValue += 1 + } + } def getPrimitiveTypeName(FBasicTypeId fBasicTypeId) { switch fBasicTypeId { @@ -1121,35 +1123,35 @@ class FrancaGeneratorExtensions { return fTypeRef.predefined.basicTypeStreamSignature } - def String createSerials(FStructType fStructType) { - var String serials; - serials = "static const CommonAPI::Serial " - + fStructType.elementName.toUpperCase() + "_SERIAL = 0x" - + getSerialId(fStructType).toHexString.toUpperCase() + ";\n"; - for (derived : fStructType.derivedFStructTypes) - serials = serials + createSerials(derived) - return serials - } - - def String generateCases(FStructType fStructType, FModelElement parent, boolean qualified) { - var String itsCases = "case "; - - //if (parent != null) - // itsCases = itsCases + parent.elementName + "::" - - if (qualified) { - itsCases = itsCases - if (fStructType.containingInterface != null) - itsCases = itsCases + fStructType.containingInterface.elementName + "::"; - } - - itsCases = itsCases + fStructType.elementName.toUpperCase() + "_SERIAL:\n"; - - for (derived : fStructType.derivedFStructTypes) - itsCases = itsCases + derived.generateCases(parent, qualified); - - return itsCases; - } + def String createSerials(FStructType fStructType) { + var String serials; + serials = "static const CommonAPI::Serial " + + fStructType.elementName.toUpperCase() + "_SERIAL = 0x" + + getSerialId(fStructType).toHexString.toUpperCase() + ";\n"; + for (derived : fStructType.derivedFStructTypes) + serials = serials + createSerials(derived) + return serials + } + + def String generateCases(FStructType fStructType, FModelElement parent, boolean qualified) { + var String itsCases = "case "; + + //if (parent != null) + // itsCases = itsCases + parent.elementName + "::" + + if (qualified) { + itsCases = itsCases + if (fStructType.containingInterface != null) + itsCases = itsCases + fStructType.containingInterface.elementName + "::"; + } + + itsCases = itsCases + fStructType.elementName.toUpperCase() + "_SERIAL:\n"; + + for (derived : fStructType.derivedFStructTypes) + itsCases = itsCases + derived.generateCases(parent, qualified); + + return itsCases; + } def private String getBasicTypeStreamSignature(FBasicTypeId fBasicTypeId) { switch fBasicTypeId { @@ -1166,7 +1168,7 @@ class FrancaGeneratorExtensions { case FBasicTypeId::DOUBLE: return "typeOutputStream.writeDoubleType();" case FBasicTypeId::STRING: return "typeOutputStream.writeStringType();" case FBasicTypeId::BYTE_BUFFER: return "typeOutputStream.writeByteBufferType();" - default: return "UNDEFINED" + default: return "UNDEFINED" } } @@ -1272,7 +1274,7 @@ class FrancaGeneratorExtensions { } def boolean hasDerivedTypes(FStructType fStructType) { - return !fStructType.derivedFStructTypes.empty + return !fStructType.derivedFStructTypes.empty } def getSerialId(FStructType fStructType) { @@ -1338,7 +1340,7 @@ class FrancaGeneratorExtensions { } def boolean isStructEmpty(FStructType fStructType) { - if(!fStructType.elements.empty) { + if(!fStructType.elements.empty || fStructType.polymorphic) { return false } if(fStructType.base != null) { @@ -1385,7 +1387,7 @@ class FrancaGeneratorExtensions { «ENDIF» ''' - def generateDeploymentNamespaceBegin(FTypeCollection _tc) ''' + def generateDeploymentNamespaceBegin(FTypeCollection _tc) ''' namespace «_tc.elementName»_ { ''' @@ -1403,7 +1405,7 @@ class FrancaGeneratorExtensions { } def getVersionPathPrefix(FTypeCollection _tc) { - var String prefix = "" + var String prefix = "" var FVersion itsVersion = _tc.version if (itsVersion != null && (itsVersion.major != 0 || itsVersion.minor != 0)) { prefix = "v" + itsVersion.major.toString + "/" @@ -1433,9 +1435,9 @@ class FrancaGeneratorExtensions { static def getCoreVersion() { val bundleName = "org.genivi.commonapi.core" getBundleVersion(bundleName) - } + } - static def getBundleVersion(String bundleName) { + static def getBundleVersion(String bundleName) { val bundle = FrameworkUtil::getBundle(FrancaGeneratorExtensions) if (bundle != null) { @@ -1523,50 +1525,45 @@ class FrancaGeneratorExtensions { 'proxyManager' + fInterface.elementName + '_' } - def Set<FInterface> getBaseInterfaces(FInterface _interface) { - val Set<FInterface> baseInterfaces = new HashSet<FInterface>() - if (_interface.base != null) { - baseInterfaces.add(_interface.base) - baseInterfaces.addAll(getBaseInterfaces(_interface.base)) - } - return baseInterfaces + def List<FInterface> getBaseInterfaces(FInterface _interface) { + val List<FInterface> baseInterfaces = new ArrayList<FInterface>() + if (_interface.base != null) { + baseInterfaces.addAll(getBaseInterfaces(_interface.base)) + if (!baseInterfaces.contains(_interface.base)) + baseInterfaces.add(_interface.base) + } + return baseInterfaces } def generateBaseInstantiations(FInterface _interface) { - val Set<FInterface> baseInterfaces = getBaseInterfaces(_interface) - return baseInterfaces.map[getTypeCollectionName(_interface) + "(_address, _connection)"].join(',\n') - } - + val List<FInterface> baseInterfaces = getBaseInterfaces(_interface) + return baseInterfaces.map[getTypeCollectionName(_interface) + "(_address, _connection)"].join(',\n') + } + def generateDBusBaseInstantiations(FInterface _interface) { - val Set<FInterface> baseInterfaces = getBaseInterfaces(_interface) - return baseInterfaces.map[ - getTypeCollectionName(_interface) + - "DBusProxy(_address, _connection)" - ].join(',\n') - } - + val List<FInterface> baseInterfaces = getBaseInterfaces(_interface) + return baseInterfaces.map[getTypeCollectionName(_interface) + "DBusProxy(_address, _connection)"].join(',\n') + } + def generateSomeIPBaseInstantiations(FInterface _interface) { - val Set<FInterface> baseInterfaces = getBaseInterfaces(_interface) - return baseInterfaces.map[ - getTypeCollectionName(_interface) + - "SomeIPProxy(_address, _connection)" - ].join(',\n') - } - - def String generateBaseRemoteHandlerConstructorsCalls(FInterface _interface) { - val Set<FInterface> baseInterfaces = getBaseInterfaces(_interface) - var String itsCalls = "" - itsCalls = baseInterfaces.map[getTypeCollectionName(_interface) + "StubDefault::RemoteEventHandler(_defaultStub)"].join(', ') - if (itsCalls != "") - itsCalls = itsCalls + ',' - return itsCalls - } - + val List<FInterface> baseInterfaces = getBaseInterfaces(_interface) + return baseInterfaces.map[getTypeCollectionName(_interface) + "SomeIPProxy(_address, _connection)"].join(',\n') + } + + def String generateBaseRemoteHandlerConstructorsCalls(FInterface _interface) { + val List<FInterface> baseInterfaces = getBaseInterfaces(_interface) + var String itsCalls = "" + itsCalls = baseInterfaces.map[getTypeCollectionName(_interface) + "StubDefault::RemoteEventHandler(_defaultStub)"].join(', ') + if (itsCalls != "") + itsCalls = itsCalls + ',' + return itsCalls + } + def List<FMethod> getInheritedMethods(FInterface fInterface) { - val List<FMethod> result = new ArrayList<FMethod>() - + val List<FMethod> result = new ArrayList<FMethod>() + if(fInterface.base == null) { - return result + return result } result.addAll(fInterface.base.methods) @@ -1656,14 +1653,14 @@ class FrancaGeneratorExtensions { } def Integer getTimeout(FMethod _method, PropertyAccessor _accessor) { - var timeout = 0; - try { - timeout = _accessor.getTimeout(_method) - } - catch (NullPointerException e) { - // intentionally empty - } - return timeout + var timeout = 0; + try { + timeout = _accessor.getTimeout(_method) + } + catch (NullPointerException e) { + // intentionally empty + } + return timeout } def boolean isTheSameVersion(FVersion _mine, FVersion _other) { @@ -1686,15 +1683,15 @@ class FrancaGeneratorExtensions { val FTypeCollection other = _other as FTypeCollection if (me.eContainer == other.eContainer && - ((me.version == null && other.version == null) || + ((me.version == null && other.version == null) || (me.version != null && other.version != null && me.version.major == other.version.major && me.version.minor == other.version.minor))) { return _me; - } - } + } + } - return getCommonContainer(_me, _other.eContainer) + return getCommonContainer(_me, _other.eContainer) } def String getContainerName(EObject _container) { @@ -1774,7 +1771,7 @@ class FrancaGeneratorExtensions { return name } - if (myContainer.getCommonContainer(otherContainer) != null) { + if (myContainer.getCommonContainer(otherContainer) != null) { return _me.getPartialName(myContainer.eContainer) } @@ -1800,7 +1797,7 @@ class FrancaGeneratorExtensions { } def String getEnumPrefix(){ - FPreferences::instance.getPreference(PreferenceConstants::P_ENUMPREFIX, "") + FPreferences::instance.getPreference(PreferenceConstants::P_ENUMPREFIX, "") } def List<FField> getAllElements(FStructType _struct) { @@ -1821,62 +1818,62 @@ class FrancaGeneratorExtensions { return elements } - /** - * Get all interfaces from the deployment model that have a specification that contains - * the given selector string (e.g.: "dbus" for commonapi.dbus specification) - * @return the list of FDInterfaces - */ - def List<FDInterface> getFDInterfaces(FDModel fdmodel, String selector) { - var List<FDInterface> fdinterfaces = new ArrayList<FDInterface>() - - for(depl : fdmodel.getDeployments()) { - if (depl instanceof FDInterface) { - var specname = depl.spec.name - if(specname != null && specname.contains(selector)) { - fdinterfaces.add(depl); - } - } - } - return fdinterfaces; - } - - /** - * Get all type collections from the deployment model that have a specification that contains - * the given selector string (e.g.: "dbus" for commonapi.dbus specification) - * @return the list of FDTypes - */ - def List<FDTypes> getFDTypesList(FDModel fdmodel, String selector) { - var List<FDTypes> fdTypes = new ArrayList<FDTypes>() - - for(depl : fdmodel.getDeployments()) { - if (depl instanceof FDTypes) { - var specname = depl.spec?.name - if(specname != null && specname.contains(selector)) { - fdTypes.add(depl); - } - } - } - return fdTypes; - } - - /** - * Get all providers from the deployment model that have a specification that contains - * the given selector string (e.g.: "dbus" for commonapi.dbus specification) - * @return the list of FDTypes - */ - def List<FDProvider> getFDProviders(FDModel fdmodel, String selector) { - var List<FDProvider> fdProviders = new ArrayList<FDProvider>() - - for(depl : fdmodel.getDeployments()) { - if (depl instanceof FDProvider) { - var specname = depl.spec?.name - if(specname != null && specname.contains(selector)) { - fdProviders.add(depl); - } - } - } - return fdProviders; - } + /** + * Get all interfaces from the deployment model that have a specification that contains + * the given selector string (e.g.: "dbus" for commonapi.dbus specification) + * @return the list of FDInterfaces + */ + def List<FDInterface> getFDInterfaces(FDModel fdmodel, String selector) { + var List<FDInterface> fdinterfaces = new ArrayList<FDInterface>() + + for(depl : fdmodel.getDeployments()) { + if (depl instanceof FDInterface) { + var specname = depl.spec.name + if(specname != null && specname.contains(selector)) { + fdinterfaces.add(depl); + } + } + } + return fdinterfaces; + } + + /** + * Get all type collections from the deployment model that have a specification that contains + * the given selector string (e.g.: "dbus" for commonapi.dbus specification) + * @return the list of FDTypes + */ + def List<FDTypes> getFDTypesList(FDModel fdmodel, String selector) { + var List<FDTypes> fdTypes = new ArrayList<FDTypes>() + + for(depl : fdmodel.getDeployments()) { + if (depl instanceof FDTypes) { + var specname = depl.spec?.name + if(specname != null && specname.contains(selector)) { + fdTypes.add(depl); + } + } + } + return fdTypes; + } + + /** + * Get all providers from the deployment model that have a specification that contains + * the given selector string (e.g.: "dbus" for commonapi.dbus specification) + * @return the list of FDTypes + */ + def List<FDProvider> getFDProviders(FDModel fdmodel, String selector) { + var List<FDProvider> fdProviders = new ArrayList<FDProvider>() + + for(depl : fdmodel.getDeployments()) { + if (depl instanceof FDProvider) { + var specname = depl.spec?.name + if(specname != null && specname.contains(selector)) { + fdProviders.add(depl); + } + } + } + return fdProviders; + } def List<FDProvider> getAllFDProviders(FDModel fdmodel) { var List<FDProvider> fdProviders = new ArrayList<FDProvider>() @@ -1886,38 +1883,38 @@ class FrancaGeneratorExtensions { } } return fdProviders; - } - /** - * Copy deployment attributes into the destination deployment - */ - def mergeDeployments(FDInterface _source, FDInterface _destination) { - - if (_source.target.equals(_destination.target)) { - if (_source.attributes.size > 0) { - if(_destination.attributes.size == 0) { - _destination.attributes.addAll(_source.attributes) - } - } - if (_source.methods.size > 0) { - _destination.methods.addAll(_source.methods) - } -// Not used so far: -// if(source.broadcasts != null) { -// destination.broadcasts.addAll(source.broadcasts) -// } + } + /** + * Copy deployment attributes into the destination deployment + */ + def mergeDeployments(FDInterface _source, FDInterface _destination) { + + if (_source.target.equals(_destination.target)) { + if (_source.attributes.size > 0) { + if(_destination.attributes.size == 0) { + _destination.attributes.addAll(_source.attributes) + } + } + if (_source.methods.size > 0) { + _destination.methods.addAll(_source.methods) + } +// Not used so far: +// if(source.broadcasts != null) { +// destination.broadcasts.addAll(source.broadcasts) +// } if (_source.types.size > 0) { _destination.types.addAll(_source.types) } - } - } - - def mergeDeployments(FDTypes _source, FDTypes _destination) { - if (_source.target.equals(_destination.target)) { - if (!_source.types.empty) { - _destination.types.addAll(_source.types) - } - } - } + } + } + + def mergeDeployments(FDTypes _source, FDTypes _destination) { + if (_source.target.equals(_destination.target)) { + if (!_source.types.empty) { + _destination.types.addAll(_source.types) + } + } + } def public getAllReferencedFInterfaces(FModel fModel) { @@ -2034,15 +2031,34 @@ class FrancaGeneratorExtensions { def public String getCanonical(String _basePath, String _uri) { if (_uri.startsWith("platform:") || _uri.startsWith("file:")) return _uri - + if (_uri.startsWith(File.separatorChar.toString)) - return "file:" + _uri + return "file:" + _uri + + // handle Windows absolute paths... + var baseSplitted = _basePath.split(":") + var uriSplitted = _uri.split(":") + if (uriSplitted.length == 2 && _uri.startsWith(uriSplitted.get(0))) { + // c:/... windows abslolute + return "file:/" + _uri + } + + if (_uri.startsWith("/")) { + // get the drive letter under windows for absolute paths + if(baseSplitted.length == 3) { + return "file:" + baseSplitted.get(1) + ":" + _uri + } + else { + // linux... + return "file:" + _uri + } + } + // handle relative paths (resolve uri against basePath) var char separatorCharacter = File.separatorChar; if (_basePath.startsWith("platform:") || _basePath.startsWith("file:")) { separatorCharacter = '/' - } - + } val String itsCompleteName = _basePath + separatorCharacter + _uri val String[] itsSegments = itsCompleteName.split(separatorCharacter.toString) @@ -2078,4 +2094,5 @@ class FrancaGeneratorExtensions { */ return itsCanonicalName.reverse.join(separatorCharacter.toString) } + } diff --git a/org.genivi.commonapi.releng/pom.xml b/org.genivi.commonapi.releng/pom.xml index 21cb8c2..2f02df8 100644 --- a/org.genivi.commonapi.releng/pom.xml +++ b/org.genivi.commonapi.releng/pom.xml @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>commonapi</groupId> <artifactId>org.genivi.commonapi.releng</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> <packaging>pom</packaging> <properties> <tycho-version>0.22.0</tycho-version> @@ -46,7 +46,7 @@ <artifact> <groupId>commonapi</groupId> <artifactId>${target.id}</artifactId> - <version>3.1.4-SNAPSHOT</version> + <version>3.1.5-SNAPSHOT</version> </artifact> </target> <filters> |