Skip to content

Commit

Permalink
Darwin: Move warning settings into the Xcode project (project-chip#32828
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
ksperling-apple authored Apr 3, 2024
1 parent 978dfcb commit c1f823e
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 179 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/darwin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,7 @@ jobs:

- name: Run macOS Darwin Framework Tool Build Debug
working-directory: src/darwin/Framework
# Keep whatever Xcode settings
# for OTHER_CFLAGS exist by using ${inherited}.
#
# Enable -Wconversion by hand as well, because it seems to not be
# enabled by default in the Xcode config.
#
# Disable availability annotations, since we are not building against a system
# Matter.framework.
run: xcodebuild -target "darwin-framework-tool" -sdk macosx -configuration Debug OTHER_CFLAGS='${inherited} -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
run: xcodebuild -target "darwin-framework-tool" -sdk macosx -configuration Debug
- name: Delete Defaults
run: defaults delete com.apple.dt.xctest.tool
continue-on-error: true
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ jobs:
strategy:
matrix:
options: # We don't need a full matrix
- flavor: macos-release-availability
arguments: -sdk macosx -configuration Release WARNING_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new'
- flavor: macos-release
arguments: -sdk macosx -configuration Release
- flavor: ios-release
arguments: -sdk iphoneos -configuration Release WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
- flavor: ios-debug
arguments: -sdk iphoneos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
arguments: -sdk iphoneos -configuration Release
- flavor: tvos-debug
arguments: -sdk appletvos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
arguments: -sdk appletvos -configuration Debug
- flavor: watchos-debug
arguments: -sdk watchos -configuration Debug WARNING_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
arguments: -sdk watchos -configuration Debug
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -113,7 +111,7 @@ jobs:
# Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI.
xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx ${{ matrix.options.arguments }} \
OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1 ${{ matrix.options.defines }}' \
CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} ${{ matrix.options.defines }}' \
> >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2)
- name: Collect crash logs
if: failure() && !env.ACT
Expand Down
25 changes: 25 additions & 0 deletions src/darwin/Framework/CHIPTests/MTRAvailabilityTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (c) 2024 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Matter/Matter.h>

// The purpose of this test is to ensure that our availablity annotations are
// at least syntactically valid, because within the project we generally
// compile everything with MTR_NO_AVAILABILITY=1 (so that we can internally use
// and test features of Matter.framework independently of when they will ship.)
#if MTR_NO_AVAILABILITY
#error This test must be compiled with MTR_NO_AVAILABILITY=0
#endif
Loading

0 comments on commit c1f823e

Please sign in to comment.