forked from popcorn-official/popcorn-android-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
98 lines (85 loc) · 3.44 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
// 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.3.1'
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 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
appCompatVersion = "23.0.1"
buildToolsVersion = "22.0.1"
crashlyticsVersion = "2.5.2"
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')) {
//add the android sdk manager plugin to andriod projects
apply plugin: 'android-sdk-manager'
//global android settings
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"
}
}
} else if (project.plugins.hasPlugin('com.android.library')) {
//add the android sdk manager plugin to andriod projects
apply plugin: 'android-sdk-manager'
}
}
}
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) * 1000000 + 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"))
}
}