forked from AnySoftKeyboard/LanguagePack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
93 lines (79 loc) · 3.57 KB
/
build.gradle
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
System.setProperty("file.encoding", "UTF-8")
buildscript {
repositories {
google()
mavenCentral()
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'net.evendanan.autoversion:gradle-plugin:0.2.2'
classpath 'com.github.triplet.gradle:play-publisher:2.4.2'
//not compatible with gradle 6+
//classpath 'com.novoda:bintray-release:0.9.1'
}
}
apply from: "$rootDir/gradle/versioning_root.gradle"
tasks.register("generateMarkDownOfLanguagePacks") {
group "AnySoftKeyboard"
description 'Printing a MarkDown-friendly list of languages'
doLast {
println("## Languages in this repo")
println()
subprojects.each {
if (it.path.contains('languages') && it.plugins.hasPlugin('com.android.application')) {
def image = "<img src='languages/${it.parent.name}/apk/flag/{{IMAGE_FILENAME}}' height='16'> "
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)
}
}
}
}
tasks.register("clean") {
delete 'buildSrc/build'
}
tasks.register("copyAnySoftKeyboardBaseLib") {
group "AnySoftKeyboard"
description 'Copies several of base aars from this repo into AnySoftKeyboard local repo. Use -PanysoftkeyboardPath=[path/to/AnySoftKeyboard/]'
def libsToCopy = [':api', ':base', ':languages:english:pack']
def targets = ['external/api/libs', 'external/packs/libs', 'external/packs/libs']
libsToCopy.forEach {
dependsOn rootProject.findProject(it).tasks.named('assembleRelease')
}
doLast {
if (!project.hasProperty('anysoftkeyboardPath')) {
throw new IllegalArgumentException("Please provide path to AnySoftKeyboard code as an argument: -PanysoftkeyboardPath=[path/to/AnySoftKeyboard/]")
}
File askPath = file(project.getProperties().get('anysoftkeyboardPath'))
if (!askPath.exists() || !askPath.isDirectory()) {
throw new IllegalArgumentException("The path ${askPath.absolutePath} does not exist or is not a folder. This should point to where you have the local copy of AnySoftKeyboard code.")
}
(0..libsToCopy.size()-1).each { outputIndex ->
def libProject = rootProject.findProject(libsToCopy.get(outputIndex))
def targetFolder = "${askPath.absolutePath}/${targets[outputIndex]}/"
println "will copy ${libProject.projectDir.absolutePath} to ${targetFolder}"
delete {
delete "${targetFolder}/*"
}
copy {
from("${libProject.buildDir.absolutePath}/outputs/aar/") {
include '**/*.aar'
rename '.*', "${libProject.path.substring(1).replace(':', '-')}.aar"
}
into "${targetFolder}/"
}
}
}
}