4.1.7 Jungle Fles

My jungle files does not work with 4.1.7 this is the way it works on 4.1.5 

source folder contains all source files (3) except the the one is different form other devices

resources folder contains every resource form all devices

source-fenix5 contains the the view file is different from other devices

source-fr920xt contains the the view file is different from other devices

and does not work


project.manifest = manifest.xml
srcBase=source
resBase=resources

base.sourcePath = $(srcBase);source-fenix5
base.resourcePath = $(resBase)

base.excludeAnnotations = source-fr920xt

fr920xt.sourcePath = $(srcBase);source-fr920xt
fr920xt.excludeAnnotations = source
fr920xt.resourcePath = $(resBase);resources-fr920xt


on try to make a folder for each device containing all files for each device and again works on 4.1.5 but not on 4.1.7 

source folder contains all source files (4) for Fenix5

resources folder contains every resource form all devices

source-fenix5 is deleted

source-fr920xt contains all source files (4) for fr920xt

and does not work, what I´m doing wrong??

the error it give me is I have is this

BUILD: ERROR: fr920xt: /Users/lcda/eclipse-workspace/PowerBikeField/PowerBikeField-master/PowerBikeField/source-fr920xt/PowerBikeFieldApp.mc:11: Redefinition of '$.PowerBikeFieldApp'. Previous definition at /Users/lcda/eclipse-workspace/PowerBikeField/PowerBikeField-master/PowerBikeField/source/PowerBikeFieldApp.mc:11.



project.manifest = manifest.xml
srcBase=source
resBase=resources

base.sourcePath = $(srcBase)
base.resourcePath = $(resBase)

base.excludeAnnotations = source-fr920xt

fr920xt.sourcePath = source-fr920xt
fr920xt.excludeAnnotations = source
fr920xt.resourcePath = $(resBase);resources-fr920xt

  • You shouldn't have PowerBikeFieldApp.mc in source

  • But unless you only support fenix5 and fr920xt, you also need a source folder for devices which are not fenix5 or fr920xt. (Assuming that fenix5 has differences with other devices)

    To modify the original example, I think you need:

    source: source files which are common to all devices
    source-default: source files which are common to all devices not explicitly handled below
    source-fenix5: source files that are only for fenix 5
    source-fr920xt: source files that are only for fr920xt

    Then your monkey.jungle will look something like this:

    base.sourcePath = source;source-default
    fenix5.sourcePath = source;source-fenix5
    fr920xt.sourcePath = source;source-fr920xt

  • flowstate the app supports all devices but the fenix5 is the main source and the fr920xt are the ones that  use 16k memory and there's another folder fon edges and displays etc

    ok thanks so what is $ for ??

    i don't need exclusion anymore??

  • $(x) is the value of variable x that you defined in one of the previous lines. You can do it with or without it it doesn't really matter, the point is that for the classes/functions that you define in one of the  source directories should be a version in each of the other directories (if that is called from the main code), and 2 directories that have the same function in it should not both be included in the sourcePath for any device.

  • no, it still does not work, I´m this it's a sdk bug it ask me for background linked strings on this background file

    but it's curious that works on 4.1.5 and not on 4.1.7 but when I copy the file to the folder It works at first, but not on default folder

    and then when I want to run not a the default app, it does not run any more

    using Toybox.WatchUi;
    using Toybox.Application;
    using Toybox.Graphics;
    
    class Background extends WatchUi.Drawable {
    
        hidden var mColor;
    
        function initialize() {
            var dictionary = {
                :identifier => "Background"
            };
    
            Drawable.initialize(dictionary);
        }
    
        function setColor(color) {
            mColor = color;
        }
    
        function draw(dc) {
            dc.setColor(Graphics.COLOR_TRANSPARENT, mColor);
            dc.clear();
        }
    
    }



  • Ok, so in that case you could use a scheme like this.

    source/: source files which are common to all devices
    source-default/: source files which are common to all devices not explicitly handled below. You could also call this "source-non-fr920xt" or something
    source-fr920xt/: source files that are only for fr920xt

    monkey.jungle:

    base.sourcePath = source;source-default
    fr920xt.sourcePath = source;source-fr920xt

    I'm not 100% sure how the exclude annotations were supposed to work in your original example. Did you actually annotate your source code with "(:source-fr920xt)" and "(:source)" in front of all the fr920xt and non-fr920xt functions and global variables? Or was the intent to exclude those folders? You can't exclude folders using excludeAnnotations, but you can use a strategy of omitting folders like my example above.

    I don't know why it worked before, but somebody else mentioned something similar in another thread. I think there may have been a bug or a quirk in the old compiler which allowed some kind of implicit overrides (not sure if it worked by filename, function/resource name, or  some other way), but I think they changed it now.

  • I think it's a problem with layout resources files, I´ll rewrite the code without this expensive files and see what happens

  • well, I re-wrote all code without the layout resources files and it works like red bull Checo Pérez f1, all errors are gone and if I run on it 4.1.5 saves 2kb of memory and if I run on 4.1.7 it saves 3 kb of memory without optimization

  • I have another minor issue with old getProperties method it works on simulator but it shows me this error on line 11

    Cannot determine if container access is using container type.


    using Toybox.Application as App;
    using Toybox.WatchUi as Ui;
    using Toybox.Graphics as Gfx;
    using Toybox.System;
    using Toybox.UserProfile;
    using Toybox.Application.Properties;
    
    
    	function getProperty(key){
    	if(Application has :Storage) {return Application.Properties.getValue(key); }
    	else { return Application.getApp().getProperty(key); }
    	}g
    	
    	
    	    function initialize() {
            DataField.initialize();
    	
    	    m = getProperty("m");
            mFTP = getProperty("pFTP");
     		mBikeW = getProperty("Setup");
     		
     		}

  • maybe because you declare Toybox.Application as App but you use Application,

    try either to replace all Application by App, or just put using Toybox.Application;