-
Notifications
You must be signed in to change notification settings - Fork 41
/
build.gradle
150 lines (125 loc) · 4.33 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
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.f2prateek.checkstyle:checkstyle:1.0.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
apply plugin: 'com.f2prateek.checkstyle'
apply plugin: 'hugo'
dependencies {
repositories {
jcenter()
mavenCentral()
}
// Support Library
def supportLibraryVersion = '22.2.1'
compile "com.android.support:support-v13:${supportLibraryVersion}"
compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:palette-v7:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
// Utilities
compile 'com.squareup:otto:1.3.5'
compile 'com.f2prateek.ln:ln:1.1.1'
compile 'com.f2prateek.dart:dart:1.1.0'
// Code Generators
compile 'com.jakewharton:butterknife:5.1.2'
compile 'com.squareup.dagger:dagger:1.2.2'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'com.github.frankiesardo:android-auto-value:0.1'
provided 'com.github.frankiesardo:android-auto-value-processor:0.1'
compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.1'
// Reporting
compile 'com.segment.analytics.android:analytics:4.0.3'
// Debugging
debugCompile 'com.jakewharton.scalpel:scalpel:1.1.2'
debugCompile 'com.jakewharton.madge:madge:1.1.1'
}
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new Date()
def isTravis = "true".equals(System.getenv("TRAVIS"))
def preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
android {
compileSdkVersion 22
buildToolsVersion '23.0.3'
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !isTravis
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
lintOptions {
abortOnError false
}
signingConfigs {
release
}
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
ext.enableCrashlytics = false
}
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
applicationId "com.f2prateek.dfg"
def year = buildTime.getAt(Calendar.YEAR)
def month = buildTime.getAt(Calendar.MONTH) + 1
def day = buildTime.getAt(Calendar.DAY_OF_MONTH)
versionCode year * 10000 + month * 100 + day
versionName "${year}-${month}-${day}"
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
def buildTimeString = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))
buildConfigField "String", "BUILD_TIME", "\"${buildTimeString}\""
// Renderscript support http://bit.ly/1G9c1HQ
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
checkstyle {
configFile rootProject.file('checkstyle.xml')
}
tasks.withType(Checkstyle) {
exclude '**/ForegroundImageView.java'
exclude '**/*\$\$*.java' // Dagger, ButterKnife, Dart
}
def propFile = new File('signing.properties')
if (propFile.canRead()) {
def Properties signingProps = new Properties()
signingProps.load(new FileInputStream(propFile))
if (signingProps != null &&
signingProps.containsKey('STORE_FILE') &&
signingProps.containsKey('STORE_PASSWORD') &&
signingProps.containsKey('KEY_ALIAS') &&
signingProps.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(signingProps['STORE_FILE'])
android.signingConfigs.release.storePassword = signingProps['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = signingProps['KEY_ALIAS']
android.signingConfigs.release.keyPassword = signingProps['KEY_PASSWORD']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}