Skip to content

Commit 6b7d842

Browse files
committed
another attempt to group apps
1 parent 79e4f9d commit 6b7d842

File tree

4 files changed

+119
-87
lines changed

4 files changed

+119
-87
lines changed

.github/workflows/tests.yaml

Lines changed: 37 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,37 @@ jobs:
655655
"
656656
rm -rf out/unified-build
657657
658+
- name: Build apps for REPL tests with no-read-client unified build
659+
env:
660+
CCACHE_DIR: "${{ github.workspace }}/.ccache"
661+
run: |
662+
./scripts/run_in_build_env.sh \
663+
"./scripts/build/build_examples.py \
664+
--target linux-x64-light-${BUILD_VARIANT}-tsan-clang-test-unified-no-read-client \
665+
--target linux-x64-light-data-model-no-unique-id-${BUILD_VARIANT}-clang-unified-no-read-client \
666+
--target linux-x64-energy-management-${BUILD_VARIANT}-tsan-clang-test-unified-no-read-client \
667+
--target linux-x64-jf-admin-app-unified-no-read-client \
668+
--pw-command-launcher=ccache \
669+
build \
670+
--copy-artifacts-to objdir-clone \
671+
"
672+
rm -rf out/unified-no-read-client
673+
674+
- name: Build apps for REPL tests with rpc-json unified build
675+
env:
676+
CCACHE_DIR: "${{ github.workspace }}/.ccache"
677+
run: |
678+
./scripts/run_in_build_env.sh \
679+
"./scripts/build/build_examples.py \
680+
--target linux-x64-fabric-admin-rpc-${BUILD_VARIANT}-clang-unified-rpc-json \
681+
--target linux-x64-fabric-bridge-rpc-${BUILD_VARIANT}-clang-unified-rpc-json \
682+
--target linux-x64-jf-control-app-unified-rpc-json \
683+
--pw-command-launcher=ccache \
684+
build \
685+
--copy-artifacts-to objdir-clone \
686+
"
687+
rm -rf out/unified-rpc-json
688+
658689
- name: Build linux-x64-all-clusters
659690
env:
660691
CCACHE_DIR: "${{ github.workspace }}/.ccache"
@@ -683,15 +714,6 @@ jobs:
683714
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
684715
&& rm -rf out/linux-x64-energy-gateway-${BUILD_VARIANT}-tsan-clang-test"
685716
686-
- name: Build linux-x64-energy-management
687-
env:
688-
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
689-
run: >-
690-
./scripts/run_in_build_env.sh "./scripts/build/build_examples.py
691-
--target linux-x64-energy-management-${BUILD_VARIANT}-tsan-clang-test
692-
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
693-
&& rm -rf out/linux-x64-energy-management-${BUILD_VARIANT}-tsan-clang-test"
694-
695717
- name: Build linux-x64-network-manager
696718
env:
697719
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
@@ -701,24 +723,6 @@ jobs:
701723
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
702724
&& rm -rf out/linux-x64-network-manager-${BUILD_VARIANT}-tsan-clang-test"
703725
704-
- name: Build linux-x64-fabric-admin-rpc
705-
env:
706-
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
707-
run: >-
708-
./scripts/run_in_build_env.sh "./scripts/build/build_examples.py
709-
--target linux-x64-fabric-admin-rpc-${BUILD_VARIANT}-clang
710-
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
711-
&& rm -rf out/linux-x64-fabric-admin-rpc-${BUILD_VARIANT}-clang"
712-
713-
- name: Build linux-x64-fabric-bridge-rpc
714-
env:
715-
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
716-
run: >-
717-
./scripts/run_in_build_env.sh "./scripts/build/build_examples.py
718-
--target linux-x64-fabric-bridge-rpc-${BUILD_VARIANT}-clang
719-
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
720-
&& rm -rf out/linux-x64-fabric-bridge-rpc-${BUILD_VARIANT}-clang"
721-
722726
- name: Build linux-x64-fabric-sync
723727
env:
724728
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
@@ -747,15 +751,6 @@ jobs:
747751
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
748752
&& rm -rf out/linux-x64-camera-controller"
749753
750-
- name: Build linux-x64-light-data-model-no-unique-id
751-
env:
752-
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
753-
run: >-
754-
./scripts/run_in_build_env.sh "./scripts/build/build_examples.py
755-
--target linux-x64-light-data-model-no-unique-id-${BUILD_VARIANT}-clang
756-
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
757-
&& rm -rf out/linux-x64-light-data-model-no-unique-id-${BUILD_VARIANT}-clang"
758-
759754
- name: Build linux-x64-terms-and-conditions
760755
env:
761756
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
@@ -774,24 +769,6 @@ jobs:
774769
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
775770
&& rm -rf out/linux-x64-python-bindings-webrtc"
776771
777-
- name: Build linux-x64-jf-control-app
778-
env:
779-
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
780-
run: >-
781-
./scripts/run_in_build_env.sh "./scripts/build/build_examples.py
782-
--target linux-x64-jf-control-app
783-
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
784-
&& rm -rf out/linux-x64-jf-control-app"
785-
786-
- name: Build linux-x64-jf-admin-app
787-
env:
788-
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
789-
run: >-
790-
./scripts/run_in_build_env.sh "./scripts/build/build_examples.py
791-
--target linux-x64-jf-admin-app
792-
--pw-command-launcher=ccache build --copy-artifacts-to objdir-clone
793-
&& rm -rf out/linux-x64-jf-admin-app"
794-
795772
- name: ccache stats
796773
run: ccache -s
797774

