diff --git a/.github/workflows/build_linux_ubuntu1804.yml b/.github/workflows/build_linux_ubuntu1804.yml index ec3c678e4..c7e3b6c28 100644 --- a/.github/workflows/build_linux_ubuntu1804.yml +++ b/.github/workflows/build_linux_ubuntu1804.yml @@ -20,18 +20,25 @@ jobs: group: build-linux-ubuntu1804-${{ github.head_ref }}-${{ matrix.build_type }} cancel-in-progress: true runs-on: ubuntu-22.04 - env: - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true strategy: matrix: build_type: [release] container: image: ghcr.io/ten-framework/ten_building_ubuntu1804 steps: - - uses: actions/checkout@v3 - with: - fetch-depth: "0" - submodules: "true" + - name: Configure Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Manual Checkout Repository + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --global --add safe.directory $(pwd) + git clone https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git . + git checkout ${{ github.event.pull_request.head.sha }} + git submodule update --init --recursive - name: Update version run: | @@ -39,11 +46,6 @@ jobs: python3 tools/version/update_version_in_ten_framework.py python3 tools/version/check_version_in_ten_framework.py - - name: Install cpulimit and taskset - run: | - apt-get update - apt-get install -y cpulimit util-linux - - name: Build run: | export PATH=$(pwd)/core/ten_gn/:$PATH @@ -54,64 +56,54 @@ jobs: tgn build linux x64 ${{ matrix.build_type }} tree -I 'gen|obj' out - - name: Run Tests (ten_utils_unit_test) - env: - ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1 - MALLOC_CHECK_: 3 - TEN_ENABLE_MEMORY_TRACKING: "true" - TEN_ENABLE_BACKTRACE_DUMP: "true" - run: | - chmod +x out/linux/x64/tests/standalone/ten_utils_unit_test - out/linux/x64/tests/standalone/ten_utils_unit_test || { echo "test failed"; exit 1; } + # - name: Run Tests (ten_utils_unit_test) + # env: + # ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1 + # MALLOC_CHECK_: 3 + # TEN_ENABLE_MEMORY_TRACKING: "true" + # TEN_ENABLE_BACKTRACE_DUMP: "true" + # run: | + # chmod +x out/linux/x64/tests/standalone/ten_utils_unit_test + # out/linux/x64/tests/standalone/ten_utils_unit_test || { echo "test failed"; exit 1; } - - name: Run Tests (ten_runtime_unit_test) - env: - ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1 - MALLOC_CHECK_: 3 - TEN_ENABLE_MEMORY_TRACKING: "true" - TEN_ENABLE_BACKTRACE_DUMP: "true" - run: | - chmod +x out/linux/x64/tests/standalone/ten_runtime_unit_test - out/linux/x64/tests/standalone/ten_runtime_unit_test || { echo "test failed"; exit 1; } + # - name: Run Tests (ten_runtime_unit_test) + # env: + # ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1 + # MALLOC_CHECK_: 3 + # TEN_ENABLE_MEMORY_TRACKING: "true" + # TEN_ENABLE_BACKTRACE_DUMP: "true" + # run: | + # chmod +x out/linux/x64/tests/standalone/ten_runtime_unit_test + # out/linux/x64/tests/standalone/ten_runtime_unit_test || { echo "test failed"; exit 1; } - - name: Run Tests (ten_runtime_smoke_test) - env: - ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1 - MALLOC_CHECK_: 3 - TEN_ENABLE_MEMORY_TRACKING: "true" - TEN_ENABLE_BACKTRACE_DUMP: "true" - run: | - chmod +x out/linux/x64/tests/standalone/ten_runtime_smoke_test - out/linux/x64/tests/standalone/ten_runtime_smoke_test || { echo "test failed"; exit 1; } + # - name: Run Tests (ten_runtime_smoke_test) + # env: + # ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1 + # MALLOC_CHECK_: 3 + # TEN_ENABLE_MEMORY_TRACKING: "true" + # TEN_ENABLE_BACKTRACE_DUMP: "true" + # run: | + # chmod +x out/linux/x64/tests/standalone/ten_runtime_smoke_test + # out/linux/x64/tests/standalone/ten_runtime_smoke_test || { echo "test failed"; exit 1; } - - name: Run Tests (ten_rust standalone tests) - env: - ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1 - MALLOC_CHECK_: 3 - TEN_ENABLE_MEMORY_TRACKING: "true" - TEN_ENABLE_BACKTRACE_DUMP: "true" - run: | - cd out/linux/x64/tests/standalone/ten_rust - - chmod +x unit_test - chmod +x integration_test - - ./unit_test || { echo "ten_rust unit test failed"; exit 1; } - ./integration_test || { echo "ten_rust integration test failed"; exit 1; } - - - name: Upload ten_packages - uses: actions/upload-artifact@v3 - with: - name: ten_packages-linux-ubuntu1804-x64-gcc-${{ matrix.build_type }} - path: | - out/linux/x64/ten_packages/system/ten_runtime - out/linux/x64/ten_packages/system/ten_runtime_go - out/linux/x64/ten_packages/system/ten_runtime_python - out/linux/x64/ten_packages/extension/default_extension_cpp - out/linux/x64/ten_packages/extension/default_extension_go - out/linux/x64/ten_packages/extension/default_extension_python - out/linux/x64/ten_packages/extension/default_async_extension_python - out/linux/x64/ten_packages/extension/py_init_extension_cpp + # - name: Run Tests (ten_rust standalone tests) + # env: + # ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1 + # MALLOC_CHECK_: 3 + # TEN_ENABLE_MEMORY_TRACKING: "true" + # TEN_ENABLE_BACKTRACE_DUMP: "true" + # run: | + # cd out/linux/x64/tests/standalone/ten_rust + + # chmod +x unit_test + # chmod +x integration_test + + # ./unit_test || { echo "ten_rust unit test failed"; exit 1; } + # ./integration_test || { echo "ten_rust integration test failed"; exit 1; } + + - name: Install jq + if: startsWith(github.ref, 'refs/tags/') + run: apt-get update && apt-get install -y jq - name: Package assets if: startsWith(github.ref, 'refs/tags/') @@ -127,9 +119,36 @@ jobs: ten_packages/extension/default_async_extension_python \ ten_packages/extension/py_init_extension_cpp - - name: Publish to release assets - uses: softprops/action-gh-release@v1 + - name: Upload Release Asset if: startsWith(github.ref, 'refs/tags/') - with: - files: | - out/linux/x64/ten_packages-linux-ubuntu1804-x64-gcc-${{ matrix.build_type }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ASSET_PATH: out/linux/x64/ten_packages-linux-ubuntu1804-x64-gcc-${{ matrix.build_type }}.zip + ASSET_NAME: ten_packages-linux-ubuntu1804-x64-gcc-${{ matrix.build_type }}.zip + run: | + TAG_NAME=${GITHUB_REF#refs/tags/} + echo "Tag: $TAG_NAME" + + # Get the release information + response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ + https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$TAG_NAME) + + # Check if the release was found + if echo "$response" | grep -q '"id":'; then + echo "Release found." + else + echo "Release not found. Exiting." + exit 1 + fi + + # Extract upload_url + upload_url=$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//") + echo "Upload URL: $upload_url" + + # Upload the asset + curl -s -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/zip" \ + --data-binary @"$ASSET_PATH" \ + "$upload_url?name=$ASSET_NAME" + + echo "Asset uploaded successfully." diff --git a/core/include/ten_runtime/binding/cpp/internal/addon.h b/core/include/ten_runtime/binding/cpp/detail/addon.h similarity index 99% rename from core/include/ten_runtime/binding/cpp/internal/addon.h rename to core/include/ten_runtime/binding/cpp/detail/addon.h index 43f6ec2b7..253cd647f 100644 --- a/core/include/ten_runtime/binding/cpp/internal/addon.h +++ b/core/include/ten_runtime/binding/cpp/detail/addon.h @@ -12,8 +12,8 @@ #include "ten_runtime/addon/addon.h" #include "ten_runtime/addon/extension/extension.h" #include "ten_runtime/binding/common.h" -#include "ten_runtime/binding/cpp/internal/common.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/common.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_runtime/ten_env/ten_env.h" #include "ten_utils/lib/path.h" // IWYU pragma: export diff --git a/core/include/ten_runtime/binding/cpp/internal/app.h b/core/include/ten_runtime/binding/cpp/detail/app.h similarity index 98% rename from core/include/ten_runtime/binding/cpp/internal/app.h rename to core/include/ten_runtime/binding/cpp/detail/app.h index 431b8efc4..041e2e9ec 100644 --- a/core/include/ten_runtime/binding/cpp/internal/app.h +++ b/core/include/ten_runtime/binding/cpp/detail/app.h @@ -11,8 +11,8 @@ #include "ten_runtime/app/app.h" #include "ten_runtime/binding/common.h" -#include "ten_runtime/binding/cpp/internal/common.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/common.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_runtime/ten.h" #include "ten_utils/macro/check.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/common.h b/core/include/ten_runtime/binding/cpp/detail/common.h similarity index 100% rename from core/include/ten_runtime/binding/cpp/internal/common.h rename to core/include/ten_runtime/binding/cpp/detail/common.h diff --git a/core/include/ten_runtime/binding/cpp/internal/extension.h b/core/include/ten_runtime/binding/cpp/detail/extension.h similarity index 98% rename from core/include/ten_runtime/binding/cpp/internal/extension.h rename to core/include/ten_runtime/binding/cpp/detail/extension.h index ca7540f2c..f312e715c 100644 --- a/core/include/ten_runtime/binding/cpp/internal/extension.h +++ b/core/include/ten_runtime/binding/cpp/detail/extension.h @@ -14,13 +14,13 @@ #include #include "ten_runtime/binding/common.h" -#include "ten_runtime/binding/cpp/internal/common.h" -#include "ten_runtime/binding/cpp/internal/msg/audio_frame.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/stop_graph.h" -#include "ten_runtime/binding/cpp/internal/msg/data.h" -#include "ten_runtime/binding/cpp/internal/msg/video_frame.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/common.h" +#include "ten_runtime/binding/cpp/detail/msg/audio_frame.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/stop_graph.h" +#include "ten_runtime/binding/cpp/detail/msg/data.h" +#include "ten_runtime/binding/cpp/detail/msg/video_frame.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_runtime/extension/extension.h" #include "ten_runtime/msg/cmd/stop_graph/cmd.h" #include "ten_runtime/msg/msg.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/extension_impl.h b/core/include/ten_runtime/binding/cpp/detail/extension_impl.h similarity index 90% rename from core/include/ten_runtime/binding/cpp/internal/extension_impl.h rename to core/include/ten_runtime/binding/cpp/detail/extension_impl.h index 189ba6598..51ba4c51d 100644 --- a/core/include/ten_runtime/binding/cpp/internal/extension_impl.h +++ b/core/include/ten_runtime/binding/cpp/detail/extension_impl.h @@ -12,9 +12,9 @@ #include #include -#include "ten_runtime/binding/cpp/internal/extension.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/close_app.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/extension.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/close_app.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" #include "ten_runtime/msg/msg.h" namespace ten { diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/audio_frame.h b/core/include/ten_runtime/binding/cpp/detail/msg/audio_frame.h similarity index 99% rename from core/include/ten_runtime/binding/cpp/internal/msg/audio_frame.h rename to core/include/ten_runtime/binding/cpp/detail/msg/audio_frame.h index 308e0b408..809dd9ef0 100644 --- a/core/include/ten_runtime/binding/cpp/internal/msg/audio_frame.h +++ b/core/include/ten_runtime/binding/cpp/detail/msg/audio_frame.h @@ -11,7 +11,7 @@ #include #include -#include "ten_runtime/binding/cpp/internal/msg/msg.h" +#include "ten_runtime/binding/cpp/detail/msg/msg.h" #include "ten_runtime/msg/audio_frame/audio_frame.h" #include "ten_utils/lib/smart_ptr.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/cmd/close_app.h b/core/include/ten_runtime/binding/cpp/detail/msg/cmd/close_app.h similarity index 95% rename from core/include/ten_runtime/binding/cpp/internal/msg/cmd/close_app.h rename to core/include/ten_runtime/binding/cpp/detail/msg/cmd/close_app.h index d80c6cda8..23a334b53 100644 --- a/core/include/ten_runtime/binding/cpp/internal/msg/cmd/close_app.h +++ b/core/include/ten_runtime/binding/cpp/detail/msg/cmd/close_app.h @@ -10,7 +10,7 @@ #include -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" #include "ten_runtime/msg/cmd/close_app/cmd.h" namespace ten { diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/cmd/cmd.h b/core/include/ten_runtime/binding/cpp/detail/msg/cmd/cmd.h similarity index 97% rename from core/include/ten_runtime/binding/cpp/internal/msg/cmd/cmd.h rename to core/include/ten_runtime/binding/cpp/detail/msg/cmd/cmd.h index b70cab604..9f4f86003 100644 --- a/core/include/ten_runtime/binding/cpp/internal/msg/cmd/cmd.h +++ b/core/include/ten_runtime/binding/cpp/detail/msg/cmd/cmd.h @@ -10,7 +10,7 @@ #include -#include "ten_runtime/binding/cpp/internal/msg/msg.h" +#include "ten_runtime/binding/cpp/detail/msg/msg.h" #include "ten_runtime/msg/cmd/cmd.h" #include "ten_runtime/msg/msg.h" #include "ten_utils/lib/smart_ptr.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h b/core/include/ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h similarity index 97% rename from core/include/ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h rename to core/include/ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h index 97423e43d..4d9af28be 100644 --- a/core/include/ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h +++ b/core/include/ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h @@ -10,7 +10,7 @@ #include -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" #include "ten_runtime/msg/cmd/start_graph/cmd.h" namespace ten { diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/cmd/stop_graph.h b/core/include/ten_runtime/binding/cpp/detail/msg/cmd/stop_graph.h similarity index 95% rename from core/include/ten_runtime/binding/cpp/internal/msg/cmd/stop_graph.h rename to core/include/ten_runtime/binding/cpp/detail/msg/cmd/stop_graph.h index 533657b61..a27c8e2e1 100644 --- a/core/include/ten_runtime/binding/cpp/internal/msg/cmd/stop_graph.h +++ b/core/include/ten_runtime/binding/cpp/detail/msg/cmd/stop_graph.h @@ -10,7 +10,7 @@ #include -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" #include "ten_runtime/msg/cmd/stop_graph/cmd.h" #include "ten_utils/lib/smart_ptr.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/cmd_result.h b/core/include/ten_runtime/binding/cpp/detail/msg/cmd_result.h similarity index 97% rename from core/include/ten_runtime/binding/cpp/internal/msg/cmd_result.h rename to core/include/ten_runtime/binding/cpp/detail/msg/cmd_result.h index 02ee4a818..5f7ab79b1 100644 --- a/core/include/ten_runtime/binding/cpp/internal/msg/cmd_result.h +++ b/core/include/ten_runtime/binding/cpp/detail/msg/cmd_result.h @@ -10,7 +10,7 @@ #include -#include "ten_runtime/binding/cpp/internal/msg/msg.h" +#include "ten_runtime/binding/cpp/detail/msg/msg.h" #include "ten_runtime/common/status_code.h" #include "ten_runtime/msg/cmd_result/cmd_result.h" #include "ten_utils/lang/cpp/lib/value.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/data.h b/core/include/ten_runtime/binding/cpp/detail/msg/data.h similarity index 98% rename from core/include/ten_runtime/binding/cpp/internal/msg/data.h rename to core/include/ten_runtime/binding/cpp/detail/msg/data.h index 97b51bb72..04d532c28 100644 --- a/core/include/ten_runtime/binding/cpp/internal/msg/data.h +++ b/core/include/ten_runtime/binding/cpp/detail/msg/data.h @@ -12,7 +12,7 @@ #include #include -#include "ten_runtime/binding/cpp/internal/msg/msg.h" +#include "ten_runtime/binding/cpp/detail/msg/msg.h" #include "ten_runtime/msg/data/data.h" #include "ten_utils/lang/cpp/lib/buf.h" #include "ten_utils/lib/smart_ptr.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/msg.h b/core/include/ten_runtime/binding/cpp/detail/msg/msg.h similarity index 100% rename from core/include/ten_runtime/binding/cpp/internal/msg/msg.h rename to core/include/ten_runtime/binding/cpp/detail/msg/msg.h diff --git a/core/include/ten_runtime/binding/cpp/internal/msg/video_frame.h b/core/include/ten_runtime/binding/cpp/detail/msg/video_frame.h similarity index 98% rename from core/include/ten_runtime/binding/cpp/internal/msg/video_frame.h rename to core/include/ten_runtime/binding/cpp/detail/msg/video_frame.h index 954f7b944..acba01f74 100644 --- a/core/include/ten_runtime/binding/cpp/internal/msg/video_frame.h +++ b/core/include/ten_runtime/binding/cpp/detail/msg/video_frame.h @@ -12,7 +12,7 @@ #include #include -#include "ten_runtime/binding/cpp/internal/msg/msg.h" +#include "ten_runtime/binding/cpp/detail/msg/msg.h" #include "ten_runtime/msg/video_frame/video_frame.h" #include "ten_utils/lib/smart_ptr.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/ten_env.h b/core/include/ten_runtime/binding/cpp/detail/ten_env.h similarity index 76% rename from core/include/ten_runtime/binding/cpp/internal/ten_env.h rename to core/include/ten_runtime/binding/cpp/detail/ten_env.h index e6a6702b8..f6760c70f 100644 --- a/core/include/ten_runtime/binding/cpp/internal/ten_env.h +++ b/core/include/ten_runtime/binding/cpp/detail/ten_env.h @@ -10,11 +10,11 @@ #include #include "ten_runtime/binding/common.h" -#include "ten_runtime/binding/cpp/internal/msg/audio_frame.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd_result.h" -#include "ten_runtime/binding/cpp/internal/msg/data.h" -#include "ten_runtime/binding/cpp/internal/msg/video_frame.h" +#include "ten_runtime/binding/cpp/detail/msg/audio_frame.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd_result.h" +#include "ten_runtime/binding/cpp/detail/msg/data.h" +#include "ten_runtime/binding/cpp/detail/msg/video_frame.h" #include "ten_runtime/common/errno.h" #include "ten_runtime/msg/cmd_result/cmd_result.h" #include "ten_runtime/ten.h" @@ -49,12 +49,6 @@ class ten_env_internal_accessor_t; using result_handler_func_t = std::function)>; -using set_property_async_cb_t = - std::function; - -using get_property_async_cb_t = - std::function; - class ten_env_t { public: // @{ @@ -407,42 +401,6 @@ class ten_env_t { c_value, err != nullptr ? err->get_internal_representation() : nullptr); } - bool get_property_int32_async( - const char *path, - std::function &&cb, - error_t *err = nullptr) { - // Initialized lambda captures are a C++14 extension, and we use the - // following trick to achieve the same effect. - auto cb_copy = std::move(cb); - return get_property_async_impl( - path, - [cb_copy](ten_env_t &ten_env, ten_value_t *value, error_t *err) { - cb_copy(ten_env, - ten_value_get_int32( - value, err != nullptr ? err->get_internal_representation() - : nullptr), - err); - return; - }, - err); - } - - bool get_property_string_async( - const char *path, - std::function &&cb, - error_t *err = nullptr) { - // Initialized lambda captures are a C++14 extension, and we use the - // following trick to achieve the same effect. - auto cb_copy = std::move(cb); - return get_property_async_impl( - path, - [cb_copy](ten_env_t &ten_env, ten_value_t *value, error_t *err) { - cb_copy(ten_env, ten_value_peek_raw_str(value), err); - return; - }, - err); - } - bool set_property(const char *path, int8_t value, error_t *err = nullptr) { return set_property_impl(path, ten_value_create_int8(value), err); } @@ -510,77 +468,6 @@ class ten_env_t { return set_property_impl(path, ten_value_create_buf_with_move(buf), err); } - bool set_property_async(const char *path, int8_t value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_int8(value), - std::move(cb), err); - } - - bool set_property_async(const char *path, int16_t value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_int16(value), - std::move(cb), err); - } - - bool set_property_async(const char *path, int32_t value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_int32(value), - std::move(cb), err); - } - - bool set_property_async(const char *path, int64_t value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_int64(value), - std::move(cb), err); - } - - bool set_property_async(const char *path, uint8_t value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_uint8(value), - std::move(cb), err); - } - - bool set_property_async(const char *path, uint16_t value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_uint16(value), - std::move(cb), err); - } - - bool set_property_async(const char *path, uint32_t value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_uint32(value), - std::move(cb), err); - } - - bool set_property_async(const char *path, uint64_t value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_uint64(value), - std::move(cb), err); - } - - bool set_property_async(const char *path, const char *value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_string(value), - std::move(cb), err); - } - - // Convenient overloaded function for string type. - bool set_property_async(const char *path, const std::string &value, - set_property_async_cb_t &&cb, - error_t *err = nullptr) { - return set_property_async_impl(path, ten_value_create_string(value.c_str()), - std::move(cb), err); - } - bool is_cmd_connected(const char *cmd_name, error_t *err = nullptr) { TEN_ASSERT(c_ten_env, "Should not happen."); return ten_env_is_cmd_connected( @@ -788,43 +675,6 @@ class ten_env_t { return rc; } - /** - * @note Note the move semantics of @a value. The @a value should not be - * used after calling this function. - */ - bool set_property_async_impl(const char *path, ten_value_t *value, - set_property_async_cb_t &&cb, error_t *err) { - TEN_ASSERT(c_ten_env, "Should not happen."); - - auto *cb_ptr = new set_property_async_cb_t(cb); - - bool rc = ten_env_set_property_async( - c_ten_env, path, value, proxy_set_property_callback, cb_ptr, - err != nullptr ? err->get_internal_representation() : nullptr); - - if (!rc) { - delete cb_ptr; - } - return rc; - } - - bool get_property_async_impl(const char *path, get_property_async_cb_t &&cb, - error_t *err = nullptr) { - TEN_ASSERT(c_ten_env, "Should not happen."); - - auto *cb_ptr = new get_property_async_cb_t(cb); - - bool rc = ten_env_peek_property_async( - c_ten_env, path, proxy_get_property_async_from_peek_cb, cb_ptr, - err != nullptr ? err->get_internal_representation() : nullptr); - - if (!rc) { - delete cb_ptr; - } - - return rc; - } - static void proxy_handle_result(TEN_UNUSED ten_extension_t *extension, ::ten_env_t *ten_env, ten_shared_ptr_t *c_cmd_result, @@ -859,44 +709,6 @@ class ten_env_t { delete result_handler; } } - - static void proxy_set_property_callback(::ten_env_t *ten_env, bool res, - void *cb_data, ten_error_t *err) { - auto *callback = static_cast(cb_data); - auto *cpp_ten_env = - static_cast(ten_binding_handle_get_me_in_target_lang( - reinterpret_cast(ten_env))); - - error_t *cpp_err = nullptr; - if (err != nullptr) { - cpp_err = new error_t(err, false); - } - - (*callback)(*cpp_ten_env, res, cpp_err); - - delete cpp_err; - delete callback; - } - - static void proxy_get_property_async_from_peek_cb(::ten_env_t *ten_env, - ten_value_t *res, - void *cb_data, - ten_error_t *err) { - auto *callback = static_cast(cb_data); - auto *cpp_ten_env = - static_cast(ten_binding_handle_get_me_in_target_lang( - reinterpret_cast(ten_env))); - - error_t *cpp_err = nullptr; - if (err != nullptr) { - cpp_err = new error_t(err, false); - } - - (*callback)(*cpp_ten_env, res, cpp_err); - - delete cpp_err; - delete callback; - } }; } // namespace ten diff --git a/core/include/ten_runtime/binding/cpp/internal/ten_env_impl.h b/core/include/ten_runtime/binding/cpp/detail/ten_env_impl.h similarity index 87% rename from core/include/ten_runtime/binding/cpp/internal/ten_env_impl.h rename to core/include/ten_runtime/binding/cpp/detail/ten_env_impl.h index 4563932df..af850f111 100644 --- a/core/include/ten_runtime/binding/cpp/internal/ten_env_impl.h +++ b/core/include/ten_runtime/binding/cpp/detail/ten_env_impl.h @@ -8,9 +8,9 @@ #include -#include "ten_runtime/binding/cpp/internal/addon.h" -#include "ten_runtime/binding/cpp/internal/extension.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/addon.h" +#include "ten_runtime/binding/cpp/detail/extension.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_utils/lang/cpp/lib/error.h" namespace ten { diff --git a/core/include/ten_runtime/binding/cpp/internal/ten_env_proxy.h b/core/include/ten_runtime/binding/cpp/detail/ten_env_proxy.h similarity index 99% rename from core/include/ten_runtime/binding/cpp/internal/ten_env_proxy.h rename to core/include/ten_runtime/binding/cpp/detail/ten_env_proxy.h index fddf8e30e..26c2111e7 100644 --- a/core/include/ten_runtime/binding/cpp/internal/ten_env_proxy.h +++ b/core/include/ten_runtime/binding/cpp/detail/ten_env_proxy.h @@ -6,7 +6,7 @@ // #pragma once -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_runtime/ten_env_proxy/ten_env_proxy.h" using ten_extension_t = struct ten_extension_t; diff --git a/core/include/ten_runtime/binding/cpp/internal/test/env_tester.h b/core/include/ten_runtime/binding/cpp/detail/test/env_tester.h similarity index 95% rename from core/include/ten_runtime/binding/cpp/internal/test/env_tester.h rename to core/include/ten_runtime/binding/cpp/detail/test/env_tester.h index ec9569ea2..a26190306 100644 --- a/core/include/ten_runtime/binding/cpp/internal/test/env_tester.h +++ b/core/include/ten_runtime/binding/cpp/detail/test/env_tester.h @@ -9,11 +9,11 @@ #include #include "ten_runtime/binding/common.h" -#include "ten_runtime/binding/cpp/internal/msg/audio_frame.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd_result.h" -#include "ten_runtime/binding/cpp/internal/msg/data.h" -#include "ten_runtime/binding/cpp/internal/msg/video_frame.h" +#include "ten_runtime/binding/cpp/detail/msg/audio_frame.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd_result.h" +#include "ten_runtime/binding/cpp/detail/msg/data.h" +#include "ten_runtime/binding/cpp/detail/msg/video_frame.h" #include "ten_runtime/test/env_tester.h" #include "ten_utils/lang/cpp/lib/error.h" diff --git a/core/include/ten_runtime/binding/cpp/internal/test/env_tester_proxy.h b/core/include/ten_runtime/binding/cpp/detail/test/env_tester_proxy.h similarity index 98% rename from core/include/ten_runtime/binding/cpp/internal/test/env_tester_proxy.h rename to core/include/ten_runtime/binding/cpp/detail/test/env_tester_proxy.h index ab735a066..1a67f6cee 100644 --- a/core/include/ten_runtime/binding/cpp/internal/test/env_tester_proxy.h +++ b/core/include/ten_runtime/binding/cpp/detail/test/env_tester_proxy.h @@ -9,7 +9,7 @@ #include -#include "ten_runtime/binding/cpp/internal/test/env_tester.h" +#include "ten_runtime/binding/cpp/detail/test/env_tester.h" #include "ten_runtime/test/env_tester_proxy.h" using ten_env_tester_t = struct ten_env_tester_t; diff --git a/core/include/ten_runtime/binding/cpp/internal/test/extension_tester.h b/core/include/ten_runtime/binding/cpp/detail/test/extension_tester.h similarity index 96% rename from core/include/ten_runtime/binding/cpp/internal/test/extension_tester.h rename to core/include/ten_runtime/binding/cpp/detail/test/extension_tester.h index 66b03d420..591526cf8 100644 --- a/core/include/ten_runtime/binding/cpp/internal/test/extension_tester.h +++ b/core/include/ten_runtime/binding/cpp/detail/test/extension_tester.h @@ -9,11 +9,11 @@ #include #include "ten_runtime/binding/common.h" -#include "ten_runtime/binding/cpp/internal/msg/audio_frame.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" -#include "ten_runtime/binding/cpp/internal/msg/data.h" -#include "ten_runtime/binding/cpp/internal/msg/video_frame.h" -#include "ten_runtime/binding/cpp/internal/test/env_tester.h" +#include "ten_runtime/binding/cpp/detail/msg/audio_frame.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/data.h" +#include "ten_runtime/binding/cpp/detail/msg/video_frame.h" +#include "ten_runtime/binding/cpp/detail/test/env_tester.h" #include "ten_runtime/test/extension_tester.h" #include "ten_utils/macro/check.h" diff --git a/core/include/ten_runtime/binding/cpp/experimental/ten_client_proxy.h b/core/include/ten_runtime/binding/cpp/experimental/ten_client_proxy.h index e720b1108..09ac8903d 100644 --- a/core/include/ten_runtime/binding/cpp/experimental/ten_client_proxy.h +++ b/core/include/ten_runtime/binding/cpp/experimental/ten_client_proxy.h @@ -6,8 +6,8 @@ // #pragma once -#include "ten_runtime/binding/cpp/internal/test/env_tester_proxy.h" -#include "ten_runtime/binding/cpp/internal/test/extension_tester.h" +#include "ten_runtime/binding/cpp/detail/test/env_tester_proxy.h" +#include "ten_runtime/binding/cpp/detail/test/extension_tester.h" #include "ten_utils/log/log.h" namespace ten { diff --git a/core/include/ten_runtime/binding/cpp/ten.h b/core/include/ten_runtime/binding/cpp/ten.h index f5ad62d2f..fcb7ef615 100644 --- a/core/include/ten_runtime/binding/cpp/ten.h +++ b/core/include/ten_runtime/binding/cpp/ten.h @@ -9,28 +9,25 @@ // This header file should be the only header file where outside world should // include in the C++ programming language. -// clang-format off -#include "ten_runtime/binding/cpp/internal/common.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/ten_env.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/ten_env_proxy.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/msg.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd/stop_graph.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd/close_app.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd_result.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/data.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/video_frame.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/audio_frame.h" // IWYU pragma: export -// 'extension.h' must be in front of 'addon.h' -#include "ten_runtime/binding/cpp/internal/extension.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/test/extension_tester.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/test/env_tester.h" // IWYU pragma: export -// clang-format on - #include "ten_runtime/addon/extension/extension.h" // IWYU pragma: export #include "ten_runtime/addon/extension_group/extension_group.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/addon.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/app.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/extension_impl.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/ten_env_impl.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/addon.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/app.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/common.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/extension.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/extension_impl.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/audio_frame.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd/close_app.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd/stop_graph.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd_result.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/data.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/msg.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/video_frame.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/ten_env.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/ten_env_impl.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/ten_env_proxy.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/test/env_tester.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/test/env_tester_proxy.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/test/extension_tester.h" // IWYU pragma: export diff --git a/core/include/ten_utils/macro/check.h b/core/include/ten_utils/macro/check.h index db069a2de..39e2fc75e 100644 --- a/core/include/ten_utils/macro/check.h +++ b/core/include/ten_utils/macro/check.h @@ -40,36 +40,36 @@ #ifndef NDEBUG -#define TEN_ASSERT(expr, fmt, ...) \ - do { \ - /* NOLINTNEXTLINE */ \ - if (!(expr)) { \ - /* NOLINTNEXTLINE */ \ - char err_msg[ASSERT_ERR_MSG_MAX_LENGTH]; \ - (void)snprintf(err_msg, ASSERT_ERR_MSG_MAX_LENGTH, fmt, ##__VA_ARGS__); \ - (void)fprintf(stderr, "%s\n", err_msg); \ - ten_backtrace_dump_global(0); \ - /* NOLINTNEXTLINE */ \ - assert(0); \ - } \ +#define TEN_ASSERT(expr, fmt, ...) \ + do { \ + /* NOLINTNEXTLINE */ \ + if (!(expr)) { \ + /* NOLINTNEXTLINE */ \ + char ____err_msg[ASSERT_ERR_MSG_MAX_LENGTH]; \ + (void)snprintf(____err_msg, sizeof(____err_msg), fmt, ##__VA_ARGS__); \ + (void)fprintf(stderr, "%s\n", ____err_msg); \ + ten_backtrace_dump_global(0); \ + /* NOLINTNEXTLINE */ \ + assert(0); \ + } \ } while (0) #else // NDEBUG // Enable minimal protection if the optimization is enabled. -#define TEN_ASSERT(expr, fmt, ...) \ - do { \ - /* NOLINTNEXTLINE */ \ - if (!(expr)) { \ - /* NOLINTNEXTLINE */ \ - char err_msg[ASSERT_ERR_MSG_MAX_LENGTH]; \ - (void)snprintf(err_msg, ASSERT_ERR_MSG_MAX_LENGTH, fmt, ##__VA_ARGS__); \ - (void)fprintf(stderr, "%s\n", err_msg); \ - ten_backtrace_dump_global(0); \ - /* NOLINTNEXTLINE */ \ - abort(); \ - } \ +#define TEN_ASSERT(expr, fmt, ...) \ + do { \ + /* NOLINTNEXTLINE */ \ + if (!(expr)) { \ + /* NOLINTNEXTLINE */ \ + char ____err_msg[ASSERT_ERR_MSG_MAX_LENGTH]; \ + (void)snprintf(____err_msg, sizeof(____err_msg), fmt, ##__VA_ARGS__); \ + (void)fprintf(stderr, "%s\n", ____err_msg); \ + ten_backtrace_dump_global(0); \ + /* NOLINTNEXTLINE */ \ + abort(); \ + } \ } while (0) #endif // NDEBUG diff --git a/core/include_internal/ten_runtime/binding/cpp/internal/extension_impl.h b/core/include_internal/ten_runtime/binding/cpp/detail/extension_impl.h similarity index 82% rename from core/include_internal/ten_runtime/binding/cpp/internal/extension_impl.h rename to core/include_internal/ten_runtime/binding/cpp/detail/extension_impl.h index 5b7e7456c..d4164166a 100644 --- a/core/include_internal/ten_runtime/binding/cpp/internal/extension_impl.h +++ b/core/include_internal/ten_runtime/binding/cpp/detail/extension_impl.h @@ -9,9 +9,13 @@ #include #include #include -#include -#include -#include + +#include "include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timeout.h" +#include "include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timer.h" +#include "ten_runtime/binding/cpp/detail/extension.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/close_app.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/stop_graph.h" namespace ten { diff --git a/core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/cmd_result_internal_accessor.h b/core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/cmd_result_internal_accessor.h similarity index 94% rename from core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/cmd_result_internal_accessor.h rename to core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/cmd_result_internal_accessor.h index 49aac9959..72c540d20 100644 --- a/core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/cmd_result_internal_accessor.h +++ b/core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/cmd_result_internal_accessor.h @@ -6,7 +6,7 @@ // #pragma once -#include "ten_runtime/binding/cpp/internal/msg/cmd_result.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd_result.h" namespace ten { diff --git a/core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timeout.h b/core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timeout.h similarity index 96% rename from core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timeout.h rename to core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timeout.h index db6a684ca..ad2b5b7e1 100644 --- a/core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timeout.h +++ b/core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timeout.h @@ -11,7 +11,7 @@ #include #include "include_internal/ten_runtime/msg/cmd_base/cmd/timeout/cmd.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" namespace ten { diff --git a/core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timer.h b/core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timer.h similarity index 96% rename from core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timer.h rename to core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timer.h index 48f60ff7c..7112897a1 100644 --- a/core/include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timer.h +++ b/core/include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timer.h @@ -11,7 +11,7 @@ #include #include "include_internal/ten_runtime/msg/cmd_base/cmd/timer/cmd.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" namespace ten { diff --git a/core/include_internal/ten_runtime/binding/cpp/internal/ten_env_impl.h b/core/include_internal/ten_runtime/binding/cpp/detail/ten_env_impl.h similarity index 90% rename from core/include_internal/ten_runtime/binding/cpp/internal/ten_env_impl.h rename to core/include_internal/ten_runtime/binding/cpp/detail/ten_env_impl.h index b106e065d..0b778639e 100644 --- a/core/include_internal/ten_runtime/binding/cpp/internal/ten_env_impl.h +++ b/core/include_internal/ten_runtime/binding/cpp/detail/ten_env_impl.h @@ -6,10 +6,8 @@ // #pragma once -#include - -#include "include_internal/ten_runtime/binding/cpp/ten.h" #include "include_internal/ten_runtime/ten_env/metadata.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" namespace ten { diff --git a/core/include_internal/ten_runtime/binding/cpp/internal/ten_env_internal_accessor.h b/core/include_internal/ten_runtime/binding/cpp/detail/ten_env_internal_accessor.h similarity index 95% rename from core/include_internal/ten_runtime/binding/cpp/internal/ten_env_internal_accessor.h rename to core/include_internal/ten_runtime/binding/cpp/detail/ten_env_internal_accessor.h index e2e4eb4d0..0a4048a76 100644 --- a/core/include_internal/ten_runtime/binding/cpp/internal/ten_env_internal_accessor.h +++ b/core/include_internal/ten_runtime/binding/cpp/detail/ten_env_internal_accessor.h @@ -6,7 +6,7 @@ // #pragma once -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" namespace ten { diff --git a/core/include_internal/ten_runtime/binding/cpp/ten.h b/core/include_internal/ten_runtime/binding/cpp/ten.h index 35ec44351..87e277df2 100644 --- a/core/include_internal/ten_runtime/binding/cpp/ten.h +++ b/core/include_internal/ten_runtime/binding/cpp/ten.h @@ -9,30 +9,29 @@ // This header file should be the only header file where outside world should // include in the C++ programming language. -// clang-format off -#include "ten_runtime/binding/cpp/internal/common.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/ten_env.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/ten_env_proxy.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/msg.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd/stop_graph.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd/close_app.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/cmd_result.h" // IWYU pragma: export -#include "include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timeout.h" // IWYU pragma: export -#include "include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timer.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/data.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/video_frame.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/msg/audio_frame.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/test/extension_tester.h" // IWYU pragma: export -// 'extension.h' must be in front of 'addon.h' -#include "ten_runtime/binding/cpp/internal/extension.h" // IWYU pragma: export -// clang-format on -#include "include_internal/ten_runtime/binding/cpp/internal/extension_impl.h" // IWYU pragma: export -#include "include_internal/ten_runtime/binding/cpp/internal/ten_env_impl.h" // IWYU pragma: export -#include "include_internal/ten_runtime/binding/cpp/internal/ten_env_internal_accessor.h" // IWYU pragma: export +#include "include_internal/ten_runtime/binding/cpp/detail/extension_impl.h" // IWYU pragma: export +#include "include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timeout.h" // IWYU pragma: export +#include "include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timer.h" // IWYU pragma: export +#include "include_internal/ten_runtime/binding/cpp/detail/ten_env_impl.h" // IWYU pragma: export +#include "include_internal/ten_runtime/binding/cpp/detail/ten_env_internal_accessor.h" // IWYU pragma: export #include "ten_runtime/addon/extension/extension.h" // IWYU pragma: export #include "ten_runtime/addon/extension_group/extension_group.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/addon.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/app.h" // IWYU pragma: export -#include "ten_runtime/binding/cpp/internal/ten_env_impl.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/addon.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/app.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/common.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/extension.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/audio_frame.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd/close_app.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd/stop_graph.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/cmd_result.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/data.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/msg.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/msg/video_frame.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/ten_env.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/ten_env_impl.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/ten_env_proxy.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/test/env_tester.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/test/env_tester_proxy.h" // IWYU pragma: export +#include "ten_runtime/binding/cpp/detail/test/extension_tester.h" // IWYU pragma: export diff --git a/core/src/ten_utils/lib/sys/posix/shm.c b/core/src/ten_utils/lib/sys/posix/shm.c index dfd9c93df..a4a81e4b9 100644 --- a/core/src/ten_utils/lib/sys/posix/shm.c +++ b/core/src/ten_utils/lib/sys/posix/shm.c @@ -15,6 +15,7 @@ #include #include "ten_utils/lib/atomic.h" +#include "ten_utils/macro/check.h" static char *__make_abs_path(const char *name) { char *abs_path = NULL; @@ -67,7 +68,8 @@ void *ten_shm_map(const char *name, size_t size) { // this is to avoid truncate an existing shm file fd = shm_open(abs_path, O_RDWR, S_IRUSR | S_IWUSR); } else { - ftruncate(fd, size + sizeof(ten_atomic_t)); + int rc = ftruncate(fd, size + sizeof(ten_atomic_t)); + TEN_ASSERT(!rc, "Should not happen."); } if (fd < 0) { diff --git a/core/src/ten_utils/log/output.c b/core/src/ten_utils/log/output.c index 242ca099d..c10189e7f 100644 --- a/core/src/ten_utils/log/output.c +++ b/core/src/ten_utils/log/output.c @@ -192,7 +192,14 @@ void ten_log_output_to_file_cb(ten_string_t *msg, void *user_data) { // TODO(Wei): write() is atomic for buffers less than or equal to PIPE_BUF, // therefore we need to have some locking mechanism here to prevent log // interleaved. - write(fd, ten_string_get_raw_str(msg), ten_string_len(msg)); + ssize_t bytes_written = + write(fd, ten_string_get_raw_str(msg), ten_string_len(msg)); + if (bytes_written == -1) { + perror("write failed"); + } else if ((size_t)bytes_written < ten_string_len(msg)) { + (void)fprintf(stderr, "Partial write: only %zd of %zu bytes written\n", + bytes_written, ten_string_len(msg)); + } #endif } @@ -229,7 +236,14 @@ void ten_log_output_to_stderr_cb(ten_string_t *msg, void *user_data) { // TODO(Wei): write() is atomic for buffers less than or equal to PIPE_BUF, // therefore we need to have some locking mechanism here to prevent log // interleaved. - write(STDERR_FILENO, ten_string_get_raw_str(msg), ten_string_len(msg)); + ssize_t bytes_written = + write(STDERR_FILENO, ten_string_get_raw_str(msg), ten_string_len(msg)); + if (bytes_written == -1) { + perror("write failed"); + } else if ((size_t)bytes_written < ten_string_len(msg)) { + (void)fprintf(stderr, "Partial write: only %zd of %zu bytes written\n", + bytes_written, ten_string_len(msg)); + } #endif } diff --git a/packages/core_extensions/py_init_extension_cpp/src/main.cc b/packages/core_extensions/py_init_extension_cpp/src/main.cc index a502cda28..711fd7ba9 100644 --- a/packages/core_extensions/py_init_extension_cpp/src/main.cc +++ b/packages/core_extensions/py_init_extension_cpp/src/main.cc @@ -8,13 +8,13 @@ #include "include_internal/ten_runtime/addon/extension/extension.h" #include "include_internal/ten_runtime/app/metadata.h" -#include "include_internal/ten_runtime/binding/cpp/internal/ten_env_internal_accessor.h" +#include "include_internal/ten_runtime/binding/cpp/detail/ten_env_internal_accessor.h" #include "include_internal/ten_runtime/binding/python/common.h" #include "include_internal/ten_runtime/common/base_dir.h" #include "include_internal/ten_runtime/common/constant_str.h" #include "include_internal/ten_runtime/metadata/manifest.h" -#include "include_internal/ten_runtime/ten_env/metadata.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "include_internal/ten_runtime/ten_env/ten_env.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_runtime/binding/cpp/ten.h" #include "ten_utils/container/list_str.h" #include "ten_utils/lib/module.h" diff --git a/tests/common/client/cpp/msgpack_tcp.h b/tests/common/client/cpp/msgpack_tcp.h index ff02abe35..1f54245ee 100644 --- a/tests/common/client/cpp/msgpack_tcp.h +++ b/tests/common/client/cpp/msgpack_tcp.h @@ -11,11 +11,10 @@ #include #include -#include "include_internal/ten_runtime/binding/cpp/internal/msg/cmd/cmd_result_internal_accessor.h" +#include "include_internal/ten_runtime/binding/cpp/detail/msg/cmd/cmd_result_internal_accessor.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" #include "include_internal/ten_utils/log/log.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd_result.h" -#include "ten_utils/lib/json.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd_result.h" #include "ten_utils/lib/smart_ptr.h" #include "ten_utils/lib/string.h" #include "tests/common/client/msgpack_tcp.h" diff --git a/tests/ten_manager/install_all/install_all_fail_with_local_unsupported_pkg/test_case.py b/tests/ten_manager/install_all/install_all_fail_with_local_unsupported_pkg/test_case.py index 08ff2beb9..f3d4ac3fe 100644 --- a/tests/ten_manager/install_all/install_all_fail_with_local_unsupported_pkg/test_case.py +++ b/tests/ten_manager/install_all/install_all_fail_with_local_unsupported_pkg/test_case.py @@ -33,6 +33,9 @@ def test_tman_dependency_resolve(): cwd=app_dir, ) + print(returncode) + print(output_text) + assert returncode != 0 # As the local package 'heiheihei_1' is not compatible with linux os, and # the package cannot be found in the registry, so no candidates can be found diff --git a/tests/ten_runtime/integration/cpp/check_start_graph/check_start_graph_source/ten_packages/extension/default_extension_cpp/src/main.cc b/tests/ten_runtime/integration/cpp/check_start_graph/check_start_graph_source/ten_packages/extension/default_extension_cpp/src/main.cc index 5db3e6245..d5dd5742c 100644 --- a/tests/ten_runtime/integration/cpp/check_start_graph/check_start_graph_source/ten_packages/extension/default_extension_cpp/src/main.cc +++ b/tests/ten_runtime/integration/cpp/check_start_graph/check_start_graph_source/ten_packages/extension/default_extension_cpp/src/main.cc @@ -8,9 +8,9 @@ #include #include -#include "ten_runtime/binding/cpp/internal/msg/cmd/close_app.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/close_app.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_runtime/binding/cpp/ten.h" bool started = false; diff --git a/tests/ten_runtime/integration/cpp/multi_apps/client/client.cc b/tests/ten_runtime/integration/cpp/multi_apps/client/client.cc index de71d0051..0f224d61c 100644 --- a/tests/ten_runtime/integration/cpp/multi_apps/client/client.cc +++ b/tests/ten_runtime/integration/cpp/multi_apps/client/client.cc @@ -6,7 +6,7 @@ // #include -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" #include "ten_utils/macro/check.h" #include "tests/common/client/cpp/msgpack_tcp.h" diff --git a/tests/ten_runtime/smoke/audio_frame_test/create_from_json.cc b/tests/ten_runtime/smoke/audio_frame_test/create_from_json.cc index 1582eea2a..fd1bb06b6 100644 --- a/tests/ten_runtime/smoke/audio_frame_test/create_from_json.cc +++ b/tests/ten_runtime/smoke/audio_frame_test/create_from_json.cc @@ -10,7 +10,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/audio_frame.h" +#include "ten_runtime/binding/cpp/detail/msg/audio_frame.h" #include "ten_runtime/msg/audio_frame/audio_frame.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" diff --git a/tests/ten_runtime/smoke/cmd_conversion/cmd_conversion_path_nested_5.cc b/tests/ten_runtime/smoke/cmd_conversion/cmd_conversion_path_nested_5.cc index 357247058..8a2361045 100644 --- a/tests/ten_runtime/smoke/cmd_conversion/cmd_conversion_path_nested_5.cc +++ b/tests/ten_runtime/smoke/cmd_conversion/cmd_conversion_path_nested_5.cc @@ -9,7 +9,7 @@ #include #include "gtest/gtest.h" -#include "include_internal/ten_runtime/binding/cpp/internal/ten_env_internal_accessor.h" +#include "include_internal/ten_runtime/binding/cpp/detail/ten_env_internal_accessor.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" diff --git a/tests/ten_runtime/smoke/cmd_result_test/multiple_result_2.cc b/tests/ten_runtime/smoke/cmd_result_test/multiple_result_2.cc index 959c76cb4..b348eb47f 100644 --- a/tests/ten_runtime/smoke/cmd_result_test/multiple_result_2.cc +++ b/tests/ten_runtime/smoke/cmd_result_test/multiple_result_2.cc @@ -9,7 +9,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/cmd_result_test/multiple_result_3.cc b/tests/ten_runtime/smoke/cmd_result_test/multiple_result_3.cc index ce042b83f..a913d7254 100644 --- a/tests/ten_runtime/smoke/cmd_result_test/multiple_result_3.cc +++ b/tests/ten_runtime/smoke/cmd_result_test/multiple_result_3.cc @@ -9,7 +9,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/data_test/create_from_json.cc b/tests/ten_runtime/smoke/data_test/create_from_json.cc index 96406e867..34248e078 100644 --- a/tests/ten_runtime/smoke/data_test/create_from_json.cc +++ b/tests/ten_runtime/smoke/data_test/create_from_json.cc @@ -10,7 +10,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/data.h" +#include "ten_runtime/binding/cpp/detail/msg/data.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/extension_test/basic/basic_extensions_init_dependency.cc b/tests/ten_runtime/smoke/extension_test/basic/basic_extensions_init_dependency.cc index 0f695726d..2a155dc83 100644 --- a/tests/ten_runtime/smoke/extension_test/basic/basic_extensions_init_dependency.cc +++ b/tests/ten_runtime/smoke/extension_test/basic/basic_extensions_init_dependency.cc @@ -95,25 +95,20 @@ class test_extension_2 : public ten::extension_t { std::thread fetch_property_thread_; void get_property(ten::ten_env_t &ten_env) { - ten_env.get_property_string_async( - EXTENSION_PROP_NAME_GREETING, - [this](ten::ten_env_t &ten_env, const std::string &result, - TEN_UNUSED ten::error_t *err) { - greeting_ = result; - - auto cmd = ten::cmd_t::create("get_name"); - ten_env.send_cmd( - std::move(cmd), - [this](ten::ten_env_t &ten_env, - std::unique_ptr cmd_result) { - auto name = cmd_result->get_property_string("detail"); - greeting_ += name; - - ten_env.on_init_done(); - return true; - }, - nullptr); - }); + greeting_ = ten_env.get_property_string(EXTENSION_PROP_NAME_GREETING); + + auto cmd = ten::cmd_t::create("get_name"); + ten_env.send_cmd( + std::move(cmd), + [this](ten::ten_env_t &ten_env, + std::unique_ptr cmd_result) { + auto name = cmd_result->get_property_string("detail"); + greeting_ += name; + + ten_env.on_init_done(); + return true; + }, + nullptr); } }; diff --git a/tests/ten_runtime/smoke/extension_test/command/command_stop_graph_actively.cc b/tests/ten_runtime/smoke/extension_test/command/command_stop_graph_actively.cc index a222da22f..c20b0bb37 100644 --- a/tests/ten_runtime/smoke/extension_test/command/command_stop_graph_actively.cc +++ b/tests/ten_runtime/smoke/extension_test/command/command_stop_graph_actively.cc @@ -9,7 +9,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/stop_graph.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/stop_graph.h" #include "ten_utils/lib/thread.h" #include "ten_utils/lib/time.h" #include "tests/common/client/cpp/msgpack_tcp.h" diff --git a/tests/ten_runtime/smoke/extension_test/dest/no_audio_frame_dest.cc b/tests/ten_runtime/smoke/extension_test/dest/no_audio_frame_dest.cc index 97a33f85d..12776fc1e 100644 --- a/tests/ten_runtime/smoke/extension_test/dest/no_audio_frame_dest.cc +++ b/tests/ten_runtime/smoke/extension_test/dest/no_audio_frame_dest.cc @@ -10,8 +10,8 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_utils/lang/cpp/lib/error.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" diff --git a/tests/ten_runtime/smoke/extension_test/error/error_client_send_json.cc b/tests/ten_runtime/smoke/extension_test/error/error_client_send_json.cc index 5e080c364..9cadf7cda 100644 --- a/tests/ten_runtime/smoke/extension_test/error/error_client_send_json.cc +++ b/tests/ten_runtime/smoke/extension_test/error/error_client_send_json.cc @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" #include "ten_runtime/msg/cmd/start_graph/cmd.h" #include "ten_runtime/ten_env/internal/metadata.h" #include "ten_utils/lib/error.h" diff --git a/tests/ten_runtime/smoke/extension_test/error/failed_to_connect_to_remote.cc b/tests/ten_runtime/smoke/extension_test/error/failed_to_connect_to_remote.cc index 6e2237a21..d4fe48815 100644 --- a/tests/ten_runtime/smoke/extension_test/error/failed_to_connect_to_remote.cc +++ b/tests/ten_runtime/smoke/extension_test/error/failed_to_connect_to_remote.cc @@ -6,7 +6,7 @@ // #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" #include "ten_runtime/common/status_code.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/extension_test/graph/graph_loop_multiple_circle.cc b/tests/ten_runtime/smoke/extension_test/graph/graph_loop_multiple_circle.cc index a66f0a0c4..77bc93bd2 100644 --- a/tests/ten_runtime/smoke/extension_test/graph/graph_loop_multiple_circle.cc +++ b/tests/ten_runtime/smoke/extension_test/graph/graph_loop_multiple_circle.cc @@ -9,7 +9,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/extension_test/graph/graph_loop_multiple_circle_through_cmd_with_default.cc b/tests/ten_runtime/smoke/extension_test/graph/graph_loop_multiple_circle_through_cmd_with_default.cc index 29777099f..438ad0588 100644 --- a/tests/ten_runtime/smoke/extension_test/graph/graph_loop_multiple_circle_through_cmd_with_default.cc +++ b/tests/ten_runtime/smoke/extension_test/graph/graph_loop_multiple_circle_through_cmd_with_default.cc @@ -10,7 +10,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_utils/lib/thread.h" #include "ten_utils/log/log.h" #include "tests/common/client/cpp/msgpack_tcp.h" diff --git a/tests/ten_runtime/smoke/extension_test/outer_thread/32_threads_attempt_to_suspend_5.cc b/tests/ten_runtime/smoke/extension_test/outer_thread/32_threads_attempt_to_suspend_5.cc index 3aa49e41d..20b3c06cf 100644 --- a/tests/ten_runtime/smoke/extension_test/outer_thread/32_threads_attempt_to_suspend_5.cc +++ b/tests/ten_runtime/smoke/extension_test/outer_thread/32_threads_attempt_to_suspend_5.cc @@ -12,7 +12,7 @@ #include #include "gtest/gtest.h" -#include "include_internal/ten_runtime/binding/cpp/internal/msg/cmd/timer.h" +#include "include_internal/ten_runtime/binding/cpp/detail/msg/cmd/timer.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" #include "ten_runtime/msg/msg.h" #include "ten_utils/lang/cpp/lib/value.h" diff --git a/tests/ten_runtime/smoke/extension_test/property/property_access_app_store_async.cc b/tests/ten_runtime/smoke/extension_test/property/property_access_app_store_async.cc index d1da35500..fadb39ed8 100644 --- a/tests/ten_runtime/smoke/extension_test/property/property_access_app_store_async.cc +++ b/tests/ten_runtime/smoke/extension_test/property/property_access_app_store_async.cc @@ -24,18 +24,13 @@ class test_property_access_app_store_async_2 : public ten::extension_t { void on_cmd(ten::ten_env_t &ten_env, std::unique_ptr cmd) override { - auto cmd_shared = - std::make_shared>(std::move(cmd)); - ten_env.get_property_int32_async( - "app:aaa", [cmd_shared](ten::ten_env_t &ten_env, int32_t result, - TEN_UNUSED ten::error_t *err) { - if (result == 3) { - auto cmd_result = ten::cmd_result_t::create(TEN_STATUS_CODE_OK); - cmd_result->set_property("detail", "success"); - ten_env.return_result(std::move(cmd_result), - std::move(*cmd_shared)); - } - }); + auto result = ten_env.get_property_int32("app:aaa"); + + if (result == 3) { + auto cmd_result = ten::cmd_result_t::create(TEN_STATUS_CODE_OK); + cmd_result->set_property("detail", "success"); + ten_env.return_result(std::move(cmd_result), std::move(cmd)); + } } }; diff --git a/tests/ten_runtime/smoke/extension_test/start_graph/start_predefined_graph_cross_app.cc b/tests/ten_runtime/smoke/extension_test/start_graph/start_predefined_graph_cross_app.cc index e1564cee6..34924c7e0 100644 --- a/tests/ten_runtime/smoke/extension_test/start_graph/start_predefined_graph_cross_app.cc +++ b/tests/ten_runtime/smoke/extension_test/start_graph/start_predefined_graph_cross_app.cc @@ -6,7 +6,7 @@ // #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/extension_test/start_graph/start_two_predefined_graphs.cc b/tests/ten_runtime/smoke/extension_test/start_graph/start_two_predefined_graphs.cc index 4fec9c509..de3091bf3 100644 --- a/tests/ten_runtime/smoke/extension_test/start_graph/start_two_predefined_graphs.cc +++ b/tests/ten_runtime/smoke/extension_test/start_graph/start_two_predefined_graphs.cc @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/start_graph.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/start_graph.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h b/tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h index e03d9a861..343a56308 100644 --- a/tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h +++ b/tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h @@ -13,7 +13,7 @@ #include "gtest/gtest.h" #include "nlohmann/json.hpp" -#include "ten_runtime/binding/cpp/internal/msg/cmd_result.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd_result.h" #include "ten_runtime/common/status_code.h" namespace ten_test { diff --git a/tests/ten_runtime/smoke/msg_test/msg_12.cc b/tests/ten_runtime/smoke/msg_test/msg_12.cc index 2bcdd82dd..506cf7785 100644 --- a/tests/ten_runtime/smoke/msg_test/msg_12.cc +++ b/tests/ten_runtime/smoke/msg_test/msg_12.cc @@ -10,7 +10,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/msg_test/msg_9.cc b/tests/ten_runtime/smoke/msg_test/msg_9.cc index dcd771b66..9f7977048 100644 --- a/tests/ten_runtime/smoke/msg_test/msg_9.cc +++ b/tests/ten_runtime/smoke/msg_test/msg_9.cc @@ -10,7 +10,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/cmd/cmd.h" +#include "ten_runtime/binding/cpp/detail/msg/cmd/cmd.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/schema_test/schema_on_cmd.cc b/tests/ten_runtime/smoke/schema_test/schema_on_cmd.cc index 6dce4a331..ddcc2022e 100644 --- a/tests/ten_runtime/smoke/schema_test/schema_on_cmd.cc +++ b/tests/ten_runtime/smoke/schema_test/schema_on_cmd.cc @@ -8,7 +8,7 @@ #include #include "gtest/gtest.h" -#include "include_internal/ten_runtime/binding/cpp/internal/ten_env_internal_accessor.h" +#include "include_internal/ten_runtime/binding/cpp/detail/ten_env_internal_accessor.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" #include "ten_runtime/common/status_code.h" #include "ten_utils/lib/thread.h" diff --git a/tests/ten_runtime/smoke/standalone_test/basic.cc b/tests/ten_runtime/smoke/standalone_test/basic.cc index 3f12b0343..71c0d7d15 100644 --- a/tests/ten_runtime/smoke/standalone_test/basic.cc +++ b/tests/ten_runtime/smoke/standalone_test/basic.cc @@ -6,7 +6,7 @@ // #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/extension.h" +#include "ten_runtime/binding/cpp/detail/extension.h" #include "ten_runtime/common/status_code.h" #include "ten_utils/lang/cpp/lib/value.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/standalone_test/basic_graph.cc b/tests/ten_runtime/smoke/standalone_test/basic_graph.cc index 41deb32d6..96e2e360f 100644 --- a/tests/ten_runtime/smoke/standalone_test/basic_graph.cc +++ b/tests/ten_runtime/smoke/standalone_test/basic_graph.cc @@ -9,9 +9,9 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/extension.h" -#include "ten_runtime/binding/cpp/internal/ten_env_proxy.h" -#include "ten_runtime/binding/cpp/internal/test/env_tester.h" +#include "ten_runtime/binding/cpp/detail/extension.h" +#include "ten_runtime/binding/cpp/detail/ten_env_proxy.h" +#include "ten_runtime/binding/cpp/detail/test/env_tester.h" #include "ten_runtime/common/status_code.h" #include "ten_utils/lang/cpp/lib/value.h" #include "ten_utils/macro/check.h" diff --git a/tests/ten_runtime/smoke/standalone_test/basic_graph_outer_thread_1.cc b/tests/ten_runtime/smoke/standalone_test/basic_graph_outer_thread_1.cc index 71146ccae..b8fa7712b 100644 --- a/tests/ten_runtime/smoke/standalone_test/basic_graph_outer_thread_1.cc +++ b/tests/ten_runtime/smoke/standalone_test/basic_graph_outer_thread_1.cc @@ -10,10 +10,10 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/extension.h" -#include "ten_runtime/binding/cpp/internal/ten_env_proxy.h" -#include "ten_runtime/binding/cpp/internal/test/env_tester.h" -#include "ten_runtime/binding/cpp/internal/test/env_tester_proxy.h" +#include "ten_runtime/binding/cpp/detail/extension.h" +#include "ten_runtime/binding/cpp/detail/ten_env_proxy.h" +#include "ten_runtime/binding/cpp/detail/test/env_tester.h" +#include "ten_runtime/binding/cpp/detail/test/env_tester_proxy.h" #include "ten_runtime/common/status_code.h" #include "ten_utils/lang/cpp/lib/value.h" #include "ten_utils/lib/time.h" diff --git a/tests/ten_runtime/smoke/standalone_test/basic_graph_outer_thread_2.cc b/tests/ten_runtime/smoke/standalone_test/basic_graph_outer_thread_2.cc index acfe510cf..b2bd369d6 100644 --- a/tests/ten_runtime/smoke/standalone_test/basic_graph_outer_thread_2.cc +++ b/tests/ten_runtime/smoke/standalone_test/basic_graph_outer_thread_2.cc @@ -10,10 +10,10 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/extension.h" -#include "ten_runtime/binding/cpp/internal/ten_env_proxy.h" -#include "ten_runtime/binding/cpp/internal/test/env_tester.h" -#include "ten_runtime/binding/cpp/internal/test/env_tester_proxy.h" +#include "ten_runtime/binding/cpp/detail/extension.h" +#include "ten_runtime/binding/cpp/detail/ten_env_proxy.h" +#include "ten_runtime/binding/cpp/detail/test/env_tester.h" +#include "ten_runtime/binding/cpp/detail/test/env_tester_proxy.h" #include "ten_runtime/common/status_code.h" #include "ten_utils/lang/cpp/lib/value.h" #include "ten_utils/macro/check.h" diff --git a/tests/ten_runtime/smoke/standalone_test/on_cmd.cc b/tests/ten_runtime/smoke/standalone_test/on_cmd.cc index 69ec6d2ec..f894cd404 100644 --- a/tests/ten_runtime/smoke/standalone_test/on_cmd.cc +++ b/tests/ten_runtime/smoke/standalone_test/on_cmd.cc @@ -6,7 +6,7 @@ // #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/extension.h" +#include "ten_runtime/binding/cpp/detail/extension.h" #include "ten_runtime/common/status_code.h" #include "ten_utils/lang/cpp/lib/value.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/ten_env_call_timing/on_xxx_done.cc b/tests/ten_runtime/smoke/ten_env_call_timing/on_xxx_done.cc index e81943825..7e27f83cd 100644 --- a/tests/ten_runtime/smoke/ten_env_call_timing/on_xxx_done.cc +++ b/tests/ten_runtime/smoke/ten_env_call_timing/on_xxx_done.cc @@ -9,7 +9,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/ten_env.h" +#include "ten_runtime/binding/cpp/detail/ten_env.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h" #include "tests/ten_runtime/smoke/extension_test/util/binding/cpp/check.h" diff --git a/tests/ten_runtime/smoke/video_frame_test/create_from_json.cc b/tests/ten_runtime/smoke/video_frame_test/create_from_json.cc index 03fa2694c..50e062732 100644 --- a/tests/ten_runtime/smoke/video_frame_test/create_from_json.cc +++ b/tests/ten_runtime/smoke/video_frame_test/create_from_json.cc @@ -10,7 +10,7 @@ #include "gtest/gtest.h" #include "include_internal/ten_runtime/binding/cpp/ten.h" -#include "ten_runtime/binding/cpp/internal/msg/video_frame.h" +#include "ten_runtime/binding/cpp/detail/msg/video_frame.h" #include "ten_runtime/msg/video_frame/video_frame.h" #include "ten_utils/lib/thread.h" #include "tests/common/client/cpp/msgpack_tcp.h"