aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src/main/kotlin/ca
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-06-07 14:21:53 -0400
committerAllan Wang <me@allanwang.ca>2019-06-07 14:21:53 -0400
commit6fedbcdbc51e3cbc93b920f3fda573e1d2ec780b (patch)
treeb01d8c13c5a91994e619a6865d2a8341575ebfee /buildSrc/src/main/kotlin/ca
parent2c20c8bd36589e96388a0bfe851e7229d7f7cf58 (diff)
downloadkau-6fedbcdbc51e3cbc93b920f3fda573e1d2ec780b.tar.gz
kau-6fedbcdbc51e3cbc93b920f3fda573e1d2ec780b.tar.bz2
kau-6fedbcdbc51e3cbc93b920f3fda573e1d2ec780b.zip
Remove package name
Diffstat (limited to 'buildSrc/src/main/kotlin/ca')
-rw-r--r--buildSrc/src/main/kotlin/ca/allanwang/kau/ChangelogGenerator.kt103
-rw-r--r--buildSrc/src/main/kotlin/ca/allanwang/kau/Dependencies.kt13
-rw-r--r--buildSrc/src/main/kotlin/ca/allanwang/kau/Plugins.kt14
-rw-r--r--buildSrc/src/main/kotlin/ca/allanwang/kau/Versions.kt80
4 files changed, 0 insertions, 210 deletions
diff --git a/buildSrc/src/main/kotlin/ca/allanwang/kau/ChangelogGenerator.kt b/buildSrc/src/main/kotlin/ca/allanwang/kau/ChangelogGenerator.kt
deleted file mode 100644
index 66f28f9..0000000
--- a/buildSrc/src/main/kotlin/ca/allanwang/kau/ChangelogGenerator.kt
+++ /dev/null
@@ -1,103 +0,0 @@
-package ca.allanwang.kau
-
-import groovy.util.Node
-import groovy.util.XmlParser
-import org.gradle.api.GradleException
-import java.io.File
-
-/**
- * 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
- */
-object ChangelogGenerator {
-
- class ChangelogException(message: String) : GradleException(message)
-
- private fun fail(message: String): Nothing =
- throw ChangelogException(message)
-
- class ChangelogEntry(val version: String, val items: Array<String>)
-
- private fun Node.forEachNode(action: (Node) -> Unit) {
- children().forEach {
- action(it as Node)
- }
- }
-
- fun read(inputUri: String): List<ChangelogEntry> {
- val input = File(inputUri)
- if (!input.exists()) {
- fail("Could not generate changelog from ${input.absolutePath}")
- }
-
- val parser = XmlParser().parse(inputUri)
-
- val entries: MutableList<ChangelogEntry> = mutableListOf()
- var version: String? = null
- val items: MutableList<String> = mutableListOf()
-
- fun addEntry() {
- version?.also { v ->
- entries.add(ChangelogEntry(v, items.toTypedArray()))
- items.clear()
- }
- }
-
- parser.depthFirst().mapNotNull { it as? Node }.forEach { n ->
- when (n.name()) {
- "version" -> {
- addEntry()
- version = n.attribute("title")?.toString() ?: ""
- }
- "item" -> {
- n.attribute("text")?.toString()?.takeIf(String::isNotBlank)?.let {
- items.add(it)
- }
- }
- }
- }
- addEntry()
- return entries
- }
-
- fun generate(inputUri: String, outputUri: String): List<ChangelogEntry> {
- val entries = read(inputUri)
- val output = 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}")
- }
- val markdown = buildString {
- append("# Changelog\n")
- entries.forEach { e ->
- append("\n## ${e.version}\n")
- e.items.forEach {
- append("* $it\n")
- }
- }
- }
- output.writeText(markdown)
- println("Generated changelog at ${output.absolutePath}")
- return entries
- }
-} \ No newline at end of file
diff --git a/buildSrc/src/main/kotlin/ca/allanwang/kau/Dependencies.kt b/buildSrc/src/main/kotlin/ca/allanwang/kau/Dependencies.kt
deleted file mode 100644
index 74f482f..0000000
--- a/buildSrc/src/main/kotlin/ca/allanwang/kau/Dependencies.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package ca.allanwang.kau
-
-/**
- * Some common dependencies, backed by the supplied versions
- */
-object Dependencies {
- const val kotlin = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}"
- const val kotlinTest = "org.jetbrains.kotlin:kotlin-test-junit:${Versions.kotlin}"
- const val junit = "junit:junit:${Versions.junit}"
- const val espresso = "androidx.test.espresso:espresso-core:${Versions.espresso}"
- const val testRunner = "androidx.test.ext:junit:${Versions.testRunner}"
- const val testRules = "androidx.test:rules:${Versions.testRules}"
-} \ No newline at end of file
diff --git a/buildSrc/src/main/kotlin/ca/allanwang/kau/Plugins.kt b/buildSrc/src/main/kotlin/ca/allanwang/kau/Plugins.kt
deleted file mode 100644
index 2be0a59..0000000
--- a/buildSrc/src/main/kotlin/ca/allanwang/kau/Plugins.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package ca.allanwang.kau
-
-/**
- * Some common buildscript plugins, backed by the supplied versions
- */
-object Plugins {
- const val android = "com.android.tools.build:gradle:${Versions.gradlePlugin}"
- const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
- const val androidMaven = "com.github.dcendents:android-maven-gradle-plugin:${Versions.mavenPlugin}"
- const val playPublisher = "com.github.triplet.gradle:play-publisher:${Versions.playPublishPlugin}"
- const val dexCount = "com.getkeepsafe.dexcount:dexcount-gradle-plugin:${Versions.dexCountPlugin}"
- const val gitVersion = "com.gladed.androidgitversion:gradle-android-git-version:${Versions.gitVersionPlugin}"
- const val spotless = "com.diffplug.spotless:spotless-plugin-gradle:${Versions.spotless}"
-} \ No newline at end of file
diff --git a/buildSrc/src/main/kotlin/ca/allanwang/kau/Versions.kt b/buildSrc/src/main/kotlin/ca/allanwang/kau/Versions.kt
deleted file mode 100644
index 93cb25e..0000000
--- a/buildSrc/src/main/kotlin/ca/allanwang/kau/Versions.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package ca.allanwang.kau
-
-object Versions {
- const val coreMinSdk = 19
- const val minSdk = 21
- const val targetSdk = 28
-
- // https://developer.android.com/studio/releases/build-tools
- const val buildTools = "28.0.3"
-
- // https://mvnrepository.com/artifact/androidx.appcompat/appcompat?repo=google
- const val appcompat = "1.0.2"
-
- // https://mvnrepository.com/artifact/com.google.android.material/material
- const val googleMaterial = "1.0.0"
-
- // https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview
- const val recyclerView = "1.0.0"
-
- // https://mvnrepository.com/artifact/androidx.cardview/cardview
- const val cardView = "1.0.0"
-
- // https://mvnrepository.com/artifact/androidx.constraintlayout/constraintlayout
- const val constraintLayout = "1.1.3"
-
- // https://kotlinlang.org/docs/reference/using-gradle.html
- const val kotlin = "1.3.31"
-
- // https://github.com/Kotlin/kotlinx.coroutines/releases
- const val coroutines = "1.3.0-M1"
-
- // https://github.com/mikepenz/AboutLibraries/releases
- const val aboutLibraries = "6.2.3"
-
- // https://github.com/wasabeef/Blurry/releases
- const val blurry = "3.0.0"
-
- // https://github.com/mikepenz/FastAdapter#using-maven
- const val fastAdapter = "3.3.1"
- const val fastAdapterCommons = fastAdapter
-
- // https://github.com/bumptech/glide/releases
- const val glide = "4.9.0"
-
- // https://github.com/mikepenz/Android-Iconics#1-provide-the-gradle-dependency
- const val iconics = "3.2.5"
- const val iconicsGoogle = "3.0.1.3"
- const val iconicsMaterial = "2.2.0.5"
- const val iconicsCommunity = "3.5.95.1"
-
- // https://github.com/afollestad/material-dialogs/releases
- const val materialDialog = "3.0.0-rc2"
-
- // https://mvnrepository.com/artifact/androidx.test.espresso/espresso-core?repo=google
- const val espresso = "3.1.1"
-
- // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
- const val junit = "4.12"
-
- const val testRunner = "1.1.0"
-
- // https://mvnrepository.com/artifact/androidx.test/rules?repo=google
- const val testRules = "1.1.1"
-
- // https://github.com/diffplug/spotless/blob/master/plugin-gradle/CHANGES.md
- const val spotless = "3.18.0"
-
- // https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google
- const val gradlePlugin = "3.4.1"
- // https://github.com/dcendents/android-maven-gradle-plugin/releases
- const val mavenPlugin = "2.1"
- // https://github.com/Triple-T/gradle-play-publisher/releases
- const val playPublishPlugin = "2.2.1"
-
- // https://github.com/KeepSafe/dexcount-gradle-plugin/releases
- const val dexCountPlugin = "0.8.6"
-
- // https://github.com/gladed/gradle-android-git-version/releases
- const val gitVersionPlugin = "0.4.9"
-} \ No newline at end of file