From 1523d6e99e8d27b1574cb28a960558fbcf6eae51 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Sat, 9 Jul 2022 11:47:30 -0700 Subject: [PATCH] [Tizen] Platform builds for all-clusters and all-clusters-minimal apps (#20480) (#20528) * [Tizen] Platform build for all-clusters-minimal app * Add Tizen all-clusters-minimal app build to build script * [Tizen] Platform build for all-clusters app Co-authored-by: Arkadiusz Bokowy --- .github/workflows/examples-tizen.yaml | 2 +- examples/all-clusters-app/tizen/.gn | 26 +++++ examples/all-clusters-app/tizen/BUILD.gn | 77 +++++++++++++++ examples/all-clusters-app/tizen/args.gni | 25 +++++ .../all-clusters-app/tizen/build_overrides | 1 + .../tizen/include/CHIPProjectAppConfig.h | 31 ++++++ examples/all-clusters-app/tizen/src/main.cpp | 52 ++++++++++ .../tizen/third_party/connectedhomeip | 1 + .../all-clusters-app/tizen/tizen-manifest.xml | 17 ++++ examples/all-clusters-minimal-app/tizen/.gn | 26 +++++ .../all-clusters-minimal-app/tizen/BUILD.gn | 77 +++++++++++++++ .../all-clusters-minimal-app/tizen/args.gni | 25 +++++ .../tizen/build_overrides | 1 + .../tizen/include/CHIPProjectAppConfig.h | 31 ++++++ .../tizen/src/main.cpp | 52 ++++++++++ .../tizen/third_party/connectedhomeip | 1 + .../tizen/tizen-manifest.xml | 17 ++++ examples/lighting-app/tizen/BUILD.gn | 4 - examples/lighting-app/tizen/src/main.cpp | 6 +- .../platform/tizen/TizenServiceAppMain.cpp | 2 - scripts/build/build/targets.py | 2 + scripts/build/builders/tizen.py | 61 ++++++------ .../testdata/all_targets_except_host.txt | 16 ++++ .../build/testdata/build_all_except_host.txt | 96 +++++++++++++++++++ .../glob_star_targets_except_host.txt | 2 + 25 files changed, 612 insertions(+), 39 deletions(-) create mode 100644 examples/all-clusters-app/tizen/.gn create mode 100644 examples/all-clusters-app/tizen/BUILD.gn create mode 100644 examples/all-clusters-app/tizen/args.gni create mode 120000 examples/all-clusters-app/tizen/build_overrides create mode 100644 examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h create mode 100644 examples/all-clusters-app/tizen/src/main.cpp create mode 120000 examples/all-clusters-app/tizen/third_party/connectedhomeip create mode 100644 examples/all-clusters-app/tizen/tizen-manifest.xml create mode 100644 examples/all-clusters-minimal-app/tizen/.gn create mode 100644 examples/all-clusters-minimal-app/tizen/BUILD.gn create mode 100644 examples/all-clusters-minimal-app/tizen/args.gni create mode 120000 examples/all-clusters-minimal-app/tizen/build_overrides create mode 100644 examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h create mode 100644 examples/all-clusters-minimal-app/tizen/src/main.cpp create mode 120000 examples/all-clusters-minimal-app/tizen/third_party/connectedhomeip create mode 100644 examples/all-clusters-minimal-app/tizen/tizen-manifest.xml diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index c238ebb2cf5be0..802ffb0ec45d53 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -49,5 +49,5 @@ jobs: attempt_delay: 2000 - name: Checkout submodules run: scripts/checkout_submodules.py --shallow --platform tizen - - name: Build example Tizen lighting app + - name: Build Tizen examples run: scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target-glob 'tizen-*' build" diff --git a/examples/all-clusters-app/tizen/.gn b/examples/all-clusters-app/tizen/.gn new file mode 100644 index 00000000000000..c50b81609edec2 --- /dev/null +++ b/examples/all-clusters-app/tizen/.gn @@ -0,0 +1,26 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + target_os = "tizen" + import("//args.gni") +} diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn new file mode 100644 index 00000000000000..d860d723befcfe --- /dev/null +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -0,0 +1,77 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("//build_overrides/tizen.gni") + +import("${chip_root}/build/chip/tools.gni") +import("${chip_root}/src/app/common_flags.gni") + +import("${tizen_sdk_build_root}/tizen_sdk.gni") +assert(chip_build_tools) + +source_set("chip-all-clusters-common") { + sources = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", + ] + + deps = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common", + "${chip_root}/src/lib/shell:shell_core", + ] + + include_dirs = + [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] +} + +executable("chip-all-clusters-app") { + sources = [ + "include/CHIPProjectAppConfig.h", + "src/main.cpp", + ] + + deps = [ + ":chip-all-clusters-common", + "${chip_root}/examples/platform/tizen:app-main", + "${chip_root}/src/lib", + ] + + include_dirs = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/zzz_generated/all-clusters-app", + "include", + ] + + output_dir = root_out_dir +} + +tizen_sdk_package("chip-all-clusters-app:tpk") { + deps = [ ":chip-all-clusters-app" ] + manifest = rebase_path("tizen-manifest.xml") + sign_security_profile = "CHIP" +} + +group("tizen") { + deps = [ ":chip-all-clusters-app" ] +} + +group("tizen:tpk") { + deps = [ ":chip-all-clusters-app:tpk" ] +} + +group("default") { + deps = [ ":tizen" ] +} diff --git a/examples/all-clusters-app/tizen/args.gni b/examples/all-clusters-app/tizen/args.gni new file mode 100644 index 00000000000000..41e334d3bd52d8 --- /dev/null +++ b/examples/all-clusters-app/tizen/args.gni @@ -0,0 +1,25 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +chip_device_project_config_include = "" +chip_project_config_include = "" +chip_system_project_config_include = "" + +chip_project_config_include_dirs = + [ "${chip_root}/examples/all-clusters-app/tizen/include" ] +chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] diff --git a/examples/all-clusters-app/tizen/build_overrides b/examples/all-clusters-app/tizen/build_overrides new file mode 120000 index 00000000000000..e578e73312ebd1 --- /dev/null +++ b/examples/all-clusters-app/tizen/build_overrides @@ -0,0 +1 @@ +../../build_overrides \ No newline at end of file diff --git a/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h b/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h new file mode 100644 index 00000000000000..cecc041dc2d34b --- /dev/null +++ b/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h @@ -0,0 +1,31 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// include the CHIPProjectConfig from config/standalone +#include diff --git a/examples/all-clusters-app/tizen/src/main.cpp b/examples/all-clusters-app/tizen/src/main.cpp new file mode 100644 index 00000000000000..89002ef05bc3e0 --- /dev/null +++ b/examples/all-clusters-app/tizen/src/main.cpp @@ -0,0 +1,52 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include + +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; + +// Network commissioning +namespace { +constexpr EndpointId kNetworkCommissioningEndpointMain = 0; +constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; +} // namespace + +void ApplicationInit() +{ + // Enable secondary endpoint only when we need it. + emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); +} + +int main(int argc, char * argv[]) +{ + TizenServiceAppMain app; + VerifyOrDie(app.Init(argc, argv) == 0); + + VerifyOrDie(InitBindingHandlers() == CHIP_NO_ERROR); + + return app.RunMainLoop(); +} diff --git a/examples/all-clusters-app/tizen/third_party/connectedhomeip b/examples/all-clusters-app/tizen/third_party/connectedhomeip new file mode 120000 index 00000000000000..11a54ed360106c --- /dev/null +++ b/examples/all-clusters-app/tizen/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../ \ No newline at end of file diff --git a/examples/all-clusters-app/tizen/tizen-manifest.xml b/examples/all-clusters-app/tizen/tizen-manifest.xml new file mode 100644 index 00000000000000..dfd08655700512 --- /dev/null +++ b/examples/all-clusters-app/tizen/tizen-manifest.xml @@ -0,0 +1,17 @@ + + + + + + + + http://tizen.org/privilege/bluetooth + http://tizen.org/privilege/internet + http://tizen.org/privilege/network.get + + true + true + true + true + true + diff --git a/examples/all-clusters-minimal-app/tizen/.gn b/examples/all-clusters-minimal-app/tizen/.gn new file mode 100644 index 00000000000000..c50b81609edec2 --- /dev/null +++ b/examples/all-clusters-minimal-app/tizen/.gn @@ -0,0 +1,26 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + target_os = "tizen" + import("//args.gni") +} diff --git a/examples/all-clusters-minimal-app/tizen/BUILD.gn b/examples/all-clusters-minimal-app/tizen/BUILD.gn new file mode 100644 index 00000000000000..07b6bf6260943e --- /dev/null +++ b/examples/all-clusters-minimal-app/tizen/BUILD.gn @@ -0,0 +1,77 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("//build_overrides/tizen.gni") + +import("${chip_root}/build/chip/tools.gni") +import("${chip_root}/src/app/common_flags.gni") + +import("${tizen_sdk_build_root}/tizen_sdk.gni") +assert(chip_build_tools) + +source_set("chip-all-clusters-common") { + sources = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", + ] + + deps = [ + "${chip_root}/examples/all-clusters-minimal-app/all-clusters-common", + "${chip_root}/src/lib/shell:shell_core", + ] + + include_dirs = + [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] +} + +executable("chip-all-clusters-minimal-app") { + sources = [ + "include/CHIPProjectAppConfig.h", + "src/main.cpp", + ] + + deps = [ + ":chip-all-clusters-common", + "${chip_root}/examples/platform/tizen:app-main", + "${chip_root}/src/lib", + ] + + include_dirs = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/zzz_generated/all-clusters-minimal-app", + "include", + ] + + output_dir = root_out_dir +} + +tizen_sdk_package("chip-all-clusters-minimal-app:tpk") { + deps = [ ":chip-all-clusters-minimal-app" ] + manifest = rebase_path("tizen-manifest.xml") + sign_security_profile = "CHIP" +} + +group("tizen") { + deps = [ ":chip-all-clusters-minimal-app" ] +} + +group("tizen:tpk") { + deps = [ ":chip-all-clusters-minimal-app:tpk" ] +} + +group("default") { + deps = [ ":tizen" ] +} diff --git a/examples/all-clusters-minimal-app/tizen/args.gni b/examples/all-clusters-minimal-app/tizen/args.gni new file mode 100644 index 00000000000000..bf1ef5219e5d93 --- /dev/null +++ b/examples/all-clusters-minimal-app/tizen/args.gni @@ -0,0 +1,25 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +chip_device_project_config_include = "" +chip_project_config_include = "" +chip_system_project_config_include = "" + +chip_project_config_include_dirs = + [ "${chip_root}/examples/all-clusters-minimal-app/tizen/include" ] +chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] diff --git a/examples/all-clusters-minimal-app/tizen/build_overrides b/examples/all-clusters-minimal-app/tizen/build_overrides new file mode 120000 index 00000000000000..e578e73312ebd1 --- /dev/null +++ b/examples/all-clusters-minimal-app/tizen/build_overrides @@ -0,0 +1 @@ +../../build_overrides \ No newline at end of file diff --git a/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h b/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h new file mode 100644 index 00000000000000..cecc041dc2d34b --- /dev/null +++ b/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h @@ -0,0 +1,31 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// include the CHIPProjectConfig from config/standalone +#include diff --git a/examples/all-clusters-minimal-app/tizen/src/main.cpp b/examples/all-clusters-minimal-app/tizen/src/main.cpp new file mode 100644 index 00000000000000..89002ef05bc3e0 --- /dev/null +++ b/examples/all-clusters-minimal-app/tizen/src/main.cpp @@ -0,0 +1,52 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include + +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; + +// Network commissioning +namespace { +constexpr EndpointId kNetworkCommissioningEndpointMain = 0; +constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; +} // namespace + +void ApplicationInit() +{ + // Enable secondary endpoint only when we need it. + emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); +} + +int main(int argc, char * argv[]) +{ + TizenServiceAppMain app; + VerifyOrDie(app.Init(argc, argv) == 0); + + VerifyOrDie(InitBindingHandlers() == CHIP_NO_ERROR); + + return app.RunMainLoop(); +} diff --git a/examples/all-clusters-minimal-app/tizen/third_party/connectedhomeip b/examples/all-clusters-minimal-app/tizen/third_party/connectedhomeip new file mode 120000 index 00000000000000..11a54ed360106c --- /dev/null +++ b/examples/all-clusters-minimal-app/tizen/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../ \ No newline at end of file diff --git a/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml b/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml new file mode 100644 index 00000000000000..ca1b4edc263bdc --- /dev/null +++ b/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml @@ -0,0 +1,17 @@ + + + + + + + + http://tizen.org/privilege/bluetooth + http://tizen.org/privilege/internet + http://tizen.org/privilege/network.get + + true + true + true + true + true + diff --git a/examples/lighting-app/tizen/BUILD.gn b/examples/lighting-app/tizen/BUILD.gn index b45574db92b349..dac62cb04f346a 100644 --- a/examples/lighting-app/tizen/BUILD.gn +++ b/examples/lighting-app/tizen/BUILD.gn @@ -21,10 +21,6 @@ import("${tizen_sdk_build_root}/tizen_sdk.gni") assert(chip_build_tools) -config("includes") { - include_dirs = [ "include" ] -} - executable("chip-lighting-app") { sources = [ "include/CHIPProjectAppConfig.h", diff --git a/examples/lighting-app/tizen/src/main.cpp b/examples/lighting-app/tizen/src/main.cpp index fde7338d5582f0..5c9ba03b675bd1 100644 --- a/examples/lighting-app/tizen/src/main.cpp +++ b/examples/lighting-app/tizen/src/main.cpp @@ -36,12 +36,14 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & } } +void ApplicationInit() {} + int main(int argc, char * argv[]) { TizenServiceAppMain app; - app.Init(argc, argv); + VerifyOrDie(app.Init(argc, argv) == 0); - LightingMgr().Init(); + VerifyOrDie(LightingMgr().Init() == CHIP_NO_ERROR); return app.RunMainLoop(); } diff --git a/examples/platform/tizen/TizenServiceAppMain.cpp b/examples/platform/tizen/TizenServiceAppMain.cpp index 06f90928b99c9a..b174abcfd78e2a 100644 --- a/examples/platform/tizen/TizenServiceAppMain.cpp +++ b/examples/platform/tizen/TizenServiceAppMain.cpp @@ -45,8 +45,6 @@ void service_app_control(app_control_h app_control, void * data) } }; // namespace -void ApplicationInit() {} - int TizenServiceAppMain::Init(int argc, char ** argv) { mArgc = argc; diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index fe6ab538adb67c..28a3ab3bb04f1c 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -557,6 +557,8 @@ def TizenTargets(): target = Target('tizen-arm', TizenBuilder, board=TizenBoard.ARM) + builder.targets.append(target.Extend('all-clusters', app=TizenApp.ALL_CLUSTERS)) + builder.targets.append(target.Extend('all-clusters-minimal', app=TizenApp.ALL_CLUSTERS_MINIMAL)) builder.targets.append(target.Extend('chip-tool', app=TizenApp.CHIP_TOOL)) builder.targets.append(target.Extend('light', app=TizenApp.LIGHT)) diff --git a/scripts/build/builders/tizen.py b/scripts/build/builders/tizen.py index 5c8ca690ae4caf..b256018d48accc 100644 --- a/scripts/build/builders/tizen.py +++ b/scripts/build/builders/tizen.py @@ -14,30 +14,38 @@ import logging import os -from enum import Enum, auto +from collections import namedtuple +from enum import Enum from xml.etree import ElementTree as ET from .gn import GnBuilder +App = namedtuple('App', ['name', 'source', 'outputs']) +Board = namedtuple('Board', ['target_cpu']) -class TizenApp(Enum): - - CHIP_TOOL = auto() - LIGHT = auto() - def ExamplePath(self): - if self == TizenApp.CHIP_TOOL: - return 'chip-tool' - elif self == TizenApp.LIGHT: - return 'lighting-app/tizen' - else: - raise Exception('Unknown app type: %r' % self) +class TizenApp(Enum): - def AppName(self): - if self == TizenApp.LIGHT: - return 'chip-lighting-app' - else: - raise Exception('Unknown app type: %r' % self) + ALL_CLUSTERS = App( + 'chip-all-clusters-app', + 'examples/all-clusters-app/tizen', + ('chip-all-clusters-app', + 'chip-all-clusters-app.map')) + ALL_CLUSTERS_MINIMAL = App( + 'chip-all-clusters-minimal-app', + 'examples/all-clusters-minimal-app/tizen', + ('chip-all-clusters-minimal-app', + 'chip-all-clusters-minimal-app.map')) + CHIP_TOOL = App( + 'chip-tool', + 'examples/chip-tool', + ('chip-tool', + 'chip-tool.map')) + LIGHT = App( + 'chip-lighting-app', + 'examples/lighting-app/tizen', + ('chip-lighting-app', + 'chip-lighting-app.map')) def PackageName(self): return self.manifest.get('package') @@ -50,13 +58,8 @@ def parse_manifest(self, manifest: str): class TizenBoard(Enum): - ARM = auto() - def TargetCpuName(self): - if self == TizenBoard.ARM: - return 'arm' - else: - raise Exception('Unknown board type: %r' % self) + ARM = Board('arm') class TizenBuilder(GnBuilder): @@ -72,7 +75,7 @@ def __init__(self, use_tsan: bool = False, ): super(TizenBuilder, self).__init__( - root=os.path.join(root, 'examples', app.ExamplePath()), + root=os.path.join(root, app.value.source), runner=runner) self.app = app @@ -107,22 +110,20 @@ def GnBuildArgs(self): return self.extra_gn_options + [ 'target_os="tizen"', - 'target_cpu="%s"' % self.board.TargetCpuName(), + 'target_cpu="%s"' % self.board.value.target_cpu, 'tizen_sdk_root="%s"' % os.environ['TIZEN_SDK_ROOT'], 'tizen_sdk_sysroot="%s"' % os.environ['TIZEN_SDK_SYSROOT'], ] def _generate_flashbundle(self): logging.info('Packaging %s', self.output_dir) - cmd = ['ninja', '-C', self.output_dir, self.app.AppName() + ':tpk'] + cmd = ['ninja', '-C', self.output_dir, self.app.value.name + ':tpk'] self._Execute(cmd, title='Packaging ' + self.identifier) def build_outputs(self): return { - '%s' % self.app.AppName(): - os.path.join(self.output_dir, self.app.AppName()), - '%s.map' % self.app.AppName(): - os.path.join(self.output_dir, '%s.map' % self.app.AppName()), + output: os.path.join(self.output_dir, output) + for output in self.app.value.outputs } def flashbundle(self): diff --git a/scripts/build/testdata/all_targets_except_host.txt b/scripts/build/testdata/all_targets_except_host.txt index 082430b019ac39..31b5c69437dfbc 100644 --- a/scripts/build/testdata/all_targets_except_host.txt +++ b/scripts/build/testdata/all_targets_except_host.txt @@ -231,6 +231,22 @@ qpg-persistent-storage qpg-shell telink-tlsr9518adk80d-light telink-tlsr9518adk80d-light-switch +tizen-arm-all-clusters +tizen-arm-all-clusters-asan (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-minimal +tizen-arm-all-clusters-minimal-asan (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-minimal-no-ble (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-minimal-no-ble-asan (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-minimal-no-ble-no-wifi (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-minimal-no-ble-no-wifi-asan (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-minimal-no-wifi (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-minimal-no-wifi-asan (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-no-ble (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-no-ble-asan (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-no-ble-no-wifi (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-no-ble-no-wifi-asan (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-no-wifi (NOGLOB: Reduce default build variants) +tizen-arm-all-clusters-no-wifi-asan (NOGLOB: Reduce default build variants) tizen-arm-chip-tool tizen-arm-chip-tool-asan (NOGLOB: Reduce default build variants) tizen-arm-chip-tool-no-ble (NOGLOB: Reduce default build variants) diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index 321dd96d45721a..0cd4131a107229 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -1114,6 +1114,54 @@ export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {out}/telink-tlsr9518adk80d-light-switch -b tlsr9518adk80d {root}/examples/light-switch-app/telink' +# Generating tizen-arm-all-clusters +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/tizen '--args=target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters + +# Generating tizen-arm-all-clusters-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/tizen '--args=is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-asan + +# Generating tizen-arm-all-clusters-minimal +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-minimal-app/tizen '--args=target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-minimal + +# Generating tizen-arm-all-clusters-minimal-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-minimal-app/tizen '--args=is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-minimal-asan + +# Generating tizen-arm-all-clusters-minimal-no-ble +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-minimal-app/tizen '--args=chip_config_network_layer_ble=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-minimal-no-ble + +# Generating tizen-arm-all-clusters-minimal-no-ble-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-minimal-app/tizen '--args=chip_config_network_layer_ble=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-minimal-no-ble-asan + +# Generating tizen-arm-all-clusters-minimal-no-ble-no-wifi +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-minimal-app/tizen '--args=chip_config_network_layer_ble=false chip_enable_wifi=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-minimal-no-ble-no-wifi + +# Generating tizen-arm-all-clusters-minimal-no-ble-no-wifi-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-minimal-app/tizen '--args=chip_config_network_layer_ble=false chip_enable_wifi=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-minimal-no-ble-no-wifi-asan + +# Generating tizen-arm-all-clusters-minimal-no-wifi +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-minimal-app/tizen '--args=chip_enable_wifi=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-minimal-no-wifi + +# Generating tizen-arm-all-clusters-minimal-no-wifi-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-minimal-app/tizen '--args=chip_enable_wifi=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-minimal-no-wifi-asan + +# Generating tizen-arm-all-clusters-no-ble +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/tizen '--args=chip_config_network_layer_ble=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-no-ble + +# Generating tizen-arm-all-clusters-no-ble-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/tizen '--args=chip_config_network_layer_ble=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-no-ble-asan + +# Generating tizen-arm-all-clusters-no-ble-no-wifi +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/tizen '--args=chip_config_network_layer_ble=false chip_enable_wifi=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-no-ble-no-wifi + +# Generating tizen-arm-all-clusters-no-ble-no-wifi-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/tizen '--args=chip_config_network_layer_ble=false chip_enable_wifi=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-no-ble-no-wifi-asan + +# Generating tizen-arm-all-clusters-no-wifi +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/tizen '--args=chip_enable_wifi=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-no-wifi + +# Generating tizen-arm-all-clusters-no-wifi-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/tizen '--args=chip_enable_wifi=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-all-clusters-no-wifi-asan + # Generating tizen-arm-chip-tool gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/chip-tool '--args=target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" tizen_sdk_sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-chip-tool @@ -2232,6 +2280,54 @@ ninja -C {out}/telink-tlsr9518adk80d-light # Building telink-tlsr9518adk80d-light-switch ninja -C {out}/telink-tlsr9518adk80d-light-switch +# Building tizen-arm-all-clusters +ninja -C {out}/tizen-arm-all-clusters + +# Building tizen-arm-all-clusters-asan +ninja -C {out}/tizen-arm-all-clusters-asan + +# Building tizen-arm-all-clusters-minimal +ninja -C {out}/tizen-arm-all-clusters-minimal + +# Building tizen-arm-all-clusters-minimal-asan +ninja -C {out}/tizen-arm-all-clusters-minimal-asan + +# Building tizen-arm-all-clusters-minimal-no-ble +ninja -C {out}/tizen-arm-all-clusters-minimal-no-ble + +# Building tizen-arm-all-clusters-minimal-no-ble-asan +ninja -C {out}/tizen-arm-all-clusters-minimal-no-ble-asan + +# Building tizen-arm-all-clusters-minimal-no-ble-no-wifi +ninja -C {out}/tizen-arm-all-clusters-minimal-no-ble-no-wifi + +# Building tizen-arm-all-clusters-minimal-no-ble-no-wifi-asan +ninja -C {out}/tizen-arm-all-clusters-minimal-no-ble-no-wifi-asan + +# Building tizen-arm-all-clusters-minimal-no-wifi +ninja -C {out}/tizen-arm-all-clusters-minimal-no-wifi + +# Building tizen-arm-all-clusters-minimal-no-wifi-asan +ninja -C {out}/tizen-arm-all-clusters-minimal-no-wifi-asan + +# Building tizen-arm-all-clusters-no-ble +ninja -C {out}/tizen-arm-all-clusters-no-ble + +# Building tizen-arm-all-clusters-no-ble-asan +ninja -C {out}/tizen-arm-all-clusters-no-ble-asan + +# Building tizen-arm-all-clusters-no-ble-no-wifi +ninja -C {out}/tizen-arm-all-clusters-no-ble-no-wifi + +# Building tizen-arm-all-clusters-no-ble-no-wifi-asan +ninja -C {out}/tizen-arm-all-clusters-no-ble-no-wifi-asan + +# Building tizen-arm-all-clusters-no-wifi +ninja -C {out}/tizen-arm-all-clusters-no-wifi + +# Building tizen-arm-all-clusters-no-wifi-asan +ninja -C {out}/tizen-arm-all-clusters-no-wifi-asan + # Building tizen-arm-chip-tool ninja -C {out}/tizen-arm-chip-tool diff --git a/scripts/build/testdata/glob_star_targets_except_host.txt b/scripts/build/testdata/glob_star_targets_except_host.txt index e8bcb0bf1568d2..ea1d511153e29d 100644 --- a/scripts/build/testdata/glob_star_targets_except_host.txt +++ b/scripts/build/testdata/glob_star_targets_except_host.txt @@ -109,5 +109,7 @@ qpg-persistent-storage qpg-shell telink-tlsr9518adk80d-light telink-tlsr9518adk80d-light-switch +tizen-arm-all-clusters +tizen-arm-all-clusters-minimal tizen-arm-chip-tool tizen-arm-light