I have following problem module core contains test utils which is resused in dependent modules.
How to use this code in those modules? (maven dosen't include this code by convention, but how to solve this problem)
Use maven-source-plugin to create a test jar. It will be published along with your normal jar as an artifact of the build.
Related
I'm planning to release a C++ project I've been working on as my first open source project. I use GTest as my unit test framework, and I don't know what's the common procedure to include this dependency in a public project.
Right now I have GTest as a submodule of my main project, but looking at other projects they don't usually have any submodule dependency, and it seems wrong to me to make people clone GTest as well as part of my project, as if they're already using it for their own unit tests they'll end up having duplicated code etc.
What's the common procedure for cases like this?
Thank you very much!
Usually we put test under compilation flags (or cmake variable, or autotools configuration flag, or...) and disable compilation of test when the framework is not detected or not asked to be used by the person that compiles.
That way, the dependency is not required but the user has the ability to add it if he wishes to use the unit tests.
I have a simple module to test with a few inline pa_ounit tests, i've setup the directory in the oasis style and got it all to build.
For a reference I've been using: https://github.com/janestreet/textutils
How would one execute the unit-tests for the above repo? I'm assuming there's an executable .ml file to write but what goes in this, how it is it built and does it extend the tests described at the module level in any way?
I've read the docs for pa_ounit and they just make me more confused ha.
As pa_ounit readme says, run the executable that contains tests with inline-test-runner argument.
Even without pa_ounit (when using plain OUnit), the file with tests is compiled and then executed. You should probably try OUnit itself before you start using the syntax extension so you can get the feel of the system.
OASIS, a popular build automation tool, allows you to build tests and run them with "make test" easily. See https://ocaml.org/learn/tutorials/setting_up_with_oasis.html#Tests
There is two java projects A and B, the build-engine is gradle.
That is a multi-project and A depends on B
A: build.gradle
...
dependencies {
compile project (':B')
}
...
B has core code in src/main/java and test code in src/test/java.
Also in src/test/java is some testing infrastructure classes like loading of test-data.
gradle :B:test work fine
Tests in A-Project uses the testing infrastructure classes from B-Project, and that is alright for eclipse, but not for gradle. Because the builded jar-file dependency on B-Project includes only classes from src/main/java.
And we get the error:
com.aaa.SomeClassFromAAAA.java:42: error: cannot find symbol
import com.bbb.InfrastructureTestClassFromBBB;
What is the solution?
This is discussed on Gradle forum here. The idea is to build JAR with your test classes and make it visible to your A project. There are also notes why this is difficult for the IDEs.
The alternative way is to move test infrastructure classes into main sources of another project. This assumes they do not depend on A's main sources. You can see something similar in Gradle's codebase (int*-test* folders in https://github.com/gradle/gradle/tree/master/subprojects).
I am trying to setup a testing environment for RestKit while using CocoaPods and I can't seem to be able to include RestKit's testing framework.
I followed Unit Testing with RestKit but I wasn't able to include any of my podfiles.
Then I found this article about setting up CocoaPods with a small section about testing:
When trying to execute the unit tests of CookPix, I got this issue
LoggerClient.h not found As described above, pod install changes your
Xcode project main target (I guess it takes the one named like the
project) to base the target configuration on the Pods.xcconfig file.
This lets Xcode found the headers of your dependencies and compile
your project with the right flags as well.
However it does not change the configuration of all targets and in our
case, the unit tests target. To fix that, click on your Xcode project,
then again on the Xcode project on the secondary panel, then on the
Info tab. Change the "Based on Configuration file" attribute of your
unit tests target to Pods. This should fix the dependencies of your
unit tests target.
This fixed the issue of including my pod files but I can't get RestKit's test framework installed. The compiler can't find this file because the pod doesn't install it.
#import <RestKit/Testing.h>
By looking at the CocoaPod spec it looks like it should be included. This is the relevant line in my Podfile.
pod 'RestKit', '0.10.1'
I also tried:
pod 'RestKit/Testing', '0.10.1'
With the same results.
I haven't investigated why this works but to include RestKit's testing files you must put
pod 'RestKit/Testing', '0.10.1'
before
pod 'RestKit', '0.10.1'
and clear out your pods directory and do a pod install. Or you might be able to skip this step if you are running Cocoapods 0.14.0.rc1 in which case you might be able to use pod update.
Context
I want to use JavaFx with clojure.
I am aware of http://nailthatbug.net/2011/06/clojure-javafx-2-0-simple-app/
Question:
Is there a way to make JavaFX work with Clojure using native-deps in lein instead?
Thanks!
I've created a simple Clojure and JavaFX example on Github. Testing on Ubuntu I had to install the JavaFX runtime into my local Maven repository, using the deploy:deploy-file target (install:install-file did not work for me).
mvn deploy:deploy-file -DgroupId=local.oracle -DartifactId=javafxrt -Dversion=2.2.0 -Dpackaging=jar -Dfile=/usr/lib/jvm/java-7-oracle-amd64/jre/lib/jfxrt.jar -Durl=file:/home/raju/.m2/repository
Make sure you have the following arguments set correctly:
-Dfile={full path to jfxrt.jar in jre/lib folder}
-Durl=file:{full path to Maven repository, e.g. $HOME/m2.repository}
In the project.clj, I added the dependency based on the -DgroupId and -DartifactId values when installing the JAR into the repository. If you use change these values, make sure to change the dependency accordingly:
[local.oracle/javafxrt "2.2.0"]
Java was able to load the binary libraries without any problems. If Java reports problems loading a binary library, e.g.
Caused by: java.lang.UnsatisfiedLinkError: Can't load library:
/usr/lib/jvm/javafx-sdk/rt/lib/amd64/libglass.so
check out these two question on SO:
What is LD_LIBRARY_PATH and how to use it?
java.lang.UnsatisfiedLinkError no *****.dll in java.library.path
Because JavaFx has native dependencies your option are limited to, ]
shipping these dependencies with your project (including them),
creating a package that you can depend on which has them (providing them),
or having your package require the user to install them in some other way.
Because the tutorial you link to covers the case where the user of your package/program installs JavaFx on their own, by using robert.hook and depending on the end-user's package manager to provide the actual native dependencies. I'll cover how to have your package/program include the dependencies.
native-deps can be used to ship native dependencies with your package. You just need to add all the .so, .dll, .etc files in the appropriate directories. I think the projects github page does a better job than I of explaining the structure.
The link in the question is broken so I can't see your example, but with Java 8, JavaFX is now part of the standard JDK/JRE. I therefore expect the native dependency issue to be irrelevant at this point.
Not sure if this will work for others, but this appears (so far) to have worked for me:
mvn install:install-file -DgroupId=javafx -DartifactId=javafx -Dversion=2.1.0 -Dpackaging=jar -Dfile=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/jfxrt.jar
I have no idea why this works, but I believe jfxrt.jar has the files I need. Then, after this, I kindle it in project.clj as
[javafx "2.1.0"]
in the :dependencies (not :native-deps) section.
[Having written this, I really have no idea why this even appears to work.]