From 7809e09bab7ce7ed17d8236892674d662dc6b8af Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 7 Jun 2019 15:04:33 -0400 Subject: Update gradle plugin docs --- buildSrc/README.md | 72 +++++++++++++++++------------------------------------- 1 file changed, 22 insertions(+), 50 deletions(-) diff --git a/buildSrc/README.md b/buildSrc/README.md index f79303c..14ae3d6 100644 --- a/buildSrc/README.md +++ b/buildSrc/README.md @@ -5,75 +5,47 @@ KAU holds quite a big collection of projects, with the intent on making it easy to reuse complex features, and also to update. This plugin aims to help maintain version updates straight from the source, and also adds on a few nice functions. -As a note, this is located under `buildSrc` as it is automatically included when building KAU. +As a note, this is located under `buildSrc` as it is automatically included when building Everything here is used when generating the library, so it's always tested. ## Contents -* [kau.Versions](#versions) -* [kau.Plugins](#plugins) -* [kau.Dependencies](#dependencies) +* [Usage](#usage) +* [Constants](#constants) * [Changelog Generator](#changelog-generator) ## Usage -Firstly, add KAU to the buildscript: +The easiest way to use this is to create your own `buildSrc` folder, and include `ca.allanwang.kau:gradle-plugin:${KAU}` as a dependency. +This way, you can also use items in your buildscript. +You can also add your own classes to manage versions in your app. -```gradle -buildscript { - repositories { - ... - maven { url "https://jitpack.io" } - } - - dependencies { - ... - classpath "ca.allanwang:kau:${KAU}" - } -} -``` - -Then where necessary, apply the plugin using - -```gradle -apply plugin: 'ca.allanwang.kau' -``` - -# kau.Versions - -> [kau.Versions.groovy](/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy) - -Contains the version code for any external library used in KAU. -You are free to use the values through `kau.[tagName]`. - -As an example, AppCompat is imported in KAU using +When making your own `buildSrc`, make sure you add the jitpack repository: ```gradle -api "androidx.appcompat:appcompat:${kau.appcompat}" +repositories { + ... + maven { url "https://jitpack.io" } +} ``` -# kau.Plugins +--- -> [kau.Plugins.groovy](/buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy) +Currently, the plugin is a collection of simple classes. -Unfortunately, it seems like you can't use the plugin directly in the buildscript, so this is mainly internal. +## Constants -The plugins data, found using `kauPlugins.[tagName]` contains a collection of useful plugin classpaths. -The versions are taken from `kau.Versions.groovy`, so it is always in sync. +`Versions`, `Plugins`, and `Dependencies` supply constants you can use for your classpath and dependencies -# kau.Dependencies - -> [kau.Dependencies.groovy](/buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy) - -Contains the dependency string for common libraries. -You are free to use the values through `kau.Dependencies.[tagName]`. - -As an example, adding junit can be done through +Eg ```gradle -testImplementation kau.Dependencies.junit +dependencies { + ... + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${kau.Versions.coroutines}" +} ``` -# Changelog Generator +## Changelog Generator In conjunction with [core](/core#changelog-xml), the xml changelog can be converted to markdown. @@ -82,7 +54,7 @@ To allow for compilation per build, add your own task: ```gradle task generateChangelogMd() { - kauChangelog.generate([inputPath], [outputPath]) + kau.ChangelogGenerator.generate([inputPath], [outputPath]) } ``` -- cgit v1.2.3