Skip to content

Commit

Permalink
Update ZAP to pull in MTR_AVAILABLE. (#29362)
Browse files Browse the repository at this point in the history
* Update ZAP to pull in MTR_AVAILABLE.

Also defines MTR_AVAILABLE to be empty if MTR_SKIP_AVAILABILITY_ANNOTATIONS is
set, sets it in our CI, and removes all the -Wno-unguarded-availability-new.

This caused use of "compare:" on UUIDs, which is not available until Mac OS
12.0, hence the update of deployment target to Mac OS 12.0.

* Address review comments.
  • Loading branch information
bzbarsky-apple authored Sep 23, 2023
1 parent a38af8b commit 33052cc
Show file tree
Hide file tree
Showing 43 changed files with 10,240 additions and 10,224 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/darwin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ jobs:
# Enable -Wconversion by hand as well, because it seems to not be
# enabled by default in the Xcode config.
#
# Disable -Wunguarded-availability-new because we internally use
# APIs we added after our deployment target version. Maybe we
# should change the deployment target version instead?
run: xcodebuild -target "darwin-framework-tool" -sdk macosx -configuration Debug OTHER_CFLAGS='${inherited} -Wconversion -Wno-unguarded-availability-new'
# 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'
- name: Delete Defaults
run: defaults delete com.apple.dt.xctest.tool
continue-on-error: true
Expand Down
31 changes: 14 additions & 17 deletions .github/workflows/darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,14 @@ jobs:
run: scripts/run_in_build_env.sh '(zap-cli --version && exit 1) || exit 0'
- name: Run iOS Build Debug
working-directory: src/darwin/Framework
# For now disable unguarded-availability-new warnings because we
# internally use APIs that we are annotating as only available on
# new enough versions. Maybe we should change out deployment
# target versions instead?
run: xcodebuild -target "Matter" -sdk iphoneos -configuration Debug OTHER_CFLAGS='${inherited} -Wno-unguarded-availability-new'
# Disable availability annotations, since we are not building a system
# Matter.framework.
run: xcodebuild -target "Matter" -sdk iphoneos -configuration Debug GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
- name: Run iOS Build Release
working-directory: src/darwin/Framework
# For now disable unguarded-availability-new warnings because we
# internally use APIs that we are annotating as only available on
# new enough versions. Maybe we should change out deployment
# target versions instead?
run: xcodebuild -target "Matter" -sdk iphoneos -configuration Release OTHER_CFLAGS='${inherited} -Wno-unguarded-availability-new'
# Disable availability annotations, since we are not building a system
# Matter.framework.
run: xcodebuild -target "Matter" -sdk iphoneos -configuration Release GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
- name: Clean Build
run: xcodebuild clean
working-directory: src/darwin/Framework
Expand All @@ -77,10 +73,9 @@ jobs:
# Enable -Wconversion by hand as well, because it seems to not be
# enabled by default in the Xcode config.
#
# Disable -Wunguarded-availability-new because we internally use
# APIs we added after our deployment target version. Maybe we
# should change the deployment target version instead?
run: xcodebuild -target "Matter" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new'
# Disable availability annotations, since we are not building a system
# Matter.framework.
run: xcodebuild -target "Matter" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
working-directory: src/darwin/Framework
- name: Clean Build
run: xcodebuild clean
Expand Down Expand Up @@ -115,12 +110,14 @@ jobs:
#
# -enableUndefinedBehaviorSanitizer instruments the code in Matter.framework,
# but to instrument the code in the underlying libCHIP we need to pass CHIP_IS_UBSAN=YES
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_UBSAN=YES CHIP_IS_BLE=NO > >(tee /tmp/darwin/framework-tests/darwin-tests-asan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-err.log >&2)
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_UBSAN=YES 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)
# And the same thing, but with MTR_PER_CONTROLLER_STORAGE_ENABLED turned on.
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_UBSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_PER_CONTROLLER_STORAGE_ENABLED=1' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-provisional.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-provisional-err.log >&2)
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_UBSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1 MTR_PER_CONTROLLER_STORAGE_ENABLED=1' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-provisional.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-provisional-err.log >&2)
# And the same thing, but with MTR_NO_AVAILABILITY not turned on. This requires -Wno-unguarded-availability-new to avoid availability errors.
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_UBSAN=YES 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)
# -enableThreadSanitizer instruments the code in Matter.framework,
# but to instrument the code in the underlying libCHIP we need to pass CHIP_IS_TSAN=YES
xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableThreadSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new' CHIP_IS_TSAN=YES CHIP_IS_BLE=NO > >(tee /tmp/darwin/framework-tests/darwin-tests-tsan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-tsan-err.log >&2)
xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableThreadSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_TSAN=YES 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)
working-directory: src/darwin/Framework
- name: Build Matter TV Casting Bridge
run: |
Expand Down
8 changes: 4 additions & 4 deletions examples/darwin-framework-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ config("config") {
defines = [
"CONFIG_ENABLE_YAML_TESTS=${config_enable_yaml_tests}",
"CONFIG_USE_INTERACTIVE_MODE=${config_use_interactive_mode}",

# Disable availability annotations in Matter.framework headers because we
# are not building against a system Matter.framework here anyway.
"MTR_NO_AVAILABILITY=1",
]

cflags = [
"-Wconversion",
"-fobjc-arc",

# For now disable unguarded-availability-new warnings because we
# are not building against a system Matter.framework here anyway.
"-Wno-unguarded-availability-new",
]
}

Expand Down
11 changes: 5 additions & 6 deletions scripts/build/build_darwin_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,13 @@ def build_darwin_framework(args):
for option in options:
command += ["{}={}".format(option, "YES" if options[option] else "NO")]

defines = 'GCC_PREPROCESSOR_DEFINITIONS=${inherited} MTR_NO_AVAILABILITY=1'
if args.enable_provisional_framework_features:
command += ['GCC_PREPROCESSOR_DEFINITIONS=${inherited} MTR_ENABLE_PROVISIONAL=1']
defines += ' MTR_ENABLE_PROVISIONAL=1'

# For now disable unguarded-availability-new warnings because we
# internally use APIs that we are annotating as only available on
# new enough versions. Maybe we should change out deployment
# target versions instead?
cflags = ["${inherited}", "-Wno-unguarded-availability-new"]
command += [defines]

cflags = ["${inherited}"]
ldflags = ["${inherited}"]

if args.clang:
Expand Down
4 changes: 2 additions & 2 deletions scripts/setup/zap.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"mac-amd64",
"windows-amd64"
],
"tags": ["version:2@v2023.09.12-nightly.1"]
"tags": ["version:2@v2023.09.22-nightly.1"]
},
{
"_comment": "Always get the amd64 version on mac until usable arm64 zap build is available",
"path": "fuchsia/third_party/zap/mac-amd64",
"platforms": ["mac-arm64"],
"tags": ["version:2@v2023.09.12-nightly.1"]
"tags": ["version:2@v2023.09.22-nightly.1"]
}
]
}
2 changes: 1 addition & 1 deletion scripts/setup/zap.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2023.09.12-nightly
v2023.09.22-nightly
2 changes: 1 addition & 1 deletion scripts/tools/zap/zap_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Use scripts/tools/zap/version_update.py to manage ZAP versioning as many
# files may need updating for versions
#
MIN_ZAP_VERSION = '2023.9.12'
MIN_ZAP_VERSION = '2023.9.22'


class ZapTool:
Expand Down
Loading

0 comments on commit 33052cc

Please sign in to comment.