Skip to content

Commit 57df271

Browse files
Merge branch 'master' into Set-3-18-24
2 parents 04e9fe2 + f86633b commit 57df271

File tree

16 files changed

+235
-197
lines changed

16 files changed

+235
-197
lines changed

.github/workflows/darwin.yaml

+82-71
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,25 @@ concurrency:
2626

2727
env:
2828
CHIP_NO_LOG_TIMESTAMPS: true
29-
30-
jobs:
31-
darwin:
32-
name: Build Darwin
3329

30+
jobs:
31+
framework:
32+
name: Build framework
3433
if: github.actor != 'restyled-io[bot]'
3534
runs-on: macos-latest
36-
35+
strategy:
36+
matrix:
37+
options: # We don't need a full matrix
38+
- flavor: macos-release-availability
39+
arguments: -sdk macosx -configuration Release OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new'
40+
- flavor: ios-release
41+
arguments: -sdk iphoneos -configuration Release OTHER_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
42+
- flavor: ios-debug
43+
arguments: -sdk iphoneos -configuration Debug OTHER_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
44+
- flavor: tvos-debug
45+
arguments: -sdk appletvos -configuration Debug OTHER_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
46+
- flavor: watchos-debug
47+
arguments: -sdk watchos -configuration Debug OTHER_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
3748
steps:
3849
- name: Checkout
3950
uses: actions/checkout@v4
@@ -43,57 +54,41 @@ jobs:
4354
uses: ./.github/actions/checkout-submodules-and-bootstrap
4455
with:
4556
platform: darwin
57+
bootstrap-log-name: bootstrap-logs-framework-${{ matrix.options.flavor }}
4658
- name: Block zap-cli from being used
47-
# xcodebuild is NOT expected to require zap-cli
48-
run: scripts/run_in_build_env.sh 'D=$(dirname $(which zap-cli)) && mv $D/zap-cli $D/zap-cli.moved'
49-
- name: Validate zap-cli is NOT available
50-
# run_in_build_env.sh is used to ensure PATH is set to something that would otherwise find zap-cli
51-
run: scripts/run_in_build_env.sh '(zap-cli --version && exit 1) || exit 0'
52-
- name: Run watchOS Build Debug
53-
working-directory: src/darwin/Framework
54-
# Disable availability annotations, since we are not building a system
55-
# Matter.framework.
56-
run: xcodebuild -target "Matter" -sdk watchos -configuration Debug GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
57-
- name: Run tvOS Build Debug
58-
working-directory: src/darwin/Framework
59-
# Disable availability annotations, since we are not building a system
60-
# Matter.framework.
61-
run: xcodebuild -target "Matter" -sdk appletvos -configuration Debug GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
62-
- name: Run iOS Build Debug
63-
working-directory: src/darwin/Framework
64-
# Disable availability annotations, since we are not building a system
65-
# Matter.framework.
66-
run: xcodebuild -target "Matter" -sdk iphoneos -configuration Debug GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
67-
- name: Run iOS Build Release
68-
working-directory: src/darwin/Framework
69-
# Disable availability annotations, since we are not building a system
70-
# Matter.framework.
71-
run: xcodebuild -target "Matter" -sdk iphoneos -configuration Release GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
72-
- name: Clean Build
73-
run: xcodebuild clean
74-
working-directory: src/darwin/Framework
75-
- name: Delete Defaults
76-
run: defaults delete com.apple.dt.xctest.tool
77-
continue-on-error: true
78-
- name: Run macOS Build
79-
# Enable -Werror by hand here, because the Xcode config can't
80-
# enable it for various reasons. Keep whatever Xcode settings
81-
# for OTHER_CFLAGS exist by using ${inherited}.
82-
#
83-
# Enable -Wconversion by hand as well, because it seems to not be
84-
# enabled by default in the Xcode config.
85-
#
86-
# Disable availability annotations, since we are not building a system
87-
# Matter.framework.
88-
run: xcodebuild -target "Matter" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
89-
working-directory: src/darwin/Framework
90-
- name: Clean Build
91-
run: xcodebuild clean
59+
run: |
60+
# Framework builds are NOT expected to require zap-cli
61+
scripts/run_in_build_env.sh 'D=$(dirname $(which zap-cli)) && mv $D/zap-cli $D/zap-cli.moved'
62+
# run_in_build_env.sh is used to ensure PATH is set to something that would otherwise find zap-cli
63+
scripts/run_in_build_env.sh '(zap-cli --version && exit 1) || exit 0'
64+
- name: Build
9265
working-directory: src/darwin/Framework
93-
- name: Make zap-cli work again
94-
run: scripts/run_in_build_env.sh 'D=$(dirname $(which zap-cli.moved)) && mv $D/zap-cli.moved $D/zap-cli'
95-
- name: Validate zap-cli is again available
96-
run: scripts/run_in_build_env.sh 'zap-cli --version'
66+
run: xcodebuild -target "Matter" ${{ matrix.options.arguments }}
67+
68+
tests:
69+
name: Run framework tests
70+
if: github.actor != 'restyled-io[bot]'
71+
runs-on: macos-latest
72+
strategy:
73+
matrix:
74+
options: # We don't need a full matrix
75+
- flavor: asan
76+
arguments: -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES
77+
- flavor: asan-global-storage
78+
arguments: -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES
79+
defines: MTR_PER_CONTROLLER_STORAGE_ENABLED=0
80+
- flavor: tsan
81+
arguments: -enableThreadSanitizer YES
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v4
85+
- name: Setup Environment
86+
run: brew install python@3.9
87+
- name: Checkout submodules & Bootstrap
88+
uses: ./.github/actions/checkout-submodules-and-bootstrap
89+
with:
90+
platform: darwin
91+
bootstrap-log-name: bootstrap-logs-framework-${{ matrix.options.flavor }}
9792
- name: Build example All Clusters Server
9893
run: |
9994
scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug chip_config_network_layer_ble=false
@@ -103,40 +98,56 @@ jobs:
10398
- name: Build example OTA Requestor
10499
run: |
105100
scripts/examples/gn_build_example.sh examples/ota-requestor-app/linux out/debug/ota-requestor-app chip_config_network_layer_ble=false non_spec_compliant_ota_action_delay_floor=0
106-
- name: Delete Defaults
107-
run: defaults delete com.apple.dt.xctest.tool
108-
continue-on-error: true
109101
- name: Run Framework Tests
110102
# For now disable unguarded-availability-new warnings because we
111103
# internally use APIs that we are annotating as only available on
112104
# new enough versions. Maybe we should change out deployment
113105
# target versions instead?
106+
working-directory: src/darwin/Framework
114107
run: |
115108
mkdir -p /tmp/darwin/framework-tests
116109
../../../out/debug/chip-all-clusters-app --interface-id -1 > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) &
117110
../../../out/debug/chip-all-clusters-app --interface-id -1 --dac_provider ../../../credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json --product-id 32768 --discriminator 3839 --secured-device-port 5539 --KVS /tmp/chip-all-clusters-app-kvs2 > >(tee /tmp/darwin/framework-tests/all-cluster-app-origin-vid.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-origin-vid-err.log >&2) &
118-
# Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI.
119111
120-
TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'> >(tee /tmp/darwin/framework-tests/darwin-tests-asan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-err.log >&2)
121-
# And the same thing, but with MTR_PER_CONTROLLER_STORAGE_ENABLED turned off, so we test that it does not break for now.
122-
TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1 MTR_PER_CONTROLLER_STORAGE_ENABLED=0' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-controller-storage.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-controller-storage-err.log >&2)
123-
# And the same thing, but with MTR_NO_AVAILABILITY not turned on. This requires -Wno-unguarded-availability-new to avoid availability errors.
124-
TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited}' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-with-availability-annotations.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-with-availability-annotations-err.log >&2)
112+
export TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1
125113
126-
xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableThreadSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' > >(tee /tmp/darwin/framework-tests/darwin-tests-tsan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-tsan-err.log >&2)
127-
working-directory: src/darwin/Framework
128-
- name: Build Matter TV Casting Bridge
129-
run: |
130-
xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos
131-
working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge
114+
# Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI.
115+
xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx ${{ matrix.options.arguments }} \
116+
OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1 ${{ matrix.options.defines }}' \
117+
> >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2)
132118
- name: Collect crash logs
133119
run: |
134120
mkdir -p /tmp/darwin/framework-tests
135121
find ~/Library/Developer/Xcode/DerivedData /Library/Logs/DiagnosticReports -name '*.ips' -print0 | xargs -0 -J % cp % /tmp/darwin/framework-tests
136122
- name: Uploading log files
137123
uses: actions/upload-artifact@v4
138-
if: ${{ failure() && !env.ACT }}
124+
if: failure() && !env.ACT
139125
with:
140-
name: darwin-framework-test-logs
126+
name: darwin-framework-test-logs-${{ matrix.options.flavor }}
141127
path: /tmp/darwin/framework-tests
142128
retention-days: 5
129+
130+
tv-casting-bridge:
131+
name: Build TV Casting Bridge example
132+
if: github.actor != 'restyled-io[bot]'
133+
runs-on: macos-latest
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@v4
137+
- name: Setup Environment
138+
run: brew install python@3.9
139+
- name: Checkout submodules & Bootstrap
140+
uses: ./.github/actions/checkout-submodules-and-bootstrap
141+
with:
142+
platform: darwin
143+
- name: Build
144+
working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge
145+
run: xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos
146+
147+
darwin:
148+
name: Build Darwin # Matches the previous monolithic build that's marked "required" for PRs
149+
needs: [ framework, tests ]
150+
runs-on: macos-latest
151+
steps:
152+
- name: Done
153+
run: 'true' # nothing to do

build/config/mac/mac_sdk.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (current_os == "mac") {
3434
deployment_target = "11.0"
3535
}
3636
} else {
37-
deployment_target = "13.4"
37+
deployment_target = "14.0"
3838
}
3939

4040
declare_args() {

docs/ERROR_CODES.md

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ This file was **AUTOMATICALLY** generated by
202202

203203
| Decimal | Hex | Name |
204204
|-----------|-------|---------------------------------------------|
205+
| 1025 | 0x401 | `BLE_ERROR_ADAPTER_UNAVAILABLE` |
205206
| 1027 | 0x403 | `BLE_ERROR_NO_CONNECTION_RECEIVED_CALLBACK` |
206207
| 1028 | 0x404 | `BLE_ERROR_CENTRAL_UNSUBSCRIBED` |
207208
| 1029 | 0x405 | `BLE_ERROR_GATT_SUBSCRIBE_FAILED` |

examples/tv-casting-app/darwin/MatterTvCastingBridge/chip_xcode_build_connector.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ find_in_ancestors() {
145145
fi
146146

147147
# there are environments where these bits are unwanted, unnecessary, or impossible
148-
[[ -n $CHIP_NO_SUBMODULES ]] || git submodule update --init
148+
[[ -n $CHIP_NO_SUBMODULES ]] || scripts/checkout_submodules.py --shallow --platform darwin
149149
if [[ -z $CHIP_NO_ACTIVATE ]]; then
150150
# first run bootstrap/activate in an external env to build everything
151151
env -i PW_ENVSETUP_NO_BANNER=1 PW_ENVSETUP_QUIET=1 bash -c '. scripts/activate.sh'

examples/virtual-device-app/android/java/src/com/matter/virtual/device/app/DeviceEventType.java

+11-14
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,23 @@ public class DeviceEventType {
2323
public static final long EventId_ServiceConnectivityChange = 0x8003;
2424
public static final long EventId_ServiceProvisioningChange = 0x8004;
2525
public static final long EventId_TimeSyncChange = 0x8005;
26-
public static final long EventId_ICDPollingIntervalChang = 0x8006;
27-
public static final long EventId_CHIPoBLEConnectionEstablished = 0x8007;
28-
public static final long EventId_CHIPoBLEConnectionClosed = 0x8008;
29-
public static final long EventId_ThreadStateChange = 0x8009;
30-
public static final long EventId_ThreadInterfaceStateChange = 0x800A;
31-
public static final long EventId_CHIPoBLEAdvertisingChange = 0x800B;
32-
public static final long EventId_InterfaceIpAddressChanged = 0x800C;
33-
public static final long EventId_CommissioningWindowStatusChanged = 0x800D;
34-
public static final long EventId_CommissioningComplete = 0x800E;
35-
public static final long EventId_FailSafeTimerExpired = 0x800F;
36-
public static final long EventId_FailSafeStateChanged = 0x8010;
26+
public static final long EventId_CHIPoBLEConnectionEstablished = 0x8006;
27+
public static final long EventId_CHIPoBLEConnectionClosed = 0x8007;
28+
public static final long EventId_kCloseAllBleConnections = 0x8008;
29+
public static final long EventId_kWiFiDeviceAvailable = 0x8009;
30+
public static final long EventId_kOperationalNetworkStarted = 0x800A;
31+
public static final long EventId_ThreadStateChange = 0x800B;
32+
public static final long EventId_ThreadInterfaceStateChange = 0x800C;
33+
public static final long EventId_CHIPoBLEAdvertisingChange = 0x800D;
34+
public static final long EventId_InterfaceIpAddressChanged = 0x800E;
35+
public static final long EventId_CommissioningComplete = 0x800F;
36+
public static final long EventId_FailSafeTimerExpired = 0x8010;
3737
public static final long EventId_OperationalNetworkEnabled = 0x8011;
3838
public static final long EventId_DnssdInitialized = 0x8012;
3939
public static final long EventId_DnssdRestartNeeded = 0x8013;
4040
public static final long EventId_BindingsChangedViaCluster = 0x8014;
4141
public static final long EventId_OtaStateChanged = 0x8015;
4242
public static final long EventId_ServerReady = 0x8016;
43-
public static final long EventId_ChipMsgSentEvent = 0x8017;
44-
public static final long EventId_ChipMsgRxEventHandled = 0x8018;
45-
public static final long EventId_AppWakeUpEvent = 0x8018;
4643

4744
// out of public event range (0x8000)
4845
public static final long EventId_FabricRemoved = 0x9FFF;

src/ble/BleError.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ bool FormatLayerError(char * buf, uint16_t bufSize, CHIP_ERROR err)
5555
#if !CHIP_CONFIG_SHORT_ERROR_STR
5656
switch (err.AsInteger())
5757
{
58+
case BLE_ERROR_ADAPTER_UNAVAILABLE.AsInteger():
59+
desc = "BLE adapter unavailable";
60+
break;
5861
case BLE_ERROR_NO_CONNECTION_RECEIVED_CALLBACK.AsInteger():
5962
desc = "No chip over BLE connection received callback set";
6063
break;

src/ble/BleError.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@
4444
* @{
4545
*/
4646

47-
// unused CHIP_BLE_ERROR(0x01)
47+
/**
48+
* @def BLE_ERROR_ADAPTER_UNAVAILABLE
49+
*
50+
* @brief
51+
* Bluetooth LE adapter is (currently) unavailable.
52+
*
53+
*/
54+
#define BLE_ERROR_ADAPTER_UNAVAILABLE CHIP_BLE_ERROR(0x01)
55+
4856
// unused CHIP_BLE_ERROR(0x02)
4957

5058
/**

src/ble/tests/TestBleErrorStr.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ using namespace chip;
4141
// clang-format off
4242
static const CHIP_ERROR kTestElements[] =
4343
{
44+
BLE_ERROR_ADAPTER_UNAVAILABLE,
4445
BLE_ERROR_NO_CONNECTION_RECEIVED_CALLBACK,
4546
BLE_ERROR_CENTRAL_UNSUBSCRIBED,
4647
BLE_ERROR_GATT_SUBSCRIBE_FAILED,

src/darwin/Framework/CHIP/MTRDeviceControllerXPCConnection.mm

+1-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ - (void)handleReportWithController:(id)controller
195195
if (!controllerDictionary) {
196196
return;
197197
}
198-
NSNumber * nodeIdKey = [NSNumber numberWithUnsignedInteger:nodeId];
199-
NSMutableArray * nodeArray = controllerDictionary[nodeIdKey];
198+
NSMutableArray * nodeArray = controllerDictionary[@(nodeId)];
200199
if (!nodeArray) {
201200
return;
202201
}

src/darwin/Framework/CHIP/ServerEndpoint/MTRAccessGrant.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ - (BOOL)isEqual:(id)object
112112

113113
- (NSUInteger)hash
114114
{
115-
return _subjectID.unsignedLongLongValue ^ _grantedPrivilege ^ _authenticationMode;
115+
return _subjectID.unsignedIntegerValue ^ _grantedPrivilege ^ _authenticationMode;
116116
}
117117

118118
- (NSString *)description

src/darwin/Framework/Matter.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2254,7 +2254,7 @@
22542254
);
22552255
INFOPLIST_FILE = CHIP/Info.plist;
22562256
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2257-
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
2257+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
22582258
LIBRARY_SEARCH_PATHS = "$(TEMP_DIR)/out/lib";
22592259
OTHER_CFLAGS = "-fmacro-prefix-map=$(SRCROOT)/CHIP/=";
22602260
OTHER_LDFLAGS = "";
@@ -2421,7 +2421,7 @@
24212421
);
24222422
INFOPLIST_FILE = CHIP/Info.plist;
24232423
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2424-
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
2424+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
24252425
LIBRARY_SEARCH_PATHS = "$(TEMP_DIR)/out/lib";
24262426
OTHER_CFLAGS = "-fmacro-prefix-map=$(SRCROOT)/CHIP/=";
24272427
OTHER_LDFLAGS = "";

0 commit comments

Comments
 (0)