@@ -839,23 +816,23 @@ jobs:
839816
echo "CHIP_LOCK_APP: objdir-clone/linux-x64-lock-${BUILD_VARIANT}-tsan-clang-test-unified/chip-lock-app" >> /tmp/test_env.yaml
840817
echo "CAMERA_APP: objdir-clone/linux-x64-camera/chip-camera-app" >> /tmp/test_env.yaml
841818
echo "CAMERA_CONTROLLER_APP: objdir-clone/linux-x64-camera-controller/chip-camera-controller" >> /tmp/test_env.yaml
842-
echo "ENERGY_MANAGEMENT_APP: objdir-clone/linux-x64-energy-management-${BUILD_VARIANT}-tsan-clang-test/chip-energy-management-app" >> /tmp/test_env.yaml
819+
echo "ENERGY_MANAGEMENT_APP: objdir-clone/linux-x64-energy-management-${BUILD_VARIANT}-tsan-clang-test-unified-no-read-client/chip-energy-management-app" >> /tmp/test_env.yaml
843820
echo "ENERGY_GATEWAY_APP: objdir-clone/linux-x64-energy-gateway-${BUILD_VARIANT}-tsan-clang-test/chip-energy-gateway-app" >> /tmp/test_env.yaml
844821
echo "LIT_ICD_APP: objdir-clone/linux-x64-lit-icd-${BUILD_VARIANT}-tsan-clang-test/lit-icd-app" >> /tmp/test_env.yaml
845822
echo "AIR_PURIFIER_APP: objdir-clone/linux-x64-air-purifier-${BUILD_VARIANT}-tsan-clang-test-unified/chip-air-purifier-app" >> /tmp/test_env.yaml
846823
echo "CHIP_MICROWAVE_OVEN_APP: objdir-clone/linux-x64-microwave-oven-${BUILD_VARIANT}-tsan-clang-test-unified/chip-microwave-oven-app" >> /tmp/test_env.yaml
847824
echo "CHIP_RVC_APP: objdir-clone/linux-x64-rvc-${BUILD_VARIANT}-tsan-clang-test-unified/chip-rvc-app" >> /tmp/test_env.yaml
848825
echo "NETWORK_MANAGEMENT_APP: objdir-clone/linux-x64-network-manager-${BUILD_VARIANT}-tsan-clang-test/matter-network-manager-app" >> /tmp/test_env.yaml
849-
echo "FABRIC_ADMIN_APP: objdir-clone/linux-x64-fabric-admin-rpc-${BUILD_VARIANT}-clang/fabric-admin" >> /tmp/test_env.yaml
850-
echo "FABRIC_BRIDGE_APP: objdir-clone/linux-x64-fabric-bridge-rpc-${BUILD_VARIANT}-clang/fabric-bridge-app" >> /tmp/test_env.yaml
826+
echo "FABRIC_ADMIN_APP: objdir-clone/linux-x64-fabric-admin-rpc-${BUILD_VARIANT}-clang-unified-rpc-json/fabric-admin" >> /tmp/test_env.yaml
827+
echo "FABRIC_BRIDGE_APP: objdir-clone/linux-x64-fabric-bridge-rpc-${BUILD_VARIANT}-clang-unified-rpc-json/fabric-bridge-app" >> /tmp/test_env.yaml
851828
echo "FABRIC_SYNC_APP: objdir-clone/linux-x64-fabric-sync-${BUILD_VARIANT}-clang/fabric-sync" >> /tmp/test_env.yaml
852-
echo "LIGHTING_APP_NO_UNIQUE_ID: objdir-clone/linux-x64-light-data-model-no-unique-id-${BUILD_VARIANT}-clang/chip-lighting-app" >> /tmp/test_env.yaml
829+
echo "LIGHTING_APP_NO_UNIQUE_ID: objdir-clone/linux-x64-light-data-model-no-unique-id-${BUILD_VARIANT}-clang-unified-no-read-client/chip-lighting-app" >> /tmp/test_env.yaml
853830
echo "TERMS_AND_CONDITIONS_APP: objdir-clone/linux-x64-terms-and-conditions/chip-terms-and-conditions-app" >> /tmp/test_env.yaml
854831
echo "OTA_PROVIDER_APP: objdir-clone/linux-x64-ota-provider-${BUILD_VARIANT}-tsan-clang-test/chip-ota-provider-app" >> /tmp/test_env.yaml
855832
echo "OTA_REQUESTOR_APP: objdir-clone/linux-x64-ota-requestor-${BUILD_VARIANT}-tsan-clang-test/chip-ota-requestor-app" >> /tmp/test_env.yaml
856833
echo "TRACE_APP: out/trace_data/app-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
857-
echo "JF_CONTROL_APP: objdir-clone/linux-x64-jf-control-app/jfc-app" >> /tmp/test_env.yaml
858-
echo "JF_ADMIN_APP: objdir-clone/linux-x64-jf-admin-app/jfa-app" >> /tmp/test_env.yaml
834+
echo "JF_CONTROL_APP: objdir-clone/linux-x64-jf-control-app-unified-rpc-json/jfc-app" >> /tmp/test_env.yaml
835+
echo "JF_ADMIN_APP: objdir-clone/linux-x64-jf-admin-app-unified-no-read-client/jfa-app" >> /tmp/test_env.yaml
859836
echo "CLOSURE_APP: objdir-clone/linux-x64-closure-${BUILD_VARIANT}-tsan-clang-test-unified/closure-app" >> /tmp/test_env.yaml
860837
echo "WATER_LEAK_DETECTOR_APP: objdir-clone/linux-x64-water-leak-detector-${BUILD_VARIANT}-tsan-clang-test-unified/water-leak-detector-app" >> /tmp/test_env.yaml
861838
echo "PUSH_AV_SERVER: src/tools/push_av_server/server.py" >> /tmp/test_env.yaml

