forked from BelledonneCommunications/linphone-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinphoneAndroidSdk.gradle
145 lines (123 loc) · 3.86 KB
/
linphoneAndroidSdk.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
// Project information
buildDir = 'bin'
def firebaseEnable() {
File googleFile = new File('google-services.json')
return googleFile.exists()
}
buildscript {
File googleFile = new File('google-services.json')
repositories {
jcenter()
mavenCentral()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
if (googleFile.exists()) {
classpath 'com.google.gms:google-services:3.1.0'
}
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
google()
}
}
apply plugin: 'com.android.library'
dependencies {
compile group: 'org.apache.commons', name: 'commons-compress', version: '+'
if (firebaseEnable()) {
compile 'com.google.firebase:firebase-messaging:11.2.0'
} else {
compile fileTree(include: 'gcm.jar', dir: 'libs')
compile 'com.android.support:support-v4:+'
}
}
if (firebaseEnable()) {
apply plugin: 'com.google.gms.google-services'
}
def srcDirs = ['submodules/mediastreamer2/java/src',
'submodules/linphone/java/j2se',
'submodules/linphone/java/common',
'submodules/linphone/java/impl',
'submodules/linphone/coreapi/help/examples/java',
'src/android']
def excludeFiles = []
// Exclude firebase file if not enable
if (!firebaseEnable()) {
excludeFiles.add('**/Firebase*')
} else {
excludeFiles.add('**/gcm*')
}
excludeFiles.add('**/mediastream/MediastreamerActivity.java')
def excludePackage = []
excludePackage.add('**/gdb.*')
excludePackage.add('**/libopenh264**')
excludePackage.add('**/**tester**')
excludePackage.add('**/LICENSE.txt')
android {
defaultConfig {
compileSdkVersion 26
buildToolsVersion "26.0.0"
multiDexEnabled true
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
sourceSets {
main {
manifest.srcFile 'AndroidManifestLibrary.xml'
java.srcDirs = srcDirs
resources.srcDirs = srcDirs
aidl.srcDirs = srcDirs
renderscript.srcDirs = srcDirs
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
java.excludes = excludeFiles
// Exclude some useless files
packagingOptions {
excludes = excludePackage
}
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
///////////// Task /////////////
task(releaseJavadoc, type: Javadoc, dependsOn: "assembleRelease") {
source = ['submodules/mediastreamer2/java/src',
'submodules/linphone/java/j2se',
'submodules/linphone/java/common',
'submodules/linphone/java/impl',
'submodules/linphone/coreapi/help/java']
excludes = ['**/mediastream/MediastreamerActivity.java',
'**/**.html',
'**/**.aidl']
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += files(android.libraryVariants.release.javaCompile.classpath.files)
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
task androidJavadocsJar(type: Jar, dependsOn: releaseJavadoc) {
classifier = 'javadoc'
from releaseJavadoc.destinationDir
}
task sdkZip(type: Zip) {
String appName = "linphone-android-sdk"
String gitSha = 'git describe --always'.execute().text.trim()
String newSdkName = appName + "-" + gitSha + ".zip"
from('bin/libs',
'bin/outputs/aar')
include '*'
archiveName newSdkName
}