Is there a way to detect changes in a barrel during development and rebuild it when I run my app?

This is my barrels.jungle in my DemoDF datafield. DemoDF is to demonstrate the features of the barrel plus this is the way I develop and test the barrel.

Flocsy = [../../barrel/monkey.jungle]
base.barrelPath = $(base.barrelPath);$(Flocsy)
base.Flocsy.annotations = foo

Every time I change anything in the barrel (let's say an mc file) and then I Run the DemoDF again, it just starts the already compiled version instead of rebuilding it (like when I change some file inside the DemoDF app). Currently my "workaround" is to edit barrels.jungle (add/remove an empty line, then save it) and then Run the DemoDF app. After this it does rebuild it.

I have the feeling that there's a better way to do it, without this workaround. How do you do this?

  • When you edit the mc file. do you rebuild that barrel project (a new .barrel?)

    a barrel is basically just a zip of the barrel project, and when you build a project that uses that barrel. the .barrel is "unzipped" and built for each target in the calling app

    Last I checked (it's been a while) using a barrel and not just directly using the mc file in the main app added about 1k of overhead.

    When I do barrel project, I write them such that I can use the barrel or directly use the mc file

  • No, and in order not to confuse the compiler I even totally removed the .barrel file and everything else from the bin/ directory under the barrel project.

    Foo/
    Foo/barrel/: monkey.junge, manifest.xml, sources...
    Foo/sample/DemDF/: barrels.jungle, monkey.jungle, manifest.xml, sources, resources...

    step 1. Window #1. I edit the source under Foo/barrel/source/Foo.mc
    step 2. Window #2. I "Run App" or "Run without Debugging", where I have the project under Foo/sample/DemDF/

    BTW: how do you "write them such that I can use the barrel or directly"?

  • So that in barrels.jungle for the main app I can have the .barrel file,

    or have nothing in barrels.jungle and in the monkey.jungle file I include the path to the mc file along with my normal source, like this:

    base.sourcePath=$(srcBase);$(barBgWu);$(barBgSettings)

    where barBgWU is
    barBgWu=..\BgWu
    (Thats the root of the barrel project)
    I've done this since barrels were first introduced as there are some devices that don't support barrels so on those I use the mc file.
  • Which devices don't "support" barrels? I thought this is completely in compile time, and the generated code has no knowledge whether you used a barrel, included the mc as you did or if I would copy & paste the mc into my project.

  • Ok, just tried a project with a barrel on the original vivoactive and got this:


    "ERROR: vivoactive: Monkey Barrel dependencies were detected during Jungle file processing. Device 'vivoactive' does not support Monkey Barrels."

    It's not just compile time, as you'll also see things if you use resources in the barrel

  • I point to the folder where the mc file is for the barrel.  No copy/paste.  The exact same mc file is used in both cases.

    It's in fact how I also share code between multiple apps where the .barrel isn't used.

  • Hmmmmmm. I also see this, but I think this is some bug. I mean it is possible that vivoactive is not supposed to work with barrels, that's strange but acceptable, however why the latest SDK doesn't know this? I mean vivoactive is in my barrel's manifest. It does allow me to add it. Why? But it even exports the barrel, and even then it didn't say a work about vivoactive. Only when we try to run an app that tries to use it.

    Garmin, what do you say?

  • Search the forums for barrels and look at posts from when CIQ1 was common, barrels were new and questions like yours were common

    I see the error when I try to compile an app that uses a barrel on a CIQ1 device.  Consider the case where you already had a CIQ1 device in the manifest and then tried to add a barrel.  This would be the proper error.. Same as if you added a CIQ 1 device to a project that uses barrels

    You now know that you can't use barrels on CIQ1 devices.

  • So why they show up in the manifest editor? If you're right then that's the bug probably.

    Anyway my original question wasn't answered and your way (to add the source to the app that is using the barrel) also doesn't work in my case, because I am generating the monkey/jungle of the barrel and the source files for each device in the barrel, so it only works properly when I include them in the barrels.jungle.

    Only that the Monkey C plugin of VSC would need a slight improvement to allow it to detect changes in the barrel. I guess it probably only checks for the version of the barrel, but I guess that I am not the only developer who changes code in a barrel and then wants to see it in actions and not bumping the version all the time during development.