forked from daimajia/Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
120 lines (111 loc) · 4.59 KB
/
Copy pathbuild.gradle
File metadata and controls
120 lines (111 loc) · 4.59 KB
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
apply plugin: 'com.android.application'
def packTime() {
return new Date().format("yyyyMMddHHmm", TimeZone.getTimeZone("UTC"))
}
def projectUrl = "https://github.com/lguipeng/Notes"
def blogUrl = "http://www.jianshu.com/users/f612d54d668e/latest_articles"
def appDownloadUrl = "http://notes.55058a091d225.d01.nanoyun.com/release/notes.apk"
def aboutAppUrl = "http://www.jianshu.com/p/640a7f2fe0c5"
//remember to add your bmob app key in local.properties
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def bmobAppKey = properties.getProperty('BMOB_KEY')
def weChatId = properties.getProperty('WECHAT_ID')
android {
signingConfigs {
debug {
}
release {
//setting your signing.properties
//first, add signing.properties to ./app/
//second, add property STORE_FILE, STORE_PASSWORD, KEY_ALIAS, KEY_PASSWORD
}
}
compileSdkVersion Integer.parseInt(ANDROID_BUILD_COMPILE_SDK_VERSION)
buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.lguipeng.notes"
minSdkVersion Integer.parseInt(MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode Integer.parseInt(VERSION_CODE)
versionName VERSION_NAME
buildConfigField "String", "BMOB_KEY", "\"${bmobAppKey}\""
buildConfigField "String", "WECHAT_ID", "\"${weChatId}\""
buildConfigField "String", "APP_DOWNLOAD_URL", "\"${appDownloadUrl}\""
buildConfigField "String", "PROJECT_URL", "\"${projectUrl}\""
buildConfigField "String", "BLOG_URL", "\"${blogUrl}\""
buildConfigField "String", "ABOUT_APP_URL", "\"${aboutAppUrl}\""
}
buildTypes {
debug {
versionNameSuffix " Beta"
minifyEnabled false
zipAlignEnabled false
shrinkResources false
signingConfig signingConfigs.debug
}
release {
minifyEnabled false
zipAlignEnabled false
shrinkResources true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
File outputDirectory = new File(outputFile.parent);
def fileName
if (variant.buildType.name == "release") {
fileName = "notes_v${defaultConfig.versionName}_${packTime()}.apk"
}else{
fileName = "notes_beta.apk"
}
output.outputFile = new File(outputDirectory, fileName)
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.rengwuxian.materialedittext:library:2.1.3'
compile 'com.squareup.dagger:dagger:1.2.2'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.pnikosis:materialish-progress:1.5'
compile 'com.nispok:snackbar:2.10.10'
compile project(':orm-library')
compile project(':MaterialPreference')
}
File propFile = file('signing.properties');
if (propFile.exists()) {
def Properties props = new Properties()
props.load(new FileInputStream(propFile))
if (props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
android.buildTypes.release.signingConfig = null
}
} else {
android.buildTypes.release.signingConfig = null
}