Skip to content

build.py --dev flag does not do the same as codal.json "dev": true #86

@microbit-carlos

Description

@microbit-carlos

Looking at build.py, the dev flag is described as "enable developer mode (does not use target-locked.json)":

parser.add_option('-d', '--dev', dest='dev', action="store_true", help='enable developer mode (does not use target-locked.json)', default=False)


There is also another way to "enable developer mode" by setting the "target.dev": true key in codal.json. This mode is processed in the CMake files and it read target-locked.json instead of target.json from codal-microbit-v2:

if("${codal.target.dev}" STRGREATER "")
file(READ "./${LIB_DEST}/${codal.target.name}/target.json" device_json)
message("${BoldMagenta}Using target.json (dev version) ${ColourReset}")
else()
file(READ "./${LIB_DEST}/${codal.target.name}/target-locked.json" device_json)
message("${BoldMagenta}Using target-locked.json${ColourReset}")
endif()

The build.py --dev flag it's only used:

  • When the --update flag is used to update (git pull) the libraries:
    • build.py#L61
    • In this case a build.py does not invoke any CMake files, so it never uses target-locked.json or target.json
    • So in this case, the build.py description of the --dev flag does not quite apply
  • When the "target" command argument is used (e.g. python build.py codal-microbit --dev)
    • build.py#L116
    • In this case it completely overwrites the codal.json to include this flag, and incidentally loses all other configured options from the file
    • Also, this needs an existing target to be specified in utils/targets.json, which right now does not contain an entry for codal-microbit-v2
    • So this is either an obsolete option, or something that needs to be updated for micro:bit V2

With the normal python build.py invocation with the --dev flag does not do anything at all, which is also a bit confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions