forked from AnySoftKeyboard/LanguagePack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
191 lines (159 loc) · 6.8 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
import com.anysoftkeyboard.tools.generatewordslist.GenerateWordsListFromAOSPTask
import com.anysoftkeyboard.tools.generatewordslist.GenerateWordsListTask
import com.anysoftkeyboard.tools.generatewordslist.MergeWordsListTask
import com.anysoftkeyboard.tools.makedictionary.MakeDictionaryTask
import fr.avianey.androidsvgdrawable.gradle.SvgDrawableTask
import net.evendanan.versiongenerator.generators.EnvBuildVersionGenerator
import net.evendanan.versiongenerator.generators.GitBuildVersionGenerator
import net.evendanan.versiongenerator.generators.StaticVersionGenerator
System.setProperty("file.encoding", "UTF-8")
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.github.AnySoftKeyboard.AnySoftKeyboardTools:makedictionary:287fe7812294918636359e4d28dbcbc931f3dab8'
classpath 'com.github.AnySoftKeyboard.AnySoftKeyboardTools:generatewordslist:287fe7812294918636359e4d28dbcbc931f3dab8'
//classpath files('english_dictionary/generatewordslist-1.0-SNAPSHOT.jar')
classpath 'org.jsoup:jsoup:1.9.1'
classpath 'com.github.Triple-T:gradle-play-publisher:8cda31a5d0e3c4f2d7f47ffde6fc3b370e59dd8a'
classpath 'com.github.menny:GradleVersion:0.0.4'
classpath('fr.avianey.androidsvgdrawable:gradle-plugin:3.0.0') {
exclude group: 'xerces'
}
}
}
apply plugin: 'checkstyle'
apply plugin: 'com.android.application'
apply plugin: 'com.github.triplet.play'
apply plugin: 'net.evendanan.versiongenerator'
apply plugin: "androidsvgdrawable"
def generators = [
new EnvBuildVersionGenerator.CircleCi(0,0),
new GitBuildVersionGenerator(0,0),
new StaticVersionGenerator()
]
def versionData = versionGenerator.generateVersion(1, 0, 0, generators)
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "com.anysoftkeyboard.languagepack.languagepack"
minSdkVersion 7
targetSdkVersion 26
versionName versionData.versionName
versionCode versionData.versionCode
// change name of generated apk to make previews and testing of multiple packs easier
def packName = applicationId.substring(applicationId.lastIndexOf(".") + 1)
setProperty("archivesBaseName", "ASKLangPack-${packName}-${versionCode}")
println "Building ${applicationId} v${versionName}, version-code ${versionCode}..."
}
signingConfigs {
release {
storeFile file("/tmp/language_pack.keystore")
storePassword System.getenv("PACK_KEYSTORE_PASSWORD")
keyAlias System.getenv("PACK_KEYSTORE_ALIAS")
keyPassword System.getenv("PACK_KEYSTORE_KEY_PASSWORD")
}
}
buildTypes {
release {
signingConfig signingConfigs.release
zipAlignEnabled true
debuggable false
minifyEnabled false
}
}
}
play {
track = 'alpha'
serviceAccountEmail = System.getenv("PUBLISH_APK_SERVICE_ACCOUNT_EMAIL")
pk12File = file('/tmp/apk_upload_key.p12')
uploadImages = true
}
task parseTextInputFiles(type: GenerateWordsListTask) {
inputFiles new File(project.getProjectDir(), "dictionary/NY_STATE_ASSEMBLY_TRANSCRIPT_20120621.txt"),
//Download the archive from https://dumps.wikimedia.org/other/static_html_dumps/current/simple/
new File(project.getProjectDir(), "dictionary/First_English_Civil_War_Wikipedia.htm")
outputWordsListFile new File(project.getProjectDir(), "dictionary/words_from_texts.xml")
}
//another option is to download the words-list from AOSP at https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/master/dictionaries/
//make sure that you are using an unzipped file. The XX_wordlist.combined file should be a plain text file.
task parseAospForEnglishDictionary(type: GenerateWordsListFromAOSPTask) {
inputFile new File(project.getProjectDir(), "dictionary/aosp_en_wordlist.combined")
outputWordsListFile new File(project.getProjectDir(), "dictionary/words_from_aosp.xml")
maxWordsInList 300000
}
task mergeAllWordLists(type: MergeWordsListTask) {
dependsOn parseTextInputFiles
inputWordsListFiles = [
new File(project.getProjectDir(), "dictionary/words_from_texts.xml"),
new File(project.getProjectDir(), "dictionary/popular_websites_words.xml"),//website I use most
] as File[]
outputWordsListFile new File(project.getProjectDir(), "dictionary/words_merged.xml")
maxWordsInList 100000
}
task makeDictionary(type: MakeDictionaryTask) {
dependsOn mergeAllWordLists
inputWordsListFile new File(project.getProjectDir(), "dictionary/words_merged.xml")
}
afterEvaluate { proj ->
proj.tasks.all { task ->
if (task.name.startsWith('generate') && task.name.endsWith('BuildConfig')) {
task.dependsOn makeDictionary
}
}
}
dependencies {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
compile 'com.github.AnySoftKeyboard:AnySoftKeyboard-API:1.9.0'
}
task checkstyle(type: Checkstyle) {
configFile file("${projectDir}/checkstyle/checkstyle.xml")
source 'src'
classpath = files()
}
// create app icon in all necessary sizes, automatically adding flag
task svgToDrawablePng(type: SvgDrawableTask) {
// specify where to pick SVG from
from = files('src/main/svg-png/dummy')
// specify the android res folder
to = file('src/main/res')
// create qualified directories if missing
createMissingDirectories = true
// override files only if necessary
overwriteMode = 'ifModified'
// generate PNGs for the following densities
targetedDensities = ['ldpi', 'hdpi', 'mdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi']
outputFormat = 'PNG'
outputType = 'mipmap'
// composition of SVGs
svgMaskFiles = files('src/main/svg-png/mask-launcher')
svgMaskResourceFiles = files('src/main/svg-png/flag')
}
// create app icon in all necessary sizes, automatically adding flag
task svgToDrawablePngPlay(type: SvgDrawableTask) {
// specify where to pick SVG from
from = files('src/main/svg-png/dummy')
// specify the android res folder
to = file('src/main/play/en-US/listing/icon')
// create qualified directories if missing
createMissingDirectories = true
// override files only if necessary
overwriteMode = 'ifModified'
outputFormat = 'PNG'
outputType = 'raw'
// composition of SVGs
svgMaskFiles = files('src/main/svg-png/mask-play')
svgMaskResourceFiles = files('src/main/svg-png/flag')
doLast {
file('src/main/play/en-US/listing/icon/logo_launcher.png').renameTo(file('src/main/play/en-US/listing/icon/ask_logo.png'))
}
}