forked from popcorn-official/popcorn-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
90 lines (80 loc) · 3.18 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
//temporary to solve hugo error
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
classpath 'org.moallemi.gradle.advanced-build-version:gradle-plugin:1.5.1'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
appCompatVersion = "23.1.1"
buildToolsVersion = "23.0.1"
targetSdk = 23
compileSdk = 23
minSdk = 15
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://guardian.github.com/maven/repo-releases' }
}
//let project evaluate its script first
project.afterEvaluate {
//only apply to projects that have the android plugin
if (project.plugins.hasPlugin('com.android.application')) {
//global android setting
project.android {
packagingOptions {
exclude 'META-INF/beans.xml'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES.txt'
}
applicationVariants.all { variant ->
//rename output files
renameOutputFiles(project, variant)
}
dexOptions {
jumboMode = true
javaMaxHeapSize "2048M"
}
}
}
}
}
def renameOutputFiles(Project project, variant) {
variant.outputs.each { output ->
def abi = output.getFilter(com.android.build.OutputFile.ABI);
output.versionCodeOverride = project.ext.versionCodes.get(abi, 0) * 10000000 + output.versionCode
def alignedOutputFile = output.outputFile
def unalignedOutputFile = output.packageApplication.outputFile
def outputFileName = alignedOutputFile.name
// Customise APK filenames
if (outputFileName.contains("debug")) {
outputFileName = outputFileName.replace("debug", "development").replace(".apk", "-" + (System.getenv("BUILD_NUMBER") ?: "local") + ".apk")
} else {
outputFileName = outputFileName.replace(".apk", "-" + variant.versionName + ".apk")
}
if (variant.buildType.zipAlignEnabled) {
// normal APK
output.outputFile = new File(alignedOutputFile.parent, outputFileName)
}
// 'unaligned' APK
output.packageApplication.outputFile = new File(unalignedOutputFile.parent, outputFileName.replace(".apk", "-unaligned.apk"))
}
}