File overriding

Hi,

I tried to overwrite files to differ between semiround and round watches. But if I do that, I always get an error that I attempt to redefine the view.

Here is a screenshot of my environment:
https://www.dropbox.com/s/5eby7gadaatmry1/excludeFiles.JPG?dl=0

I have just copied the main view and renamed it with <original name>-semi.mc

I try to build for a round watch and get that error message.
  • How are you trying do to this?

    let's say you have

    round.mc
    semiround.mc

    Are you using build file excludes, jungles?

    the thing is you can only build with one of them, and by default, it will use both.
  • Hi Jim,

    I just use build file excludes as shown in the screenshot.
  • You should use build exclusions via jungles as described in the Programmer's Guide.

    If you organize your files like this...

    +-- bin
    +-- resources
    | +-- drawables
    | +-- layouts
    | +-- strings
    | \-- resources.xml
    +-- resources-round
    +-- resources-semiround
    +-- resources-square
    +-- source
    | +-- DateCountdownApp.mc
    | \-- DateCountdownDelegate.mc
    +-- source-round
    | \-- DateCountdownView.mc
    +-- source-semiround
    | \-- DateCountdownView.mc
    +-- source-square
    \-- DateCountdownView.mc


    Then the jungle file should look something like this...

    round.sourcePath = $(round.sourcePath);sources-round
    semiround.sourcePath = $(semiround.sourcePath);sources-semiround
    square.sourcePath = $(square.sourcePath);sources-square


    If you really wanted to, you could put the files in the same source folder and then use an expression match (source/*-semi.mc or similar) or via explicit names, but it is simpler to just toss them into folders.

    Travis
  • Hi Travis,

    I can't get that running. I have everything in place as you described (btw: you have a spelling error - an "s" is too much):
    round.sourcePath = $(round.sourcePath);sources-round

    Here is a screenshot of what I did:
    https://www.dropbox.com/s/0ar75lykc2y0siy/Jungle.JPG?dl=0
  • you have to fix the autobuild by choosing 1 device or in your case a device group

    add this to your jungle:
    base.sourcePath=$(round.sourcePath)
  • Peter, this does not work at all.
    https://www.dropbox.com/s/0ar75lykc2...ungle.JPG?dl=0

    Isn't there an example how to configure that? I mean no code snippet like in the programmers guide. Overriding did work so easy formerly.
  • I always override at device specific level not at device group level.

    This is a simple project where i have twice the same Class name defined.

    https://github.com/Peterdedecker/connectiq/blob/master/guestposts/guestpost-01/01-other-screen-size/

    have a look at the monkey.jungle and the device folders.
  • ah I think I'm seeing the issue with your config
    $(round.sourcePath) etc by default takes all *.mc files in your complete project, it does not only look in the source folder which is what you want, so you can't use $(round.sourcePath) in your override.

    try this jungle file:
    #fix autobuild to a specific shape
    base.sourcePath=$(round.sourcePath)

    #specify folder for each screen shape
    round.sourcePath = source;source-round
    semiround.sourcePath = source;source-semiround
    square.sourcePath = source;source-square
  • I'm trying to consolidate the diff source files / features for multiple watches into 1. I read about the monkey.jungle file and search the forums and the prog guide. But I'm still stucked.


    The Root directory is similar to what Travis.ConnectIQ showed.

    +-- bin
    +-- resources
    | +-- fonts
    | +-- images
    | +-- menu
    | \-- resources.xml
    | \-- properties.xml
    +-- source-fenix5plus
    | \-- CustomArray.mc
    +-- source-fenix5splus
    | \-- CustomArray.mc
    +-- source-fenix5xplus
    | \-- CustomArray.mc
    +-- source
    | +-- MyApp.mc
    | \-- MyGlobals.mc
    | \-- MyFunctions.mc


    I have tried the following methods to get the monkey.jungle. both doesn't work

    #Version 1
    project.manifest = manifest.xml
    #base.sourcePath = fenix5plus.sourcePath

    #fenix5plus.sourcePath = $(fenix5plus.sourcePath);source-fenix5plus
    #fenix5splus.sourcePath = $(fenix5splus.sourcePath);source-fenix5splus
    #fenix5xplus.sourcePath = $(fenix5xplus.sourcePath);source-fenix5xplus

    #version2
    base.sourcePath = source/*.mc
    fenix5plus.sourcePath = source;source-fenix5plus
    fenix5splus.sourcePath = source;source-fenix5splus
    fenix5xplus.sourcePath = source;source-fenix5xplus

    I am trying to compile it from the command line and the only variation it allows me is the following command
    monkeyc -o bin/F5plus.prg -y developer_key.der -f monkey.jungle


    ERROR: null
    java.lang.NullPointerException
    at com.garmin.monkeybrains.jungle.JungleManager.getProjectPath(JungleManager.java:379)
    at com.garmin.monkeybrains.jungle.JungleManager.getPath(JungleManager.java:728)
    at com.garmin.monkeybrains.jungle.JunglePreProcessor.visitInstruction(JunglePreProcessor.java:112)
    at com.garmin.monkeybrains.jungle.JunglePreProcessor.visitInstruction(JunglePreProcessor.java:16)
    at com.garmin.connectiq.common.antlr.jungle.JungleParser$InstructionContext.accept(JungleParser.java:201)
    at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:70)
    at com.garmin.connectiq.common.antlr.jungle.JungleBaseVisitor.visitProgram(JungleBaseVisitor.java:20)
    at com.garmin.monkeybrains.jungle.JunglePreProcessor.visitProgram(JunglePreProcessor.java:71)
    at com.garmin.monkeybrains.jungle.JungleManager.preProcess(JungleManager.java:448)
    at com.garmin.monkeybrains.jungle.JungleManager.preProcess(JungleManager.java:428)
    at com.garmin.monkeybrains.jungle.JungleManager.<init>(JungleManager.java:193)
    at com.garmin.monkeybrains.jungle.JungleManager.<init>(JungleManager.java:229)
    at com.garmin.monkeybrains.Monkeybrains.run(Monkeybrains.java:2327)
    at com.garmin.monkeybrains.Monkeybrains.simpleMain(Monkeybrains.java:270)
    at com.garmin.monkeybrains.Monkeybrains.simpleMain(Monkeybrains.java:253)
    at com.garmin.monkeybrains.Monkeybrains.main(Monkeybrains.java:299)
    usage: monkeyc [-a <arg>] [-b] [-c <arg>] [-d <arg>] [-e] [-f <arg>] [-g] [-h <arg>] [--hideApi <arg>] [-i <arg>] [-k] [-m <arg>] [-n <arg>] [-o <arg>]
  • can you build with just
    base.sourcePath = source;source-fenix5plus


    and the next 3 lines commented out?

    it seems that in your command line, you aren't specifying a target to build for (-d <whatever>) so not sure if that will work.