From 8052a9a4b5f64191d19912d53e16d7e49a587a17 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 4 Jun 2019 01:02:35 -0400 Subject: Convert plugin to kotlin code --- .../ca/allanwang/kau/ChangelogGenerator.groovy | 76 -------------------- .../groovy/ca/allanwang/kau/Dependencies.groovy | 13 ---- .../main/groovy/ca/allanwang/kau/KauPlugin.groovy | 16 ----- .../main/groovy/ca/allanwang/kau/Plugins.groovy | 18 ----- .../main/groovy/ca/allanwang/kau/Versions.groovy | 81 ---------------------- 5 files changed, 204 deletions(-) delete mode 100644 buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy delete mode 100644 buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy delete mode 100644 buildSrc/src/main/groovy/ca/allanwang/kau/KauPlugin.groovy delete mode 100644 buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy delete mode 100644 buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy (limited to 'buildSrc/src/main/groovy') diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy deleted file mode 100644 index bb56fa2..0000000 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy +++ /dev/null @@ -1,76 +0,0 @@ -package ca.allanwang.kau - -import org.gradle.api.GradleException -import org.gradle.api.Project - -/** - * Given an xml of the format - * - * - * - * - * - * - * - * - * - * - * 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 deleted file mode 100644 index a27e503..0000000 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy +++ /dev/null @@ -1,13 +0,0 @@ -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}" - static def espresso = "androidx.test.espresso:espresso-core:${Versions.espresso}" - static def testRunner = "androidx.test.ext:junit:${Versions.testRunner}" - static def testRules = "androidx.test:rules:${Versions.testRules}" -} \ 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 deleted file mode 100644 index e73564c..0000000 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/KauPlugin.groovy +++ /dev/null @@ -1,16 +0,0 @@ -package ca.allanwang.kau - -import org.gradle.api.Plugin -import org.gradle.api.Project - -class KauPlugin implements Plugin { - - @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 deleted file mode 100644 index 89182f1..0000000 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy +++ /dev/null @@ -1,18 +0,0 @@ -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}" - static def spotless = "com.diffplug.spotless:spotless-plugin-gradle:${Versions.spotless}" -} \ 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 deleted file mode 100644 index a50a7a0..0000000 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy +++ /dev/null @@ -1,81 +0,0 @@ -package ca.allanwang.kau - -class Versions { - static def coreMinSdk = 19 - static def minSdk = 21 - static def targetSdk = 28 - - // https://developer.android.com/studio/releases/build-tools - static def buildTools = '28.0.3' - - // https://mvnrepository.com/artifact/androidx.appcompat/appcompat?repo=google - static def appcompat = '1.0.2' - - // https://mvnrepository.com/artifact/com.google.android.material/material - static def googleMaterial = '1.0.0' - - // https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview - static def recyclerView = '1.0.0' - - // https://mvnrepository.com/artifact/androidx.cardview/cardview - static def cardView = '1.0.0' - - // https://mvnrepository.com/artifact/androidx.constraintlayout/constraintlayout - static def constraintLayout = '1.1.3' - - // https://kotlinlang.org/docs/reference/using-gradle.html - static def kotlin = '1.3.31' - - // https://github.com/Kotlin/kotlinx.coroutines/releases - static def coroutines = '1.2.1' - - // https://github.com/mikepenz/AboutLibraries/releases - static def aboutLibraries = '6.2.3' - - // https://github.com/wasabeef/Blurry/releases - static def blurry = '3.0.0' - - // https://github.com/mikepenz/FastAdapter#using-maven - static def fastAdapter = '3.3.1' - static def fastAdapterCommons = fastAdapter - - // https://github.com/bumptech/glide/releases - static def glide = '4.9.0' - - // https://github.com/mikepenz/Android-Iconics#1-provide-the-gradle-dependency - static def iconics = '3.2.5' - static def iconicsGoogle = '3.0.1.3' - static def iconicsMaterial = '2.2.0.5' - static def iconicsCommunity = '3.5.95.1' - - // https://github.com/afollestad/material-dialogs/releases - static def materialDialog = '0.9.6.0' - - // https://mvnrepository.com/artifact/androidx.test.espresso/espresso-core?repo=google - static def espresso = '3.1.1' - - // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api - static def junit = '4.12' - - - static def testRunner = '1.1.0' - - // https://mvnrepository.com/artifact/androidx.test/rules?repo=google - static def testRules = '1.1.1' - - // https://github.com/diffplug/spotless/blob/master/plugin-gradle/CHANGES.md - static def spotless = '3.18.0' - - // https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google - static def gradlePlugin = '3.4.1' - // https://github.com/dcendents/android-maven-gradle-plugin/releases - static def mavenPlugin = '2.1' - // https://github.com/Triple-T/gradle-play-publisher/releases - static def playPublishPlugin = '2.1.0' - - // https://github.com/KeepSafe/dexcount-gradle-plugin/releases - static def dexCountPlugin = '0.8.6' - - // https://github.com/gladed/gradle-android-git-version/releases - static def gitVersionPlugin = '0.4.7' -} \ No newline at end of file -- cgit v1.2.3