-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Android-compliant builds #58
Add support for Android-compliant builds #58
Conversation
…sions) using the ANDROID project property.
Hi @eburke56 , wow! Thank you for figuring this out and making the huge step to actually get it working! I'm impressed! It'll take me some days to look over it and try it out. Thank you alot! |
You're welcome! I love the library you built here -- makes Kotlin tests extremely readable. Let me know if you need any updates. |
It works really well, thank you :-) I'll go on and test the rest on Tuesday and push it to bintray by then. Is using the DateTime API fine for Android? I thought they have older APIs on Android. Also do you have any tip or experience on how to set up a reliant Android build on Travis or somewhere else? It would be helpful for future features to know when we break some kind of Android constraint :-) |
RE: DateTime APIs, since it's Java 8, we can use it on Android. However, you should probably note that in the documentation so that folks using Java 7 don't get bit by it. That said, anyone using Kotlin on Android is probably using Java 8. :) I have never set up Travis, but I do know some people who have done it. I will reach out to them and see what they know. To run the tests on Android, you can try using Robolectric and run unit tests as normal. You would just need to choose the Robolectric test runner instead of the standard JUnit runner. That might uncover these issues. If not, you can create an |
It works as expected, thank you very much! I've already published the Android version to bintray: https://bintray.com/markusamshove/maven/Kluent-Android At the moment it is awaiting approval from bintray to include it in jcenter, so to use it you have to include my maven repository at bintray at the moment:
once the package is approved I'll update the docs according to it, thank you very much! Do you want to spread the word about Android support, on reddit for example? If not then I'd like to do that once it's approved :-) |
Sure, I'll post to reddit -- let me know to which you'd like me to post. Thanks for approving this so quickly! |
It is now available in jcenter and working on my local builds. I was thinking about the Kotlin subreddit :-P |
It turns out that Android does not support having spaces in method names. As a result, Android instrumentation tests fail to run due to a runtime failure with the backtick versions of the methods in Kluent.
I moved the backtick code into separate files. I also made the code more uniform in that the camelCase methods have the actual code, where the backtick methods simply forward to the camelCase methods.
If you set the "ANDROID" property on the project, it will exclude the backtick files. When publishing, it will name the artifact "kluent-android".
For Android builds: ./gradlew -PANDROID assemble
I ensured that all unit tests run with and without the ANDROID property. I also verified that if I don't exclude the backtick tests, but I do exclude the backtick source, that the tests do in fact fail.
I also tested publishing to maven local and using the artifact in my Android projects. Everything works as expected.