Acknowledged

solved: bug: project.optimization and project.typecheck settings are ignored by compiler in VSC

EDIT: SOLVED:

I use SDK 4.1.7. In my monkey.jungle I have:

project.typecheck = 3
project.optimization = 2z

If I set anything in the Monkey C VSC extension's settings: Compiler Options, then I get the following warning:

WARNING: The optimization level is specified both at the command line and in a Jungle file. The Jungle file specification will be ignored.

However when I leave the Compiler Options empty then there's no -O option passed to the compiler.

Similarily, When the Type Check Level is set to anything but Default then I get the warning:

WARNING: The type check level is specified both at the command line and in a Jungle file. The Jungle file specification will be ignored.

However when I set Type Check Level to Default, then no -l option is passed to the compiler.

Executing task: java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-4.1.7-2022-11-21-562b8a195/bin/monkeybrains.jar -o bin/MyApp.prg -f MyApp/monkey.jungle;MyApp/barrels.jungle -y garmin_developer_key.der -d fenix6_sim -w

My launch.json looks like this:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "monkeyc",
            "request": "launch",
            "name": "Run App",
            "stopAtLaunch": false,
            "device": "${command:GetTargetDevice}"
        },
        {
            "type": "monkeyc",
            "request": "launch",
            "name": "Run Tests",
            "runTests": true,
            "device": "${command:GetTargetDevice}"
        }
   ]
}

  • Hi Jim. The first 3 lines work fine. If I try to add any of the next three, I get errors. Seems I can set these compile options in monkey.jungle?

  • OK, you are right again. When I added this code at the beginning of the constructor of the app:

    var stats = System.getSystemStats();
    log("t: " + stats.totalMemory + ", f: " + stats.freeMemory + ", u: " + stats.usedMemory);
    Then I can see the difference:

    -O2z: t: 29200, f: 3648, u: 25552

    -O1: t: 29200, f: 3144, u: 26056

    So it does work. I still think it is a bit confusing that there is no visual feedback on this when it "works", only when there's a warning that it's being set both in the settings and in the jungle. I would like to see this on the log.

  • Same for optimization in monkey.jungle.  This gives far more control on a project by project basis..

  • This is how it works and was designed to work.  The project.typecheck=x in the monkey.jungle is only used if the typecheck level in the VS C extension is set to "default".  There is no -l specified on the compiler command line, but it does use type checking ("gradual" it appears) - that's the "default" with the current SDKs.  If you specify something other than default, you see a -l on the command line

    With default, and an old app of mine throws all kinds or warnings with this command line:

     Executing task in folder SimPiT: C:\ciq\java\jdk-17.0.2\bin\java.exe -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar c:\Users\James\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-4.2.0.beta2-2023-01-18-feb362b89\bin\monkeybrains.jar -o bin\SimPiT.prg -f c:\Users\James\workspace-prod\SimPiT\monkey.jungle -y c:\users\james\google drive\ciq.key -d fenix5plus_sim -w 

    When I set gradual, I see

     Executing task in folder SimPiT: C:\ciq\java\jdk-17.0.2\bin\java.exe -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar c:\Users\James\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-4.2.0.beta2-2023-01-18-feb362b89\bin\monkeybrains.jar -o bin\SimPiT.prg -f c:\Users\James\workspace-prod\SimPiT\monkey.jungle -y c:\users\james\google drive\ciq.key -d fenix5plus_sim -w -l 1

    and the same errors/warnings are thrown.

    I keep the extension at "default" and use project.typecheck for apps where I want to use a different level of typechecking than the "default"