project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.45k stars 1.99k forks source link

[BUG] When `matter_enable_java_compilation` is true, it assumes the build is on linux which leads to an assert on darwin platform #34586

Closed mkardous-silabs closed 2 months ago

mkardous-silabs commented 3 months ago

Reproduction steps

  1. Set the JAVA_PATH environment variable
  2. On MacOS, run the bootstrap script
  3. Bootstrap will assert because the GN files incorrectly assume the build is on linux.

Bug prevalence

Systematically

GitHub hash of the SDK that was being used

decd9e9a20

Platform

darwin

Platform Version(s)

No response

Anything else?

Failure Logs

ERROR at //src/platform/Linux/BUILD.gn:23:1: Assertion failed.
assert(chip_device_platform == "linux")
^-----
See //src/messaging/tests/java/BUILD.gn:39:15: which caused the file to be included.
    deps += [ "${chip_root}/src/platform/Linux" ]
              ^--------------------------------
['gn', 'gen', '/Users/makardou/code/connectedhomeip/.environment/gn_out', '--args=chip_crypto="boringssl" dir_pigweed="/Users/makardou/code/connectedhomeip/third_party/pigweed/repo"']

Issue is in build/chip/java/config.gni due to this conditional : if (java_path != "" && (current_os == "linux" || current_os == "mac")) {

joonhaengHeo commented 2 months ago

@mkardous-silabs Please check my PR. I modified it in the same way as the code below. https://github.com/project-chip/connectedhomeip/blob/144bfec73904d95af3bcf29511e0d53d78a8daa9/src/controller/java/BUILD.gn#L90