Assistance in using jungle files for Device Qualifiers.

For my watch application, I have separate image resources for round and rectangular watch screens, and they are defined in their own resources folders, but I'm unable to make it work with jungle files.
When I locate the two resource folders ("resources-round" and "resources-rectangle") in

A) the root of the project, the code fails to compile, "Undefined symbol.." with this code:


(new Ui.Bitmap({:rezId=>Rez.Drawables.NavIcon

,:locX=> xOffset

,:locY=> yOffset

})).draw(dc);



B) However, when the folders are located in the "resources" folder under the root of the project, the code compiles, but at run-time the round resources are being displayed on a rectangular watch.


I have made the following entries in the monkey.jungle file:

Round.resourcePath = $(base.resourcePath);resources-round

rectangle.resourcePath = $(base.resourcePath);resourcse-rectangle



But they don't seem to operate.

It seems that the correct approach should be A), but I'm unable to make it work.





(Mac, High Sierra, Eclipse Oxygen, SDK 3.0.3)
  • You get the duplicate symbols with auto build, correct? With autobuild, there is no target, so it's neither round nor rectangle so nothing is excluded and you get a duplicate. That's why the mention of having a default came up in earlier posts.

    You can just ignore errors in auto build, and only look into them when you use a specific target, or as Travis said, disable auto build and always build for a specific target.
  • but the compiler now flags that as an error:
    Duplicate declaration of symbol drawIcons in class DashboardView.


    I think that's the same issue with the automatic builds that Travis mentioned. I think the best solution (which will allow Run No Evil to work *) would be to add a default exclude annotation, as Jim mentioned. e.g.
    base.excludeAnnotations = round

    (*) Run No Evil won't start if the default build fails, and I don't see a way to ignore duplicate symbol errors (which is probably a good thing)

    Anyway here's my monkey.jungle file (this is actually how I had in the first place):
    project.manifest = manifest.xml
    round.excludeAnnotations = rectangle
    rectangle.excludeAnnotations = round


    The app code is the same as above.

    Test cases:
    645: Prints "round"
    VAHR: Prints "rectangle"
    230: Does not compile, due to duplicate symbol error (this one is expected)

    Not sure why it's not working for you. Do you have "round.excludeAnnotations = " or "rectangle.excludeAnnotations =" anywhere else in your project?
  • Yes, you're right. The duplicate symbols error appears with auto build and goes away when building for a target, so I can remove the calls to separate functions depending on screen shape, and thus eliminate the need for the totally confusing syntax in jungles.
    I had duplicate function calls in my earlier code, but when I returned to it 12 months later with an updated SDK 3 and got the BUILD errors, I incorrectly assumed the worst.

    But I'm still convinced round.excludeAnnotations = rectangle doesn't work
    Thanks.
    Woudn't it be nice to have this stuff documented in a single place?
    (and boy, I'm totally over clicking on buses, hills and traffic lights!)
  • What you can do is do something like

    base.excludeAnnotations=round

    as the second line

    If no target (auto builds) it should work and then will set correctly for the other targets.
  • jim_m_58 Travis.ConnectIQ I noticed that Run No Evil won't work if the default build fails (as far as I can tell), so the choices are:
    - Don't use excludeAnnotations in a way that defines duplicate symbols for the default build, which probably leads to redundant code
    or
    - Don't use automatic unit tests
    or
    - Use a hack in the jungle file, which is understandably not recommended (*)

    (*) According to an edited version of the previous post.

    Seems to like the jungle file hack is the only solution that covers all the bases.

    Maybe the default build could use one of the devices from the configured project targets?
  • But I'm still convinced round.excludeAnnotations = rectangle doesn't work
    Thanks.


    No worries. For what it's worth, here's a complete watch-app project with pretty much the code I posted above. I generated it using the CIQ project wizard. It only has two targets: 645 and VAHR.

    If you want, try running it for each target and let me know what the console prints out: "rectangle" or "round.

    Sorry for the dropbox link, but the forum won't let me attach the file.
    https://www.dropbox.com/s/6eihr4phqq1jdmq/CiqTestAnnotations.zip?dl=1
  • No worries. For what it's worth, here's a complete watch-app project with pretty much the code I posted above. I generated it using the CIQ project wizard. It only has two targets: 645 and VAHR.



    It works as you describe. I'll have to investigate further.
    Thanks.
  • Will has figured it out... Device information is inherited. Consider the fenix5 device qualifier. It inherits attributes of the base qualifiers...

    base <= round <= round-240x240 <= fenix5


    If you specify an entry like this..

    fenix5.excludeAnnotations = rectangle


    You will break the inheritance for fenix5. You will have to explicitly specify each exclude for each device, which will become unmaintainable really quick.

    If you take advantage of the inheritance, you can greatly simplify the jungle file shown above..

    fenix5.excludeAnnotations = rectangle
    fr645.excludeAnnotations = rectangle
    fr645m.excludeAnnotations = rectangle
    fenix5s.excludeAnnotations = rectangle
    fenix5plus.excludeAnnotations = rectangle
    fenix5splus.excludeAnnotations = rectangle
    fenix5x.excludeAnnotations = rectangle
    fenix5xplus.excludeAnnotations = rectangle
    fenixchronos.excludeAnnotations = rectangle
    round.excludeAnnotations = rectangle
    fr935.excludeAnnotations = rectangle
    vivoactive_hr.excludeAnnotations = round


    You can accomplish exactly the same (and more) with this..

    round.excludeAnnotations = $(round.excludeAnnotations);rectangle;semiround
    rectangle.excludeAnnotations = $(rectangle.excludeAnnotations);round;semiround
    semiround.excludeAnnotations = $(semiround.excludeAnnotations);round;rectangle


    If you want to add support for another device, the correct excludes will be picked up automatically... all because of the inheritance. You just have to make sure you have the correct resources for the device, and enable it in the manifest.
  • I feel like I'm in a conversation in a foreign language that I am picking up by trial and error and for which I have not found the language guide!

  • In college, I had to take a foreign language to graduate. I was talking to the teacher my 3rd semester and she said it was a really stupid requirement for computer science people, as they could talk to computers and she sure couldn't with a master's degree!