Build, Run, Test, Package
The SDK project requires no external dependencies other than the Android SDK. The project is configured to be built with Gradle. As such, you can simply open the root and run
./gradlew assembleRelease to build the project.
- Build Configurations
The top-level project has several tasks, which are briefly described below:
assembleRelease: builds the SDK and exports an .aar.
connectedCheck: builds the SDK and runs all unit and integration tests. (Requires a connected device)
releaseJavadoc: builds the SDK and exports HTML Javadoc files.
releaseJavadocJar: builds the SDK and exports a Javadoc jar.
Artifacts are output to the following locations:
- Library archive (.aar) – richrelevance/build/outputs/aar/richrelevance-release.aar
- Javadoc HTML – richrelevance/build/docs/javadoc
- Javadoc JAR – richrelevance/build/libs/richrelevance-javadoc.jar
As stated, Gradle is used for building and managing dependencies within the SDK project. Since there are currently no external dependencies, Gradle is only used for building the SDK. It is of note however, that this project does not upload the archive to jCenter, this would be a recommended future improvement.
Also note that the SDK itself includes a third party component called Signpost for OAuth 1.0 functionality. The project has been stripped down to only include the pieces we need and has been repackaged to avoid prevent conflicts with consuming code. These source files retain their original source code licenses and are Apache licensed.
There are a comprehensive set of unit tests that cover all SDK functionality via mocking out the API (web layer). Additionally, there is a small set of happy path integration tests that hit the live API with a set of test credentials. These tests can be run through as mentioned above.
Since the tests currently require and leverage some Android components, and as such need to be run as Android tests instead of plain JUnit tests. This means that an Android device (physical device or emulator) must be connected in order to run the tests. A future consideration may be to remove the Android dependencies in order to run these without a connected Android device.
The tests can be run also be run directly through Android Studio, though at the time of writing this, Android Studio will not automatically add the test configuration. To do so manually: 1. Go to Run -> Edit Configurations 2. Click the + at the top left, and select Android Tests. 3. On the right panel, change the module to richrelevance. 4. Hit OK
With the configuration set up, you can select it at the top and hit the run button to run the tests.