Announcement

Collapse
No announcement yet.

Assistance in using jungle files for Device Qualifiers.

Collapse
X
  • Time
  • Show
Clear All
new posts

  • 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:


    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:

    Code:
    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)
    Last edited by RaceQs; 10-21-2018, 08:36 PM.
    raceQs sailboat racing app.

  • #2
    Why do you override the round.resourcepath with the base.resourcepath?
    I would expect this:
    Code:
    Round.resourcePath = $(Round.resourcePath);whatever you want to add here...
    (On a side-note personally I don't use the common device qualifiers such as round and rectangle, but go for the per device qualifiers instead as we have seen in the past that for instance the fenix5s changed fonts all of the sudden.)

    Another thing I do is place my jungle specific resources in another folder but the resources* folder, this allows me to combine the common system (and place whatever I want in there, eg language specific files), and my own jungle system where the files reside in the _jungle folder.
    a simple example:

    Code:
    project.manifest = manifest.xml
    
    #ciq1
    fr230.resourcePath = $(fr230.resourcePath);_jungle\ciq1\properties_ciq1.xml
    
    #just copy it to the fr235 as it should act the same as the fr230 for this app
    fr235.resourcePath = $(fr230.resourcePath)
    My best Connect IQ apps:Other:

    Comment


    • #3
      Hi RaceQs , is it possible this is just a typo? I see that your resources-rectangle is mispelled in the code snippet you shared:

      Code:
       
       rectangle.resourcePath = $(base.resourcePath);resourcse-rectangle
      Also, you should be able to go with option A without adding those instructions into your jungle file. The default.jungle will apply the following instructions for you if you have the folders in your root project directory:

      Code:
      # Set the base properties, base represents the root of the Monkey C Project
      base.sourcePath = .\**.mc
      base.resourcePath = resources
      
      # Set the round family qualifier
      round = $(base)
      round.resourcePath = $(round.resourcePath);resources-round
      
      # Set the rectangle family qualifier
      rectangle = $(base)
      rectangle.resourcePath = $(rectangle.resourcePath);resources-rectangle
      These instructions should accomplish what you seem to be attempting to build unless I have misunderstood your intent. Please let me know if that works for you - otherwise, I would be happy to investigate further.

      Marianne

      Comment


      • #4


        Hi peterdedeker, I "overrode the round.resourcepath with the base.resourcepath" because I really don't understand the syntax, thanks. Your suggestions re device specific qualifiers is good, thanks.

        Hi Marianne , yes a typo that I caught later, but not the base problem.

        I copied your code but still get compile errors "Undefined symbol {...} detected" for all the symbols referenced in the round and rectangle resource files.

        I suspect I have made some kindergarten error in referencing them:

        Code:
        (new Ui.Bitmap({:rezId=>Rez.Drawables.NavIcon
        
                   ,:locX=> xOffset
        
                   ,:locY=> yOffset
        
                   })).draw(dc);
        I have, for example, a NavIcon in both locations


        (I keep getting obscure errors from the Forum site like

        Error while saving content: SyntaxError: JSON Parse error: Unexpected identifier "Please", so have gone with a vanilla layout.)
        Here's some screenshots (I was unable to paste images!)

        PS it all worked fine when I last worked on it last year in SDK 2.? on my Win10/Eclipse Neon. I've been absent since then and have only just returned to the strange new world of Mac/SDK 3, Eclipse Oxygen)
        Last edited by RaceQs; 10-22-2018, 02:58 PM.
        raceQs sailboat racing app.

        Comment


        • #5
          RaceQs, your screenshots seem to suggest a combination of things could be tricking you up. Undefined symbol checking is a more recent feature of the compiler. That feature in combination with Jungles and our resource overriding system could be causing these errors. Are you getting them when you actually build for a round / rectangle device (either by launching the simulator or exporting the app)? Or are you only seeing the errors for an automatic build of the project?

          An automatic build of the project does not have any device context - it just builds the source / resources defined for the base qualifier within the Jungle. Your base qualifier, as is currently defined, pulls in all the source code within the root of the project. That source code is referencing symbols that never actually get defined for an automatic build because they are symbols from either resources-round or resources-rectangle specific builds.

          The beauty of Jungles is that we have really given our developers the power to define their project builds in whatever way works best for them. If what I suggested is the case, then there are a number of ways that you can use Jungles to get around these automatic build errors if they bother you. It just depends on which way you would prefer to do it:
          • You could set automatic (base) builds to a default device
          • You could only pull source code that is the not referencing the Rez module into base auto-builds, then add that source code just to builds with a device context
          • You could possibly use (if it makes sense) excluded annotations
          For example, if you want to set a default device:
          Code:
          # Set the base properties, base represents the root of the Monkey C Project
          base.sourcePath = .\**.mc
          base.resourcePath = resources;resources-round
          
          # Set the round family qualifier
          round = $(base)
          
          # Set the rectangle family qualifier
          rectangle = $(base)
          rectangle.resourcePath = $(rectangle.resourcePath);resources-rectangle
          Please let me know if this helps,
          Marianne

          Comment


          • #6
            Thanks for the additional info.
            I'm seeing the errors for an automatic build of the project.

            When use your first suggestion, a default device, set to rectangle, the build now fails only on the round code even though I am using the excludeAnnotations.
            Code:
            project.manifest = manifest.xml
            
            round.excludeAnnotations = rectangle
            
            rectangle.excludeAnnotations = round
            and
            Code:
            (:round)
            
                function drawRoundIcons(dc, drawLines) {
            
                     var yOffset = 2;
            
                    if (drawLines){
            
                            dc.setColor(0xFFFFFF, 0xFFFFFF);
            
                             dc.drawLine (screenWidth/2 - 89, 101, screenWidth/2 + 89, 101);
            
                             dc.drawLine (screenWidth/2 - 76, 165, screenWidth/2 + 76, 165);
            
            ....
                    if (isTouchScreen){
            
                         horizNavIcon.draw(dc);}
            
                     else{
            
                                  //screen navigation buttons - arrow-04
            
                         (new Ui.Bitmap({:rezId=>Rez.Drawables.navButtons
            
                        ,:locX=> 4
            
                        ,:locY=> 89
            
                        })).draw(dc);
            
                    }
            
            
            
            
                 }
            ....
            
            
                     }
            It looks like the excludeAnnotations isn't working as expected.

            Just for clarification, in my code, the "navButtons" is only defined for round devices, and so I would have thought the excludeAnnotations for round would not encounter the round code.

            [LATE NEWS]
            Seems the builder it not recognising that the viviactive-hr is not a round device:
            When I use vivoactive_hr.excludeAnnotations = round instead of
            round.excludeAnnotations, it does exclude the (:round) code when building for the VA-HR.
            Maybe I should have listened to @peterdedeker in the first place!
            Last edited by RaceQs; 10-22-2018, 05:34 PM.
            raceQs sailboat racing app.

            Comment


            • #7
              Originally posted by RaceQs View Post
              I'm seeing the errors for an automatic build of the project.
              This is because your base does not have the excludedAnnotations code.

              The base part is used for two things:
              - automatic build
              - inclusion in device specific builds (unless overriden)

              so as an example:
              Code:
              project.manifest = manifest.xml
              
              #fix autobuild
              base.sourcePath = $(round.sourcePath)
              base.resourcePath = $(round.resourcePath)
              base.excludedAnnotations = $(round.excludedAnnotations)
              # take care with the latter as a side-effect of this is if you for instance in your rectangle instructions you have no excludedAnnotations it will include the base excludedAnnotations. This side-effect was the cause of a bug in my sources :)  
              
              round.sourcePath = $(round.sourcePath);any extra folders you may want
              round.resourcePath = $(round.resourcePath);any extra folders you may want
              round.excludedAnnotations = rectangle  
              
              rectangle.sourcePath = $(rectangle.sourcePath);any extra folders you may want
              rectangle.resourcePath = $(rectangle.resourcePath);any extra folders you may want
              rectangle.excludedAnnotations = round
              For the automatic build errors you can change these to build warnings by including the following compiler directive (I'd wish this was the default behavior as it gives all the benefits without the downsides of the syntax checking):
              Code:
              --Eno-invalid-symbol
              The vivoactive hr not being recognized as a rectangular device might be indeed a bug though...



              Last edited by peterdedecker; 10-23-2018, 02:38 AM.
              My best Connect IQ apps:Other:

              Comment


              • #8
                What's happening is with auto-build there's no actual build target, so that's why you need defaults as Peter indicated. You can see if this is the problem by building with an actual target, even if you got an error with the auto-build.

                I just added this to one of my apps as a test:
                Code:
                rectangle.sourcePath= $(srcBase);source-maps
                rectangle.resourcePath = $(resBase);resources-maps
                and it worked as expected for the va-hr (built it using maps), so not sure why it's not for you with the vahr. I'm using the 3.0.3 SDK.
                My Connect IQ Apps in the Store
                Facebook - Instagram -
                Twitter

                Comment


                • #9
                  Thanks Jim and Peter, I agree with both of you. Unfortunately, the --Eno-invalid-symbol compiler flag is not documented yet. However, there is a ticket open to do so. That is also a way that you could suppress the build errors for an auto-build. These would now just be warnings.

                  Comment


                  • #10
                    @peterdedeker Could I ask you to check out the possible bug with the VA-HR not being recognised as round? I'm not yet sure of may way around this part of the woods.
                    raceQs sailboat racing app.

                    Comment


                    • #11
                      The va-hr isn't round. In post 8, I verified it's one of the rectangles and works as that.
                      My Connect IQ Apps in the Store
                      Facebook - Instagram -
                      Twitter

                      Comment


                      • #12
                        Originally posted by peterdedecker View Post
                        The vivoactive hr not being recognized as a rectangular device might be indeed a bug though...
                        Actually the problem is that the round devices don't seem to be recognised as round in excludeAnnotations. I have had to do all this to exclude rectangle code for the round devices as
                        round.excludeAnnotations = rectangle didn't do the trick:
                        Code:
                        fenix5.excludeAnnotations = rectangle
                        fr645.excludeAnnotations = rectangle
                        fr645m.excludeAnnotations = rectangle
                        fenix5s.excludeAnnotations = rectangle
                        fenix5plus.excludeAnnotations = rectagle
                        fenix5splus.excludeAnnotations = rectangle
                        fenix5x.excludeAnnotations = rectangle
                        fenix5xplus.excludeAnnotations = rectangle
                        fenixchronos.excludeAnnotations = rectangle
                        round.excludeAnnotations = rectangle
                        fr935.excludeAnnotations = rectangle
                        vivoactive_hr.excludeAnnotations = round
                        raceQs sailboat racing app.

                        Comment


                        • #13
                          You don't want to just blanket override settings like this...

                          Code:
                            fenix5.excludeAnnotations = rectangle
                          Doing so strips out the excludeAnnotations from base configurations. i.e., if round.excludeAnnotations had an entry for the fictional flag zebra, the above like would wipe out that exclude for the fenix5. This is typically not what you want.

                          If you have resources for round devices in a resources-round folder and resources for rectangular devices in resources-rectangle, you should not need to do any further configuration from the jungle files. I've used the jungles stuff quite a bit in the last week, and I know it works.

                          You are the second person this week to mention compile errors for undefined symbols when using the automatic rebuild option. I'm not exactly sure what the best way to handle this in the jungle file, but in my experience the easiest thing to do is to disable the automatic rebuild option and build for a specific device every time.

                          Travis

                          Comment


                          • #14
                            I'm patently missing the point here, as I'm not following your response at all.

                            Originally posted by Travis.ConnectIQ View Post
                            You don't want to just blanket override settings like this...
                            If you have resources for round devices in a resources-round folder and resources for rectangular devices in resources-rectangle, you should not need to do any further configuration from the jungle files. I've used the jungles stuff quite a bit in the last week, and I know it works.
                            It's not just different resources, in my app, round and rectangle devices require differently positioned and named image resources, so I have created layout code for each class
                            and call them separately, drawRectResults(dc) needs to be excluded from round compiles and drawRoundResults(dc) needs to be excluded from rectangle compiles.

                            I expected
                            Code:
                            round.excludeAnnotations = rectangle
                            rectangle = round
                            to do this, but no, I have had to resort to excluding rectangle from each specific device as I described above.

                            (I have tried for 1/2 hr to post my code but the forum rejects with a crazy JSON error!)
                            raceQs sailboat racing app.

                            Comment


                            • #15
                              Originally posted by Travis.ConnectIQ View Post
                              You don't want to just blanket override settings like this...

                              Code:
                              fenix5.excludeAnnotations = rectangle
                              Doing so strips out the excludeAnnotations from base configurations. i.e., if round.excludeAnnotations had an entry for the fictional flag zebra, the above like would wipe out that exclude for the fenix5. This is typically not what you want.
                              I'm a little curious about this. I looked in the default.jungle file in the Connect IQ SDK and I didn't saw any references to excludeAnnotations. I'm willing to accept that the "real" default.jungle (not the one that's for reference only) could have excludeAnnotations or that it could change in the future, or that you don't want to mess with your own excludeAnnotations (in a base project/folder) by accident.

                              However, the programmer's guide has an example of what you said not to do:

                              https://developer.garmin.com/connect...ing-resources/
                              If the app is approaching memory limits, it may be useful to exclude the unused method, especially if the method is sufficiently large and impacts available memory. To do this, set the excludeAnnotations qualifier property in the Jungle file to the appropriate annotation value:
                              Code:
                              # Exclude the oldAndBustedAlgorithm() from fenix 5
                              fenix5.excludeAnnotations = older
                              Another couple of minor nitpicks about the doc:
                              - Earlier on, the doc refers to excludedAnnotations (spelled incorrectly)
                              - The online version of the doc has references to internal links (with square brackets) which only work in the offline version of the doc distributed with the SDK. Not a big deal, but it looks strange.

                              https://developer.garmin.com/connect...ing-resources/
                              The excludedAnnotations qualifier property allows build instructions to specify specific [annotations][Annotations] that will be excluded when an application is built
                              A list of supported localization qualifiers can be found in the [Appendices][] chapter.
                              Anyway, what I got from your post is that the correct code would be:
                              Code:
                              fenix5.excludeAnnotations = $(fenix5.excludeAnnotations);older
                              Last edited by WillNorthYork; 11-05-2018, 04:13 PM.

                              Comment

                              Working...
                              X