This repository contains common configuration to be used across our Android libraries. The advantage of sharing these configurations is mainly consistency of configuration among multiple libraries and reduction of boilerplate.
First add the submodule to your project:
$ cd my_project
$ git submodule add [email protected]: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
- Spotbugs
- Jacoco
- PMD
- Detekt
- Gitleaks
- BuildSrc
- Documentation
- Publish
- CircleCI Orbs
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
- Quality/Detekt: removed usage of obsolete
fail-fast
andtest-pattern
properties.
- Feature: Added Dangerfile that can be used for branch naming, commit, and other code rules.
- Updated Android Gradle plugin version to 7.2.0.
- Updated Add parameter annotation to groovy tasks.
- Breaking Change: Renamed
artifactory.gradle
torepository.gradle
, and project config keys for publishing.
- Breaking Change: Added Support for building with Java 11. You will need to set your JDK version to 11.
- Updated Android Gradle plugin version to 7.1.0.
- Updated Android Kotlin plugin version to 1.5.21.
- Updated Detekt version to 1.19.0.
- Feature: Added Github Release configuration for releases and release assets creation.
- Feature: Added Gitleaks tool for detecting and preventing hardcoded secrets.
- Update versions:
- AGP 4.0.2 (requires Gradle 6.1.1+).
- Targets (and builds with) SDK 30.
- Updated: Support for Dokka v1.6.10. This is a BREAKING change. You will need to update your Dokka version and change your dokka configuration as described in the documentation README
- Feature: Updated
compile
andtarget
to API 31, and min to API 23 inversions.gradle
- Feature: Added publication configuration for Java libraries.
- Feature: Added Maven Central publishing script.
- Removed: Bintray/JCenter publishing script was removed because these services are being shutdown.
- Updated: Target and compile versions bumped to 30.
- Updated: AGP bumped to 4.0.2. This now requires your project to use Gradle 6.1.1+.
- Quality: replaced deprecated
FindBugs
withSpotBugs
.
- Fixed: GitHub pages publishing would sometimes upload the incomplete documentation.
- Fixed: Bintray publishing was failing due to an impcompatibility of the Bintray Gradle plugin with the Android Maven Publish plugin. The Bintray Gradle plugin has been removed so you no longer need to add
com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4
as a plugin dependency.
- Added config for creating html version of the userguide markdown and adding it to the generated javadoc.
- Added config for publishing documentation to gh-pages
- Added support for using Gradle Property for repository details to handle different settings for snapshot and release repo.
- Breaking Change: Remove
digital.wup.android-maven-publish
plugin as it is deprecated and AGP now has built-in support for the maven-publish plugin. Due to this change, you now must configure your publications within a theafterEvaluate
phase. See the [publishing readme](publish/README.md] for more details. You should also removedigital.wup.android-maven-publish
from your dependencies. - Added support for [KDoc generation](documentation/README.md] using dokka.
- Update target/compile SDK to 29 and update Min SDK to 21.
- Update Android Gradle Plugin to 3.6.2. You must now update your Gradle version to 5.6.4+.
- Add support for publishing to Bintray or Artifactory.
- Fixed an issue with documentation generation where images sometimes weren't copied to the documentation folder.
- Add
property
closure toCONFIG
. This can be used to return a value that has been set as either an environment variable or gradle property. Use like this:CONFIG.property('PROPERTY_NAME')
.
- 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