I changed my project to become multi-platform.
Previous state: Only one module (project) with one build.gradle. All tests were in the test folder, and when I ran gradlew testDebug , all my 500 tests were running.
New state: I have a main gradle project that does nothing but three modules
- core
- androidversion
- rasberryPiVersion
Each of these modules has its own gradle file, but only the android and rasberryPi module can be created. In their dependencies (in the corresponding build.gradle file), they are compiled against the "main" module. Like this:
dependencies { compile project(':clapcore') compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android:android:4.1.1.4' }
All my 500 tests are now in the kernel. Therefore, when I do gradlew clean assembleDebug testDebug on the Android module, the test is not detected and the folder with the test result is empty.
I tried to run the testDebug command in the main module directly, but since it is not created by myself, I get an error message:
FAILURE: Build failed with an exception. * What went wrong: Task 'testDebug' not found in project ':core'.
So my question is: is there a way in gradle to tell the command "testDebug" to run all the tests that are in it depending on the module (kernel)?
I also tried adding testCompile to the android module dependency, but it does not work, for example:
dependencies { compile project(':clapcore') testCompile project(':clapcore') compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android:android:4.1.1.4' }
Thanks!
EDIT I found that I can execute the gradlew build in the kernel and it will run the test in the "core" module. But I would like this test to be performed using a cascade, if possible.
* EDIT 2 * I found that I can execute the gradlew buildNeeded in the android module and it will build for the android module and kernel. Unfortunately, it is only being built in release! If someone can tell me a way to use this function, but when debugging it will be awesome. I need to debug it because the build release launches a lot more tasks, such as changing the version, committing to git, push, etc. This is only for nightly assembly, so it needs to be debugged.