aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-01-24 23:44:49 -0500
committerAllan Wang <me@allanwang.ca>2018-01-24 23:44:49 -0500
commit3a92363e65a29b6106cdfa98d6bcf297b0eda5ad (patch)
tree9c61fbce5d486374aad1e7767ebc2ee6f67348cc
parent9c00231884c69456c2deb2918cd0ecd50f3ac0a0 (diff)
downloadkau-3a92363e65a29b6106cdfa98d6bcf297b0eda5ad.tar.gz
kau-3a92363e65a29b6106cdfa98d6bcf297b0eda5ad.tar.bz2
kau-3a92363e65a29b6106cdfa98d6bcf297b0eda5ad.zip
Create buildSrc
-rw-r--r--.travis.yml20
-rw-r--r--README.md16
-rw-r--r--about/build.gradle5
-rw-r--r--adapter/build.gradle11
-rw-r--r--android-lib.gradle20
-rw-r--r--build.gradle42
-rw-r--r--buildSrc/.gitignore2
-rw-r--r--buildSrc/README.md92
-rw-r--r--buildSrc/build.gradle9
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy76
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy10
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/KauPlugin.groovy16
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy13
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy37
-rw-r--r--buildSrc/src/main/resources/META-INF/gradle-plugins/ca.allanwang.kau.properties1
-rw-r--r--colorpicker/build.gradle7
-rw-r--r--core-ui/build.gradle5
-rw-r--r--core/build.gradle27
-rw-r--r--dependencies.gradle28
-rw-r--r--docs/Changelog.md2
-rw-r--r--gradle.properties25
-rw-r--r--kpref-activity/build.gradle5
-rw-r--r--mediapicker/build.gradle9
-rw-r--r--sample/build.gradle23
-rw-r--r--sample/src/main/res/xml/kau_changelog.xml2
-rw-r--r--searchview/build.gradle3
-rw-r--r--settings.gradle8
27 files changed, 383 insertions, 131 deletions
diff --git a/.travis.yml b/.travis.yml
index 3ebc688..d248bd9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ env:
android:
components:
- tools
- - android-$EMULATOR_API
+# - android-$EMULATOR_API
- platform-tools
- tools
- build-tools-$ANDROID_BUILD_TOOLS
@@ -17,17 +17,17 @@ android:
- extra-android-support
- extra-android-m2repository
- extra-google-m2repository
- - sys-img-armeabi-v7a-android-$EMULATOR_API
+# - sys-img-armeabi-v7a-android-$EMULATOR_API
licenses:
- ".+"
-before_script:
-- echo "y" | android update sdk -a --no-ui --filter android-$EMULATOR_API
-- echo "y" | android update sdk -a --no-ui --filter sys-img-armeabi-v7a-android-$EMULATOR_API
-- android list targets | grep -E '^id:' | awk -F '"' '{$1=""; print $2}' # list all targets
-- echo no | android create avd --force -n test -t android-$EMULATOR_API --abi armeabi-v7a
-- emulator -avd test -no-skin -no-window &
-- android-wait-for-emulator
-- adb shell input keyevent 82 &
+#before_script:
+#- echo "y" | android update sdk -a --no-ui --filter android-$EMULATOR_API
+#- echo "y" | android update sdk -a --no-ui --filter sys-img-armeabi-v7a-android-$EMULATOR_API
+#- android list targets | grep -E '^id:' | awk -F '"' '{$1=""; print $2}' # list all targets
+#- echo no | android create avd --force -n test -t android-$EMULATOR_API --abi armeabi-v7a
+#- emulator -avd test -no-skin -no-window &
+#- android-wait-for-emulator
+#- adb shell input keyevent 82 &
script:
- chmod +x gradlew
- "./gradlew --quiet androidGitVersion"
diff --git a/README.md b/README.md
index 3a6a837..218640d 100644
--- a/README.md
+++ b/README.md
@@ -56,6 +56,19 @@ dependencies {
implementation "ca.allanwang.kau:searchview:$KAU"
}
+// optional buildscript plugin (see below)
+buildscript {
+ repositories {
+ ...
+ maven { url "https://jitpack.io" }
+ }
+
+ dependencies {
+ ...
+ classpath "ca.allanwang:kau:${KAU}"
+ }
+}
+
```
(If you are using gradle < 4.0, use `compile` instead of `implementation`)
@@ -125,6 +138,9 @@ This means that you'll need to explicitly include each submodule you'd like to u
* Material searchview with kotlin bindings
* Includes `:core-ui`, `:adapter`
+## [Gradle Plugin](buildSrc#readme)
+* Gradle plugin to help facilitate versioning and other gradle functions
+
-----------
# Showcase
diff --git a/about/build.gradle b/about/build.gradle
index af87f1e..29f77c0 100644
--- a/about/build.gradle
+++ b/about/build.gradle
@@ -1,6 +1,3 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
apply from: '../android-lib.gradle'
android {
@@ -13,7 +10,7 @@ dependencies {
implementation project(':core-ui')
implementation project(':adapter')
- api("com.mikepenz:aboutlibraries:${ABOUT_LIBRARIES}@aar") {
+ api("com.mikepenz:aboutlibraries:${kau.aboutLibraries}@aar") {
transitive = false
}
}
diff --git a/adapter/build.gradle b/adapter/build.gradle
index e4dd045..b58c912 100644
--- a/adapter/build.gradle
+++ b/adapter/build.gradle
@@ -1,15 +1,14 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
-ext.kauSubModuleMinSdk = project.CORE_MIN_SDK
+ext.kauSubModuleMinSdk = kau.coreMinSdk
apply from: '../android-lib.gradle'
dependencies {
implementation project(':core')
- api "com.mikepenz:fastadapter:${FAST_ADAPTER}@aar"
- api "com.mikepenz:fastadapter-commons:${FAST_ADAPTER_COMMONS}@aar"
+ //noinspection GradleDependency
+ api "com.mikepenz:fastadapter-commons:${kau.fastAdapterCommons}@aar"
+ //noinspection GradleDependency
+ api "com.mikepenz:fastadapter:${kau.fastAdapter}@aar"
}
apply from: '../artifacts.gradle'
diff --git a/android-lib.gradle b/android-lib.gradle
index 123aec7..86c0067 100644
--- a/android-lib.gradle
+++ b/android-lib.gradle
@@ -2,18 +2,18 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.getkeepsafe.dexcount'
-group = project.APP_GROUP
+group = "ca.allanwang"
android {
- compileSdkVersion Integer.parseInt(project.TARGET_SDK)
- buildToolsVersion project.BUILD_TOOLS
+ compileSdkVersion kau.targetSdk
+ buildToolsVersion kau.buildTools
androidGitVersion {
codeFormat = 'MMNNPPXX'
format = '%tag%%.count%%-commit%'
}
- def kauMinSdk = project.MIN_SDK
+ def kauMinSdk = kau.minSdk
if (project.hasProperty('kauSubModuleMinSdk'))
kauMinSdk = kauSubModuleMinSdk
@@ -24,8 +24,8 @@ android {
resourcePrefix kauResourcePrefix
defaultConfig {
- minSdkVersion Integer.parseInt(kauMinSdk)
- targetSdkVersion Integer.parseInt(project.TARGET_SDK)
+ minSdkVersion kauMinSdk
+ targetSdkVersion kau.targetSdk
versionName androidGitVersion.name()
versionCode androidGitVersion.code()
consumerProguardFiles 'progress-proguard.txt'
@@ -81,10 +81,10 @@ android {
}
dependencies {
- androidTestImplementation("com.android.support.test:runner:${TEST_RUNNER}") {
+ androidTestImplementation("com.android.support.test:runner:${kau.testRunner}") {
exclude group: 'com.android.support', module: 'support-annotations'
}
- androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}"
- testImplementation "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}"
- testImplementation "junit:junit:${JUNIT}"
+ androidTestImplementation kauDependency.kotlinTest
+ testImplementation kauDependency.kotlinTest
+ testImplementation kauDependency.junit
} \ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 0905ce0..341dcd1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,44 +1,40 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
+ maven { url "https://plugins.gradle.org/m2/" }
}
+
+ apply plugin: "ca.allanwang.kau"
+
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.1'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN}"
- classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
- classpath 'com.github.triplet.gradle:play-publisher:1.2.0'
- classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath kauPlugin.android
+ classpath kauPlugin.kotlin
+ classpath kauPlugin.androidMaven
+ classpath kauPlugin.playPublisher
+ classpath kauPlugin.dexCount
+ classpath kauPlugin.gitVersion
}
}
+apply plugin: "ca.allanwang.kau"
+
task clean(type: Delete) {
delete rootProject.buildDir
}
task generateChangelogMd {
- def parsedProjectXml = (new XmlParser()).parse("$project.rootDir/sample/src/main/res/xml/kau_changelog.xml")
- def sw = new StringWriter()
- sw.append("# Changelog\n")
- parsedProjectXml.depthFirst().each {
- switch (it.name()) {
- case "version":
- sw.append("\n## ${it.@title}\n")
- break
- case "item":
- if (it.@text?.trim())
- sw.append("* ${it.@text}\n")
- }
- }
- def changelogMd = new File("$project.rootDir/docs/Changelog.md")
- changelogMd.write(sw.toString())
+ kauChangelog.generate("$project.rootDir/sample/src/main/res/xml/kau_changelog.xml")
}
subprojects {
+
+ if (it.name == 'gradle-plugin')
+ return
+
+ apply plugin: 'com.gladed.androidgitversion'
+
repositories {
google()
jcenter()
diff --git a/buildSrc/.gitignore b/buildSrc/.gitignore
new file mode 100644
index 0000000..192221b
--- /dev/null
+++ b/buildSrc/.gitignore
@@ -0,0 +1,2 @@
+.gradle/
+build/ \ No newline at end of file
diff --git a/buildSrc/README.md b/buildSrc/README.md
new file mode 100644
index 0000000..60d2dfc
--- /dev/null
+++ b/buildSrc/README.md
@@ -0,0 +1,92 @@
+# KAU :gradle-plugin
+
+> Plugin helper for KAU
+
+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.
+Everything here is used when generating the library, so it's always tested.
+
+## Contents
+* [Versions](#versions)
+* [Plugins](#plugins)
+* [Dependencies](#dependencies)
+* [Changelog Generator](#changelog-generator)
+
+## Usage
+
+Firstly, add KAU to the buildscript:
+
+```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'
+```
+
+# Versions
+
+> [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
+
+```gradle
+api "com.android.support:appcompat-v7:${kau.supportLibs}"
+```
+
+# Plugins
+
+> [Plugins.groovy](/buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy)
+
+Unfortunately, it seems like you can't use the plugin directly in the buildscript, so this is mainly internal.
+
+The plugins data, found using `kauPlugins.[tagName]` contains a collection of useful plugin classpaths.
+The versions are taken from `Versions.groovy`, so it is always in sync.
+
+# Dependencies
+
+> [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 `kauDependency.[tagName]`.
+
+As an example, adding junit can be done through
+
+```gradle
+testImplementation kauDependency.junit
+```
+
+# Changelog Generator
+
+In conjunction with [core](/core#changelog-xml),
+the xml changelog can be converted to markdown.
+
+To allow for compilation per build, add your own task:
+
+```gradle
+task generateChangelogMd() {
+ kauChangelog.generate([inputPath], [outputPath])
+}
+```
+
+The wrapper allows for the generator to be called automatically with each build.
+
+
+
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
new file mode 100644
index 0000000..a51e9ae
--- /dev/null
+++ b/buildSrc/build.gradle
@@ -0,0 +1,9 @@
+apply plugin: 'groovy'
+apply plugin: 'maven'
+
+group = "ca.allanwang"
+
+dependencies {
+ compile gradleApi()
+ compile localGroovy()
+} \ No newline at end of file
diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy
new file mode 100644
index 0000000..bb56fa2
--- /dev/null
+++ b/buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy
@@ -0,0 +1,76 @@
+package ca.allanwang.kau
+
+import org.gradle.api.GradleException
+import org.gradle.api.Project
+
+/**
+ * Given an xml of the format
+ *
+ * <?xml version="1.0" encoding="utf-8"?>
+ * <resources>
+ * <version title="v0.1" />
+ * <item text="Initial Changelog" />
+ * <item text="Bullet point here" />
+ * <item text="More points" />
+ * <item text="" /> <!-- this one is empty and therefore ignored -->
+ * </resources>
+ *
+ * Outputs a changelog in markdown format
+ */
+class ChangelogGenerator {
+
+ static class ChangelogException extends GradleException {
+ ChangelogException(String message) {
+ super(message)
+ }
+ }
+
+ private Project project
+
+ ChangelogGenerator(Project project) {
+ this.project = project
+ }
+
+ private static void fail(String message) {
+ throw new ChangelogException(message)
+ }
+
+ final void generate(String inputUri, String outputUri = "$project.rootDir/docs/Changelog.md") {
+ def input = new File(inputUri)
+ if (!input.exists())
+ fail("Could not generate changelog from ${input.absolutePath}")
+
+ def output = new File(outputUri)
+
+ if (output.exists()) {
+ if (output.isDirectory())
+ fail("Cannot save changelog at directory ${output.absolutePath}")
+
+
+ if (output.isFile() && !output.delete())
+ fail("Could not delete changelog at ${output.absolutePath}")
+ } else {
+ output.parentFile.mkdirs()
+ }
+
+ if (!output.createNewFile())
+ fail("Could not create changelog file at ${output.absolutePath}")
+
+ def parsedProjectXml = (new XmlParser()).parse(inputUri)
+ def sw = new StringWriter()
+ sw.append("# Changelog\n")
+ parsedProjectXml.depthFirst().each {
+ switch (it.name()) {
+ case "version":
+ sw.append("\n## ${it.@title}\n")
+ break
+ case "item":
+ if (it.@text?.trim())
+ sw.append("* ${it.@text}\n")
+ }
+ }
+ output.write(sw.toString())
+ println("Generated changelog at ${output.absolutePath}")
+ }
+
+} \ No newline at end of file
diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy
new file mode 100644
index 0000000..368b0a8
--- /dev/null
+++ b/buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy
@@ -0,0 +1,10 @@
+package ca.allanwang.kau
+
+/**
+ * Some common dependencies, backed by the supplied versions
+ */
+class Dependencies {
+ static def kotlin = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}"
+ static def kotlinTest = "org.jetbrains.kotlin:kotlin-test-junit:${Versions.kotlin}"
+ static def junit = "junit:junit:${Versions.junit}"
+} \ No newline at end of file
diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/KauPlugin.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/KauPlugin.groovy
new file mode 100644
index 0000000..e73564c
--- /dev/null
+++ b/buildSrc/src/main/groovy/ca/allanwang/kau/KauPlugin.groovy
@@ -0,0 +1,16 @@
+package ca.allanwang.kau
+
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+
+class KauPlugin implements Plugin<Project> {
+
+ @Override
+ void apply(Project project) {
+ project.extensions.create("kau", Versions)
+ project.extensions.create("kauPlugin", Plugins)
+ project.extensions.create("kauDependency", Dependencies)
+ project.extensions.create("kauChangelog", ChangelogGenerator, project)
+ }
+
+} \ No newline at end of file
diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy
new file mode 100644
index 0000000..040e2a2
--- /dev/null
+++ b/buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy
@@ -0,0 +1,13 @@
+package ca.allanwang.kau
+
+/**
+ * Some common buildscript plugins, backed by the supplied versions
+ */
+class Plugins {
+ static def android = "com.android.tools.build:gradle:${Versions.gradlePlugin}"
+ static def kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
+ static def androidMaven = "com.github.dcendents:android-maven-gradle-plugin:${Versions.mavenPlugin}"
+ static def playPublisher = "com.github.triplet.gradle:play-publisher:${Versions.playPublishPlugin}"
+ static def dexCount = "com.getkeepsafe.dexcount:dexcount-gradle-plugin:${Versions.dexCountPlugin}"
+ static def gitVersion = "gradle.plugin.com.gladed.gradle.androidgitversion:gradle-android-git-version:${Versions.gitVersionPlugin}"
+} \ No newline at end of file
diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy
new file mode 100644
index 0000000..4633a4d
--- /dev/null
+++ b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy
@@ -0,0 +1,37 @@
+package ca.allanwang.kau
+
+class Versions {
+ static def coreMinSdk = 19
+ static def minSdk = 21
+ static def targetSdk = 27
+
+ static def buildTools = '27.0.2'
+ static def supportLibs = '27.0.2'
+
+ static def kotlin = '1.2.21'
+
+ static def aboutLibraries = '6.0.1'
+ static def anko = '0.10.4'
+ static def blurry = '2.1.1'
+ static def constraintLayout = '1.1.0-beta4'
+ static def fastAdapter = '3.1.2'
+ static def fastAdapterCommons = '3.1.2'
+ static def glide = '4.5.0'
+
+ static def iconics = '3.0.2'
+ static def iconicsGoogle = '3.0.1.2'
+ static def iconicsMaterial = '2.2.0.4'
+ static def iconicsCommunity = '2.0.46.1'
+
+ static def materialDialog = '0.9.6.0'
+
+ static def espresso = '3.0.0'
+ static def junit = '4.12'
+ static def testRunner = '1.0.0'
+
+ static def gradlePlugin = '3.0.1'
+ static def mavenPlugin = '2.0'
+ static def playPublishPlugin = '1.2.0'
+ static def dexCountPlugin = '0.8.2'
+ static def gitVersionPlugin = '0.4.3'
+} \ No newline at end of file
diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/ca.allanwang.kau.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/ca.allanwang.kau.properties
new file mode 100644
index 0000000..ba824cd
--- /dev/null
+++ b/buildSrc/src/main/resources/META-INF/gradle-plugins/ca.allanwang.kau.properties
@@ -0,0 +1 @@
+implementation-class=ca.allanwang.kau.KauPlugin \ No newline at end of file
diff --git a/colorpicker/build.gradle b/colorpicker/build.gradle
index fdf5728..9b52cd4 100644
--- a/colorpicker/build.gradle
+++ b/colorpicker/build.gradle
@@ -1,16 +1,13 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
ext.kauSubModuleResourcePrefix = "kau_color_"
-ext.kauSubModuleMinSdk = project.CORE_MIN_SDK
+ext.kauSubModuleMinSdk = kau.coreMinSdk
apply from: '../android-lib.gradle'
dependencies {
implementation project(':core')
- implementation "com.afollestad.material-dialogs:commons:${MATERIAL_DIALOG}"
+ implementation "com.afollestad.material-dialogs:commons:${kau.materialDialog}"
}
apply from: '../artifacts.gradle'
diff --git a/core-ui/build.gradle b/core-ui/build.gradle
index 58cde79..397d4ab 100644
--- a/core-ui/build.gradle
+++ b/core-ui/build.gradle
@@ -1,7 +1,4 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
-ext.kauSubModuleMinSdk = project.CORE_MIN_SDK
+ext.kauSubModuleMinSdk = kau.coreMinSdk
apply from: '../android-lib.gradle'
diff --git a/core/build.gradle b/core/build.gradle
index 99ea569..a2d1dd3 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -1,26 +1,23 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
-ext.kauSubModuleMinSdk = project.CORE_MIN_SDK
+ext.kauSubModuleMinSdk = kau.coreMinSdk
apply from: '../android-lib.gradle'
dependencies {
- api "org.jetbrains.kotlin:kotlin-stdlib:${KOTLIN}"
+ api kauDependency.kotlin
- api "com.android.support:appcompat-v7:${ANDROID_SUPPORT_LIBS}"
- api "com.android.support:support-v13:${ANDROID_SUPPORT_LIBS}"
- api "com.android.support:design:${ANDROID_SUPPORT_LIBS}"
- api "com.android.support:recyclerview-v7:${ANDROID_SUPPORT_LIBS}"
- api "com.android.support:cardview-v7:${ANDROID_SUPPORT_LIBS}"
- api "com.android.support.constraint:constraint-layout:${CONSTRAINT_LAYOUT}"
+ api "com.android.support:appcompat-v7:${kau.supportLibs}"
+ api "com.android.support:support-v13:${kau.supportLibs}"
+ api "com.android.support:design:${kau.supportLibs}"
+ api "com.android.support:recyclerview-v7:${kau.supportLibs}"
+ api "com.android.support:cardview-v7:${kau.supportLibs}"
+ api "com.android.support.constraint:constraint-layout:${kau.constraintLayout}"
- api "com.mikepenz:iconics-core:${ICONICS}@aar"
- api "com.mikepenz:google-material-typeface:${IICON_GOOGLE}.original@aar"
+ api "com.mikepenz:iconics-core:${kau.iconics}@aar"
+ api "com.mikepenz:google-material-typeface:${kau.iconicsGoogle}.original@aar"
- api "com.afollestad.material-dialogs:core:${MATERIAL_DIALOG}"
+ api "com.afollestad.material-dialogs:core:${kau.materialDialog}"
- api "org.jetbrains.anko:anko-commons:${ANKO}"
+ api "org.jetbrains.anko:anko-commons:${kau.anko}"
}
apply from: '../artifacts.gradle'
diff --git a/dependencies.gradle b/dependencies.gradle
new file mode 100644
index 0000000..08a3869
--- /dev/null
+++ b/dependencies.gradle
@@ -0,0 +1,28 @@
+ext.versions = [
+ coreMinSdk : 19,
+ minSdk : 21,
+ targetSdk : 27,
+ buildTools : '27.0.2',
+
+ gradlePlugin : '3.0.1',
+ mavenPlugin : '2.0',
+ playPublishPlugin : '1.2.0',
+ dexCountPlugin : '0.8.2',
+
+ supportLib : '27.0.2',
+ kotlin : '1.2.20',
+ aboutLibraries : '6.0.1',
+ anko : '0.10.4',
+ blurry : '2.1.1',
+ constraintLayout : '1.1.0-beta4',
+ fastAdapter : '3.1.2',
+ fastAdapterCommons : '3.1.2',
+ glide : '4.5.0',
+ iconics : '3.0.0',
+ iiconGoogle : '3.0.1.2',
+ materialDialog : '0.9.6.0',
+
+ espresso : '3.0.0',
+ junit : '4.12',
+ testRunner : '1.0.0'
+]
diff --git a/docs/Changelog.md b/docs/Changelog.md
index c95dbce..2b8f6d1 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -1,9 +1,11 @@
# Changelog
## v3.6.3
+* :core: Check for tablet in email builder
* :kpref-activity: Simplify internal code and add better encapsulation
* Add Chinese, Indonesian, Norwegian, Polish, Thai, and Turkish translations
* Add back git versioning
+* Created gradle plugin for getting version updates
## v3.6.2
* :core: Pass null instead of bundle if bundle is empty for startActivity
diff --git a/gradle.properties b/gradle.properties
index c55bb91..f1c49f3 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -14,27 +14,4 @@ org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-APP_ID=KAU
-APP_GROUP=ca.allanwang
-CORE_MIN_SDK=19
-MIN_SDK=21
-TARGET_SDK=27
-BUILD_TOOLS=27.0.2
-ANDROID_SUPPORT_LIBS=27.0.2
-
-KOTLIN=1.2.20
-ABOUT_LIBRARIES=6.0.1
-ANKO=0.10.4
-BLURRY=2.1.1
-CONSTRAINT_LAYOUT=1.1.0-beta4
-FAST_ADAPTER=3.1.2
-FAST_ADAPTER_COMMONS=3.1.2
-GLIDE=4.5.0
-ICONICS=3.0.0
-IICON_GOOGLE=3.0.1.2
-MATERIAL_DIALOG=0.9.6.0
-
-ESPRESSO=3.0.0
-JUNIT=4.12
-TEST_RUNNER=1.0.0
+# org.gradle.parallel=true \ No newline at end of file
diff --git a/kpref-activity/build.gradle b/kpref-activity/build.gradle
index 7cd923b..8b2d12d 100644
--- a/kpref-activity/build.gradle
+++ b/kpref-activity/build.gradle
@@ -1,7 +1,4 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
-ext.kauSubModuleMinSdk = project.CORE_MIN_SDK
+ext.kauSubModuleMinSdk = kau.coreMinSdk
ext.kauSubModuleResourcePrefix = "kau_pref_"
diff --git a/mediapicker/build.gradle b/mediapicker/build.gradle
index aff10c4..cbba092 100644
--- a/mediapicker/build.gradle
+++ b/mediapicker/build.gradle
@@ -1,7 +1,4 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
-ext.kauSubModuleMinSdk = project.CORE_MIN_SDK
+ext.kauSubModuleMinSdk = kau.coreMinSdk
apply from: '../android-lib.gradle'
apply plugin: 'kotlin-kapt'
@@ -10,8 +7,8 @@ dependencies {
implementation project(':core-ui')
implementation project(':adapter')
- api "com.github.bumptech.glide:glide:${GLIDE}"
- implementation "jp.wasabeef:blurry:${BLURRY}"
+ api "com.github.bumptech.glide:glide:${kau.glide}"
+ implementation "jp.wasabeef:blurry:${kau.blurry}"
}
apply from: '../artifacts.gradle'
diff --git a/sample/build.gradle b/sample/build.gradle
index bfe5182..5bbdbb0 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,6 +1,3 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.triplet.play'
@@ -14,8 +11,8 @@ play {
}
android {
- compileSdkVersion Integer.parseInt(project.TARGET_SDK)
- buildToolsVersion project.BUILD_TOOLS
+ compileSdkVersion kau.targetSdk
+ buildToolsVersion kau.buildTools
androidGitVersion {
codeFormat = 'MMNNPPXX'
@@ -24,8 +21,8 @@ android {
defaultConfig {
applicationId "ca.allanwang.kau.sample"
- minSdkVersion Integer.parseInt(project.MIN_SDK)
- targetSdkVersion Integer.parseInt(project.TARGET_SDK)
+ minSdkVersion kau.minSdk
+ targetSdkVersion kau.targetSdk
versionName androidGitVersion.name()
versionCode androidGitVersion.code()
multiDexEnabled true
@@ -97,16 +94,14 @@ dependencies {
implementation project(':kpref-activity')
implementation project(':searchview')
implementation project(':mediapicker')
- implementation "com.mikepenz:google-material-typeface:${IICON_GOOGLE}.original@aar"
- implementation "org.jetbrains.kotlin:kotlin-stdlib:${KOTLIN}"
- androidTestImplementation("com.android.support.test.espresso:espresso-core:${ESPRESSO}") {
+ androidTestImplementation("com.android.support.test.espresso:espresso-core:${kau.espresso}") {
exclude group: 'com.android.support', module: 'support-annotations'
}
- androidTestImplementation("com.android.support.test:runner:${TEST_RUNNER}") {
+ androidTestImplementation("com.android.support.test:runner:${kau.testRunner}") {
exclude group: 'com.android.support', module: 'support-annotations'
}
- androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}"
- testImplementation "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}"
- testImplementation "junit:junit:${JUNIT}"
+ androidTestImplementation kauDependency.kotlinTest
+ testImplementation kauDependency.kotlinTest
+ testImplementation kauDependency.junit
}
diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml
index 3eec313..cd6c41a 100644
--- a/sample/src/main/res/xml/kau_changelog.xml
+++ b/sample/src/main/res/xml/kau_changelog.xml
@@ -12,7 +12,7 @@
<item text="" />
<item text="Add Chinese, Indonesian, Norwegian, Polish, Thai, and Turkish translations" />
<item text="Add back git versioning" />
- <item text="" />
+ <item text="Created gradle plugin for getting version updates" />
<item text="" />
<version title="v3.6.2" />
diff --git a/searchview/build.gradle b/searchview/build.gradle
index edf3f9c..39a3662 100644
--- a/searchview/build.gradle
+++ b/searchview/build.gradle
@@ -1,6 +1,3 @@
-plugins {
- id 'com.gladed.androidgitversion' version '0.4.3'
-}
ext.kauSubModuleResourcePrefix = "kau_search_"
apply from: '../android-lib.gradle'
diff --git a/settings.gradle b/settings.gradle
index 031dff4..2bd5947 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -6,7 +6,11 @@ include ':core',
':colorpicker',
':mediapicker',
':kpref-activity',
- ':searchview'
+ ':searchview',
+
+ ':gradle-plugin'
if (!System.env.JITPACK)
- include ':sample' \ No newline at end of file
+ include ':sample'
+
+project(":gradle-plugin").projectDir = file("buildSrc") \ No newline at end of file