forked from asamm/locus-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
143 lines (121 loc) · 4.1 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// basic repositories
google()
jcenter()
mavenCentral()
}
dependencies {
// Android build
classpath 'com.android.tools.build:gradle:' + ANDROID_PLUGIN_GRADLE
// Bintray support
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
// Kotlin
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' + KOTLIN_VERSION
}
}
// define global parameters
allprojects {
repositories {
// local maven
mavenLocal()
// basic repositories
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
configure([
project(":locus-api-android-sample")]) {
apply plugin: 'com.android.application'
apply plugin: "kotlin-android"
android {
// setup SDK
compileSdkVersion Integer.valueOf(PARAM_COMPILE_SDK_VERSION)
buildToolsVersion ANDROID_BUILD_TOOLS
defaultConfig {
minSdkVersion Integer.valueOf(PARAM_MIN_SDK_VERSION)
targetSdkVersion Integer.valueOf(PARAM_TARGET_SDK_VERSION)
}
dexOptions {
jumboMode true
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// enable lint in project
lintOptions {
checkReleaseBuilds true
abortOnError true
absolutePaths false
lintConfig file("../lint-global.xml")
}
// signing of versions
signingConfigs {
debug {
storeFile file(SIGN_DEBUG_STORE_FILE)
storePassword = SIGN_DEBUG_STORE_PASSWORD
keyAlias = SIGN_DEBUG_KEY_ALIAS
keyPassword = SIGN_DEBUG_KEY_PASSWORD
}
release {
storeFile file(SIGN_RELEASE_STORE_FILE)
storePassword = SIGN_RELEASE_STORE_PASSWORD
keyAlias = SIGN_RELEASE_KEY_ALIAS
keyPassword = SIGN_RELEASE_KEY_PASSWORD
}
}
// building task
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}
}
// iterate over all versions
android.applicationVariants.all { variant ->
// define base parameters
println "Config for: " + build
// rename result file
variant.outputs.all {
// generate base name
def newName = variant.name.capitalize()
// remove from 'LocusFreeSamsungDebug', last work 'Debug'
newName = newName.substring(0, newName.length() - variant.buildType.name.length())
// create full name like 'LocusFreeSamsung_342_3.5.2_debug.apk'
def baseFileName = "${newName}_${variant.versionCode}_${variant.versionName}_${variant.buildType.name}"
// set new output file name
outputFileName = "${baseFileName}.apk"
}
// create also release task for "release builds"
variant.productFlavors.each { flavor ->
// do not handle certain flavors at all
def flavorName = flavor.name.capitalize()
if (flavor.name == '') {
return;
}
// skip invalid build types (so generate only releases versions)
if (variant.buildType.name != 'release') {
return;
}
// create task for release
tasks.create(name: variant.buildType.name + flavorName,
dependsOn: variant.assemble) {
group 'Publish'
description "Assembles and archives $flavorName and its proguard mapping for the $build build"
}
}
}
}