forked from AnySoftKeyboard/AnySoftKeyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
191 lines (165 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
import com.android.build.OutputFile;
import localproperties.LocalPropertiesFile;
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'pmd'
apply plugin: 'jacoco'
version versionbuilder.VersionBuilder.buildGitVersionName()
group 'net.evendanan'
println "Building AnySoftKeyboard "+version
def localExtraProperties = new LocalPropertiesFile(new File(projectDir, 'local.extra.properties'))
def localSigningProperties = new LocalPropertiesFile(new File(projectDir, 'local.signing.properties'))
//support for density split
ext.versionCodes = [all:0, ldpi:1, mdpi:2, hdpi:3, xhdpi:4]
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
def key = output.getFilter(OutputFile.DENSITY) == null ? "all" : output.getFilter(OutputFile.DENSITY)
output.versionCodeOverride = project.ext.versionCodes.get(key) + android.defaultConfig.versionCode
output.versionNameOverride = android.defaultConfig.versionName+"-"+key
def fileName = output.outputFile.name.replace(".apk", "-" + output.versionNameOverride + ".apk")
output.outputFile = new File(output.outputFile.parent, fileName)
}
}
android {
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
}
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId 'com.menny.android.anysoftkeyboard'
versionCode versionbuilder.VersionBuilder.buildGitVersionNumber()
versionName project.version
minSdkVersion 7
targetSdkVersion 22
//adding additional fields to the BuildConfig class.
//extra details - from local
def String support_email_address = localExtraProperties.getValueWithConsoleFallback('CRASH_REPORT_EMAIL', 'ooops@example.com', 'Support email address')
println 'crash report email is: '+support_email_address
buildConfigField "String", "CRASH_REPORT_EMAIL_ADDRESS", '"'+support_email_address+'"'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
signingConfigs {
release {
def String keystore_file = localSigningProperties.getValueWithConsoleFallback('STORE_FILE', 'Key-Store file name')
def String keystore_password = localSigningProperties.getValueWithConsoleFallback('STORE_PASSWORD', 'Key-Store file password')
def String key_alias = localSigningProperties.getValueWithConsoleFallback('KEY_ALIAS', 'App key alias')
def String key_alias_password = localSigningProperties.getValueWithConsoleFallback('KEY_PASSWORD', 'App key password')
if ( utils.Utils.isEmpty(keystore_file) || utils.Utils.isEmpty(keystore_password) ||
utils.Utils.isEmpty(key_alias) || utils.Utils.isEmpty(key_alias_password)) {
//missing signing details, so I'll use debug signingConfigs details.
println "Missing release build-type signing details, I'll use DEBUG signing for the release."
storeFile signingConfigs.debug.storeFile
storePassword signingConfigs.debug.storePassword
keyAlias signingConfigs.debug.keyAlias
keyPassword signingConfigs.debug.keyPassword
} else {
println 'For signing, will use key-store file '+keystore_file+', with key '+key_alias
storeFile file(keystore_file)
storePassword keystore_password
keyAlias key_alias
keyPassword key_alias_password
}
}
}
buildTypes {
release {
signingConfig signingConfigs.release
zipAlignEnabled true
minifyEnabled true
proguardFiles 'proguard-android-optimize.txt', 'proguard-android-samsung-app-compact-fix.txt', 'proguard-rules.txt'
}
debug {
signingConfig signingConfigs.release
zipAlignEnabled true
debuggable true
testCoverageEnabled false
}
}
jacoco {
version "0.7.1.201405082137"
}
splits {
density {
enable false
//these will merged into the universal APK
//I'm trying to really reduce the size of the low densities.
exclude "tvdpi", "xxhdpi", "xxxhdpi"
}
}
}
jacoco {
toolVersion "0.7.1.201405082137"
}
// Define coverage source.
// If you have rs/aidl etc... add them here.
def coverageSourceDirs = [
'src/main/java',
]
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
classDirectories = fileTree(
dir: './build/intermediates/classes/debug',
excludes: ['**/R*.class',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector*.class'
])
sourceDirectories = files(coverageSourceDirs)
executionData = files("$buildDir/jacoco/testDebug.exec")
// Bit hacky but fixes https://code.google.com/p/android/issues/detail?id=69174.
// We iterate through the compiled .class tree and rename $$ to $.
doFirst {
new File("$buildDir/intermediates/classes/").eachFileRecurse { file ->
if (file.name.contains('$$')) {
file.renameTo(file.path.replace('$$', '$'))
}
}
}
}
dependencies {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
compile project(':jnidictionaryv1')
compile project(':jnidictionaryv2')
compile 'net.evendanan.anysoftkeyboard:api:1.2.3@aar'
compile 'net.evendanan:frankenrobot:1.1.3@aar'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:support-annotations:21.0.0'
compile fileTree(dir: 'libs', include: '*.jar')
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0-SNAPSHOT'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'com.squareup:fest-android:1.0.8'
}