I am helping the Guardian project on NetCipher . For obsolete reasons, they want to keep the existing project structure based on Eclipse. However, instead of having tests in the tests/ library subdirectory, they came with a peer-to-peer design model. Thus, from the root of the libnetcipher/ repo root is the library, and netciphertest/ is the control tests.
Instrument tests have never been configured to build Gradle, unlike libnetcipher/ . So, I am adding stuff to the libnetcipher/build.gradle file so that it points its androidTest sourceset to the netciphertest/ directory, and not to its normal location.
It works:
androidTest { manifest.srcFile '../netciphertest/AndroidManifest.xml' java.srcDirs = ['../netciphertest/src'] resources.srcDirs = ['../netciphertest/src'] aidl.srcDirs = ['../netciphertest/src'] renderscript.srcDirs = ['../netciphertest/src'] res.srcDirs = ['../netciphertest/res'] assets.srcDirs = ['../netciphertest/assets'] }
However, the repeated bits of ../netciphertest are fuzzy. I could define this as a constant to minimize duplication, of course. I am trying to find out if there is a better approach to the whole problem.
For example, this does not work:
androidTest.setRoot('../netciphertest') androidTest { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] }
I thought that perhaps the material srcDirs and srcFile could be interpreted with respect to the value of setRoot() , but they seem to be interpreted with respect to the native root of the project.
Is there a more elegant solution than mine?
android android-gradle gradle
CommonsWare
source share