-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Libraries, Samples and Components: Where next? #1983
Comments
We need a package manager similar to NPM for NodeJS, Composer for PHP or https://platformio.org/lib. It would be best if we can reuse an existing package manager. Anyone having experience with package managers that can be used in Sming (C/C++ ) ? |
https://conan.io Looks promising. @aemseemann you mentioned it in the CMake thread, any thoughts? |
As I already stated in the CMake thread, I have mixed feelings about conan. As such, I can recommend conan for tasks you would normally use your distro's package manager like fetching a prebuild toolchain. However, in the same way as you probably wouldn't include rpm or yum in your incremental development workflow, I would not recommend using conan in that workflow either! While a 'conanized' Sming (where each library/component is wrapped in a Conan package) might work for projects purely consuming Sming and some libraries/components (which then would all get built in the conan cache automatically), it will be a nightmare if you work on Sming or a component itself, let alone more than one package at the same time. This is because for each modified package, you would have to trigger a package rebuild manually. By default, this is always a full rebuild and even the source is copied from your local editing location to the cache. In addition, to get dependencies right, you have to manually increase the package version with each modification, which effectively creates a new package and also forces a full rebuild. To be fair, there are ways to overcome the aforementioned limitations like packages in editable mode and, more recently, conan workspaces, but these add further steps to learn and keep in mind all the time. My general feeling is that when including Conan in an incremental development workflow there are a lot of ways to screw up and the benefit is rather limited. |
I wonder why all the submodules of the top level Sming repositories are submodules. From my understanding, they are not really used in the way git submodules were designed, especially with all the patching done during the build. Wouldn't it be possibly to instead fetch them on demand from an URL/commit HASH given in component.mk without adding them as submodules? |
Historical!
I really like this idea! In essence, we'd take the .gitmodules entries and move them into the related component.mk file. I don't think it would be much of a stretch to implement either. It would also simplify things like rebasing.
Why not?! |
Clearly adopting any package manager is going to require customisation, and if it doesn't make our life easier then we don't do it. Something I didn't mention in the opening post was version control, which is kind of important thing to leave out! However, if we ditch (some or all) submodules and go with your hash-based fetching @aemseemann the problem will disappear because the dependencies will no longer be tied into the main Sming repo. |
@mikee47 If you want make a PR where the submodules are removed and replaced with a makefile function(s) that take care to fetch the right hash from the right URL. What I would like to remain is a way to fetch all submodules and patch them at once. I need this to create a submodule archive and attach it to every release. This archive is our guarantee that if a remote submodule disappears we still have its last working source code. |
Yes, we'll need this to build the docs too. |
@slaff Your submodule archive, do you do that manually? Is that something worth integrating into the build system? |
Of course not :) See lines 21 to 29 https://github.com/SmingHub/Sming/blob/develop/.travis/deploy.sh#L21 |
Should we be looking at git subtrees instead, or other similar solutions https://codeburst.io/4-git-submodules-alternatives-you-should-know-592095859b0 I haven't used subtrees at all, but the article says "As opposed to submodules, subtrees’ sources files are stored in the repo. It’s not just a link, the code is really there." I'm not clear ATM how this might affect patching; would it still require patch files? |
With git subtrees you basically store everything "by value" in the main repository, i.e. it is very similar to having everything in a single repository (as is done for Sming releases). With subtrees, patching and the whole "fetching on demand" stuff wouldn't be necessary anymore. However, there is the scalability issue of having everything in one big repository (though git has proven to cope with repositories way larger than what Sming will probably ever grow). |
#1991 is a good case where the sample could be moved into a sub-directory of the
|
Further to #1991 and, addressing the general case, including sample application(s) in the Component instead of in the Sming
|
#1992 has been an interesting process as we've gone through the creation of a new Component in some detail, thrown up some potential issues and also one interesting and probably simple solution to the 'package management' issue. Firstly, let's consider that we have an existing Component/Library which we want to move out to an external repository. Here's an outline of the steps required, but so far the only Component like this is
This last step is required so that Sming knows about your Component's requirements (submodules and source directories). However, we can add a new From #1983 (comment) we'd replace
This would be a lot simpler than submodules as we can see exactly which commit we're using and wouldn't need to involve GIT at all. |
@mikee47 We can "hack-or-borrow" the existing PHP package manager called In
|
@slaff, how would Sming's package manager verify if the selected module is compatible with the current version? For example there were a lot of changes to Sming 4 and obviously the modules would not compile without modifications (that would be left to the package maintainer?). |
It feels like we're heading in the right direction then. @slaff Your suggestion of hack/borrow-ing parts of composer is interesting, but what if we could handle all the dependency stuff in a web application? If that were hosted on a public website we could:
and so on. The generated configuration information could just be cut & pasted into a project. |
re. "Git as a package repository", if I browse to, say,
In a nutshell this is all the information needed to incoporate the Component into a Sming project. Why does it need to be any more complicated than that? |
I was wondering why |
In PR2006 (Comment), the question was brought up why there is a distinction between Components and Libraries. Quoting from that comment, the main issue is confusing variable/file names:
The distinction between "Core" parts and optional parts could be resolved by an appropriate directory hierarchy instead. ESP-IDF also knows about 'components' only. Sticking to the existing terms for the moment, another step probably worth considering is pulling more optional features out of the core into Libraries. Some candidates that come to my mind:
|
In IMHO the way forward is
|
From #1431:
Fast forward 18 months and we have made some progress. If you run
This is in priority order, so core components in the first two locations will always be picked up ahead of anything else. The point I'd like to make here is that whilst all of these may be If we just used |
👍 |
One of the things I like most about Sming is the large selection of libraries and sample applications available out of the box.
However, we cannot just keep adding to these directories indefinitely. I have a few thoughts about where I think we should be heading with this.
** samples **
To reduce the size of this directory, many samples could be moved into an
examples
sub-directory of the corresponding library. For example,Basic_Capsense
,Basic_NeoPixel
,Basic_APA102
, etc.This would also make it easier to maintain both library and sample application(s) so they are consistent, and to keep documentation together.
** Libraries **
Every major framework has some kind of library management, so Arduino has its integrated library manager https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ.
This is still lacking in Sming. Rather than just adding new libraries directly into the framework, we should be trying to pare it down to the minimum and use external repositories for all the 'add-on' stuff.
This is one reason why I chose to use an external repository for FlashString, rather than including it directly.
(Note that it's in the Components directory only because it's used elsewhere in the framework, otherwise it would have gone into Libraries.)
With Sming 4.0.0, we now require applications to explicitly identify which libraries it uses (via
ARDUINO_LIBRARIES
).This triggers the following actions:
Step (1) is where further work is required, since Sming knows only about the following Component directories:
This list can be expanded by the application COMPONENT_SEARCH_DIRS, but those directories must already exist;
there is no way to tell Sming to look directly in an external repository.
** External Repsitories **
I recently added the
RingTone
,ToneGenerator
andSignalGenerator
libraries, along with some sample applications. Let's consider how these might be moved out of the main Sming repo. and into my own github account, as a separate repository
Sming Audio Libraries
.I could just make them submodules, but then that just adds more to the
.gitmodules
framework dependencies. What I want to do is remove that dependency completely.As an initial suggestion, rather than listing every individual library we just keep a list within Sming of the location of any 'approved' library repositories. The build system then pulls in the library list from each of these repositories and things proceed as usual.
In this way new libraries could be added to those repositories and would be made available for all users without any change to the core Sming framework. It also provides a way to delegate responsibility and management for those libraries to their originators.
We could also provide a way to allow users to specify additional 'un-approved' repositories for their own uses.
The goal would be to reduce the size of the core Sming repository without affect the user experience.
The text was updated successfully, but these errors were encountered: