Mbed forum

Local module dependency in yotta

mbed_os
yotta
(Aaron Campbell) #1

Hey! I am new to yotta, and I’m working on developing a module for mbed OS. However, I can’t find how to include a local module in the module.json script (for an app that depends on the module).

To get the idea across, here’s what I tried (and didn’t work) for the app’s module.json:

{
“name”: “my-app”,

“dependencies”: {
“mbed-drivers”: “~0.12.0”,
“my-module-123”: “/home/me/git/my_module#^1.0.0”
}
}

Also didn’t work:

{
“name”: “my-app”,

“dependencies”: {
“mbed-drivers”: “~0.12.0”,
“my-module-123”: “git+ssh:/home/me/git/my_module#^1.0.0”
}
}

Other than localhosting my module’s git repository, how can I use a module from my local computer as a dependency? Worth noting: the module is not in a subdirectory of the app.

(James Crosby) #2

You can use http://yottadocs.mbed.com/reference/commands.html#yotta-link to link a local module into your app before you’re ready to publish it (otherwise you would need to have it accessible from a git/hg repo).

You’re right that it’d be nice to support file paths in the dependencies list, too, but I don’t know when that’ll be supported.

(Aaron Campbell) #3

Thanks for the answer @jamcro01 . I got my git repo localhosted, and now yotta recognizes it.

Here’s another slightly related question: when building a module, is there a way to use the user application’s source folder as an include directory? My module needs a certain configuration header file which is provided by the user, but I don’t know if there’s a non-hacky way to expose a user header file for the module to include.

(James Crosby) #4

The root of the application directory is included in the search path for all modules, so it could be placed there. Be sure to name it something that won’t collide with any other header files though (use yourmodulename_app_config.h for example!)