Skip to content

Commit 837867d

Browse files
authored
Merge branch 'master' into chef_fix_esp32_disable_ipv4
2 parents 3db774e + bc6b438 commit 837867d

File tree

43 files changed

+1161
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1161
-443
lines changed

.restyled.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ exclude:
7272
- "scripts/idl/tests/outputs/**/*" # Matches generated output 1:1
7373
- "examples/chef/sample_app_util/test_files/*.yaml"
7474
- "examples/chef/zzz_generated/**/*"
75-
- "src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm" # https://github.com/project-chip/connectedhomeip/issues/20236
76-
- "src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h" # https://github.com/project-chip/connectedhomeip/issues/20236
7775
- "examples/platform/nxp/k32w/k32w0/scripts/demo_generated_certs/**/*"
7876
- "integrations/cloudbuild/*.yaml" # uglier long command line content
7977

.spellcheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ matrix:
6161
# converts markdown to HTML
6262
- pyspelling.filters.markdown:
6363
sources:
64-
- '**/*.md|!third_party/**|!examples/common/**/repo/**'
64+
- '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md'
6565
aspell:
6666
ignore-case: true

build/chip/java/rules.gni

+175-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ template("java_library") {
114114
_data_deps = invoker.data_deps
115115
}
116116

117-
# Generates a .java file containing all sources to be compiled
117+
# Generates a .sources file containing all sources to be compiled
118118
_java_sources_file = "$target_gen_dir/$target_name.sources"
119119
if (defined(invoker.java_sources_file)) {
120120
_java_sources_file = invoker.java_sources_file
@@ -176,6 +176,162 @@ template("java_library") {
176176
}
177177
}
178178

179+
# Declare a Java executable target
180+
#
181+
# Manifext.txt: contains the given class as the entrypoint about the files packaged in a Java executable target.
182+
#
183+
# sources: List of .java files included in this binary. Mutually exclusive with jar_path.
184+
#
185+
# jar_path: A path to an existing JAR. Mutually exclusive with sources.
186+
#
187+
# output_name: File name for the output binary under root_build_dir/bin.
188+
#
189+
# javac_flags: additional flags to pass to the javac compiler
190+
#
191+
template("java_binary") {
192+
# Figure out the output name
193+
_jar_name = target_name
194+
if (defined(invoker.output_name)) {
195+
_jar_name = invoker.output_name
196+
} else {
197+
_jar_name += ".jar"
198+
}
199+
200+
_deps = []
201+
if (defined(invoker.deps)) {
202+
_deps = invoker.deps
203+
}
204+
205+
# What files will be compiled
206+
_java_files = []
207+
if (defined(invoker.sources)) {
208+
_java_files = invoker.sources
209+
}
210+
211+
_is_prebuilt = defined(invoker.jar_path)
212+
213+
_jar_output = ""
214+
_target_dir_name = get_label_info(":$target_name", "dir")
215+
if (_is_prebuilt) {
216+
assert(_java_files == [])
217+
_jar_output = "$root_out_dir/bin/$_target_dir_name/" +
218+
get_path_info(invoker.jar_path, "name") + ".jar"
219+
} else {
220+
_jar_output = "$root_out_dir/bin/$_target_dir_name/$_jar_name"
221+
}
222+
223+
# Generate a list containing the expected build_config filepath of every dependency.
224+
_deps_configs = []
225+
foreach(_dep, _deps) {
226+
_dep_gen_dir = get_label_info(_dep, "target_gen_dir")
227+
_dep_name = get_label_info(_dep, "name")
228+
_dep_config = "$_dep_gen_dir/$_dep_name.json"
229+
_deps_configs += [ _dep_config ]
230+
}
231+
_rebased_deps_configs = rebase_path(_deps_configs, root_build_dir)
232+
233+
# Create the name for this target's build_config.
234+
_library_target_name = target_name
235+
_build_config = "$target_gen_dir/$_library_target_name.json"
236+
_rebased_build_config = rebase_path(_build_config, root_build_dir)
237+
238+
# Write the build_config file for this target.
239+
_config_target_name = target_name + "_config"
240+
action(_config_target_name) {
241+
script = write_build_config
242+
243+
deps = _deps
244+
245+
outputs = [ _build_config ]
246+
args = [
247+
"--jar-path",
248+
rebase_path(_jar_output, root_build_dir),
249+
"--build-config",
250+
_rebased_build_config,
251+
"--deps-configs=$_rebased_deps_configs",
252+
]
253+
}
254+
255+
# Building from sources - perform Java compilation and JAR creation.
256+
if (!_is_prebuilt) {
257+
# Additional flags
258+
_javac_flags = [
259+
"-Werror",
260+
"-Xlint:all",
261+
]
262+
if (defined(invoker.javac_flags)) {
263+
_javac_flags += invoker.javac_flags
264+
}
265+
266+
# Data deps
267+
_data_deps = []
268+
if (defined(invoker.data_deps)) {
269+
_data_deps = invoker.data_deps
270+
}
271+
272+
# Generates a .sources file containing all sources to be compiled
273+
_java_sources_file = "$target_gen_dir/$target_name.sources"
274+
if (defined(invoker.java_sources_file)) {
275+
_java_sources_file = invoker.java_sources_file
276+
}
277+
write_file(_java_sources_file, rebase_path(_java_files, root_build_dir))
278+
279+
# Compiles the given files into a directory and generates a 'class list'
280+
_javac_target_name = target_name + "__javac"
281+
_class_dir = rebase_path(target_out_dir, root_build_dir) + "/classes"
282+
_class_list_file = "$target_gen_dir/$target_name.classlist"
283+
action(_javac_target_name) {
284+
sources = _java_files
285+
deps = [ ":$_config_target_name" ]
286+
287+
outputs = [ _class_list_file ]
288+
289+
script = javac_runner
290+
291+
args = [
292+
"--classdir",
293+
_class_dir,
294+
"--outfile",
295+
rebase_path(_class_list_file, root_build_dir),
296+
"--build-config",
297+
_rebased_build_config,
298+
"--",
299+
"-d",
300+
_class_dir,
301+
"@" + rebase_path(_java_sources_file, root_build_dir),
302+
] + _javac_flags
303+
}
304+
305+
# Bundles all files within the 'class directory' into a jar file
306+
action(target_name) {
307+
deps = [ ":$_javac_target_name" ] + _deps
308+
309+
data_deps = _data_deps
310+
311+
outputs = [ _jar_output ]
312+
313+
script = jar_runner
314+
315+
args = [
316+
"cfm",
317+
rebase_path(_jar_output, root_build_dir),
318+
"Manifest.txt",
319+
"-C",
320+
_class_dir,
321+
".",
322+
]
323+
}
324+
} else {
325+
# Using pre-specified JAR instead of building from sources - simply copy the JAR to the output directory.
326+
_original_jar_path = invoker.jar_path
327+
copy(target_name) {
328+
sources = [ _original_jar_path ]
329+
outputs = [ _jar_output ]
330+
deps = [ ":$_config_target_name" ] + _deps
331+
}
332+
}
333+
}
334+
179335
template("android_library") {
180336
java_library(target_name) {
181337
forward_variables_from(invoker, "*")
@@ -194,6 +350,24 @@ template("android_library") {
194350
}
195351
}
196352

353+
template("android_binary") {
354+
java_binary(target_name) {
355+
forward_variables_from(invoker, "*")
356+
357+
if (!defined(javac_flags)) {
358+
javac_flags = []
359+
}
360+
361+
javac_flags += [
362+
"-Xlint:-options",
363+
"-source",
364+
"8",
365+
"-target",
366+
"8",
367+
]
368+
}
369+
}
370+
197371
template("java_prebuilt") {
198372
java_library(target_name) {
199373
forward_variables_from(invoker, "*")

config/nrfconnect/chip-module/generate_factory_data.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ if(CONFIG_CHIP_FACTORY_DATA_USE_DEFAULT_CERTS)
6363
# convert decimal PID to its hexadecimal representation to find out certification files in repository
6464
math(EXPR LOCAL_PID "${CONFIG_CHIP_DEVICE_PRODUCT_ID}" OUTPUT_FORMAT HEXADECIMAL)
6565
string(SUBSTRING ${LOCAL_PID} 2 -1 raw_pid)
66+
string(TOUPPER ${raw_pid} raw_pid_upper)
6667
# all certs are located in ${CHIP_ROOT}/credentials/development/attestation
6768
# it can be used during development without need to generate new certifications
68-
string(APPEND script_args "--dac_cert \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-DAC-${raw_pid}-Cert.der\"\n")
69-
string(APPEND script_args "--dac_key \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-DAC-${raw_pid}-Key.der\"\n")
69+
string(APPEND script_args "--dac_cert \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-DAC-${raw_pid_upper}-Cert.der\"\n")
70+
string(APPEND script_args "--dac_key \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-DAC-${raw_pid_upper}-Key.der\"\n")
7071
string(APPEND script_args "--pai_cert \"${CHIP_ROOT}/credentials/development/attestation/Matter-Development-PAI-noPID-Cert.der\"\n")
7172
else()
7273
find_program(chip_cert_exe NAMES chip-cert REQUIRED)
@@ -79,6 +80,7 @@ string(APPEND script_args "--spake2_it \"${CONFIG_CHIP_DEVICE_SPAKE2_IT}\"\n")
7980
string(APPEND script_args "--spake2_salt \"${CONFIG_CHIP_DEVICE_SPAKE2_SALT}\"\n")
8081
string(APPEND script_args "--discriminator ${CONFIG_CHIP_DEVICE_DISCRIMINATOR}\n")
8182
string(APPEND script_args "--passcode ${CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE}\n")
83+
string(APPEND script_args "--include_passcode\n")
8284
string(APPEND script_args "--overwrite\n")
8385

8486
# check if spake2 verifier should be generated using script

0 commit comments

Comments
 (0)