Complete

Compiler doesn't complain about invalid device id (argument to "-d") in compiler options; causes an issue if "--disable-api-has-check-removal" option is accidentally specified with one leading hyphen instead of two

The Monkey C compiler doesn't complain about invalid device id (argument to "-d") in compiler options, because the VS Code Monkey C extension build system already specifies a valid device id earlier in the command line.

This is a problem because someone could accidentally add the option "-disable-api-has-check-removal" (for example), with one leading hyphen instead of two. They might think that "--disable-api-has-check-removal" was specified, even though it wasn't, especially since the compiler would not emit a warning or error.

I know this is a plausible scenario because that advice was just given in the CIQ forums:

https://forums.garmin.com/developer/connect-iq/f/discussion/398737/ciq-system-8---no-announcement---but-fenix-8-series-spoil-the-information/1876027#1876027

Observed behavior:

- I specify "-disable-api-has-check-removal" as a compiler command line option in the monkey c vs code settings

- I expect the compiler to emit the following error (or something similar): "Invalid device id: isable-api-has-check-removal". (Because a single hyphen specifies a short option, and any characters beyond the first letter of a short option are treated as the argument to that option. This can be verified by manually running the compiler with a command line such as "-dfr965" (no space between "-" and "fr965") and observing that it still works properly

Actual behavior:

- I specify "-disable-api-has-check-removal" as a compiler command line option in the monkey c vs code settings

- The compiler emits no warning or error

Example command line:

java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar %APPDATA%\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-7.4.3-2024-12-11-90ec25e45\bin\monkeybrains.jar -o bin\makeImageRequestTEST.prg -f project_path\monkey.jungle -y "key_path\developer_key" -d fr965_sim -w -O 3 -disable-api-has-check-removal

  • However it is still the case that a bad 2nd argument to "-d" will be ignored. Maybe it's not so much of a problem though.

    java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar %APPDATA%\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-7.4.3-2024-12-11-90ec25e45\bin\monkeybrains.jar -o bin\app.prg -f project_path\monkey.jungle -y "key_path\developer_key" -w -O 3 -dfr965 -dbad

    No error

    --

    java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar %APPDATA%\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-7.4.3-2024-12-11-90ec25e45\bin\monkeybrains.jar -o bin\app.prg -f project_path\monkey.jungle -y "key_path\developer_key" -w -O 3 -dbad

    ERROR: Invalid device id specified: 'bad'.

  • My reasoning for why I think it works properly:

    java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar %APPDATA%\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-7.4.3-2024-12-11-90ec25e45\bin\monkeybrains.jar -o bin\app.prg -f project_path\monkey.jungle -y "key_path\developer_key" -w -O 3 -disable-api-has-check-removal

    No error

    --

    java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar %APPDATA%\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-7.4.3-2024-12-11-90ec25e45\bin\monkeybrains.jar -o bin\app.prg -f project_path\monkey.jungle -y "key_path\developer_key" -w -O 3 -d isable-api-has-check-removal

    ERROR: Invalid device id specified: 'isable-api-has-check-removal

    --

    java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar %APPDATA%\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-7.4.3-2024-12-11-90ec25e45\bin\monkeybrains.jar -o bin\app.prg -f project_path\monkey.jungle -y "key_path\developer_key" -w -O 3 -disable-api-has-check-removalx

    ERROR: Invalid device id specified: 'isable-api-has-check-removalx

  • EDIT: actually I think I'm wrong and "-disable-api-has-check-removal work as expected.

    Sorry for the noise.