SBT code generation and fork - sbt

I'm trying to generate code in SBT build for Slick like in the example.
However if I have
fork:=true
setting in the project - build fails with:
java.lang.NoClassDefFoundError: scala/reflect/runtime/package$
I want to keep that option to prevent memory leaks in my unit tests. If I get it right - there is no scala-reflect.jar loaded in forked jvm. But I have no idea how to load it.

I had a wrong assumption that SBT always loads all scala libraries by default, what appears to be incorrect for forked run. If I add scala-reflect dependency explicitly like Seth suggested it works ok.

Related

Is it possible to have task-dependent SBT dependencies?

We have custom SBT task which has a dependency (addSbtPlugin). But this plugin is not actually used for compilation and testing, though SBT tries to resolve dependency immediately.
Is is possible to make SBT resolve this dependency only when the particular task is started?
I think this is not possible. If I understood you correctly, what you are asking is similar to "is it possible to resolve a library dependency only when I run the code that depends on it?". If your task depends on the plugin (or is introduced by it), that dependency has to be resolved when the project is loading.
On another note, if this plugin is not related to the project itself and you don't want to force other maintainers to use it, it's a good idea to add it to your global config (which will affect only you and work for all sbt projects on your computer):
place addSbtPlugin in ~/.sbt/1.0/plugins/
if that plugin needs any settings, you can add them to ~/.sbt/1.0/global.sbt
(substitute the version, if you are using older sbt)

QT deployment doesn't work missing entry point

I'm working on my second application in QT and i'm trying to deploy a rough copy for testing. It would not run on a test computer, runs with no problems on mine, giving the error "Procedure Entry Point _ZdaPVJ not found in QT5core.dll". So to make sure that was not my program messing things up, i created a blank test application, compile it for release, moved the test.exe to a different location, run windeployqt --release test.exe, it created all the dependencies and folders. clicked on test.exe run with no problem. grabbed the folder recently created took it to the other computer and go the same error.
Is there something that i have forgotten since i compile my first application? Did i changed some setup somewhere without realizing it?
frustrated...
Perhaps you can check if your problem is related to different versions of the dll existing on your system and the wrong one is being loaded:
QT Release build DLL procedure entry point error
https://forum.qt.io/topic/26707/the-procedure-entry-point-cound-not-be-located-in-the-dynamic-link-library
As is suggested in the latter link above (towards the bottom), you could try to use dependency walker to determine from where the dll is loaded. Or use static linking with the licensing issues that causes (also see the latter link above).
And throwing in a final link on using Qt's Window's Deployment tool: Qt deployment; the procedure entry point ... could not be located

Rebuid only modules that contains warnings

For now i'm working on complicated Qt project and trying to eliminate many of warnings which appears when i'm trying to build project with using of different compilers (gcc,clang,msvc). Full rebuild of project takes up a long time.
Is there a some tool or maybe a artful approach to rebuild only modules that has warnings on previous build?
I think it might be reached by deleting (or outdating) those modules. Thus Make utility can rebuild them for me.
As the earlier comment say, only do a normal build. Anything that didn't compile last time will now compile. This of cause requires that you set a compiler flag to treat warnings as error or the compiler will create object files even though there are warnings. And the above strategy will fail.

Is it necessary to use gradle with roboelectric for android unit testing?

I and my team have built up an android library project. it is built up on eclipse but we are using ant to build it. Presently we aren't using gradle. I have a roboelectric with dependencies jar file instead. But when I use this, while running the unit tests, the following error comes up
WARNING: multiple versions of ant detected in path for junit
[junit] jar:file:/Users/prateekarora/Desktop/eclipse/plugins/org.apache.ant_1.9.2.v201404171502/lib/ant.jar!/org/apache/tools/ant/Project.class
[junit] and jar:file:/Users/prateekarora/trunk/client/android/MCCMobileClient/test2/libs/robolectric-2.3-with-dependencies.jar!/org/apache/tools/ant/Project.class
When I remove the apache ant from eclipse's plugin folder, this stops working.
Can Anybody explain why this is happening?
Also, is it necessary to use roboelectric with gradle? If no, where can I find the roboelectric's jar files with/without dependencies?
It is not necessary to use gradle with robolectric. It is just about running specified java class (from junit) with proper classpath (including you source, test code and dependencies). Fixing your case is not something that is easy to make over stackoverflow (it will be some challenge even if you sit behind same computer).
Here are possible solutions:
Migrate your project build to the gradle
Keep using ant but move from dependency management from manuals jars to ivy
Keep using ant and manual jars dependency, but try to get robolectric.jar with all dependencies except ant one
The first one option is the easiest option as for me. It will require to change mindset a bit but this is officially only one supported build tool by Google as well there are a lot of examples and people that could help.
The second one also require you to learn how to use new tool. As well there less examples about ivy usage especially in android projects.
The third one will require to write custom script that removes ant from jar file or to rebuild robolectric-all.jar without one (ant) dependency. This will require to dive into maven build tool learning

sbt: Prevent erroneous command being issued?

I have an sbt project in which the build is normally invoked via package-tar. If a developer types package, it's very likely that they actually meant package-tar instead.
However, package-tar depends on package. How can I prevent or deter or warn when a developer seems to be making this mistake - since I can't actually disable the package task because it's necessary?
I considered integrating actual deployment into the build, but this is not compatible with our current deployment process.
Instead of making package-tar a separate task, how about just redefining package to do what you want? The new behavior can invoke the old behavior.
http://www.scala-sbt.org/0.13.0/docs/Detailed-Topics/Artifacts.html has examples of customizing what package does. The material on addArtifact looks relevant.

Resources