Skip to content

Commit c1f823e

Browse files
Darwin: Move warning settings into the Xcode project (project-chip#32828)
* Darwin: Sort some project sections for easier maintenance * Darwin: Move warning settings into the Xcode project Enable warnings in the build settings rather than feeding them in during CI builds only. Also build targets within the project with MTR_NO_AVAILABILITY=1 and provisional / experimental APIs enabled. This means actual warnings now don't get drowned out by thousands of availability warnings. Explicitly suppress certain warnings within third-party code in dft. * Adjust xcodebuild args for darwin-framework-tool * Also adjust xcodebuild args for building unit tests * Availability is now tested via MTRAvailabilityTests * Remove iOS-debug CI variant to reduce load * Whitespace * Darwin: Remove some framework sources from the dft target
1 parent 978dfcb commit c1f823e

File tree

4 files changed

+180
-179
lines changed

4 files changed

+180
-179
lines changed

.github/workflows/darwin-tests.yaml

+1-9
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,7 @@ jobs:
7272

7373
- name: Run macOS Darwin Framework Tool Build Debug
7474
working-directory: src/darwin/Framework
75-
# Keep whatever Xcode settings
76-
# for OTHER_CFLAGS exist by using ${inherited}.
77-
#
78-
# Enable -Wconversion by hand as well, because it seems to not be
79-
# enabled by default in the Xcode config.
80-
#
81-
# Disable availability annotations, since we are not building against a system
82-
# Matter.framework.
83-
run: xcodebuild -target "darwin-framework-tool" -sdk macosx -configuration Debug OTHER_CFLAGS='${inherited} -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
75+
run: xcodebuild -target "darwin-framework-tool" -sdk macosx -configuration Debug
8476
- name: Delete Defaults
8577
run: defaults delete com.apple.dt.xctest.tool
8678
continue-on-error: true

.github/workflows/darwin.yaml

+6-8
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,14 @@ jobs:
3535
strategy:
3636
matrix:
3737
options: # We don't need a full matrix
38-
- flavor: macos-release-availability
39-
arguments: -sdk macosx -configuration Release WARNING_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new'
38+
- flavor: macos-release
39+
arguments: -sdk macosx -configuration Release
4040
- flavor: ios-release
41-
arguments: -sdk iphoneos -configuration Release WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
42-
- flavor: ios-debug
43-
arguments: -sdk iphoneos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
41+
arguments: -sdk iphoneos -configuration Release
4442
- flavor: tvos-debug
45-
arguments: -sdk appletvos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
43+
arguments: -sdk appletvos -configuration Debug
4644
- flavor: watchos-debug
47-
arguments: -sdk watchos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
45+
arguments: -sdk watchos -configuration Debug
4846
steps:
4947
- name: Checkout
5048
uses: actions/checkout@v4
@@ -113,7 +111,7 @@ jobs:
113111
114112
# Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI.
115113
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 }}' \
114+
CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} ${{ matrix.options.defines }}' \
117115
> >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2)
118116
- name: Collect crash logs
119117
if: failure() && !env.ACT
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Copyright (c) 2024 Project CHIP Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#import <Matter/Matter.h>
18+
19+
// The purpose of this test is to ensure that our availablity annotations are
20+
// at least syntactically valid, because within the project we generally
21+
// compile everything with MTR_NO_AVAILABILITY=1 (so that we can internally use
22+
// and test features of Matter.framework independently of when they will ship.)
23+
#if MTR_NO_AVAILABILITY
24+
#error This test must be compiled with MTR_NO_AVAILABILITY=0
25+
#endif

0 commit comments

Comments
 (0)