8000 Add Darwin framework tool compilation by woody-apple · Pull Request #20462 · project-chip/connectedhomeip · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Darwin framework tool compilation #20462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 15 additions & 34 deletions .github/workflows/darwin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,42 +82,23 @@ jobs:
- name: Delete Defaults
run: defaults delete com.apple.dt.xctest.tool
continue-on-error: true
- name: Run macOS Build
timeout-minutes: 40
# Enable -Werror by hand here, because the Xcode config can't
# enable it for various reasons. Keep whatever Xcode settings
# for OTHER_CFLAGS exist by using ${inherited}.
#
# Disable -Wmacro-redefined because CHIP_DEVICE_CONFIG_ENABLE_MDNS
# seems to be unconditionally defined in CHIPDeviceBuildConfig.h,
# which is apparently being included after CHIPDeviceConfig.h.
run: xcodebuild -target "Matter" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wno-macro-redefined'
working-directory: src/darwin/Framework
- name: Copying Framework to Temporary Path
continue-on-error: true
- name: Build Apps
timeout-minutes: 75
run: |
mkdir -p /tmp/macos_framework_output
ls -la /Users/runner/work/connectedhomeip/connectedhomeip/src/darwin/Framework/build/Release/
mv /Users/runner/work/connectedhomeip/connectedhomeip/src/darwin/Framework/build/Release/Matter.framework /tmp/macos_framework_output
ls -la /tmp/macos_framework_output
# Disabling for now
#
# - name: Build Apps
# timeout-minutes: 60
# run: |
# ./scripts/run_in_build_env.sh \
# "./scripts/build/build_examples.py \
# --target darwin-x64-darwin-framework-tool-${BUILD_VARIANT} \
# --target darwin-x64-all-clusters-${BUILD_VARIANT} \
# --target darwin-x64-lock-${BUILD_VARIANT} \
# --target darwin-x64-ota-provider-${BUILD_VARIANT} \
# --target darwin-x64-ota-requestor-${BUILD_VARIANT} \
# --target darwin-x64-tv-app-${BUILD_VARIANT} \
# build \
# --copy-artifacts-to objdir-clone \
# "
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target darwin-x64-darwin-framework-tool-${BUILD_VARIANT} \
--target darwin-x64-all-clusters-${BUILD_VARIANT} \
--target darwin-x64-lock-${BUILD_VARIANT} \
--target darwin-x64-ota-provider-${BUILD_VARIANT} \
--target darwin-x64-ota-requestor-${BUILD_VARIANT} \
--target darwin-x64-tv-app-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
# Disable for now
# - name: Run Tests
# timeout-minutes: 60
# timeout-minutes: 65
# run: |
# ./scripts/run_in_build_env.sh \
# "./scripts/tests/run_test_suite.py \
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,9 @@ jobs:
# which is apparently being included after CHIPDeviceConfig.h.
run: xcodebuild -target "Matter" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wno-macro-redefined'
working-directory: src/darwin/Framework
- name: Copying Framework to Temporary Path
continue-on-error: true
run: |
mkdir -p /tmp/macos_framework_output
ls -la /Users/runner/work/connectedhomeip/connectedhomeip/src/darwin/Framework/build/Release/
mv /Users/runner/work/connectedhomeip/connectedhomeip/src/darwin/Framework/build/Release/Matter.framework /tmp/macos_framework_output
ls -la /tmp/macos_framework_output
- name: Clean Build
run: xcodebuild clean
working-directory: src/darwin/Framework
# Disabling for now
# - name: Build example darwin-framework-tool
# timeout-minutes: 15
# run: |
# scripts/examples/gn_build_example.sh examples/darwin-framework-tool out/debug chip_config_network_layer_ble=false is_asan=true
- name: Build example All Clusters Server
timeout-minutes: 15
run: |
Expand Down
48 changes: 34 additions & 14 deletions examples/darwin-framework-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,38 @@ if (config_use_interactive_mode) {

assert(chip_build_tools)

action("build-darwin-framwork") {
script = "${chip_root}/scripts/build/build_darwin_framework.py"

inputs = [ "${chip_root}/src/darwin/Framework/Matter.xcodeproj" ]

args = [
"--project_path",
rebase_path("${chip_root}/src/darwin/Framework/Matter.xcodeproj",
root_build_dir),
"--out_path",
"macos_framework_output",
"--target",
"Matter",
"--log_path",
rebase_path("${root_build_dir}/darwin_framework_build.log", root_build_dir),
]

output_name = "Matter.framework"
outputs = [ "${root_out_dir}/macos_framework_output/${output_name}" ]
}

config("config") {
include_dirs = [
".",
"${chip_root}/src/darwin/Framework/CHIP/zap-generated",
"${chip_root}/src/darwin/Framework/CHIP",
"${chip_root}/examples/darwin-framework-tool/commands/common",
"${chip_root}/zzz_generated/darwin-framework-tool",
"${chip_root}/zzz_generated/controller-clusters",
"${chip_root}/examples/chip-tool/commands/clusters/ComplexArgument.h",
"/tmp/macos_framework_output",
"${root_out_dir}/macos_framework_output",
]

framework_dirs = [ "/tmp/macos_framework_output" ]
framework_dirs = [ "${root_out_dir}/macos_framework_output" ]

defines = [
"CONFIG_ENABLE_YAML_TESTS=${config_enable_yaml_tests}",
Expand Down Expand Up @@ -79,25 +98,26 @@ executable("darwin-framework-tool") {
"main.mm",
]

if (config_use_interactive_mode) {
sources += [ "commands/interactive/InteractiveCommands.mm" ]
deps += [ "${editline_root}:editline" ]
}

if (config_enable_yaml_tests) {
sources += [ "${chip_root}/zzz_generated/darwin-framework-tool/zap-generated/cluster/MTRTestClustersObjc.mm" ]
}

deps = [
":build-darwin-framwork",
"${chip_root}/examples/chip-tool:chip-tool-utils",
"${chip_root}/src/app/server",
"${chip_root}/src/darwin/Framework/CHIP:static-matter",
"${chip_root}/src/lib",
"${chip_root}/src/platform",
"${chip_root}/third_party/inipp",
"${chip_root}/third_party/jsoncpp",
]

if (config_use_interactive_mode) {
sources += [ "commands/interactive/InteractiveCommands.mm" ]
deps += [ "${editline_root}:editline" ]
}

ldflags = [
"-rpath",
"@executable_path/macos_framework_output/",
]

frameworks = [
"Matter.framework",
"Security.framework",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ClusterCommand : public ModelCommand {

~ClusterCommand() {}

CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId) override
CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId) override
{
chip::TLV::TLVWriter writer;
chip::TLV::TLVReader reader;
Expand All @@ -68,7 +68,7 @@ class ClusterCommand : public ModelCommand {
return ClusterCommand::SendCommand(device, endpointId, mClusterId, mCommandId, commandFields);
}

CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId, chip::ClusterId clusterId,
CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId, chip::ClusterId clusterId,
chip::CommandId commandId, id _Nonnull commandFields)
{
uint16_t repeatCount = mRepeatCount.ValueOr(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ModelCommand : public CHIPCommandBridge
CHIP_ERROR RunCommand() override;
chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(10); }

virtual CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endPointId) = 0;
virtual CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endPointId) = 0;

private:
chip::NodeId mNodeId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@

MTRDeviceController * commissioner = CurrentCommissioner();
ChipLogProgress(chipTool, "Sending command to node 0x" ChipLogFormatX64, ChipLogValueX64(mNodeId));
[commissioner getDevice:mNodeId
queue:callbackQueue
completionHandler:^(MTRDevice * _Nullable device, NSError * _Nullable error) {
if (error != nil) {
SetCommandExitStatus(error, "Error getting connected device");
return;
}

CHIP_ERROR err;
if (device == nil) {
err = CHIP_ERROR_INTERNAL;
} else {
err = SendCommand(device, mEndPointId);
}

if (err != CHIP_NO_ERROR) {
ChipLogError(chipTool, "Error: %s", chip::ErrorStr(err));
SetCommandExitStatus(err);
return;
}
}];
[commissioner getBaseDevice:mNodeId
queue:callbackQueue
completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) {
if (error != nil) {
SetCommandExitStatus(error, "Error getting connected device");
return;
}

CHIP_ERROR err;
if (device == nil) {
err = CHIP_ERROR_INTERNAL;
} else {
err = SendCommand(device, mEndPointId);
}

if (err != CHIP_NO_ERROR) {
ChipLogError(chipTool, "Error: %s", chip::ErrorStr(err));
SetCommandExitStatus(err);
return;
}
}];
return CHIP_NO_ERROR;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ReadAttribute : public ModelCommand {

~ReadAttribute() {}

CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId) override
CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId) override
{
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
MTRReadParams * params = [[MTRReadParams alloc] init];
Expand Down Expand Up @@ -125,7 +125,7 @@ class SubscribeAttribute : public ModelCommand {

~SubscribeAttribute() {}

CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId) override
CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId) override
{
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
MTRSubscribeParams * params = [[MTRSubscribeParams alloc] init];
Expand Down Expand Up @@ -195,7 +195,7 @@ class SubscribeEvent : public ModelCommand {

~SubscribeEvent() {}

CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId) override
CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId) override
{
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class WriteAttribute : public ModelCommand {

~WriteAttribute() {}

CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId) override
CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId) override
{
chip::TLV::TLVWriter writer;
chip::TLV::TLVReader reader;
Expand All @@ -69,7 +69,7 @@ class WriteAttribute : public ModelCommand {
return WriteAttribute::SendCommand(device, endpointId, mClusterId, mAttributeId, value);
}

CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId, chip::ClusterId clusterId,
CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId, chip::ClusterId clusterId,
chip::AttributeId attributeId, id _Nonnull value)
{
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ - (nullable NSData *)storageDataForKey:(NSString *)key

- (BOOL)setStorageData:(NSData *)value forKey:(NSString *)key
{
return CHIPSetDomainValueForKey(kCHIPToolDefaultsDomain, key, value);
return MTRSetDomainValueForKey(kCHIPToolDefaultsDomain, key, value);
}

- (BOOL)removeStorageDataForKey:(NSString *)key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@interface CHIPToolKeypair : NSObject <MTRKeypair>
- (BOOL)initialize;
- (NSData *)ECDSA_sign_message_raw:(NSData *)message;
- (NSData *)signMessageECDSA_RAW:(NSData *)message;
- (SecKeyRef)publicKey;
- (CHIP_ERROR)Serialize:(chip::Crypto::P256SerializedKeypair &)output;
- (CHIP_ERROR)Deserialize:(chip::Crypto::P256SerializedKeypair &)input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (BOOL)initialize
return _mKeyPair.Initialize() == CHIP_NO_ERROR;
}

- (NSData *)ECDSA_sign_message_raw:(NSData *)message
- (NSData *)signMessageECDSA_RAW:(NSData *)message
{
chip::Crypto::P256ECDSASignature signature;
NSData * out_signature;
Expand Down

This file was deleted.

40 changes: 0 additions & 40 deletions examples/darwin-framework-tool/commands/common/MTRDevice_Externs.h

This file was deleted.

Loading
0