find sbt plugins versions - sbt

I am using some sbt plugins on a project and I would like to know which are their versions from sbt console.
I can type plugins which list the plugins but do not present their versions.
I want to do it from the sbt console, I do not want to inspect some plugins.sbt file or similar somewhere.

When you use plugins command, you see references to the plugins as they are defined in the Scala code. A single artifact can contain many plugins. Those artifacts with plugins have versions and here's how you can see them.
First load the metaproject: reload plugins
Then check dependencies: libraryDependencies
Go back to your project: reload return
You can define an alias for this in your ~/.sbt/<version>/global.sbt:
addCommandAlias("pluginsVersions", "; reload plugins ; libraryDependencies ; reload return")
It's not perfect, the output is noisy and not formatted nicely, but it's something you can get out of the box.

Related

where did 'resolved.xml.xml` file disappear?

after changing the sbt.version in the build.properties to 1.3.x, i've found out that the resolved.xml.xml files, which were created after running sbt compile are not created anymore. i'm using those files to re-create the project's structure and dependencies tree.
is there any equivalent to those files in the new SBT version?
yes, i'm familiar with sbt-dependency-graph plugin, but i want to avoid using external solution.
You can disable the integrated coursier to get the old behaviour back:
ThisBuild / useCoursier := false

Custom plugin for qt is not loaded. How to debug?

I wrote a custom plugin for QCanBus, that simply is a copy of the socketcan plugin but has been renamed and the identifiers have been adjusted to that new name.
I did that copying to first get the plugin recognised before I alter it.
I changed the qmake project to look that way:
TEMPLATE = lib
TARGET = qtcopysocketcanbus
CONFIG += plugin
QT = core serialbus
HEADERS += \
copysocketcanbackend.h
SOURCES += \
main.cpp \
copysocketcanbackend.cpp
DISTFILES = plugin.json
and added the plugin.json like so:
{
"Key": "copysocketcan"
}
I then renamed everything else from socketcan to copysocketcan in the main.cpp, the copysocketcan.cpp and the copysocketcan.h as well.
When I build the project, I get my *.so file which i put into $QT_PLUGIN_PATH/canbus/ on my target.
However, a quick start reveals, that qt only lists the plugins that came with the installation, not my added custom one.
I tried putting QLoggingCategory::setFilterRules(QStringLiteral("qt.canbus* = true")); as first line in my code and hoped getting more debug output, but I only get the debug output that my own application is producing. No output from the actual QCanBus.
So my questions are
How to enable the debug output for qt.canbus? Do I have to build QT with debug config for that?
Does my approach for creating a plugin reasonable?
Any ideas, why the custom plugin is not listed?
Through a helpful comment, I was able to debug the problems. The commentor suggested to use QT_DEBUG_PLUGINS to debug the plugin call. That lead to the appearance of an error message, that clearly stated, that the plugin I was trying to load because it was not a plugin and plugin metadata could not be extracted.
A bit of googling after those messages helped.
The answer to question 1 is:
Yes, you apparently have QT to build with debug information, to get the actual log output.
In my case, I configured the framework with --force-debug-info
For the second question, my approach was indeed reasonable, because as answer for question 3 turned out that one has to include the moc file as soon, as a Q_OBJECT macro is used within a *.cpp file and not in a separate header, which is the case for the canbus plugins. You can read more about that here

what is the usage of sbt-git plugin

My sbt version is 1.1.5
I read readme in git,and add addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") in plugins.sbt .
When I use enablePlugins(GitVersioning), it's red, "Cannot resolve symbol GitVersioning"
New user to sbt, cannot figure out where did I missed.
Reload project and error will dissapear.
Every change to sbt build definition (e.g. build.sbt, plugins.sbt) requires sbt project rebuild.
If working directly from sbt, type reload or from console sbt reload
If working from IntelliJ, then right click on sbt project and choose Refresh sbt project (rebuild once) or Auto-import (rebuild on every change).
You have to add addSbtPlugin line to project/plugins.sbt file (create it if doesn't exist). Then add enablePlugins(GitVersioning) to your build.sbt (in the root directory of your project).

SilverStripe Swipestripe - swipestripe-gallery module error

I've installed Swipestripe module. and added swipestripe-gallery module for product images.
when I did dev/bulid?flush=1 it shows error Class 'Gallery_PageExtension' does not exists
I have seen gallery.yml file in swipestripe-gallery/_config folder, which has
Product:
extensions:
- 'Gallery_PageExtension'
but this class is not there in Product.php file in swipestripe-gallery/code folder.
After commenting above code I did dev/build?flush=1 & there was no error. But in product page the Gallery tab is not added.
Please Help.
You didn't install using composer? Your fault ;) It installs all requirements for you and you can code happy.
See https://github.com/swipestripe/silverstripe-swipestripe-gallery#requirements, you'll need to install https://github.com/frankmullenger/silverstripe-gallery for getting this gallery extension in your codebase.
I strongly encourage you to install ALL modules with composer. It may be a bit hard in the beginning, but in some days your life will be much more comfortable! A good introduction can be found in the ss docs.
Swipestripe's config does not have that code: https://github.com/swipestripe/silverstripe-swipestripe/blob/2.1/_config/swipestripe.yaml
The gallery module for it does: https://github.com/swipestripe/silverstripe-swipestripe-gallery/blob/1.1/_config/gallery.yml
These are two separate modules. If the gallery file is in swipestripe/_config as you say, then it would seem to me that the install didn't happen as it should.
There should be two folders in your installation root
swipestripe/
swipestripe-gallery/
All files relating to each module should be in each (individual) folder. It seems you're missing the swipestripe-gallery folder all together, meaning that the class in fact does not exist (When you get this error, just check that the class exists somewhere in your install. Using grep is the easiest way).

Removing "gen-java" prefix from auto-generated Java files with sbt-thrift in SBT 0.12?

I am working with sbt-thrift plugin 0.6 and SBT 0.12.
In my thrift files I have mentioned the namespace as below.
namespace java abc.xyz
//some
//thrift
//codes
But the generated files goes to
gen-java/abc/xyz
(gen-java prefix is added automatically). How can I change this into
abc/xyz
?
There is an -out <outdir> option which does exactly that. In your case, specify the current folder . as the outdir.
Note that, unlike with the automatically generated gen-* folders, the outdir directory must exist. In other words, you have to make sure the folder is created before calling the Thrift compiler.
The --help option gives more information about all the other switches.
Regarding SBT, if the information on https://github.com/bigtoast/sbt-thrift is true, then you should contact the author of that software to add the option thriftJavaOutputDir as it seems missing.
BTW, the question looks very much like a duplicate of How to change default settings of sbt-thrift plugin in SBT? I would recommend to NOT ask ten thousand copies of similar questions on SO.

Resources