diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 3c588beab98ed8..6fe6fae55595d5 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -11,34 +11,63 @@ # 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 os from itertools import combinations from typing import List -from builders.ameba import AmebaApp, AmebaBoard, AmebaBuilder -from builders.android import AndroidApp, AndroidBoard, AndroidBuilder -from builders.cc13x2x7_26x2x7 import cc13x2x7_26x2x7App, cc13x2x7_26x2x7Builder -from builders.cyw30739 import Cyw30739App, Cyw30739Board, Cyw30739Builder -from builders.efr32 import Efr32App, Efr32Board, Efr32Builder -from builders.esp32 import Esp32App, Esp32Board, Esp32Builder -from builders.host import HostApp, HostBoard, HostBuilder -from builders.infineon import InfineonApp, InfineonBoard, InfineonBuilder -from builders.k32w import K32WApp, K32WBuilder -from builders.mbed import MbedApp, MbedBoard, MbedBuilder, MbedProfile -from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder -from builders.qpg import QpgApp, QpgBoard, QpgBuilder -from builders.telink import TelinkApp, TelinkBoard, TelinkBuilder -from builders.tizen import TizenApp, TizenBoard, TizenBuilder -from builders.bl602 import Bl602App, Bl602Board, Bl602Builder -from builders.imx import IMXApp, IMXBuilder +from builders.ameba import AmebaApp +from builders.ameba import AmebaBoard +from builders.ameba import AmebaBuilder +from builders.android import AndroidApp +from builders.android import AndroidBoard +from builders.android import AndroidBuilder +from builders.bl602 import Bl602App +from builders.bl602 import Bl602Board +from builders.bl602 import Bl602Builder +from builders.cc13x2x7_26x2x7 import cc13x2x7_26x2x7App +from builders.cc13x2x7_26x2x7 import cc13x2x7_26x2x7Builder +from builders.cyw30739 import Cyw30739App +from builders.cyw30739 import Cyw30739Board +from builders.cyw30739 import Cyw30739Builder +from builders.efr32 import Efr32App +from builders.efr32 import Efr32Board +from builders.efr32 import Efr32Builder +from builders.esp32 import Esp32App +from builders.esp32 import Esp32Board +from builders.esp32 import Esp32Builder +from builders.host import HostApp +from builders.host import HostBoard +from builders.host import HostBuilder +from builders.imx import IMXApp +from builders.imx import IMXBuilder +from builders.infineon import InfineonApp +from builders.infineon import InfineonBoard +from builders.infineon import InfineonBuilder +from builders.k32w import K32WApp +from builders.k32w import K32WBuilder +from builders.mbed import MbedApp +from builders.mbed import MbedBoard +from builders.mbed import MbedBuilder +from builders.mbed import MbedProfile +from builders.nrf import NrfApp +from builders.nrf import NrfBoard +from builders.nrf import NrfConnectBuilder +from builders.qpg import QpgApp +from builders.qpg import QpgBoard +from builders.qpg import QpgBuilder +from builders.telink import TelinkApp +from builders.telink import TelinkBoard +from builders.telink import TelinkBuilder +from builders.tizen import TizenApp +from builders.tizen import TizenBoard +from builders.tizen import TizenBuilder class Target: """Represents a build target: - Has a name identifier plus parameters on how to build it (what - builder class to use and what arguments are required to produce - the specified build) + Has a name identifier plus parameters on how to build it (what + builder class to use and what arguments are required to produce + the specified build) """ def __init__(self, name, builder_class, **kwargs): @@ -70,8 +99,9 @@ def Extend(self, suffix, **kargs): def Create(self, runner, repository_path: str, output_prefix: str, enable_flashbundle: bool): - builder = self.builder_class( - repository_path, runner=runner, **self.create_kw_args) + builder = self.builder_class(repository_path, + runner=runner, + **self.create_kw_args) builder.target = self builder.identifier = self.name @@ -100,11 +130,13 @@ def GlobBlacklistReason(self): class AcceptAnyName: + def Accept(self, name: str): return True class AcceptNameWithSubstrings: + def __init__(self, substr: List[str]): self.substr = substr @@ -116,8 +148,12 @@ def Accept(self, name: str): class BuildVariant: - def __init__(self, name: str, validator=AcceptAnyName(), - conflicts: List[str] = [], requires: List[str] = [], + + def __init__(self, + name: str, + validator=AcceptAnyName(), + conflicts: List[str] = [], + requires: List[str] = [], **buildargs): self.name = name self.validator = validator @@ -148,8 +184,7 @@ def AllRequirementsMet(items: List[BuildVariant]) -> bool: class VariantBuilder: - """Handles creating multiple build variants based on a starting target. - """ + """Handles creating multiple build variants based on a starting target.""" def __init__(self, targets: List[Target] = []): # note the clone in case the default arg is used @@ -189,7 +224,8 @@ def AllVariants(self): # skip variants that do not work for this target ok_variants = [ - v for v in self.variants if v.validator.Accept(target.name)] + v for v in self.variants if v.validator.Accept(target.name) + ] # Build every possible variant for variant_count in range(1, len(ok_variants) + 1): @@ -207,344 +243,577 @@ def AllVariants(self): option.name, **option.buildargs) # Only a few are whitelisted for globs - name = '-'.join([o.name for o in subgroup]) + name = "-".join([o.name for o in subgroup]) if name not in self.glob_whitelist: if not variant_target.IsGlobBlacklisted: variant_target = variant_target.GlobBlacklist( - 'Reduce default build variants') + "Reduce default build variants") yield variant_target def HostTargets(): target = Target(HostBoard.NATIVE.PlatformName(), HostBuilder) - target_native = target.Extend(HostBoard.NATIVE.BoardName(), board=HostBoard.NATIVE) + target_native = target.Extend(HostBoard.NATIVE.BoardName(), + board=HostBoard.NATIVE) targets = [target_native] # x64 linux supports cross compile - cross_compile = (HostBoard.NATIVE.PlatformName() == 'linux') and (HostBoard.NATIVE.BoardName() != HostBoard.ARM64.BoardName()) + cross_compile = (HostBoard.NATIVE.PlatformName() == "linux") and ( + HostBoard.NATIVE.BoardName() != HostBoard.ARM64.BoardName()) if cross_compile: - targets.append(target.Extend('arm64', board=HostBoard.ARM64)) + targets.append(target.Extend("arm64", board=HostBoard.ARM64)) app_targets = [] # Don't cross compile some builds app_targets.append( - target_native.Extend('rpc-console', app=HostApp.RPC_CONSOLE)) + target_native.Extend("rpc-console", app=HostApp.RPC_CONSOLE)) app_targets.append( - target_native.Extend('nl-test-runner', app=HostApp.NL_TEST_RUNNER)) + target_native.Extend("nl-test-runner", app=HostApp.NL_TEST_RUNNER)) for target in targets: - app_targets.append(target.Extend( - 'all-clusters', app=HostApp.ALL_CLUSTERS)) - app_targets.append(target.Extend( - 'all-clusters-minimal', app=HostApp.ALL_CLUSTERS_MINIMAL)) - if (HostBoard.NATIVE.PlatformName() == 'darwin'): - app_targets.append(target.Extend( - 'darwin-framework-tool', app=HostApp.CHIP_TOOL_DARWIN)) - app_targets.append(target.Extend('chip-tool', app=HostApp.CHIP_TOOL)) - app_targets.append(target.Extend('thermostat', app=HostApp.THERMOSTAT)) - app_targets.append(target.Extend('minmdns', app=HostApp.MIN_MDNS)) - app_targets.append(target.Extend('light', app=HostApp.LIGHT)) - app_targets.append(target.Extend('light-rpc', app=HostApp.LIGHT, enable_rpcs=True)) - app_targets.append(target.Extend('lock', app=HostApp.LOCK)) - app_targets.append(target.Extend('shell', app=HostApp.SHELL)) - app_targets.append(target.Extend( - 'ota-provider', app=HostApp.OTA_PROVIDER, enable_ble=False)) - app_targets.append(target.Extend( - 'ota-requestor', app=HostApp.OTA_REQUESTOR, enable_ble=False)) - app_targets.append(target.Extend('python-bindings', app=HostApp.PYTHON_BINDINGS)) - app_targets.append(target.Extend('tv-app', app=HostApp.TV_APP)) - app_targets.append(target.Extend('tv-casting-app', app=HostApp.TV_CASTING)) - app_targets.append(target.Extend('bridge', app=HostApp.BRIDGE)) + app_targets.append( + target.Extend("all-clusters", app=HostApp.ALL_CLUSTERS)) + app_targets.append( + target.Extend("all-clusters-minimal", + app=HostApp.ALL_CLUSTERS_MINIMAL)) + if HostBoard.NATIVE.PlatformName() == "darwin": + app_targets.append( + target.Extend("darwin-framework-tool", + app=HostApp.CHIP_TOOL_DARWIN)) + app_targets.append(target.Extend("chip-tool", app=HostApp.CHIP_TOOL)) + app_targets.append(target.Extend("thermostat", app=HostApp.THERMOSTAT)) + app_targets.append(target.Extend("minmdns", app=HostApp.MIN_MDNS)) + app_targets.append(target.Extend("light", app=HostApp.LIGHT)) + app_targets.append( + target.Extend("light-rpc", app=HostApp.LIGHT, enable_rpcs=True)) + app_targets.append(target.Extend("lock", app=HostApp.LOCK)) + app_targets.append(target.Extend("shell", app=HostApp.SHELL)) + app_targets.append( + target.Extend("ota-provider", + app=HostApp.OTA_PROVIDER, + enable_ble=False)) + app_targets.append( + target.Extend("ota-requestor", + app=HostApp.OTA_REQUESTOR, + enable_ble=False)) + app_targets.append( + target.Extend("python-bindings", app=HostApp.PYTHON_BINDINGS)) + app_targets.append(target.Extend("tv-app", app=HostApp.TV_APP)) + app_targets.append( + target.Extend("tv-casting-app", app=HostApp.TV_CASTING)) + app_targets.append(target.Extend("bridge", app=HostApp.BRIDGE)) builder = VariantBuilder() # Possible build variants. Note that number of potential # builds is exponential here - builder.AppendVariant(name="same-event-loop", validator=AcceptNameWithSubstrings( - ['-chip-tool', '-darwin-framework-tool']), separate_event_loop=False), - builder.AppendVariant(name="no-interactive", validator=AcceptNameWithSubstrings( - ['-chip-tool']), interactive_mode=False), + builder.AppendVariant( + name="same-event-loop", + validator=AcceptNameWithSubstrings( + ["-chip-tool", "-darwin-framework-tool"]), + separate_event_loop=False, + ), + builder.AppendVariant( + name="no-interactive", + validator=AcceptNameWithSubstrings(["-chip-tool"]), + interactive_mode=False, + ), builder.AppendVariant(name="ipv6only", enable_ipv4=False), builder.AppendVariant(name="no-ble", enable_ble=False), builder.AppendVariant(name="no-wifi", enable_wifi=False), - builder.AppendVariant(name="tsan", conflicts=['asan'], use_tsan=True), - builder.AppendVariant(name="asan", conflicts=['tsan'], use_asan=True), - builder.AppendVariant(name="libfuzzer", requires=[ - "clang"], use_libfuzzer=True), + builder.AppendVariant(name="tsan", conflicts=["asan"], use_tsan=True), + builder.AppendVariant(name="asan", conflicts=["tsan"], use_asan=True), + builder.AppendVariant(name="libfuzzer", + requires=["clang"], + use_libfuzzer=True), builder.AppendVariant(name="clang", use_clang=True), builder.AppendVariant(name="test", extra_tests=True), - builder.WhitelistVariantNameForGlob('no-interactive-ipv6only') - builder.WhitelistVariantNameForGlob('ipv6only') + builder.WhitelistVariantNameForGlob("no-interactive-ipv6only") + builder.WhitelistVariantNameForGlob("ipv6only") for target in app_targets: - if ('-rpc-console' in target.name) or ('-python-bindings' in target.name) or ('nl-test-runner' in target.name): + if (("-rpc-console" in target.name) + or ("-python-bindings" in target.name) + or ("nl-test-runner" in target.name)): # Single-variant builds yield target else: builder.targets.append(target) for target in builder.AllVariants(): - if cross_compile and 'chip-tool' in target.name and 'arm64' in target.name and '-no-interactive' not in target.name: + if (cross_compile and "chip-tool" in target.name + and "arm64" in target.name + and "-no-interactive" not in target.name): # Interactive builds will not compile by default on arm cross compiles # because libreadline is not part of the default sysroot - yield target.GlobBlacklist('Arm crosscompile does not support libreadline-dev') + yield target.GlobBlacklist( + "Arm crosscompile does not support libreadline-dev") else: yield target # Without extra build variants - yield target_native.Extend('chip-cert', app=HostApp.CERT_TOOL) - yield target_native.Extend('address-resolve-tool', app=HostApp.ADDRESS_RESOLVE) - yield target_native.Extend('address-resolve-tool-clang', app=HostApp.ADDRESS_RESOLVE, - use_clang=True).GlobBlacklist("Reduce default build variants") - yield target_native.Extend('address-resolve-tool-platform-mdns', app=HostApp.ADDRESS_RESOLVE, - use_platform_mdns=True).GlobBlacklist("Reduce default build variants") - yield target_native.Extend('address-resolve-tool-platform-mdns-ipv6only', app=HostApp.ADDRESS_RESOLVE, - use_platform_mdns=True, enable_ipv4=False).GlobBlacklist("Reduce default build variants") + yield target_native.Extend("chip-cert", app=HostApp.CERT_TOOL) + yield target_native.Extend("address-resolve-tool", + app=HostApp.ADDRESS_RESOLVE) + yield target_native.Extend( + "address-resolve-tool-clang", + app=HostApp.ADDRESS_RESOLVE, + use_clang=True).GlobBlacklist("Reduce default build variants") + yield target_native.Extend( + "address-resolve-tool-platform-mdns", + app=HostApp.ADDRESS_RESOLVE, + use_platform_mdns=True, + ).GlobBlacklist("Reduce default build variants") + yield target_native.Extend( + "address-resolve-tool-platform-mdns-ipv6only", + app=HostApp.ADDRESS_RESOLVE, + use_platform_mdns=True, + enable_ipv4=False, + ).GlobBlacklist("Reduce default build variants") test_target = Target(HostBoard.NATIVE.PlatformName(), HostBuilder) - yield test_target.Extend(HostBoard.NATIVE.BoardName() + '-tests', board=HostBoard.NATIVE, app=HostApp.TESTS) - yield test_target.Extend(HostBoard.NATIVE.BoardName() + '-tests-clang', board=HostBoard.NATIVE, app=HostApp.TESTS, use_clang=True) - yield test_target.Extend(HostBoard.FAKE.BoardName() + '-tests', board=HostBoard.FAKE, app=HostApp.TESTS) + yield test_target.Extend( + HostBoard.NATIVE.BoardName() + "-tests", + board=HostBoard.NATIVE, + app=HostApp.TESTS, + ) + yield test_target.Extend( + HostBoard.NATIVE.BoardName() + "-tests-clang", + board=HostBoard.NATIVE, + app=HostApp.TESTS, + use_clang=True, + ) + yield test_target.Extend(HostBoard.FAKE.BoardName() + "-tests", + board=HostBoard.FAKE, + app=HostApp.TESTS) def Esp32Targets(): - esp32_target = Target('esp32', Esp32Builder) - - yield esp32_target.Extend('m5stack-all-clusters', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS) - yield esp32_target.Extend('m5stack-all-clusters-ipv6only', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS, - enable_ipv4=False) - yield esp32_target.Extend('m5stack-all-clusters-rpc', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS, - enable_rpcs=True) - yield esp32_target.Extend('m5stack-all-clusters-rpc-ipv6only', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS, - enable_rpcs=True, enable_ipv4=False) - - yield esp32_target.Extend('m5stack-ota-requestor', board=Esp32Board.M5Stack, app=Esp32App.OTA_REQUESTOR) - yield esp32_target.Extend('m5stack-ota-requestor-rpc', board=Esp32Board.M5Stack, app=Esp32App.OTA_REQUESTOR, - enable_rpcs=True) - - yield esp32_target.Extend('c3devkit-all-clusters', board=Esp32Board.C3DevKit, app=Esp32App.ALL_CLUSTERS) - - yield esp32_target.Extend('m5stack-all-clusters-minimal', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS_MINIMAL) - yield esp32_target.Extend('m5stack-all-clusters-minimal-ipv6only', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS_MINIMAL, - enable_ipv4=False) - yield esp32_target.Extend('m5stack-all-clusters-minimal-rpc', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS_MINIMAL, - enable_rpcs=True) - yield esp32_target.Extend('m5stack-all-clusters-minimal-rpc-ipv6only', board=Esp32Board.M5Stack, app=Esp32App.ALL_CLUSTERS_MINIMAL, - enable_rpcs=True, enable_ipv4=False) - - yield esp32_target.Extend('c3devkit-all-clusters-minimal', board=Esp32Board.C3DevKit, app=Esp32App.ALL_CLUSTERS_MINIMAL) - - devkitc = esp32_target.Extend('devkitc', board=Esp32Board.DevKitC) - - yield devkitc.Extend('all-clusters', app=Esp32App.ALL_CLUSTERS) - yield devkitc.Extend('all-clusters-ipv6only', app=Esp32App.ALL_CLUSTERS, enable_ipv4=False) - yield devkitc.Extend('all-clusters-minimal', app=Esp32App.ALL_CLUSTERS_MINIMAL) - yield devkitc.Extend('all-clusters-minimal-ipv6only', app=Esp32App.ALL_CLUSTERS_MINIMAL, enable_ipv4=False) - yield devkitc.Extend('shell', app=Esp32App.SHELL) - yield devkitc.Extend('light', app=Esp32App.LIGHT) - yield devkitc.Extend('lock', app=Esp32App.LOCK) - yield devkitc.Extend('bridge', app=Esp32App.BRIDGE) - yield devkitc.Extend('temperature-measurement', app=Esp32App.TEMPERATURE_MEASUREMENT) - yield devkitc.Extend('temperature-measurement-rpc', app=Esp32App.TEMPERATURE_MEASUREMENT, enable_rpcs=True) - yield devkitc.Extend('ota-requestor', app=Esp32App.OTA_REQUESTOR) - yield devkitc.Extend('ota-requestor-rpc', app=Esp32App.OTA_REQUESTOR, enable_rpcs=True) - - yield esp32_target.Extend('qemu-tests', board=Esp32Board.QEMU, app=Esp32App.TESTS) + esp32_target = Target("esp32", Esp32Builder) + + yield esp32_target.Extend("m5stack-all-clusters", + board=Esp32Board.M5Stack, + app=Esp32App.ALL_CLUSTERS) + yield esp32_target.Extend( + "m5stack-all-clusters-ipv6only", + board=Esp32Board.M5Stack, + app=Esp32App.ALL_CLUSTERS, + enable_ipv4=False, + ) + yield esp32_target.Extend( + "m5stack-all-clusters-rpc", + board=Esp32Board.M5Stack, + app=Esp32App.ALL_CLUSTERS, + enable_rpcs=True, + ) + yield esp32_target.Extend( + "m5stack-all-clusters-rpc-ipv6only", + board=Esp32Board.M5Stack, + app=Esp32App.ALL_CLUSTERS, + enable_rpcs=True, + enable_ipv4=False, + ) + + yield esp32_target.Extend("m5stack-ota-requestor", + board=Esp32Board.M5Stack, + app=Esp32App.OTA_REQUESTOR) + yield esp32_target.Extend( + "m5stack-ota-requestor-rpc", + board=Esp32Board.M5Stack, + app=Esp32App.OTA_REQUESTOR, + enable_rpcs=True, + ) + + yield esp32_target.Extend("c3devkit-all-clusters", + board=Esp32Board.C3DevKit, + app=Esp32App.ALL_CLUSTERS) + + yield esp32_target.Extend( + "m5stack-all-clusters-minimal", + board=Esp32Board.M5Stack, + app=Esp32App.ALL_CLUSTERS_MINIMAL, + ) + yield esp32_target.Extend( + "m5stack-all-clusters-minimal-ipv6only", + board=Esp32Board.M5Stack, + app=Esp32App.ALL_CLUSTERS_MINIMAL, + enable_ipv4=False, + ) + yield esp32_target.Extend( + "m5stack-all-clusters-minimal-rpc", + board=Esp32Board.M5Stack, + app=Esp32App.ALL_CLUSTERS_MINIMAL, + enable_rpcs=True, + ) + yield esp32_target.Extend( + "m5stack-all-clusters-minimal-rpc-ipv6only", + board=Esp32Board.M5Stack, + app=Esp32App.ALL_CLUSTERS_MINIMAL, + enable_rpcs=True, + enable_ipv4=False, + ) + + yield esp32_target.Extend( + "c3devkit-all-clusters-minimal", + board=Esp32Board.C3DevKit, + app=Esp32App.ALL_CLUSTERS_MINIMAL, + ) + + devkitc = esp32_target.Extend("devkitc", board=Esp32Board.DevKitC) + + yield devkitc.Extend("all-clusters", app=Esp32App.ALL_CLUSTERS) + yield devkitc.Extend("all-clusters-ipv6only", + app=Esp32App.ALL_CLUSTERS, + enable_ipv4=False) + yield devkitc.Extend("all-clusters-minimal", + app=Esp32App.ALL_CLUSTERS_MINIMAL) + yield devkitc.Extend( + "all-clusters-minimal-ipv6only", + app=Esp32App.ALL_CLUSTERS_MINIMAL, + enable_ipv4=False, + ) + yield devkitc.Extend("shell", app=Esp32App.SHELL) + yield devkitc.Extend("light", app=Esp32App.LIGHT) + yield devkitc.Extend("lock", app=Esp32App.LOCK) + yield devkitc.Extend("bridge", app=Esp32App.BRIDGE) + yield devkitc.Extend("temperature-measurement", + app=Esp32App.TEMPERATURE_MEASUREMENT) + yield devkitc.Extend( + "temperature-measurement-rpc", + app=Esp32App.TEMPERATURE_MEASUREMENT, + enable_rpcs=True, + ) + yield devkitc.Extend("ota-requestor", app=Esp32App.OTA_REQUESTOR) + yield devkitc.Extend("ota-requestor-rpc", + app=Esp32App.OTA_REQUESTOR, + enable_rpcs=True) + + yield esp32_target.Extend("qemu-tests", + board=Esp32Board.QEMU, + app=Esp32App.TESTS) def Efr32Targets(): - efr_target = Target('efr32', Efr32Builder) + efr_target = Target("efr32", Efr32Builder) board_targets = [ - efr_target.Extend('brd4161a', board=Efr32Board.BRD4161A), - efr_target.Extend('brd4163a', board=Efr32Board.BRD4163A).GlobBlacklist( - 'only user requested'), - efr_target.Extend('brd4164a', board=Efr32Board.BRD4164A).GlobBlacklist( - 'only user requested'), - efr_target.Extend('brd4166a', board=Efr32Board.BRD4166A).GlobBlacklist( - 'only user requested'), - efr_target.Extend('brd4170a', board=Efr32Board.BRD4170A).GlobBlacklist( - 'only user requested'), - efr_target.Extend('brd4186a', board=Efr32Board.BRD4186A).GlobBlacklist( - 'only user requested'), - efr_target.Extend('brd4187a', board=Efr32Board.BRD4187A).GlobBlacklist( - 'only user requested'), - efr_target.Extend('brd4304a', board=Efr32Board.BRD4304A).GlobBlacklist( - 'only user requested') + efr_target.Extend("brd4161a", board=Efr32Board.BRD4161A), + efr_target.Extend( + "brd4163a", + board=Efr32Board.BRD4163A).GlobBlacklist("only user requested"), + efr_target.Extend( + "brd4164a", + board=Efr32Board.BRD4164A).GlobBlacklist("only user requested"), + efr_target.Extend( + "brd4166a", + board=Efr32Board.BRD4166A).GlobBlacklist("only user requested"), + efr_target.Extend( + "brd4170a", + board=Efr32Board.BRD4170A).GlobBlacklist("only user requested"), + efr_target.Extend( + "brd4186a", + board=Efr32Board.BRD4186A).GlobBlacklist("only user requested"), + efr_target.Extend( + "brd4187a", + board=Efr32Board.BRD4187A).GlobBlacklist("only user requested"), + efr_target.Extend( + "brd4304a", + board=Efr32Board.BRD4304A).GlobBlacklist("only user requested"), ] builder = VariantBuilder() for board_target in board_targets: - builder.targets.append(board_target.Extend( - 'window-covering', app=Efr32App.WINDOW_COVERING)) - builder.targets.append(board_target.Extend( - 'switch', app=Efr32App.SWITCH)) - builder.targets.append(board_target.Extend( - 'unit-test', app=Efr32App.UNIT_TEST)) builder.targets.append( - board_target.Extend('light', app=Efr32App.LIGHT)) - builder.targets.append(board_target.Extend('lock', app=Efr32App.LOCK)) + board_target.Extend("window-covering", + app=Efr32App.WINDOW_COVERING)) + builder.targets.append( + board_target.Extend("switch", app=Efr32App.SWITCH)) + builder.targets.append( + board_target.Extend("unit-test", app=Efr32App.UNIT_TEST)) + builder.targets.append(board_target.Extend("light", + app=Efr32App.LIGHT)) + builder.targets.append(board_target.Extend("lock", app=Efr32App.LOCK)) # Possible build variants. Note that number of potential # builds is exponential here - builder.AppendVariant(name="rpc", validator=AcceptNameWithSubstrings( - ['-light', '-lock']), enable_rpcs=True) + builder.AppendVariant( + name="rpc", + validator=AcceptNameWithSubstrings(["-light", "-lock"]), + enable_rpcs=True, + ) builder.AppendVariant(name="with-ota-requestor", enable_ota_requestor=True) - builder.WhitelistVariantNameForGlob('rpc') + builder.WhitelistVariantNameForGlob("rpc") for target in builder.AllVariants(): yield target def NrfTargets(): - target = Target('nrf', NrfConnectBuilder) + target = Target("nrf", NrfConnectBuilder) - yield target.Extend('native-posix-64-tests', board=NrfBoard.NATIVE_POSIX_64, app=NrfApp.UNIT_TESTS) + yield target.Extend("native-posix-64-tests", + board=NrfBoard.NATIVE_POSIX_64, + app=NrfApp.UNIT_TESTS) targets = [ - target.Extend('nrf5340dk', board=NrfBoard.NRF5340DK), - target.Extend('nrf52840dk', board=NrfBoard.NRF52840DK), + target.Extend("nrf5340dk", board=NrfBoard.NRF5340DK), + target.Extend("nrf52840dk", board=NrfBoard.NRF52840DK), ] # Enable nrf52840dongle for all-clusters and lighting app only - yield target.Extend('nrf52840dongle-all-clusters', board=NrfBoard.NRF52840DONGLE, app=NrfApp.ALL_CLUSTERS) - yield target.Extend('nrf52840dongle-all-clusters-minimal', board=NrfBoard.NRF52840DONGLE, app=NrfApp.ALL_CLUSTERS_MINIMAL) - yield target.Extend('nrf52840dongle-light', board=NrfBoard.NRF52840DONGLE, app=NrfApp.LIGHT) + yield target.Extend( + "nrf52840dongle-all-clusters", + board=NrfBoard.NRF52840DONGLE, + app=NrfApp.ALL_CLUSTERS, + ) + yield target.Extend( + "nrf52840dongle-all-clusters-minimal", + board=NrfBoard.NRF52840DONGLE, + app=NrfApp.ALL_CLUSTERS_MINIMAL, + ) + yield target.Extend("nrf52840dongle-light", + board=NrfBoard.NRF52840DONGLE, + app=NrfApp.LIGHT) for target in targets: - yield target.Extend('all-clusters', app=NrfApp.ALL_CLUSTERS) - yield target.Extend('all-clusters-minimal', app=NrfApp.ALL_CLUSTERS_MINIMAL) - yield target.Extend('lock', app=NrfApp.LOCK) - yield target.Extend('light', app=NrfApp.LIGHT) - yield target.Extend('shell', app=NrfApp.SHELL) - yield target.Extend('pump', app=NrfApp.PUMP) - yield target.Extend('pump-controller', app=NrfApp.PUMP_CONTROLLER) - - rpc = target.Extend('light-rpc', app=NrfApp.LIGHT, enable_rpcs=True) - - if '-nrf5340dk-' in rpc.name: + yield target.Extend("all-clusters", app=NrfApp.ALL_CLUSTERS) + yield target.Extend("all-clusters-minimal", + app=NrfApp.ALL_CLUSTERS_MINIMAL) + yield target.Extend("lock", app=NrfApp.LOCK) + yield target.Extend("light", app=NrfApp.LIGHT) + yield target.Extend("shell", app=NrfApp.SHELL) + yield target.Extend("pump", app=NrfApp.PUMP) + yield target.Extend("pump-controller", app=NrfApp.PUMP_CONTROLLER) + + rpc = target.Extend("light-rpc", app=NrfApp.LIGHT, enable_rpcs=True) + + if "-nrf5340dk-" in rpc.name: rpc = rpc.GlobBlacklist( - 'Compile failure due to pw_build args not forwarded to proto compiler. ' - 'https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/66760') + "Compile failure due to pw_build args not forwarded to proto compiler. " + "https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/66760" + ) yield rpc def AndroidTargets(): - target = Target('android', AndroidBuilder) - - yield target.Extend('arm-chip-tool', board=AndroidBoard.ARM, app=AndroidApp.CHIP_TOOL) - yield target.Extend('arm64-chip-tool', board=AndroidBoard.ARM64, app=AndroidApp.CHIP_TOOL) - yield target.Extend('x64-chip-tool', board=AndroidBoard.X64, app=AndroidApp.CHIP_TOOL) - yield target.Extend('x86-chip-tool', board=AndroidBoard.X86, app=AndroidApp.CHIP_TOOL) - yield target.Extend('arm64-chip-test', board=AndroidBoard.ARM64, app=AndroidApp.CHIP_TEST) - yield target.Extend('androidstudio-arm-chip-tool', board=AndroidBoard.AndroidStudio_ARM, app=AndroidApp.CHIP_TOOL) - yield target.Extend('androidstudio-arm64-chip-tool', board=AndroidBoard.AndroidStudio_ARM64, app=AndroidApp.CHIP_TOOL) - yield target.Extend('androidstudio-x86-chip-tool', board=AndroidBoard.AndroidStudio_X86, app=AndroidApp.CHIP_TOOL) - yield target.Extend('androidstudio-x64-chip-tool', board=AndroidBoard.AndroidStudio_X64, app=AndroidApp.CHIP_TOOL) - yield target.Extend('arm64-chip-tvserver', board=AndroidBoard.ARM64, app=AndroidApp.CHIP_TVServer) - yield target.Extend('arm-chip-tvserver', board=AndroidBoard.ARM, app=AndroidApp.CHIP_TVServer) - yield target.Extend('x86-chip-tvserver', board=AndroidBoard.X86, app=AndroidApp.CHIP_TVServer) - yield target.Extend('x64-chip-tvserver', board=AndroidBoard.X64, app=AndroidApp.CHIP_TVServer) - yield target.Extend('arm64-chip-tv-casting-app', board=AndroidBoard.ARM64, app=AndroidApp.CHIP_TV_CASTING_APP) - yield target.Extend('arm-chip-tv-casting-app', board=AndroidBoard.ARM, app=AndroidApp.CHIP_TV_CASTING_APP) + target = Target("android", AndroidBuilder) + + yield target.Extend("arm-chip-tool", + board=AndroidBoard.ARM, + app=AndroidApp.CHIP_TOOL) + yield target.Extend("arm64-chip-tool", + board=AndroidBoard.ARM64, + app=AndroidApp.CHIP_TOOL) + yield target.Extend("x64-chip-tool", + board=AndroidBoard.X64, + app=AndroidApp.CHIP_TOOL) + yield target.Extend("x86-chip-tool", + board=AndroidBoard.X86, + app=AndroidApp.CHIP_TOOL) + yield target.Extend("arm64-chip-test", + board=AndroidBoard.ARM64, + app=AndroidApp.CHIP_TEST) + yield target.Extend( + "androidstudio-arm-chip-tool", + board=AndroidBoard.AndroidStudio_ARM, + app=AndroidApp.CHIP_TOOL, + ) + yield target.Extend( + "androidstudio-arm64-chip-tool", + board=AndroidBoard.AndroidStudio_ARM64, + app=AndroidApp.CHIP_TOOL, + ) + yield target.Extend( + "androidstudio-x86-chip-tool", + board=AndroidBoard.AndroidStudio_X86, + app=AndroidApp.CHIP_TOOL, + ) + yield target.Extend( + "androidstudio-x64-chip-tool", + board=AndroidBoard.AndroidStudio_X64, + app=AndroidApp.CHIP_TOOL, + ) + yield target.Extend("arm64-chip-tvserver", + board=AndroidBoard.ARM64, + app=AndroidApp.CHIP_TVServer) + yield target.Extend("arm-chip-tvserver", + board=AndroidBoard.ARM, + app=AndroidApp.CHIP_TVServer) + yield target.Extend("x86-chip-tvserver", + board=AndroidBoard.X86, + app=AndroidApp.CHIP_TVServer) + yield target.Extend("x64-chip-tvserver", + board=AndroidBoard.X64, + app=AndroidApp.CHIP_TVServer) + yield target.Extend( + "arm64-chip-tv-casting-app", + board=AndroidBoard.ARM64, + app=AndroidApp.CHIP_TV_CASTING_APP, + ) + yield target.Extend( + "arm-chip-tv-casting-app", + board=AndroidBoard.ARM, + app=AndroidApp.CHIP_TV_CASTING_APP, + ) def MbedTargets(): - target = Target('mbed', MbedBuilder) + target = Target("mbed", MbedBuilder) targets = [ - target.Extend('CY8CPROTO_062_4343W', + target.Extend("CY8CPROTO_062_4343W", board=MbedBoard.CY8CPROTO_062_4343W), ] app_targets = [] for target in targets: - app_targets.append(target.Extend('lock', app=MbedApp.LOCK)) - app_targets.append(target.Extend('light', app=MbedApp.LIGHT)) - app_targets.append(target.Extend( - 'all-clusters', app=MbedApp.ALL_CLUSTERS)) - app_targets.append(target.Extend( - 'all-clusters-minimal', app=MbedApp.ALL_CLUSTERS_MINIMAL)) - app_targets.append(target.Extend('pigweed', app=MbedApp.PIGWEED)) - app_targets.append(target.Extend('shell', app=MbedApp.SHELL)) + app_targets.append(target.Extend("lock", app=MbedApp.LOCK)) + app_targets.append(target.Extend("light", app=MbedApp.LIGHT)) + app_targets.append( + target.Extend("all-clusters", app=MbedApp.ALL_CLUSTERS)) + app_targets.append( + target.Extend("all-clusters-minimal", + app=MbedApp.ALL_CLUSTERS_MINIMAL)) + app_targets.append(target.Extend("pigweed", app=MbedApp.PIGWEED)) + app_targets.append(target.Extend("shell", app=MbedApp.SHELL)) for target in app_targets: - yield target.Extend('release', profile=MbedProfile.RELEASE) - yield target.Extend('develop', profile=MbedProfile.DEVELOP).GlobBlacklist( - 'Compile only for debugging purpose - ' - 'https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html') - yield target.Extend('debug', profile=MbedProfile.DEBUG).GlobBlacklist( - 'Compile only for debugging purpose - ' - 'https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html') + yield target.Extend("release", profile=MbedProfile.RELEASE) + yield target.Extend( + "develop", profile=MbedProfile.DEVELOP + ).GlobBlacklist( + "Compile only for debugging purpose - " + "https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html" + ) + yield target.Extend("debug", profile=MbedProfile.DEBUG).GlobBlacklist( + "Compile only for debugging purpose - " + "https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html" + ) def InfineonTargets(): - target = Target('infineon', InfineonBuilder) - - yield target.Extend('p6-lock', board=InfineonBoard.P6BOARD, app=InfineonApp.LOCK) - yield target.Extend('p6-all-clusters', board=InfineonBoard.P6BOARD, app=InfineonApp.ALL_CLUSTERS) - yield target.Extend('p6-all-clusters-minimal', board=InfineonBoard.P6BOARD, app=InfineonApp.ALL_CLUSTERS_MINIMAL) - yield target.Extend('p6-light', board=InfineonBoard.P6BOARD, app=InfineonApp.LIGHT) + target = Target("infineon", InfineonBuilder) + + yield target.Extend("p6-lock", + board=InfineonBoard.P6BOARD, + app=InfineonApp.LOCK) + yield target.Extend("p6-all-clusters", + board=InfineonBoard.P6BOARD, + app=InfineonApp.ALL_CLUSTERS) + yield target.Extend( + "p6-all-clusters-minimal", + board=InfineonBoard.P6BOARD, + app=InfineonApp.ALL_CLUSTERS_MINIMAL, + ) + yield target.Extend("p6-light", + board=InfineonBoard.P6BOARD, + app=InfineonApp.LIGHT) def AmebaTargets(): - ameba_target = Target('ameba', AmebaBuilder) - - yield ameba_target.Extend('amebad-all-clusters', board=AmebaBoard.AMEBAD, app=AmebaApp.ALL_CLUSTERS) - yield ameba_target.Extend('amebad-all-clusters-minimal', board=AmebaBoard.AMEBAD, app=AmebaApp.ALL_CLUSTERS_MINIMAL) - yield ameba_target.Extend('amebad-light', board=AmebaBoard.AMEBAD, app=AmebaApp.LIGHT) - yield ameba_target.Extend('amebad-pigweed', board=AmebaBoard.AMEBAD, app=AmebaApp.PIGWEED) + ameba_target = Target("ameba", AmebaBuilder) + + yield ameba_target.Extend("amebad-all-clusters", + board=AmebaBoard.AMEBAD, + app=AmebaApp.ALL_CLUSTERS) + yield ameba_target.Extend( + "amebad-all-clusters-minimal", + board=AmebaBoard.AMEBAD, + app=AmebaApp.ALL_CLUSTERS_MINIMAL, + ) + yield ameba_target.Extend("amebad-light", + board=AmebaBoard.AMEBAD, + app=AmebaApp.LIGHT) + yield ameba_target.Extend("amebad-pigweed", + board=AmebaBoard.AMEBAD, + app=AmebaApp.PIGWEED) def K32WTargets(): - target = Target('k32w', K32WBuilder) - - yield target.Extend('light-ota-se', app=K32WApp.LIGHT, release=True, disable_ble=True, se05x=True).GlobBlacklist("Only on demand build") - yield target.Extend('light-release-no-ota', app=K32WApp.LIGHT, tokenizer=True, disable_ota=True, release=True) - yield target.Extend('shell-release', app=K32WApp.SHELL, release=True) - yield target.Extend('lock-release', app=K32WApp.LOCK, release=True) - yield target.Extend('lock-low-power-release', app=K32WApp.LOCK, - low_power=True, release=True).GlobBlacklist("Only on demand build") + target = Target("k32w", K32WBuilder) + + yield target.Extend("light-ota-se", + app=K32WApp.LIGHT, + release=True, + disable_ble=True, + se05x=True).GlobBlacklist("Only on demand build") + yield target.Extend( + "light-release-no-ota", + app=K32WApp.LIGHT, + tokenizer=True, + disable_ota=True, + release=True, + ) + yield target.Extend("shell-release", app=K32WApp.SHELL, release=True) + yield target.Extend("lock-release", app=K32WApp.LOCK, release=True) + yield target.Extend("lock-low-power-release", + app=K32WApp.LOCK, + low_power=True, + release=True).GlobBlacklist("Only on demand build") def cc13x2x7_26x2x7Targets(): - target = Target('cc13x2x7_26x2x7', cc13x2x7_26x2x7Builder) - - yield target.Extend('lock-ftd', app=cc13x2x7_26x2x7App.LOCK, openthread_ftd=True) - yield target.Extend('lock-mtd', app=cc13x2x7_26x2x7App.LOCK, openthread_ftd=False) - yield target.Extend('pump', app=cc13x2x7_26x2x7App.PUMP) - yield target.Extend('pump-controller', app=cc13x2x7_26x2x7App.PUMP_CONTROLLER) - yield target.Extend('all-clusters', app=cc13x2x7_26x2x7App.ALL_CLUSTERS) - yield target.Extend('all-clusters-minimal', app=cc13x2x7_26x2x7App.ALL_CLUSTERS_MINIMAL) - yield target.Extend('shell', app=cc13x2x7_26x2x7App.SHELL) + target = Target("cc13x2x7_26x2x7", cc13x2x7_26x2x7Builder) + + yield target.Extend("lock-ftd", + app=cc13x2x7_26x2x7App.LOCK, + openthread_ftd=True) + yield target.Extend("lock-mtd", + app=cc13x2x7_26x2x7App.LOCK, + openthread_ftd=False) + yield target.Extend("pump", app=cc13x2x7_26x2x7App.PUMP) + yield target.Extend("pump-controller", + app=cc13x2x7_26x2x7App.PUMP_CONTROLLER) + yield target.Extend("all-clusters", app=cc13x2x7_26x2x7App.ALL_CLUSTERS) + yield target.Extend("all-clusters-minimal", + app=cc13x2x7_26x2x7App.ALL_CLUSTERS_MINIMAL) + yield target.Extend("shell", app=cc13x2x7_26x2x7App.SHELL) def Cyw30739Targets(): - yield Target('cyw30739-cyw930739m2evb_01-light', Cyw30739Builder, - board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.LIGHT) - yield Target('cyw30739-cyw930739m2evb_01-lock', Cyw30739Builder, - board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.LOCK) - yield Target('cyw30739-cyw930739m2evb_01-ota-requestor', Cyw30739Builder, - board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.OTA_REQUESTOR).GlobBlacklist( - "Running out of XIP flash space") - yield Target('cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging', Cyw30739Builder, - board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.OTA_REQUESTOR, progress_logging=False) + yield Target( + "cyw30739-cyw930739m2evb_01-light", + Cyw30739Builder, + board=Cyw30739Board.CYW930739M2EVB_01, + app=Cyw30739App.LIGHT, + ) + yield Target( + "cyw30739-cyw930739m2evb_01-lock", + Cyw30739Builder, + board=Cyw30739Board.CYW930739M2EVB_01, + app=Cyw30739App.LOCK, + ) + yield Target( + "cyw30739-cyw930739m2evb_01-ota-requestor", + Cyw30739Builder, + board=Cyw30739Board.CYW930739M2EVB_01, + app=Cyw30739App.OTA_REQUESTOR, + ).GlobBlacklist("Running out of XIP flash space") + yield Target( + "cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging", + Cyw30739Builder, + board=Cyw30739Board.CYW930739M2EVB_01, + app=Cyw30739App.OTA_REQUESTOR, + progress_logging=False, + ) def QorvoTargets(): - target = Target('qpg', QpgBuilder) + target = Target("qpg", QpgBuilder) - yield target.Extend('lock', board=QpgBoard.QPG6105, app=QpgApp.LOCK) - yield target.Extend('light', board=QpgBoard.QPG6105, app=QpgApp.LIGHT) - yield target.Extend('shell', board=QpgBoard.QPG6105, app=QpgApp.SHELL) - yield target.Extend('persistent-storage', board=QpgBoard.QPG6105, app=QpgApp.PERSISTENT_STORAGE) + yield target.Extend("lock", board=QpgBoard.QPG6105, app=QpgApp.LOCK) + yield target.Extend("light", board=QpgBoard.QPG6105, app=QpgApp.LIGHT) + yield target.Extend("shell", board=QpgBoard.QPG6105, app=QpgApp.SHELL) + yield target.Extend("persistent-storage", + board=QpgBoard.QPG6105, + app=QpgApp.PERSISTENT_STORAGE) def TizenTargets(): @@ -556,36 +825,51 @@ def TizenTargets(): builder.AppendVariant(name="no-wifi", enable_wifi=False) builder.AppendVariant(name="asan", use_asan=True) - target = Target('tizen-arm', TizenBuilder, board=TizenBoard.ARM) + target = Target("tizen-arm", TizenBuilder, board=TizenBoard.ARM) - builder.targets.append(target.Extend('chip-tool', app=TizenApp.CHIP_TOOL)) - builder.targets.append(target.Extend('light', app=TizenApp.LIGHT)) + builder.targets.append(target.Extend("chip-tool", app=TizenApp.CHIP_TOOL)) + builder.targets.append(target.Extend("light", app=TizenApp.LIGHT)) for target in builder.AllVariants(): yield target def Bl602Targets(): - target = Target('bl602', Bl602Builder) + target = Target("bl602", Bl602Builder) - yield target.Extend('light', board=Bl602Board.BL602BOARD, app=Bl602App.LIGHT) + yield target.Extend("light", + board=Bl602Board.BL602BOARD, + app=Bl602App.LIGHT) def IMXTargets(): - target = Target('imx', IMXBuilder) - - yield target.Extend('chip-tool', app=IMXApp.CHIP_TOOL) - yield target.Extend('lighting-app', app=IMXApp.LIGHT) - yield target.Extend('thermostat', app=IMXApp.THERMOSTAT) - yield target.Extend('all-clusters-app', app=IMXApp.ALL_CLUSTERS) - yield target.Extend('all-clusters-minimal-app', app=IMXApp.ALL_CLUSTERS_MINIMAL) - yield target.Extend('ota-provider-app', app=IMXApp.OTA_PROVIDER) - yield target.Extend('chip-tool-release', app=IMXApp.CHIP_TOOL, release=True) - yield target.Extend('lighting-app-release', app=IMXApp.LIGHT, release=True) - yield target.Extend('thermostat-release', app=IMXApp.THERMOSTAT, release=True) - yield target.Extend('all-clusters-app-release', app=IMXApp.ALL_CLUSTERS, release=True) - yield target.Extend('all-clusters-minimal-app-release', app=IMXApp.ALL_CLUSTERS_MINIMAL, release=True) - yield target.Extend('ota-provider-app-release', app=IMXApp.OTA_PROVIDER, release=True) + target = Target("imx", IMXBuilder) + + yield target.Extend("chip-tool", app=IMXApp.CHIP_TOOL) + yield target.Extend("lighting-app", app=IMXApp.LIGHT) + yield target.Extend("thermostat", app=IMXApp.THERMOSTAT) + yield target.Extend("all-clusters-app", app=IMXApp.ALL_CLUSTERS) + yield target.Extend("all-clusters-minimal-app", + app=IMXApp.ALL_CLUSTERS_MINIMAL) + yield target.Extend("ota-provider-app", app=IMXApp.OTA_PROVIDER) + yield target.Extend("chip-tool-release", + app=IMXApp.CHIP_TOOL, + release=True) + yield target.Extend("lighting-app-release", app=IMXApp.LIGHT, release=True) + yield target.Extend("thermostat-release", + app=IMXApp.THERMOSTAT, + release=True) + yield target.Extend("all-clusters-app-release", + app=IMXApp.ALL_CLUSTERS, + release=True) + yield target.Extend( + "all-clusters-minimal-app-release", + app=IMXApp.ALL_CLUSTERS_MINIMAL, + release=True, + ) + yield target.Extend("ota-provider-app-release", + app=IMXApp.OTA_PROVIDER, + release=True) ALL = [] @@ -613,10 +897,20 @@ def IMXTargets(): ALL.append(target) # Simple targets added one by one -ALL.append(Target('telink-tlsr9518adk80d-light', TelinkBuilder, - board=TelinkBoard.TLSR9518ADK80D, app=TelinkApp.LIGHT)) -ALL.append(Target('telink-tlsr9518adk80d-light-switch', TelinkBuilder, - board=TelinkBoard.TLSR9518ADK80D, app=TelinkApp.SWITCH)) +ALL.append( + Target( + "telink-tlsr9518adk80d-light", + TelinkBuilder, + board=TelinkBoard.TLSR9518ADK80D, + app=TelinkApp.LIGHT, + )) +ALL.append( + Target( + "telink-tlsr9518adk80d-light-switch", + TelinkBuilder, + board=TelinkBoard.TLSR9518ADK80D, + app=TelinkApp.SWITCH, + )) # have a consistent order overall ALL.sort(key=lambda t: t.name) diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index 5e6a22aadf3379..4a45b34a247c27 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -11,9 +11,9 @@ # 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 os -from enum import Enum, auto +from enum import auto +from enum import Enum from platform import uname from .gn import GnBuilder @@ -44,110 +44,115 @@ class HostApp(Enum): def ExamplePath(self): if self == HostApp.ALL_CLUSTERS: - return 'all-clusters-app/linux' + return "all-clusters-app/linux" elif self == HostApp.ALL_CLUSTERS_MINIMAL: - return 'all-clusters-minimal-app/linux' + return "all-clusters-minimal-app/linux" elif self == HostApp.CHIP_TOOL: - return 'chip-tool' + return "chip-tool" elif self == HostApp.CHIP_TOOL_DARWIN: - return 'darwin-framework-tool' + return "darwin-framework-tool" elif self == HostApp.THERMOSTAT: - return 'thermostat/linux' + return "thermostat/linux" elif self == HostApp.RPC_CONSOLE: - return 'common/pigweed/rpc_console' + return "common/pigweed/rpc_console" elif self == HostApp.MIN_MDNS: - return 'minimal-mdns' + return "minimal-mdns" elif self == HostApp.TV_APP: - return 'tv-app/linux' + return "tv-app/linux" elif self == HostApp.TV_CASTING_APP: - return 'tv-casting-app/linux' + return "tv-casting-app/linux" elif self == HostApp.LIGHT: - return 'lighting-app/linux' + return "lighting-app/linux" elif self == HostApp.LOCK: - return 'lock-app/linux' + return "lock-app/linux" elif self == HostApp.SHELL: - return 'shell/standalone' + return "shell/standalone" elif self == HostApp.OTA_PROVIDER: - return 'ota-provider-app/linux' + return "ota-provider-app/linux" elif self == HostApp.OTA_REQUESTOR: - return 'ota-requestor-app/linux' - elif self in [HostApp.ADDRESS_RESOLVE, HostApp.TESTS, HostApp.PYTHON_BINDINGS, HostApp.CERT_TOOL]: - return '../' + return "ota-requestor-app/linux" + elif self in [ + HostApp.ADDRESS_RESOLVE, + HostApp.TESTS, + HostApp.PYTHON_BINDINGS, + HostApp.CERT_TOOL, + ]: + return "../" elif self == HostApp.NL_TEST_RUNNER: - return '../src/test_driver/efr32' + return "../src/test_driver/efr32" elif self == HostApp.TV_CASTING: - return 'tv-casting-app/linux' + return "tv-casting-app/linux" elif self == HostApp.BRIDGE: - return 'bridge-app/linux' + return "bridge-app/linux" else: - raise Exception('Unknown app type: %r' % self) + raise Exception("Unknown app type: %r" % self) def OutputNames(self): if self == HostApp.ALL_CLUSTERS: - yield 'chip-all-clusters-app' - yield 'chip-all-clusters-app.map' + yield "chip-all-clusters-app" + yield "chip-all-clusters-app.map" elif self == HostApp.ALL_CLUSTERS_MINIMAL: - yield 'chip-all-clusters-minimal-app' - yield 'chip-all-clusters-minimal-app.map' + yield "chip-all-clusters-minimal-app" + yield "chip-all-clusters-minimal-app.map" elif self == HostApp.CHIP_TOOL: - yield 'chip-tool' - yield 'chip-tool.map' + yield "chip-tool" + yield "chip-tool.map" elif self == HostApp.CHIP_TOOL_DARWIN: - yield 'darwin-framework-tool' - yield 'darwin-framework-tool.map' + yield "darwin-framework-tool" + yield "darwin-framework-tool.map" elif self == HostApp.THERMOSTAT: - yield 'thermostat-app' - yield 'thermostat-app.map' + yield "thermostat-app" + yield "thermostat-app.map" elif self == HostApp.RPC_CONSOLE: - yield 'chip_rpc_console_wheels' + yield "chip_rpc_console_wheels" elif self == HostApp.MIN_MDNS: - yield 'mdns-advertiser' - yield 'mdns-advertiser.map' - yield 'minimal-mdns-client' - yield 'minimal-mdns-client.map' - yield 'minimal-mdns-server' - yield 'minimal-mdns-server.map' + yield "mdns-advertiser" + yield "mdns-advertiser.map" + yield "minimal-mdns-client" + yield "minimal-mdns-client.map" + yield "minimal-mdns-server" + yield "minimal-mdns-server.map" elif self == HostApp.ADDRESS_RESOLVE: - yield 'address-resolve-tool' - yield 'address-resolve-tool.map' + yield "address-resolve-tool" + yield "address-resolve-tool.map" elif self == HostApp.TV_APP: - yield 'chip-tv-app' - yield 'chip-tv-app.map' + yield "chip-tv-app" + yield "chip-tv-app.map" elif self == HostApp.TV_CASTING_APP: - yield 'chip-tv-casting-app' - yield 'chip-tv-casting-app.map' + yield "chip-tv-casting-app" + yield "chip-tv-casting-app.map" elif self == HostApp.LIGHT: - yield 'chip-lighting-app' - yield 'chip-lighting-app.map' + yield "chip-lighting-app" + yield "chip-lighting-app.map" elif self == HostApp.LOCK: - yield 'chip-lock-app' - yield 'chip-lock-app.map' + yield "chip-lock-app" + yield "chip-lock-app.map" elif self == HostApp.TESTS: pass elif self == HostApp.SHELL: - yield 'chip-shell' - yield 'chip-shell.map' + yield "chip-shell" + yield "chip-shell.map" elif self == HostApp.CERT_TOOL: - yield 'chip-cert' - yield 'chip-cert.map' + yield "chip-cert" + yield "chip-cert.map" elif self == HostApp.OTA_PROVIDER: - yield 'chip-ota-provider-app' - yield 'chip-ota-provider-app.map' + yield "chip-ota-provider-app" + yield "chip-ota-provider-app.map" elif self == HostApp.OTA_REQUESTOR: - yield 'chip-ota-requestor-app' - yield 'chip-ota-requestor-app.map' + yield "chip-ota-requestor-app" + yield "chip-ota-requestor-app.map" elif self == HostApp.PYTHON_BINDINGS: - yield 'controller/python' # Directory containing WHL files + yield "controller/python" # Directory containing WHL files elif self == HostApp.NL_TEST_RUNNER: - yield 'chip_nl_test_runner_wheels' + yield "chip_nl_test_runner_wheels" elif self == HostApp.TV_CASTING: - yield 'chip-tv-casting-app' - yield 'chip-tv-casting-app.map' + yield "chip-tv-casting-app" + yield "chip-tv-casting-app.map" elif self == HostApp.BRIDGE: - yield 'chip-bridge-app' - yield 'chip-bridge-app.map' + yield "chip-bridge-app" + yield "chip-bridge-app.map" else: - raise Exception('Unknown app type: %r' % self) + raise Exception("Unknown app type: %r" % self) class HostBoard(Enum): @@ -165,40 +170,56 @@ def BoardName(self): arch = uname_result.machine # standardize some common platforms - if arch == 'x86_64': - arch = 'x64' - elif arch == 'i386' or arch == 'i686': - arch = 'x86' - elif arch in ('aarch64', 'aarch64_be', 'armv8b', 'armv8l'): - arch = 'arm64' + if arch == "x86_64": + arch = "x64" + elif arch == "i386" or arch == "i686": + arch = "x86" + elif arch in ("aarch64", "aarch64_be", "armv8b", "armv8l"): + arch = "arm64" return arch elif self == HostBoard.ARM64: - return 'arm64' + return "arm64" elif self == HostBoard.FAKE: - return 'fake' + return "fake" else: - raise Exception('Unknown host board type: %r' % self) + raise Exception("Unknown host board type: %r" % self) def PlatformName(self): if self == HostBoard.NATIVE: return uname().system.lower() elif self == HostBoard.FAKE: - return 'fake' + return "fake" else: # Cross compilation assumes linux currently - return 'linux' + return "linux" class HostBuilder(GnBuilder): - def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True, - enable_ble=True, enable_wifi=True, use_tsan=False, use_asan=False, separate_event_loop=True, - use_libfuzzer=False, use_clang=False, interactive_mode=True, extra_tests=False, - use_platform_mdns=False, enable_rpcs=False): - super(HostBuilder, self).__init__( - root=os.path.join(root, 'examples', app.ExamplePath()), - runner=runner) + def __init__( + self, + root, + runner, + app: HostApp, + board=HostBoard.NATIVE, + enable_ipv4=True, + enable_ble=True, + enable_wifi=True, + use_tsan=False, + use_asan=False, + separate_event_loop=True, + use_libfuzzer=False, + use_clang=False, + interactive_mode=True, + extra_tests=False, + use_platform_mdns=False, + enable_rpcs=False, + ): + super(HostBuilder, + self).__init__(root=os.path.join(root, "examples", + app.ExamplePath()), + runner=runner) self.app = app self.board = board @@ -208,36 +229,36 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip self.extra_gn_options.append('import("//with_pw_rpc.gni")') if not enable_ipv4: - self.extra_gn_options.append('chip_inet_config_enable_ipv4=false') + self.extra_gn_options.append("chip_inet_config_enable_ipv4=false") if not enable_ble: - self.extra_gn_options.append('chip_config_network_layer_ble=false') + self.extra_gn_options.append("chip_config_network_layer_ble=false") if not enable_wifi: - self.extra_gn_options.append('chip_enable_wifi=false') + self.extra_gn_options.append("chip_enable_wifi=false") if use_tsan: - self.extra_gn_options.append('is_tsan=true') + self.extra_gn_options.append("is_tsan=true") if use_asan: - self.extra_gn_options.append('is_asan=true') + self.extra_gn_options.append("is_asan=true") if not separate_event_loop: - self.extra_gn_options.append('config_use_separate_eventloop=false') + self.extra_gn_options.append("config_use_separate_eventloop=false") if not interactive_mode: - self.extra_gn_options.append('config_use_interactive_mode=false') + self.extra_gn_options.append("config_use_interactive_mode=false") if use_libfuzzer: - self.extra_gn_options.append('is_libfuzzer=true') + self.extra_gn_options.append("is_libfuzzer=true") if use_clang: - self.extra_gn_options.append('is_clang=true') + self.extra_gn_options.append("is_clang=true") if self.board == HostBoard.FAKE: # Fake uses "//build/toolchain/fake:fake_x64_gcc" # so setting clang is not correct - raise Exception('Fake host board is always gcc (not clang)') + raise Exception("Fake host board is always gcc (not clang)") if use_platform_mdns: self.extra_gn_options.append('chip_mdns="platform"') @@ -245,14 +266,14 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip if extra_tests: # Flag for testing purpose self.extra_gn_options.append( - 'chip_im_force_fabric_quota_check=true') + "chip_im_force_fabric_quota_check=true") if app == HostApp.TESTS: - self.extra_gn_options.append('chip_build_tests=true') - self.build_command = 'check' + self.extra_gn_options.append("chip_build_tests=true") + self.build_command = "check" if app == HostApp.NL_TEST_RUNNER: - self.build_command = 'runner' + self.build_command = "runner" if app == HostApp.CERT_TOOL: # Certification only built for openssl @@ -262,40 +283,37 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip raise Exception( "Cannot cross compile CERT TOOL: ssl library conflict") self.extra_gn_options.append('chip_crypto="openssl"') - self.build_command = 'src/tools/chip-cert' + self.build_command = "src/tools/chip-cert" elif app == HostApp.ADDRESS_RESOLVE: - self.build_command = 'src/lib/address_resolve:address-resolve-tool' + self.build_command = "src/lib/address_resolve:address-resolve-tool" elif app == HostApp.PYTHON_BINDINGS: - self.extra_gn_options.append('enable_rtti=false') - self.extra_gn_options.append('chip_project_config_include_dirs=["//config/python"]') - self.build_command = 'python' + self.extra_gn_options.append("enable_rtti=false") + self.extra_gn_options.append( + 'chip_project_config_include_dirs=["//config/python"]') + self.build_command = "python" def GnBuildArgs(self): if self.board == HostBoard.NATIVE: return self.extra_gn_options elif self.board == HostBoard.ARM64: - self.extra_gn_options.extend( - [ - 'target_cpu="arm64"', - 'is_clang=true', - 'chip_crypto="mbedtls"', - 'sysroot="%s"' % self.SysRootPath('SYSROOT_AARCH64') - ] - ) + self.extra_gn_options.extend([ + 'target_cpu="arm64"', + "is_clang=true", + 'chip_crypto="mbedtls"', + 'sysroot="%s"' % self.SysRootPath("SYSROOT_AARCH64"), + ]) return self.extra_gn_options elif self.board == HostBoard.FAKE: - self.extra_gn_options.extend( - [ - 'custom_toolchain="//build/toolchain/fake:fake_x64_gcc"', - 'chip_link_tests=true', - 'chip_device_platform="fake"', - 'chip_fake_platform=true', - ] - ) + self.extra_gn_options.extend([ + 'custom_toolchain="//build/toolchain/fake:fake_x64_gcc"', + "chip_link_tests=true", + 'chip_device_platform="fake"', + "chip_fake_platform=true", + ]) return self.extra_gn_options else: - raise Exception('Unknown host board type: %r' % self) + raise Exception("Unknown host board type: %r" % self) def GnBuildEnv(self): if self.board == HostBoard.NATIVE: @@ -304,12 +322,14 @@ def GnBuildEnv(self): return None elif self.board == HostBoard.ARM64: return { - 'PKG_CONFIG_PATH': os.path.join( - self.SysRootPath('SYSROOT_AARCH64'), - 'lib/aarch64-linux-gnu/pkgconfig'), + "PKG_CONFIG_PATH": + os.path.join( + self.SysRootPath("SYSROOT_AARCH64"), + "lib/aarch64-linux-gnu/pkgconfig", + ), } else: - raise Exception('Unknown host board type: %r' % self) + raise Exception("Unknown host board type: %r" % self) def SysRootPath(self, name): if name not in os.environ: @@ -324,12 +344,8 @@ def build_outputs(self): if os.path.isdir(path): for root, dirs, files in os.walk(path): for file in files: - outputs.update({ - file: os.path.join(root, file) - }) + outputs.update({file: os.path.join(root, file)}) else: - outputs.update({ - name: os.path.join(self.output_dir, name) - }) + outputs.update({name: os.path.join(self.output_dir, name)}) return outputs