This repository contains common configuration to be used across our Android libraries. The advantage of sharing these configurations in mainly consistency of configuration among multiple libraries and reduction of boilerplate.
First add the subomudle to your project:
$ cd my_project
$ git submodule add git@github.com:rakutentech/android-buildconfig.git config
Then modify your root build.gradle
to apply the configuration:
buildscript {
// This must be the first line of your buildscript closure
apply from: "config/index.gradle"
// …repositories, classpaths, etc…
}
From there, you can reference the global CONFIG
object from any gradle file inside your project.
By default only versions is added to the project. You can apply configurations as desired.
- Versions
- Android project defaults
- Quality Tools
- Checkstyle
- Findbugs
- Jacoco
- PMD
- Detekt
- BuildSrc
- Documentation
This configuration's versions follow semantic versioning. We align all libraries that we bundle together on the same major version of this configuration. To clarify the semantics in the context of shared configurations here are a few examples of what are breaking changes (major version change), backwards compatible improvements (minor version change) and bug fixes (patch level):
Major | Minor | Patch |
---|---|---|
move gradle file to a different path | add new configuration | change minor or patch version of dependency |
remove gradle file | add new task in existing configuration | refactor |
change major version of dependencies | add new dependency version | |
change of the versioning contract | reduce boilerplate for consumer |
To ensure usability we follow these rules:
- Every version has a corresponding git tag of the format
Major.Minor.Patch
- Every version must describe the changes in versions section
- Major version changes must also provide a migration guide from the previous major version
If you use docummentation/doclava
with image assets: move $rootProject/images
to the project that includes the documentation/doclava/android.gradle
script.
- Update versions:
- AGP 3.3.1 (requires Gradle 4.10.1+).
- Targets (and builds with) SDK 27.
- Remove Kotlin check style tool,
Ktlint
, to replace it byDetekt
.
- Quality/jacoco: get rid of dependency of old unmaintained gradle plugin.
- Documentation/doclava: make image assets project local, i.e. not shared among subprojects.
- Documentation/doclava: add customization of javadoc
source
- Documentation/doclava: add customization of javadoc
classpath
- Documentation/doclava: simplified javadoc classpath setup
- buildSrc/SnapshotCheck: only apply to projcets in release version (according to semver)
- Quality/Pmd: Exclude
AvoidFieldNameMatchingMethodName
,JUnitTestContainsTooManyAsserts
,CommentDefaultAccessModifier
,MethodArgumentCouldBeFinal
rules - Quality/Checkstyle: Add support for
@SuppressWarnings("checkstyle:RuleName)
suppression of checkstyle rules - Quality/Findbugs: Setup complete classpath for findbugs task, relying on
android.libraryVariants
. Note that this does not work on android applications, but can be adapted to that usecase if it becomes necessary
- Documantation: Add doclava javadoc generation
- Quality/Checkstyl: Change checkstyle severity from
warning
toerror
so that non-compliant code fails the build (can still be disabled withignoreFailues
flag in quality task extensions) - Quality/jacocco: automatically make
check
depend onjacacoTestReport
- Add semantic versioning & documentation guidelines
- Move all configurations into folders
- Split up README into sub-READMEs and move to respective folders
- Merge Kotlin into master