Skip to content

Commit

Permalink
refactor!: [BREAKING CHANGE] Convert core default_extension_group add…
Browse files Browse the repository at this point in the history
…on into builtin in the ten_runtime

No longer specify the default_extension_group addon in the `dependencies` section of `manifest.json`.
  • Loading branch information
halajohn committed Sep 25, 2024
1 parent b7f0eed commit 21729a6
Show file tree
Hide file tree
Showing 107 changed files with 11 additions and 698 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"request": "launch",
"program": "${workspaceFolder}/out/linux/x64/tests/standalone/ten_runtime_smoke_test",
"args": [
"--gtest_filter=ExtensionTest.ExtensionGroupNotSpecified"
"--gtest_filter=DataTest.MultiDestData"
],
"cwd": "${workspaceFolder}/out/linux/x64/tests/standalone/",
"env": {
Expand Down
1 change: 0 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ group("ten_framework_all") {
"//core/src/ten_runtime",
"//core/src/ten_rust",
"//packages/core_apps",
"//packages/core_extension_groups",
"//packages/core_extensions",
"//packages/core_protocols",
"//packages/example_apps",
Expand Down
7 changes: 0 additions & 7 deletions core/include_internal/ten_runtime/common/constant_str.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,3 @@
#define TEN_STR_UNDERLINE_TEN "_ten"

#define TEN_STR_DEFAULT_EXTENSION_GROUP "default_extension_group"

// Because ":" is not a valid character that regular developers can use in an
// extension group name, a special internal extension group addon name uses a
// unique "ten:" prefix. This indicates that it is within the ten scope,
// preventing any potential conflicts with extension group addon names defined
// by developers.
#define TEN_STR_BUILTIN_EXTENSION_GROUP "ten:builtin_extension_group"
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
"type": "extension",
"name": "extension_addon_3",
"version": "0.1.0"
},
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1.0"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
"type": "extension",
"name": "extension_addon_3",
"version": "0.1.0"
},
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1.0"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
"type": "extension",
"name": "extension_addon_2",
"version": "0.1.0"
},
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1.0"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
"type": "extension",
"name": "extension_addon_2",
"version": "0.1.0"
},
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1.0"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
"type": "extension",
"name": "extension_addon_2",
"version": "0.1.0"
},
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1.0"
}
]
}
9 changes: 3 additions & 6 deletions core/src/ten_runtime/extension_context/extension_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,9 @@ static void ten_extension_context_create_extension_group_done(
extension_group->extension_context = extension_context;

if (ten_string_is_equal_c_str(&addon_host->name,
TEN_STR_DEFAULT_EXTENSION_GROUP) ||
ten_string_is_equal_c_str(&addon_host->name,
TEN_STR_BUILTIN_EXTENSION_GROUP)) {
// default_extension_group & ten:builtin_extension_group are 2 special
// group, it needs the 'start_graph' command to fill some important
// information.
TEN_STR_DEFAULT_EXTENSION_GROUP)) {
// default_extension_group is a special group, it needs the 'start_graph'
// command to fill some important information.

TEN_ASSERT(
requester_cmd &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void ten_builtin_extension_group_addon_on_init(TEN_UNUSED ten_addon_t *addon,
// clang-format off
"{\
\"type\": \"extension_group\",\
\"name\": \"ten:builtin_extension_group\",\
\"name\": \"default_extension_group\",\
\"version\": \"1.0.0\"\
}",
// clang-format on
Expand Down Expand Up @@ -213,18 +213,13 @@ static ten_addon_t builtin_extension_group_addon = {
ten_builtin_extension_group_addon_create_instance,
ten_builtin_extension_group_addon_destroy_instance,
NULL,
NULL,
};

// Because the name registered by this `builtin_extension_group` is a special
// name (`ten:builtin_extension_group`), with a `:` in the middle, we can't use
// the convenient macro `TEN_REGISTER_ADDON_AS_EXTENSION_GROUP`. We have to use
// an inner register method instead. However, the meaning is exactly the same.
void ten_builtin_extension_group_addon_register(void) {
ten_addon_register_extension_group(TEN_STR_BUILTIN_EXTENSION_GROUP,
ten_addon_register_extension_group(TEN_STR_DEFAULT_EXTENSION_GROUP,
&builtin_extension_group_addon);
}

void ten_builtin_extension_group_addon_unregister(void) {
ten_addon_unregister_extension_group(TEN_STR_BUILTIN_EXTENSION_GROUP);
ten_addon_unregister_extension_group(TEN_STR_DEFAULT_EXTENSION_GROUP);
}
6 changes: 3 additions & 3 deletions core/src/ten_runtime/msg/cmd_base/cmd/start_graph/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,11 @@ static void ten_raw_cmd_start_graph_add_missing_extension_group_node(
ten_extension_group_info_t *extension_group_info =
ten_extension_group_info_create();

// Create an extension_group item that uses the internal
// builtin_extension_group, allowing the extension's extension_group to be
// Create an extension_group item that uses the builtin
// default_extension_group, allowing the extension's extension_group to be
// associated with an extension_group addon.
ten_string_init_formatted(&extension_group_info->extension_group_addon_name,
TEN_STR_BUILTIN_EXTENSION_GROUP);
TEN_STR_DEFAULT_EXTENSION_GROUP);

ten_loc_set(
&extension_group_info->loc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
"type": "extension",
"name": "addon_2",
"version": "0.1.0"
},
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1.0"
}
]
}

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions packages/core_extension_groups/BUILD.gn

This file was deleted.

44 changes: 0 additions & 44 deletions packages/core_extension_groups/default_extension_group/BUILD.gn

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions packages/core_extension_groups/default_extension_group/LICENSE

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 21729a6

Please sign in to comment.