aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src/main/groovy/ca/allanwang
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc/src/main/groovy/ca/allanwang')
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/ChangelogGenerator.groovy76
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy12
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/KauPlugin.groovy16
-rw-r--r--buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy17
4 files changed, 0 insertions, 121 deletions
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
- *
- * <?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
deleted file mode 100644
index ec3d208..0000000
--- a/buildSrc/src/main/groovy/ca/allanwang/kau/Dependencies.groovy
+++ /dev/null
@@ -1,12 +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 = "com.android.support.test.espresso:espresso-core:${Versions.espresso}"
- static def testRunner = "com.android.support.test:runner:${Versions.testRunner}"
-} \ 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<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
deleted file mode 100644
index c1ecba6..0000000
--- a/buildSrc/src/main/groovy/ca/allanwang/kau/Plugins.groovy
+++ /dev/null
@@ -1,17 +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}"
-} \ No newline at end of file