Change sdk build

-exclude useless file
-fix problem when we use directly repo on other project
This commit is contained in:
Erwan Croze 2017-06-02 10:00:11 +02:00
parent 1ca5ea2b7a
commit 2ec524a62a
3 changed files with 46 additions and 40 deletions

View file

@ -2,10 +2,10 @@
<manifest package="org.linphone"
xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
android:versionCode="3260"
android:versionName="3.2.6">
android:versionCode="3280"
android:versionName="3.2.8">
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="25"/>
</manifest>
</manifest>

View file

@ -1,6 +1,5 @@
// Project information
buildDir = 'bin'
buildscript {
repositories {
jcenter()
@ -37,6 +36,14 @@ def submoduleDir = ['submodules/mediastreamer2/java/src',
'submodules/linphone/java/impl',
'submodules/linphone/coreapi/help/java']
def excludePackage = []
excludePackage.add('**/gdb.*')
excludePackage.add('**/libopenh264**')
excludePackage.add('**/**tester**')
excludePackage.add('**/LICENSE.txt')
android {
defaultConfig {
compileSdkVersion 23
@ -64,7 +71,7 @@ android {
// Exclude some useless files
packagingOptions {
exclude '**/gdb.*'
exclude = excludePackage
}
}
debug.setRoot('build-types/debug')
@ -72,16 +79,6 @@ android {
}
}
android {
libraryVariants.all { variant ->
def appName = "liblinphone-android-sdk"
variant.outputs.each { output ->
def newSdkName = "bin/outputs/aar/${appName}.aar"
output.outputFile = new File(newSdkName)
}
}
}
///////////// Task /////////////
task(releaseJavadoc, type: Javadoc, dependsOn: "assembleRelease") {
@ -113,4 +110,4 @@ task sdkZip(type: Zip) {
'bin/outputs/aar')
include '*'
archiveName newSdkName
}
}

View file

@ -1,19 +1,22 @@
// Project information
buildDir = 'bin'
def getPackageName() {
return "org.linphone"
def firebaseEnable() {
File googleFile = new File('google-services.json')
return googleFile.exists()
}
buildscript {
File googleFile = new File('google-services.json')
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:2.3.0'
if (googleFile.exists()) {
classpath 'com.google.gms:google-services:3.0.0'
}
}
}
@ -29,12 +32,17 @@ apply plugin: 'com.android.library'
dependencies {
compile group: 'org.apache.commons', name: 'commons-compress', version: '1.14'
compile "com.google.android.gms:play-services-gcm:10.2.0"
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.android.support:support-v4:+'
if (firebaseEnable()) {
compile 'com.google.firebase:firebase-messaging:10.2.4'
} else {
compile fileTree(include: 'gcm.jar', dir: 'libs')
compile 'com.android.support:support-v4:+'
}
}
apply plugin: 'com.google.gms.google-services'
if (firebaseEnable()) {
apply plugin: 'com.google.gms.google-services'
}
def srcDirs = ['submodules/mediastreamer2/java/src',
@ -45,9 +53,21 @@ def srcDirs = ['submodules/mediastreamer2/java/src',
'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 23
@ -64,7 +84,7 @@ android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
manifest.srcFile 'AndroidManifestLibrary.xml'
java.srcDirs = srcDirs
resources.srcDirs = srcDirs
aidl.srcDirs = srcDirs
@ -77,7 +97,7 @@ android {
// Exclude some useless files
packagingOptions {
exclude '**/gdb.*'
exclude = excludePackage
}
}
@ -86,17 +106,6 @@ android {
}
}
android {
libraryVariants.all { variant ->
def appName = "linphone-android-sdk"
variant.outputs.each { output ->
def newSdkName = "bin/outputs/aar/${appName}.aar"
output.outputFile = new File(newSdkName)
}
}
}
///////////// Task /////////////
task(releaseJavadoc, type: Javadoc, dependsOn: "assembleRelease") {
@ -131,4 +140,4 @@ task sdkZip(type: Zip) {
'bin/outputs/aar')
include '*'
archiveName newSdkName
}
}