Monkey.jungle : Combining variables

Hi,

Supposing I had a set of resource directories that I wanted to keep somewhere out of the way, but they were in subdirectories thereof.

EG:
/really/really/long/path/to/drawables

/really/really/long/path/to/productConfig

/really/really/long/path/to/productSpscific/drawables

Is it possible, in monkey.jungle, to set a variable for the repeated part and then to combine it?

EG: I would like to be able to something like:

storedFiles = /really/really/long/path/to

base.resourcePath = $(base.resourcePath);${storedFiles)/drawables;${storedFiles)/productConfig;${storedFiles)/productSpscific/drawables

But...

 I can't find the syntax to achieve it. Disappointed

Alternatively, is there an easy way to get the compiler to scan a directory for "resources-" style names? EG: I might have a subdirectory somewhere that has "resources-fenix5", "resources-fenix3" etc. and I just want to add the subdirectory to monkey.jungle rather than have to explicitly note down each item as "resouces-fenix5.resourcePath = $(resources-fenix5);path/to/my/subdirectory/resources-fenix5" etc.

Hopeful of Dublin

  • Check out following, this is what I do:

    # ---------
    # General
    # ---------
    
    project.manifest = manifest.xml
    
    # SOURCE
    src=source;../../shared/src-core;../../shared/src-data
    srcBase=$(src);../../shared/src-font/rotated-24
    srcBaseLarge=$(src);../../shared/src-font/rotated-36
    
    # RESOURCE
    res=resources;../../shared/res-strings/resources;../../shared/res-core
    resBase=$(res);../../shared/res-font/overlay;../../shared/res-font/rotated-24;../../shared/res-icons
    resBaseLarge=$(res);../../shared/res-font/overlay-large;../../shared/res-font/rotated-36;../../shared/res-icons-large
    resBaseWithMini=$(resBase);../../shared/res-font-mini
    
    # ...

    I define a variable names "src" and one named "res" and reuse them in the lines below them. Seems like you only have syntax errors - "()" vs "{}"...

  • Thanks Michael,

    The syntax errors were typos, sorry!

    Your doing pretty much what I am currently doing, I think, but it doesn't solve the issue.

    Let me expand on the problem with an example:

    I have a project with pretty much the same code for a few products with differences controlled by exclusions and resourcePath in monkey.jungle.

    Now let's try adding a language or two...

    The default behaviour is that if I add language "fre", I simply add "resources-fre" directory and it will be scanned as part of the language resource path.

    But for my custom product, I find I need to add in a line in monkey.jungle for every single language!

    EG:

    productPath = ../pathToProduct/storedSomewhere
    productFrePath = ../pathToProduct/storedSomewhere/resources-fre
    productDeuPath = ../pathToProduct/storedSomewhere/resources-deu
    productItaPath = ../pathToProduct/storedSomewhere/resources-ita
    
    base.lang.fre = $(base.lang.fre);$(productFrePath)
    base.lang.deu = $(base.lang.fre);$(productDeuPath)
    base.lang.ita = $(base.lang.ita);$(productItaPath)
     

    And the same problem exists but multiplied by a large number if I wanted to use product specific resources... such as a custom product icon...

    I can see two possible solutions to this, but can't work out how to do either!

    POTENTIAL SOLUTION 1... Add lower down the chain...

    If I could add another path to be scanned for base.lang... well... then my code above would become something like...

    productPath = ../pathToProduct/storedSomewhere
    # Add in product path to scanned lang object...
    base.lang = $(base.lang);$(productPath)

    POTENTIAL SOLUTION 2...

    The other potential solution, which I tried initially, would be to combine values inside each directive...

    productPath = ../pathToProduct/storedSomewhere
    
    base.lang.fre = $(base.lang.fre);$(productFrePath)/resources-fre
    base.lang.deu = $(base.lang.fre);$(productDeuPath)/resources-deu
    base.lang.ita = $(base.lang.ita);$(productItaPath)/resources-ita

    Trouble is, I am pretty certain that the second solution is not possible, and I can't find a way to achieve the potential first solution. :(

  • Not sure if I understand you correctly, but if the problem is that you want to add one path to all languages, then I don't have a solution, I do it on a per language level as well, here is what I have in my watchfaces:

    # RESOURCE - LOCALISED STRINGS
    base.lang.ces=$(base.lang.ces);../../shared/res-strings/resources-ces
    base.lang.dan=$(base.lang.dan);../../shared/res-strings/resources-dan
    base.lang.deu=$(base.lang.deu);../../shared/res-strings/resources-deu
    base.lang.dut=$(base.lang.dut);../../shared/res-strings/resources-dut
    base.lang.fin=$(base.lang.fin);../../shared/res-strings/resources-fin
    base.lang.fre=$(base.lang.fre);../../shared/res-strings/resources-fre
    base.lang.hrv=$(base.lang.hrv);../../shared/res-strings/resources-hrv
    base.lang.hun=$(base.lang.hun);../../shared/res-strings/resources-hun
    base.lang.ita=$(base.lang.ita);../../shared/res-strings/resources-ita
    base.lang.nob=$(base.lang.nob);../../shared/res-strings/resources-nob
    base.lang.pol=$(base.lang.pol);../../shared/res-strings/resources-pol
    base.lang.por=$(base.lang.por);../../shared/res-strings/resources-por
    base.lang.rus=$(base.lang.rus);../../shared/res-strings/resources-rus
    base.lang.slo=$(base.lang.slo);../../shared/res-strings/resources-slo
    base.lang.slv=$(base.lang.slv);../../shared/res-strings/resources-slv
    base.lang.spa=$(base.lang.spa);../../shared/res-strings/resources-spa
    base.lang.swe=$(base.lang.swe);../../shared/res-strings/resources-swe
    base.lang.zhs=$(base.lang.zhs);../../shared/res-strings/resources-zhs
    base.lang.zht=$(base.lang.zht);../../shared/res-strings/resources-zht

    I don't know if it is possible to add "../../shared/res-strings" to "base.lang" - seems like this would be what you'd like to to... I didn't find a way to this.