Commit 269976f0 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed android sdk build for xamarin

parent 95aae7f5
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.linphone.core"
xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
android:versionCode="4001"
android:versionName="4.0.0">
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="27"/>
</manifest>
......@@ -240,37 +240,76 @@ java-clean:
\t./gradlew clean
android-copy-libs:
\trm -rf LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/armeabi-v7a
\trm -rf android/liblinphone-sdk/res
\trm -rf android/libs-debug/armeabi
\trm -rf android/libs/armeabi
\tif test -d "android/liblinphone-sdk/android-arm"; then \\
\t\tmkdir -p android/libs-debug/armeabi && \\
\t\tcp -f android/liblinphone-sdk/android-arm/lib/lib*.so android/libs-debug/armeabi && \\
\t\tcp -f android/liblinphone-sdk/android-arm/lib/mediastreamer/plugins/*.so android/libs-debug/armeabi && \\
\t\tmkdir -p android/libs/armeabi && \\
\t\tcp -f android/liblinphone-sdk/android-arm/lib/lib*.so android/libs/armeabi && \\
\t\tcp -f android/liblinphone-sdk/android-arm/lib/mediastreamer/plugins/*.so android/libs/armeabi && \\
\t\tcp android/liblinphone-sdk/android-arm/share/linphonecs/LinphoneWrapper.cs Xamarin/Xamarin/Xamarin/ && \\
\t\tsh android/android-arm/strip.sh android/libs/armeabi/*.so; \\
\tfi
\tif test -f "android/liblinphone-sdk/android-arm/lib/wrap.sh"; then \\
\t\tmkdir -p android/liblinphone-sdk/res/lib/armeabi && \\
\t\tcp -f android/liblinphone-sdk/android-arm/lib/wrap.sh android/liblinphone-sdk/res/lib/armeabi; \\
\tfi
\trm -rf android/libs-debug/armeabi-v7a
\trm -rf android/libs/armeabi-v7a
\tif test -d "android/liblinphone-sdk/android-armv7"; then \\
\t\tmkdir -p LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/armeabi-v7a && \\
\t\tcp android/liblinphone-sdk/android-armv7/share/linphonecs/LinphoneWrapper.cs LinphoneXamarin/LinphoneXamarin/LinphoneXamarin && \\
\t\tcp -f android/liblinphone-sdk/android-armv7/lib/lib*.so LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/armeabi-v7a && \\
\t\tcp -f android/liblinphone-sdk/android-armv7/lib/mediastreamer/plugins/*.so LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/armeabi-v7a && \\
\t\tsh android/android-armv7/strip.sh LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/armeabi-v7a/*.so; \\
\t\tmkdir -p android/libs-debug/armeabi-v7a && \\
\t\tcp -f android/liblinphone-sdk/android-armv7/lib/lib*.so android/libs-debug/armeabi-v7a && \\
\t\tcp -f android/liblinphone-sdk/android-armv7/lib/mediastreamer/plugins/*.so android/libs-debug/armeabi-v7a && \\
\t\tmkdir -p android/libs/armeabi-v7a && \\
\t\tcp -f android/liblinphone-sdk/android-armv7/lib/lib*.so android/libs/armeabi-v7a && \\
\t\cp -f android/liblinphone-sdk/android-armv7/lib/mediastreamer/plugins/*.so android/libs/armeabi-v7a && \\
\t\tcp android/liblinphone-sdk/android-armv7/share/linphonecs/LinphoneWrapper.cs Xamarin/Xamarin/Xamarin/ && \\
\t\tsh android/android-armv7/strip.sh android/libs/armeabi-v7a/*.so; \\
\tfi
\trm -rf LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/arm64-v8a
\tif test -f "android/liblinphone-sdk/android-armv7/lib/wrap.sh"; then \\
\t\tmkdir -p android/liblinphone-sdk/res/lib/armeabi-v7a && \\
\t\tcp -f android/liblinphone-sdk/android-armv7/lib/wrap.sh android/liblinphone-sdk/res/lib/armeabi-v7a; \\
\tfi
\trm -rf android/libs-debug/arm64-v8a
\trm -rf android/libs/arm64-v8a
\tif test -d "android/liblinphone-sdk/android-arm64"; then \\
\t\tmkdir -p LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/arm64-v8a && \\
\t\tcp android/liblinphone-sdk/android-arm64/share/linphonecs/LinphoneWrapper.cs LinphoneXamarin/LinphoneXamarin/LinphoneXamarin && \\
\t\tcp -f android/liblinphone-sdk/android-arm64/lib/lib*.so LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/arm64-v8a && \\
\t\tcp -f android/liblinphone-sdk/android-arm64/lib/mediastreamer/plugins/*.so LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/arm64-v8a && \\
\t\tsh android/android-arm64/strip.sh LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/arm64-v8a/*.so; \\
\t\tmkdir -p android/libs-debug/arm64-v8a && \\
\t\tcp -f android/liblinphone-sdk/android-arm64/lib/lib*.so android/libs-debug/arm64-v8a && \\
\t\tcp -f android/liblinphone-sdk/android-arm64/lib/mediastreamer/plugins/*.so android/libs-debug/arm64-v8a && \\
\t\tmkdir -p android/libs/arm64-v8a && \\
\t\tcp -f android/liblinphone-sdk/android-arm64/lib/lib*.so android/libs/arm64-v8a && \\
\t\tcp -f android/liblinphone-sdk/android-arm64/lib/mediastreamer/plugins/*.so android/libs/arm64-v8a && \\
\t\tcp android/liblinphone-sdk/android-arm64/share/linphonecs/LinphoneWrapper.cs Xamarin/Xamarin/Xamarin/ && \\
\t\tsh android/android-arm64/strip.sh android/libs/arm64-v8a/*.so; \\
\tfi
\tif test -f "android/liblinphone-sdk/android-arm64/lib/wrap.sh"; then \\
\t\tmkdir -p android/liblinphone-sdk/res/lib/arm64-v8a && \\
\t\tcp -f android/liblinphone-sdk/android-arm64/lib/wrap.sh android/liblinphone-sdk/res/lib/arm64-v8a; \\
\tfi
\trm -rf LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/x86
\trm -rf android/libs-debug/x86
\trm -rf android/libs/x86
\tif test -d "android/liblinphone-sdk/android-x86"; then \\
\t\tmkdir -p LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/x86 && \\
\t\tcp android/liblinphone-sdk/android-x86/share/linphonecs/LinphoneWrapper.cs LinphoneXamarin/LinphoneXamarin/LinphoneXamarin && \\
\t\tcp -f android/liblinphone-sdk/android-x86/lib/lib*.so LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/x86 && \\
\t\tcp -f android/liblinphone-sdk/android-x86/lib/mediastreamer/plugins/*.so LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/x86 && \\
\t\tsh android/android-x86/strip.sh LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs/x86/*.so; \\
\t\tmkdir -p android/libs-debug/x86 && \\
\t\tcp -f android/liblinphone-sdk/android-x86/lib/lib*.so android/libs-debug/x86 && \\
\t\tcp -f android/liblinphone-sdk/android-x86/lib/mediastreamer/plugins/*.so android/libs-debug/x86 && \\
\t\tmkdir -p android/libs/x86 && \\
\t\tcp -f android/liblinphone-sdk/android-x86/lib/lib*.so android/libs/x86 && \\
\t\tcp -f android/liblinphone-sdk/android-x86/lib/mediastreamer/plugins/*.so android/libs/x86 && \\
\t\tcp android/liblinphone-sdk/android-x86/share/linphonecs/LinphoneWrapper.cs Xamarin/Xamarin/Xamarin/ && \\
\t\tsh android/android-x86/strip.sh android/libs/x86/*.so; \\
\tfi
\tif test -f "android/liblinphone-sdk/android-x86/lib/wrap.sh"; then \\
\t\tmkdir -p android/liblinphone-sdk/res/lib/x86 && \\
\t\tcp -f android/liblinphone-sdk/android-x86/lib/wrap.sh android/liblinphone-sdk/res/lib/x86; \\
\tfi
generate-android-sdk: clean android-build android-copy-libs create-jar
create-jar:
\t./gradlew assembleRelease
\t./gradlew classJar
{arch_targets}
......@@ -298,8 +337,6 @@ help: help-prepare-options
f.write(makefile)
f.close()
def main():
preparator = AndroidPreparator()
preparator.parse_args()
......
// Project information
buildDir = 'bin'
buildscript {
repositories {
jcenter()
mavenCentral()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:3.1.0'
}
}
......@@ -17,26 +17,73 @@ allprojects {
jcenter()
mavenCentral()
mavenLocal()
google()
}
}
configurations {
javadocDeps
}
apply plugin: 'com.android.library'
dependencies {
compile group: 'org.apache.commons', name: 'commons-compress', version: '1.5'
implementation 'org.apache.commons:commons-compress:1.16.1'
javadocDeps 'org.apache.commons:commons-compress:1.16.1'
}
def submoduleDir = ['submodules/mediastreamer2/java/src',
'submodules/linphone/java/j2se',
'submodules/linphone/java/common',
'submodules/linphone/java/impl',
'submodules/linphone/coreapi/help/java']
def srcDir = ['./submodules/mediastreamer2/java/src']
def rootSdk = 'android/liblinphone-sdk/'
if (file('android/liblinphone-sdk/android-arm64/share/linphonej/java/org/linphone/core/Factory.java').exists() )
rootSdk += 'android-arm64'
else if (file('android/liblinphone-sdk/android-arm/share/linphonej/java/org/linphone/core/Factory.java').exists() )
rootSdk += 'android-arm'
else if (file('android/liblinphone-sdk/android-armv7/share/linphonej/java/org/linphone/core/Factory.java').exists() )
rootSdk += 'android-armv7'
else if (file('android/liblinphone-sdk/android-x86/share/linphonej/java/org/linphone/core/Factory.java').exists() )
rootSdk += 'android-x86'
else {
println ("native sdk not ready yet")
rootSdk = ""
}
srcDir += [rootSdk+'/share/linphonej/java/org/linphone/core/']
srcDir += ['./submodules/linphone/wrappers/java/classes/']
def excludePackage = []
excludePackage.add('**/gdb.*')
excludePackage.add('**/libopenh264**')
excludePackage.add('**/**tester**')
excludePackage.add('**/LICENSE.txt')
android {
buildTypes {
release {}
debug {}
}
defaultConfig {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28
buildToolsVersion "28.0.0"
multiDexEnabled true
setProperty("archivesBaseName", "liblinphone-sdk")
}
// Signing
signingConfigs {
release {
}
}
buildTypes {
release {
}
packaged {
initWith release
signingConfig null
//matchingFallbacks = ['debug', 'release']
}
}
lintOptions {
......@@ -48,18 +95,19 @@ android {
sourceSets {
main {
manifest.srcFile 'LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Properties/AndroidManifest.xml'
java.srcDirs = submoduleDir
resources.srcDirs = submoduleDir
aidl.srcDirs = submoduleDir
renderscript.srcDirs = submoduleDir
jniLibs.srcDirs = ['LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs']
manifest.srcFile 'AndroidManifestLibrary.xml'
java.srcDirs = srcDir
aidl.srcDirs = srcDir
assets.srcDirs = ["${buildDir}/sdk-assets/assets/"]
renderscript.srcDirs = srcDir
jniLibs.srcDirs = ['./android/libs']
resources.srcDir("res")
java.excludes = ['**/mediastream/MediastreamerActivity.java']
// Exclude some useless files
packagingOptions {
exclude '**/gdb.*'
excludes = excludePackage
}
}
debug.setRoot('build-types/debug')
......@@ -69,10 +117,57 @@ android {
///////////// Task /////////////
task classJar(type: Jar) {
classifier = 'class'
from 'bin/intermediates/classes/release'
include '**/*.class'
libsDirName = '../LinphoneXamarin/LinphoneXamarin/LinphoneXamarin.Android/Libs'
archiveName = 'liblinphone.jar'
task(releaseJavadoc, type: Javadoc, dependsOn: "assembleRelease") {
source = srcDir
excludes = ['**/mediastream/MediastreamerActivity.java',
'**/**.html',
'**/**.aidl']
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += files(android.libraryVariants.release.javaCompile.classpath.files)
classpath += configurations.javadocDeps
options.encoding = 'UTF-8'
}
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 = "liblinphone-android-sdk"
String gitSha = 'git describe --always'.execute().text.trim()
String newSdkName = appName + "-" + gitSha + ".zip"
from('bin/libs',
'bin/outputs/aar')
include '*'
archiveName newSdkName
}
task copyAssets(type: Sync) {
from rootSdk
into "${buildDir}/sdk-assets/assets/org.linphone.core"
include '**/*.png'
include '**/*.pem'
include '**/*.mkv'
include '**/*.wav'
include '**/*_grammar'
//rename '(.*)', '$1'.toLowerCase()
eachFile {
path = path.toLowerCase() //to workaround case insensitive fs (macosx)
println("Syncing sdk asset ${sourcePath} to ${path}")
}
doFirst {
println("Syncing sdk assets into root dir ${destinationDir}")
}
// do not copy those
includeEmptyDirs = false
}
project.tasks['preBuild'].dependsOn 'copyAssets'
#Wed May 03 10:57:39 CEST 2017
#Wed May 16 15:22:42 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
......@@ -79,7 +79,7 @@ VERSION=$(shell git --git-dir=submodules/linphone/.git --work-tree=submodules/li
all: {atarget} {itarget} sdk
sdk:
\tzip -r liblinphone-xamarin-sdk-$(VERSION).zip LinphoneXamarin README.md
\tzip -r liblinphone-xamarin-sdk-$(VERSION).zip Xamarin README.md
""".format(amakefile=amakefile, imakefile=imakefile, atarget=atarget, itarget=itarget)
f = open('Makefile', 'w')
f.write(makefile)
......
Subproject commit aca36b387017d9555e484928a7b9721fae6734b9
Subproject commit 6d7fdab69ddc033b4f4e19d10cbca56c03fe200c
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment