Batch Compile/Export

After an SDK update, I generally re-export my Barrels, then recompile and export all my CIQ apps.

Right now I have to do this one at a time. I have 4 barrels and a bunch of fields. That is a whole lot of time to wait for each to complete before starting the next.

Anyone have a Windows BAT file that automates these actions to compile and export a list of projects?

Thanks!

  • Here's a modified version of what I use. Windows CMD scripting is terrible compared to bash or even powershell, so I didn't bother to make it fancy.

    export.bat

    @echo off
    setlocal EnableDelayedExpansion
    
    rem Usage: export PROJECT_FOLDER_WITH_JUNGLE [ADDITIONAL_FOLDERS_WITH_JUNGLES...]
    
    rem Edit the following 2 lines
    set EXPORTPATH=PATH\TO\EXPORT\FOLDER
    set DEVKEY=PATH\TO\DEV\KEY
    
    for /F "tokens=* USEBACKQ" %%F in (`type "%appdata%\garmin\connectiq\current-sdk.cfg"`) do (
      SET CIQSDKPATH=%%F
    )
    
    SET JUNGLES=
    
    for %%d in (%*) do (
      for %%j in (%%d\*.jungle) do (
        set JUNGLES=!JUNGLES!%%j;
      )
    )
    
    rem Use project folder name as export filename
    for %%A in (%1) do (set PROJECT_FOLDER_NAME=%%~nxA)
    
    @echo on
    "%CIQSDKPATH%\bin\monkeyc" -o "%EXPORTPATH%\%PROJECT_FOLDER_NAME%.iq" -e -w -y "%DEVKEY%" -r -f "%JUNGLES%"
    

    The java executable has to be in your path for this to work.

    If it isn't, replace the final two lines (starting with @echo on) with:

    SET JAVA=\PATH\TO\JAVA
    @echo on
    "%JAVA%" -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar "%CIQSDKPATH%\bin\monkeybrains.jar" -o "%EXPORTPATH%\%1.iq" -e -w -y "%DEVKEY%" -r -f "%JUNGLES%"


    export_all.bat (example usage of export.bat)

    pushd
    cd /D "%~dp0"
    
    call .\export AwesomeProject1
    call .\export AwesomeProject2
    
    REM build a project which has jungle files in two folders (AwesomeLibrary is not a barrel)
    call .\export AwesomeProject3 AwesomeLibrary
    
    popd

    Folder structure for this example:

    dev\
    |
    |--- projects\
            |
            |-------export.bat
            |
            |-------export_all.bat
            |
            |-------AwesomeProject1\
            |            |
            |            ---- monkey.jungle
            |-------AwesomeProject2\
            |            |
            |            ---- monkey.jungle
            |-------AwesomeProject3\
            |            |
            |            ---- monkey.jungle
            |-------AwesomeLibrary\
                         |
                         ---- monkey.jungle

    I don't use barrels, so not sure if you'll need to tweak anything to get barrels to build.