forked from klassm/andFHEM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
272 lines (238 loc) · 8.77 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/*
* AndFHEM - Open Source Android application to control a FHEM home automation
* server.
*
* Copyright (c) 2011, Matthias Klass or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU GENERAL PUBLIC LICENSE, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GENERAL PUBLIC LICENSE
* for more details.
*
* You should have received a copy of the GNU GENERAL PUBLIC LICENSE
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
classpath 'com.github.jcandksolutions.gradle:android-unit-test:2.1.1'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath 'de.mobilej.unmock:UnMockPlugin:0.1.1'
}
}
repositories {
mavenCentral()
maven { url 'https://dl.bintray.com/mamohr/maven' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'http://partnerdemo.artifactoryonline.com/partnerdemo/snapshots' }
maven { url 'https://repository-achartengine.forge.cloudbees.com/snapshot' }
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'de.mobilej.unmock'
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
testBuildType 'debug'
testOptions {
unitTests.returnDefaultValues = true
}
defaultConfig {
targetSdkVersion 21
minSdkVersion 9
testApplicationId "li.klass.fhem.test"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
compileOptions {
encoding 'UTF-8'
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
signingConfigs {
release {
storeFile file("release.keystore")
keyAlias "android"
storePassword ""
keyPassword ""
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-production.txt'
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
}
}
sourceSets {
androidTest {
aidl.srcDirs = ['src/androidTest/java']
}
test {
java.srcDirs = ['src/test/java']
resources.srcDir file('src/test/resources')
}
main {
aidl.srcDirs = ['src/main/aidl']
java.srcDirs = ['src/main/java', 'src/gen/java']
}
}
packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'APK LICENSE.txt'
exclude 'LICENSE.txt'
}
productFlavors {
inapp {
applicationId "li.klass.fhem"
}
premium {
applicationId "li.klass.fhempremium"
}
}
// TODO resolve errors and remove this
lintOptions {
disable 'IconColors'
disable 'IconDipSize'
disable 'IconLocation'
disable 'IconDensities'
}
}
unMock {
// URI to download the android-all.jar from. e.g. https://oss.sonatype.org/content/groups/public/org/robolectric/android-all/
allAndroid =
'https://oss.sonatype.org/content/groups/public/org/robolectric/android-all/4.3_r2-robolectric-0/android-all-4.3_r2-robolectric-0.jar'
// classes to keep
// matched by "startsWith" - you also need to include the dependencies manually
// if you start with an "-" the class will match by "equals" (and it will additionally match
// inner classes of this class)
keep = [
"android.text.TextUtils",
"android.util.",
"android.text.",
"android.content.ContentValues",
"android.content.Intent",
"-android.location.Location",
"android.content.res.Configuration",
"org.",
"libcore.",
"com.android.internal.R",
"com.android.internal.util."
]
}
dependencies {
compile fileTree(dir: './libs', include: '*.jar')
//noinspection GradleDependency
compile 'com.android.support:support-v4:21.0.+@aar'
//noinspection GradleDependency
compile 'com.android.support:appcompat-v7:21.0.+'
//noinspection GradleDependency
compile 'com.google.android.gms:play-services:6.1.+'
compile 'commons-net:commons-net:3.3'
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'org.achartengine:achartengine:1.2.0'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.dagger:dagger:1.2.2'
compile 'joda-time:joda-time:2.4'
//noinspection GradleDependency
compile 'com.intellij:annotations:12.+@jar'
compile 'org.slf4j:slf4j-android:1.7.7'
compile 'org.apmem.tools:layouts:1.6@aar'
compile 'de.duenndns:memorizing-trust-manager:0.9@aar'
compile 'net.lingala.zip4j:zip4j:1.3.2'
compile 'com.android.support:multidex:1.0.0'
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'com.tngtech.java:junit-dataprovider:1.9.2'
testCompile 'org.assertj:assertj-core:1.7.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile 'com.squareup:javawriter:2.5.0'
androidTestCompile 'com.squareup.spoon:spoon-client:1.1.8'
}
task readSigningPasswordsFromConsole(
dependsOn: ['readSigningStorePasswordFromConsole', 'readSigningKeyAliasPasswordFromConsole'])
task readSigningStorePasswordFromConsole << {
def storePassword = getBuildProperty("storePassword");
if (!storePassword) {
storePassword = readFromConsole("Store password")
}
android.signingConfigs.release.storePassword = storePassword
}
task readSigningKeyAliasPasswordFromConsole << {
def aliasPassword = getBuildProperty("aliasPassword");
if (!aliasPassword) {
aliasPassword = readFromConsole("Alias / Google Sites password")
}
android.signingConfigs.release.keyPassword = aliasPassword
}
tasks.whenTaskAdded { task ->
if (task.name == 'packageInappRelease' || task.name == 'packagePremiumRelease') {
task.dependsOn readSigningPasswordsFromConsole
}
}
task release(dependsOn: ['testInappDebug', 'assembleRelease', 'uploadToGoogleSites']) << {}
def readFromConsole(String prompt) {
def console = System.console()
return new String(console.readPassword('\n\n' + prompt + '\n> '))
}
task artifacts {
group = "Help"
description = "Displays the artifacts associated with each configuration of " + project
doFirst {
println " Project:" + project.name
project.configurations.each { conf ->
println " Configuration: ${conf.name}"
conf.allDependencies.each { dep ->
println " ${dep.group}:${dep.name}:${dep.version}"
}
}
}
}
def getBuildProperty(String key) {
return getBuildProperties().get(key)
}
def getBuildProperties() {
def props = new Properties()
new File(System.getProperty("user.home") + "/andFHEM.properties").withInputStream {
stream -> props.load(stream)
}
return props
}
android.applicationVariants.all { variant ->
task("javadoc${variant.name}", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
options.links("http://docs.oracle.com/javase/7/docs/api/");
options.links("http://d.android.com/reference/");
failOnError false
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.2.1'
}
apply from: 'build-includes/test-resources.gradle'
apply from: 'build-includes/resource-id-mapper-generator.gradle'
apply from: 'build-includes/google-sites-upload.gradle'