aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 35a61593d84d7deba597837390d214f98e0a76e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
System.setProperty("file.encoding", "UTF-8")

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
        mavenLocal()
        maven { url 'https://jitpack.io' }
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.github.menny:GradleVersion:1cd6d47894028c58924d80238068aaf579a04663'

        classpath 'com.github.triplet.gradle:play-publisher:2.0.0'

        //this is needed for publishing
        classpath 'com.novoda:bintray-release:0.9'
    }
}

apply plugin: 'net.evendanan.versiongenerator'

def generators = [
        new net.evendanan.versiongenerator.generators.EnvBuildVersionGenerator.CircleCi(1000, -1600),
        new net.evendanan.versiongenerator.generators.GitBuildVersionGenerator(0, 0),
        new net.evendanan.versiongenerator.generators.StaticVersionGenerator()
]

def versionData = versionGenerator.generateVersion(4, 0, 0, generators)
rootProject.version = versionData.versionName
rootProject.file('.generated_pack_version').write(versionData.versionName)

rootProject.ext.versionData = versionData

tasks.register("generateMarkDownOfLanguagePacks") {
    group "AnySoftKeyboard"
    description 'Printing a MarkDown-friendly list of languages'

    doLast {
        println("## Languages in this repo")
        println()

        subprojects.each {
            if (it.plugins.hasPlugin('com.android.application')) {
                def image = "<img src='languages/${it.parent.name}/apk/flag/{{IMAGE_FILENAME}}' height='16'>&nbsp;"
                if (it.file("flag/flag.png").exists()) {
                    image = image.replace("{{IMAGE_FILENAME}}", "flag.png")
                } else if (it.file("flag/flag.svg").exists()) {
                    image = image.replace("{{IMAGE_FILENAME}}", "flag.svg?sanitize=1")
                } else {
                    image = ""
                }
                def packReadMeDetails = "1. ${image}${it.parent.name.capitalize()}: [Source](languages/${it.parent.name})"

                if (it.ext.shouldBePublished) {
                    packReadMeDetails += " • [Play Store](https://play.google.com/store/apps/details?id=${it.android.defaultConfig.applicationId})"
                }

                println(packReadMeDetails)
            }
        }
    }
}

subprojects {
    it.group "com.anysoftkeybaord${it.parent.path.replace(':', '.')}"
    it.version = rootProject.version
}