scripts/build/build/target.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,16 @@ def __init__(self, name, builder_class, **kwargs):
223223
self.modifiers: List[TargetPart] = []
224224

225225
def isUnifiedBuild(self, parts: List[TargetPart]):
226-
"""Checks if the given parts combine into a unified build."""
226+
"""Checks if the given parts combine into a unified build.
227+
228+
Returns the unified group ID (e.g., 'main', 'no-read-client', 'rpc-json')
229+
if this is a unified build, or None otherwise.
230+
"""
227231
for part in parts:
228232
if part.build_arguments.get('unified', False):
229-
return True
230-
return False
233+
# Return the group ID, defaulting to 'main' for backward compatibility
234+
return part.build_arguments.get('unified_group', 'main')
235+
return None
231236

232237
def AppendFixedTargets(self, parts: List[TargetPart]):
233238
"""Append a list of potential targets/variants.
@@ -467,8 +472,14 @@ def Create(self, name: str, runner, repository_path: str, output_prefix: str,
467472
builder = self.builder_class(repository_path, runner=runner, **kargs)
468473
builder.target = self
469474
builder.identifier = name
470-
if self.isUnifiedBuild(parts):
471-
builder.output_dir = os.path.join(output_prefix, 'unified-build')
475+
unified_group = self.isUnifiedBuild(parts)
476+
if unified_group:
477+
# Use group-specific output directory
478+
if unified_group == 'main':
479+
dir_name = 'unified-build'
480+
else:
481+
dir_name = f'unified-{unified_group}'
482+
builder.output_dir = os.path.join(output_prefix, dir_name)
472483
else:
473484
# TODO: can we check if builds are compatible?
474485
builder.output_dir = os.path.join(output_prefix, name)

scripts/build/build/targets.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def BuildHostTarget():
204204
target.AppendModifier('googletest', use_googletest=True).OnlyIfRe('-tests')
205205
target.AppendModifier('terms-and-conditions', terms_and_conditions_required=True)
206206
target.AppendModifier('webrtc', enable_webrtc=True)
207-
target.AppendModifier('unified', unified=True).OnlyIfRe(
207+
target.AppendModifier('unified', unified=True, unified_group='main').OnlyIfRe(
208208
"-(" + "|".join([
209209
# keep-sorted start
210210
'air-purifier',
@@ -220,6 +220,23 @@ def BuildHostTarget():
220220
'water-leak-detector',
221221
# keep-sorted end
222222
]) + ")-")
223+
224+
# Group 2: No Read Client unified builds
225+
target.AppendModifier('unified-no-read-client', unified=True, unified_group='no-read-client').OnlyIfRe(
226+
"-(" + "|".join([
227+
'energy-management',
228+
'jf-admin-app',
229+
'light',
230+
'light-data-model-no-unique-id',
231+
]) + ")-")
232+
233+
# Group 3: RPC with JSON logging unified builds
234+
target.AppendModifier('unified-rpc-json', unified=True, unified_group='rpc-json').OnlyIfRe(
235+
"-(" + "|".join([
236+
'fabric-admin',
237+
'fabric-bridge',
238+
'jf-control-app',
239+
]) + ")-").OnlyIfRe('-rpc')
223240

224241
return target
225242

scripts/build/builders/host.py

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,41 @@ class HostApp(Enum):
9595
JF_ADMIN = auto()
9696
CLOSURE = auto()
9797

98-
def UnifiedTargetName(self):
98+
def UnifiedTargetName(self, unified_group='main'):
9999
"""
100-
returns the target name to compile an app as a unified build (i.e. with the GN
101-
root set to '')
100+
Returns the target name to compile an app as a unified build (i.e. with the GN
101+
root set to ''). The unified_group parameter specifies which unified build
102+
group this app belongs to.
102103
"""
103104
TARGETS = {
104-
# keep-sorted start
105-
HostApp.AIR_PURIFIER: ":linux_air_purifier_app",
106-
HostApp.BRIDGE: ":linux_bridge_app",
107-
HostApp.CLOSURE: ":linux_closure_app",
108-
HostApp.LIGHT: ":linux_lighting_app",
109-
HostApp.LOCK: ":linux_lock_app",
110-
HostApp.MICROWAVE_OVEN: ":linux_microwave_oven_app",
111-
HostApp.OTA_PROVIDER: ":linux_ota_provider_app",
112-
HostApp.RVC: ":linux_rvc_app",
113-
HostApp.THERMOSTAT: ":linux_thermostat_app",
114-
HostApp.TV_APP: ":linux_tv_app",
115-
HostApp.WATER_LEAK_DETECTOR: ":linux_water_leak_detector_app",
116-
# keep-sorted end
105+
'main': {
106+
# keep-sorted start
107+
HostApp.AIR_PURIFIER: ":linux_air_purifier_app",
108+
HostApp.BRIDGE: ":linux_bridge_app",
109+
HostApp.CLOSURE: ":linux_closure_app",
110+
HostApp.LIGHT: ":linux_lighting_app",
111+
HostApp.LOCK: ":linux_lock_app",
112+
HostApp.MICROWAVE_OVEN: ":linux_microwave_oven_app",
113+
HostApp.OTA_PROVIDER: ":linux_ota_provider_app",
114+
HostApp.RVC: ":linux_rvc_app",
115+
HostApp.THERMOSTAT: ":linux_thermostat_app",
116+
HostApp.TV_APP: ":linux_tv_app",
117+
HostApp.WATER_LEAK_DETECTOR: ":linux_water_leak_detector_app",
118+
# keep-sorted end
119+
},
120+
'no-read-client': {
121+
HostApp.LIGHT: ":linux_lighting_app",
122+
HostApp.LIGHT_DATA_MODEL_NO_UNIQUE_ID: ":linux_lighting_app_no_unique_id",
123+
HostApp.ENERGY_MANAGEMENT: ":linux_energy_management_app",
124+
HostApp.JF_ADMIN: ":linux_jf_admin_app",
125+
},
126+
'rpc-json': {
127+
HostApp.FABRIC_ADMIN: ":linux_fabric_admin",
128+
HostApp.FABRIC_BRIDGE: ":linux_fabric_bridge_app",
129+
HostApp.JF_CONTROL: ":linux_jf_control_app",
130+
},
117131
}
118-
return TARGETS[self]
132+
return TARGETS[unified_group][self]
119133

120134
def ExamplePath(self):
121135
if self == HostApp.ALL_CLUSTERS:
@@ -401,7 +415,8 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE,
401415
use_googletest=False,
402416
enable_webrtc=False,
403417
terms_and_conditions_required: Optional[bool] = None, chip_enable_nfc_based_commissioning=None,
404-
unified=False
418+
unified=False,
419+
unified_group='main'
405420
):
406421
"""
407422
Construct a host builder.
@@ -438,9 +453,21 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE,
438453
if unified:
439454
self.extra_gn_options.append('target_os="all"')
440455
self.extra_gn_options.append('matter_enable_tracing_support=true')
441-
self.extra_gn_options.append('matter_log_json_payload_hex=true')
442-
self.extra_gn_options.append('matter_log_json_payload_decode_full=true')
443-
self.build_command = app.UnifiedTargetName()
456+
457+
# Apply group-specific GN args
458+
if unified_group == 'main':
459+
self.extra_gn_options.append('matter_log_json_payload_hex=true')
460+
self.extra_gn_options.append('matter_log_json_payload_decode_full=true')
461+
elif unified_group == 'no-read-client':
462+
self.extra_gn_options.append('chip_enable_read_client=false')
463+
self.extra_gn_options.append('matter_log_json_payload_hex=true')
464+
self.extra_gn_options.append('matter_log_json_payload_decode_full=true')
465+
elif unified_group == 'rpc-json':
466+
self.extra_gn_options.append('matter_log_json_payload_hex=true')
467+
self.extra_gn_options.append('matter_log_json_payload_decode_full=true')
468+
# RPC is enabled via enable_rpcs parameter, already handled above
469+
470+
self.build_command = app.UnifiedTargetName(unified_group)
444471

445472
if not enable_wifipaf:
446473
self.extra_gn_options.append(

0 commit comments

Comments
 (0)