How would I write nodejs addon which would support all versions (atleast all stable versions > 0.10.6) of nodejs. For example, one version would have String::Utf8Value name(args[0]); where as another would have node::Utf8Value name(args[0]);. This is just an example but I have many scenarios where there will be different code for different versions of nodejs.
As far as I know this could be achieved in following ways.
Defining pre-processor to check which version and compile code accordingly.
if defined()//Not sure what exactly have to checked
include <nameser.h>
else
include <arpa/nameser.h>
endif
If this is the best option(which I don't think) even if multiple places pre-processor as to be added and code looks ugly, how would I achieve this. Meaning how would I check which version of NodeJS inside C/CPP addon.
Having separate file for each version and defining conditions inside binding.gyp to compile specific file based on nodejs version. If this is the best option, which variable I can refer to check the nodejs version.
Having tags while publishing npm package so that user can install for his specific nodejs version. Tag a published version. Although user has to check for the nodejs, non technical person won't be executing this, so shouldn't be a problem. The only problem I am seeing with this approach is versioning. Example, If there is a fix which has to applied for multiple tags, then, for every tag publish I have to specify different version (Not sure though).
Any other way I can achieve this which I am not aware of, if any the above options is not the good option to go with ?
Related
According to Ansible's developer's guide the first thing to do is to check out the Ansible project. And from there add your own module in ansible/modules/, add supporting code into ansible/module_utils. Put your test code in ansible/test/units/module/ and use the Ansible test utilities in ansible/test/units/module/utils.py.
The documentation is mute about how to distribute custom modules.
However, looking to the development method I think it's a safe assumption people are meant to maintain their own version of Ansible. After extending Ansible's source code, they have to rebuild the whole lot. From there they distribute this version of Ansible instead of the stock Ansible.
Personally, I think this is impractical:
Source code management gets complex.
There is no easy way to develop a custom module for a range of Ansible releases.
Upgrading Ansible involves a complex source code merge.
I'd rather not be involved in building from source a project like Ansible.
Not to mention there is a real risk of breaking Ansible if I touch the wrong files.
I am aware of the method to make a Python package containing code in the ansible/modules namespace. Just pip install your package and voila, Ansible knows the module. This is exactly what I need.
However, developing separate code in the ansible namespace makes it impossible to import code from the installed Ansible library. And on top of that ansible/test has been removed from the Ansible library. There is no supporting testing code anymore.
Therefor, unless I'm wrong, the only way to develop a custom module independently from Ansible's source code is to hack my way in. I'd rather not do that.
Or is there a clean way to do this ?
As the topic says, I'm interested in using some existing c++ code. It is quite much so I don't want to change everything. That's why I'm asking if I have to change the whole code or if it is possible to include it somehow.
As I noticed Android Studio/Gradle wants a CMake file in order to include those external libraries, but my code only includes ordinary makefiles.
Is there any way to make use of the given structure without many changes?
I can't give too much information about the code because it will be too much but here is something about it:
C++ Code
Using Makefiles
(will add more if needed)
Methods I tried:
Ship code inside assets, copy it in the local directory and use then use "make" to compile it on the smartphone - result: permission denied
Use precompiled Unix executable - I couldn't find a right compiler yet (already tested Android standalone toolchain)
Use Android NDK - I didn't manage to include the existing code because the changes were too deep
In my opinion, the best way would be one of the first two options. But I haven't found a way to handle these problems, which are listed above.
What I would like to know is now:
Which option would be the best? Of course, if they're all possible that will depend on the problem, but some opinions would be nice.
How do I know what compiler I have to use?
I use DUB, and want to include ncurses to project https://github.com/D-Programming-Deimos/ncurses/
it have not explicitly version specification on github page. But during build DUB ask me to specify version explicitly:
WARNING: A deprecated branch based version specification is used for the dependency ncurses. Please use numbered versions instead.
How I can do it?
http://code.dlang.org/package-format
Looks like your "DUB" tool is a later version than the tool used to create the 'package.json' file in the GIT repo. The message is rather obscure, but it's not a GIT message. It seems to mean that the 'ncurses' repo needs updating; send them a pull when you work out how.
This is dub complaining because the entry in your dub.json (or package.json) is "ncurses": "~master"
However, dub is trying to move away from using the "~master" branch (as it's prone to constant changes in most projects)
As the only available branch tag on ncurses is ~master you'll have to use it. I'm suprised that dub isn't working with the master branch however, as it's only a WARNING message, not ERROR.
Maybe pinging the owner of ncurses to create a tag may be a good idea?
Is there a simple way to find out what versions of dependencies are available using Leiningen?
E.g., if I have a web app which depends on Hiccup and Compojure, how can I be sure that I'm on the latest version of each without going to the github page for each?
NOTE: I use Ant and Ivy for building my Java projects, so I have limited knowledge of Maven - so please spell out (or provide Fine Links for me to read) any Maven concepts that Leiningen exposes to me which would help with this (I know that under the hood, Leiningen uses Maven for dependency resolution). Ta.
The Clojure ecosystem has evolved since the original answer was offered. At the present time, I would recommend using lein-ancient:
A Leiningen plugin to check your project for outdated dependencies and plugins. This plugin supersedes lein-outdated and uses metadata XML files in the different Maven repositories instead of a Lucene-based search index. Version comparison is done using version-clj.
Its precursor, lein-outdated, has this helpful message in its README: "lein-outdated is outdated". :)
The canonical way of doing this, at least for dependencies kept in clojars, is the lein-search plugin.
Update: See the highest-rated answer below for a more up-to-date response.
You should have a look at the answer to this question. Leiningen uses the same versioning mechanism as maven so, for example, if you want to use the latest version of a given library, you can substitute the word "LATEST" for the version number. You can also specify a release version or a version range. Again, look at the answer at that link.
Web service that provides this info, along with badges for readmes.
http://clj-deps.herokuapp.com
Disclaimer, by me.
There are already some questions about dependency managers here, but it seems to me that they are mostly about build systems, while I am looking for something targeted purely at making dependency tracking and resolution simpler (and I'm not necessarily interested in learning a new build system).
So, typically we have a project and some common code with another project. This common code is organized as a library, so when I want to get the latest code version for a project, I should also go get all the libraries from the source control. To do this, I need a list of dependencies. Then, to build the project I can reuse this list too.
I've looked at Maven and Ivy, but I'm not sure if they would be appropriate for C++, as they look quite heavily java-targeted (even though there might be plugins for C++, I haven't found people recommending them).
I see it as a GUI tool producing some standardized dependency list which can then be parsed by different scripts etc. It would be nice if it could integrate with source control (tag, get a tagged version with dependencies etc), but that's optional.
Would you have any suggestions? Maybe I'm just missing something, and usually it's done some other way with no need for such a tool? Thanks.
You can use Maven in relationship with C++ in two ways. First you can use it for dependency management of components between each other. Second you can use Maven-nar-plugin for creating shared libraries and unit tests in relationship with boost library (my experience). In the end you can create RPM's (maven-rpm-plugin) out of it to have adequate installation medium. Furthermore i have created the installation for CI environment via Maven (RPM's for Hudson, Nexus installation in RPM's).
I'm not sure if you would see an version control system (VCS) as build tool but Mercurial and Git support sub-repositories. In your case a sub-repository would be your dependencies:
Join multiple subrepos into one and preserve history in Mercurial
Multiple git repo in one project
Use your VCS to archive the build results -- needed anyway for maintenance -- and refer to the libs and header files in your build environment.
If you are looking for a reference take a look at https://android.googlesource.com/platform/manifest.