-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
SBT plugin? #351
Comments
Cool! Could this be extended easily to more than just OpenCV or JavaCV? I'm assigning @jpsacha because he's our resident Scala expert :) Comments? I'm also wondering, should we have a separate repo for Scala related stuff? How should it be structured? That is, if we could do something that can generalize to all libraries... |
For now though, sure please do put up a wiki page about this. Write access should be available to all! |
The plugin I wrote mainly has the following merits:
I think to generalise (I assume you mean generalising it to other JavaCPP-family projects, included JavaCPP) and keep most of those benefits, the following would be the easiest and flexible
|
@lloydmeta Looks interesting. I had only a brief look at the source code of the sbt-javacp plugin. Noticed that it duplicates javacpp code for platform detection. That can be avoided. You can directly use javacpp for that: val platform = org.bytedeco.javacpp.Loader.getPlatform like here. You will just need to add plugin dependency on javacpp: classpathTypes += "maven-plugin"
libraryDependencies += "org.bytedeco" % "javacpp" % "1.1" |
@lloydmeta So, is it something that would need to be done for each project? Or is there a possibility to create something that could automatically include native dependencies (using the classifier there), like it's possible with Maven? |
That reminds me, @jpsacha did post something related to that at #123 (comment) . So, it looks like we can have a function that the user would call and that basically adds native depencencies for the libraries passed as arguments. That sounds like something that could be done once, and would work for any JavaCPP-related projects, not just OpenCV. Thoughts? Does it really work? We can't really add dependencies that way with Maven, but if it works with sbt, sounds like that would be great. BTW, thanks for the input @jpsacha! |
@jpsacha Good idea, but it isn't quite that simple because you can't seem to manage the SBT classpathTypes of a project that pulls in your plugin. I asked this question on SO a while ago and since no one answered, gave up, thus the duplication. @saudet I see what you mean now. I think it's a good idea, but I'm not sure about its feasibility. If my experience with SBT has taught me anything, it sounds somewhat tricky because I think it would require us to look up library dependencies even before SBT itself has had a chance to resolve them. The other part is that it would no longer be a one liner (one line to add the plugin, another to add that setting in the project build definition), which isn't terrible. EDIT: For now, I've added a // in build.sbt
JavaCppPlugin.javaCppPresetDependency("opencv") |
@saudet Yes, native dependencies could be automatically added. The code in the issue 123 comment was taken out of my actual project. You will need to list only the library names and versions. As mentioned in the comment, it maybe possible to automatically scan all |
Yeah, to be clear, automatically scanning all Allowing you to easily add any preset with native dependencies is done now in |
I wrote a simple SBT plugin to make JavaCV easier to set up (adds all the dependencies, adds
maven-plugin
to the classpathTypes, and sets up the classifier stuff too), essentially turning into a 1 liner:In
project/plugins.sbt
, addYou can find it here: https://github.com/lloydmeta/sbt-opencv
Was wondering if you were interested in putting it in the SBT set up section. If so I can issue a PR.
The text was updated successfully, but these errors were encountered: