*The problem:* we want to move/rename some packages in a backwards-compatible 
manner.
For `lib` packages we can just move everything to new package and make simple 
dependency using `pkg.deps` from old (empty) package to new one. This works 
fine and was used for NimBLE migrations. The only drawback is that `newt` does 
not want about the rename.
However, the same approach cannot be used for `bsp` or `app` (and few other 
types) packages since they are read directly as specified in target settings so 
cannot be just dummy packages.

*The solution:* use transient packages
Transient package is dummy (empty) package which only link other package. 
Unlike dependencies it can link only single package. They can be specified in 
target settings since target package will be used automatically. Other than 
this, link is resolved just like regular dependency.

To define transient package it's enough to create simple `pkg.yml` file as 
follows:
```
pkg.name: old-package
pkg.type: transient
pkg.link: @repo/target-package
```

Including transient package in project will always emit a warning:
```
andk@t480s:~/devel/mynewt$ newt build btshell 
Building target targets/btshell
2018/08/24 21:36:46.229 [WARNING] Transient package 
@apache-mynewt-core/hw/bsp/nrf52840pdk used, update configuration to use target 
package instead (@apache-mynewt-core/hw/bsp/nordic_pca10056)
Target successfully built: targets/btshell
```

Existing PRs using transient packages to test with:
https://github.com/apache/mynewt-core/pull/1346
https://github.com/apache/mynewt-core/pull/1348

[ Full content available at: https://github.com/apache/mynewt-newt/pull/202 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to