Skip to content

Commit

Permalink
Merge branch 'master' into remove-chip-time-define
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored Oct 21, 2022
2 parents e20a3d8 + a325034 commit a817bc5
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/guides/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ that generates inputs to [ninja](https://ninja-build.org/).
Tested on:

- macOS 10.15
- Debian 11
- Debian 11 (64 bit required)
- Ubuntu 22.04 LTS

Build system features:
Expand Down
55 changes: 41 additions & 14 deletions scripts/tools/zap_regen_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,25 @@
import sys
import subprocess
import logging
from dataclasses import dataclass

CHIP_ROOT_DIR = os.path.realpath(
os.path.join(os.path.dirname(__file__), '../..'))


@dataclass(eq=True, frozen=True)
class ZapDistinctOutput:
"""Defines the properties that determine if some output seems unique or
not, for the purposes of detecting codegen overlap.
Not perfect, since separate templates may use the same file names, but
better than nothing.
"""

input_template: str
output_directory: str


class ZAPGenerateTarget:
def __init__(self, zap_config, template=None, output_dir=None):
self.script = './scripts/tools/zap/generate.py'
Expand All @@ -38,6 +52,9 @@ def __init__(self, zap_config, template=None, output_dir=None):
else:
self.output_dir = None

def distinct_output(self):
return ZapDistinctOutput(input_template=self.template, output_directory=self.output_dir)

def log_command(self):
"""Log the command that will get run for this target
"""
Expand Down Expand Up @@ -135,10 +152,17 @@ def getGlobalTemplatesTargets():
logging.info("Found example %s (via %s)" %
(example_name, str(filepath)))

generate_subdir = example_name

# Special casing lighting app because separate folders
if example_name == "lighting-app":
if 'nxp' in str(filepath):
generate_subdir = f"{example_name}/nxp"

# The name zap-generated is to make includes clear by using
# a name like <zap-generated/foo.h>
output_dir = os.path.join(
'zzz_generated', example_name, 'zap-generated')
'zzz_generated', generate_subdir, 'zap-generated')
targets.append(ZAPGenerateTarget(filepath, output_dir=output_dir))

targets.append(ZAPGenerateTarget(
Expand All @@ -162,19 +186,6 @@ def getTestsTemplatesTargets(test_target):
}
}

# Place holder has apps within each build
for filepath in Path('./examples/placeholder').rglob('*.zap'):
example_name = filepath.as_posix()
example_name = example_name[example_name.index(
'apps/') + len('apps/'):]
example_name = example_name[:example_name.index('/')]

templates[example_name] = {
'zap': filepath,
'template': 'examples/placeholder/templates/templates.json',
'output_dir': os.path.join('zzz_generated', 'placeholder', example_name, 'zap-generated')
}

targets = []
for key, target in templates.items():
if test_target == 'all' or test_target == key:
Expand Down Expand Up @@ -223,6 +234,22 @@ def getTargets(type, test_target):
for target in targets:
target.log_command()

# validate that every target as a DISTINCT directory (we had bugs here
# for various examples duplicating zap files)
distinct_outputs = set()
for target in targets:
o = target.distinct_output()

if o in distinct_outputs:
logging.error("Same output %r:" % o)
for t in targets:
if t.distinct_output() == o:
logging.error(" %s" % t.zap_config)

raise Exception("Duplicate/overlapping output directory: %r" % o)

distinct_outputs.add(o)

return targets


Expand Down
26 changes: 14 additions & 12 deletions src/darwin/Framework/Matter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,9 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-Wl,-unexported_symbol,\"__Z*\"";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvos appletvsimulator watchos watchsimulator";
SUPPORTS_TEXT_BASED_API = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -897,7 +897,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.csa.matter;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
TARGETED_DEVICE_FAMILY = "1,2";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
};
name = Debug;
};
Expand All @@ -914,7 +915,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.chip.CHIPTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
};
name = Debug;
};
Expand Down Expand Up @@ -969,9 +970,9 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-Wl,-unexported_symbol,\"__Z*\"";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvos appletvsimulator watchos watchsimulator";
SUPPORTS_TEXT_BASED_API = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1018,14 +1019,14 @@
"-Wformat-security",
);
OTHER_LDFLAGS = "";
"OTHER_LDFLAGS[arch=*]" = (
"-lnetwork",
"OTHER_LDFLAGS[sdk=*]" = (
"-framework",
CoreData,
"-framework",
Foundation,
"-framework",
CoreBluetooth,
"-framework",
CoreData,
"-lnetwork",
"-Wl,-unexported_symbol,\"__Z*\"",
);
"OTHER_LDFLAGS[sdk=macosx*]" = (
Expand All @@ -1044,8 +1045,9 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.csa.matter;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = iphoneos;
STRIP_STYLE = "non-global";
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
};
name = Release;
};
Expand All @@ -1063,7 +1065,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.chip.CHIPTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
};
name = Release;
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a817bc5

Please sign in to comment.