Commit 90f52df5 authored by Lucas Legrand's avatar Lucas Legrand

Update README.md

Same as Wiki page + Sources
parent 5abced08
-Introduction
= Introduction =
Until today, integrating liblinphone sdk into a third party application required compiling a sdk from the sources or importing sdk binary files from: http://www.linphone.org/technical-corner/liblinphone/downloads .
Until today, integrating liblinphone sdk into a third party application required compiling a sdk from the sources or importing sdk binary files from: [[http:~~/~~/www.linphone.org/technical-corner/liblinphone/downloads>>http://www.linphone.org/technical-corner/liblinphone/downloads]]
In order to ease integration of this sdk, we adapted a Gitlab repository as a Maven one.
Maven is a standardized tool to manage and build Java-based projects, which core unit of work is Project Object Model.
With Gradle and this Maven repository, we now offer the ability to either host or import remotely liblinphone sdk, as any future library.
-How to produce and host Liblinphone SDK on our Maven repository
= How to produce and host Liblinphone SDK on our Maven repository =
To host Liblinphone SDK and allow future remote import, follow theses steps:
== Get Linphone-Android and deploy locally Liblinphone SDK ==
Get Linphone-Android and deploy locally Liblinphone SDK
git clone git@gitlab.linphone.org:BC/public/linphone-android.git
cd linphone-android
git checkout -b master origin/master
git submodule sync && git submodule update --init --recursive
git submodule sync && git submodule update ~-~-init ~-~-recursive
./prepare.py -c && ./prepare.py && make
Prepare the local Maven repository in another folder:
== Binary and Maven files production ==
git clone https://gitlab.linphone.org/BC/public/maven_repository.git
This part requires a private SSH key used to write right to the repository, it must be asked to Simon Morlat, Jehan Monnier, Sylvain Berfini or Erwan Croze.
Then it must be placed into liblinphone-sdk folder.
=== Settings ===
Set the liblinphone-sdk/build.gradle and gradle.properties files as in the maven_repository Git project.
Set the liblinphone-sdk/build.gradle file as in the Maven repository.
It includes two parts:
liblinphone-sdk/build.gradle:
allprojects {
repositories {
...
maven { url "https://raw.github.com/synergian/wagon-git/releases"}
}
}
configurations {
...
deployerJars
}
apply plugin: 'maven'
...
dependencies {
...
deployerJars "ar.com.synergian:wagon-git:0.2.5"
}
///////////// Task /////////////
uploadArchives {
repositories {
mavenDeployer {
def home = "$System.env.HOME"
repository(url: 'file://localhost'+home+'/Workplace/maven_repository/')
configuration = configurations.deployerJars
repository(url: 'git:master://git@gitlab.linphone.org:BC/public/maven_repository.git'){
authentication(privateKey: privateKey)
}
pom.project {
groupId 'org.linphone.maven'
artifactId 'liblinphone-sdk'
version "4.0.0-RELEASE"
version project.hasProperty("debug") ? "4.0.1-DEBUG": "4.0.1"
}
}
}
}
Options explanation:
-repository: the place where all Maven files and .aar are going to be built.
It is currently on local hard drive, then sent on our repository with Git.
Set it to the place you cloned the Maven repository.
-pom.project: theses options will define the way we call the dependency in the last part,
as following: 'groupId:artifactId:version'
gradle.properties:
For other libraries or versions, just edit artifactId or version.
Keep the -RELEASE part. Maven favors convention over configuration.
privateKey=./maven_rsa
Check if linphone-android builds.
Then, in a terminal located at linphone-android's root, type:
gradle clean uploadArchives
=== Options explanation ===
Warning: If a not working version is produced, before building it again, clear the whole gradle cache ($HOME/.gradle/caches/), or gradle will produce the same.
-configuration: uses settings and deployment forms from wagon-git project, which allows gradle to push right to maven_repository.
-repository: the link to our maven_repository. In case of future modification, keep the 'git:master:~/~/' part, it is needed for wagon-git to handle sending.
-authentification: uses a private key corresponding to the deploy key assigned to this project , defined in gradle.properties.
Sending files to our remote repository
-pom.project: theses options will define the way we call the dependency in the last part, as following:
'groupId:artifactId:version'
Go to your local maven_repository and in a terminal type:
For other libraries or versions, just edit artifactId or version.
Keep the -DEBUG part in the code. Maven favors convention over configuration.
git add org
git commit -m 'Your message'
git push
=== Production ===
Check if linphone-android builds on the right device.
Then, in a terminal located at linphone-android's root, type:
gradle clean assemble uploadArchives
or
gradle clean assembleDebug uploadArchives
Warning: If a not working version is produced, before building it again, clear the whole gradle cache ($HOME/.gradle/caches/), or gradle will produce the same.
-How to use hosted Liblinphone SDK as a remote dependency
= How to use hosted Liblinphone SDK as a remote dependency =
In another linphone-android project, edit linphone-android build.gradle as in the one located in maven_repository root.
In another linphone-android project, in which you can delete liblinphone-sdk folder, edit linphone-android build.gradle like the one located in maven_repository root:
== Set our Maven repository source ==
Set our Maven repository source:
allprojects {
repositories {
......@@ -103,34 +121,37 @@ Set our Maven repository source:
}
}
Change our local project dependency to remote dependency:
Be sure to keep the raw/master part in future modification, as it defines the true path to files, not the one to navigate in web browser.
== Change our local project dependency to remote dependency ==
dependencies {
// implementation project(':liblinphone-sdk')
releaseImplementation 'org.linphone.maven:liblinphone-sdk:4.0.0-RELEASE'
debugImplementation 'org.linphone.maven:liblinphone-sdk:4.0.0'
releaseImplementation 'org.linphone.maven:liblinphone-sdk:4.0.1'
debugImplementation 'org.linphone.maven:liblinphone-sdk:4.0.1-DEBUG'
}
Comment release or debug line if no remote library is available for it.
Use again the settings provided in the creation part in order to give the way to gradle to find the right dependency:
Use the settings provided in the creation part so gradle can find the right dependency:
'groupId:artifactId:version'
In case of another library need, provided it is hosted, just change artifactId and version in accordance to its declaration in the creation part.
In case of another library need or newer version, provided it is hosted, just change artifactId and version in accordance to its declaration in the creation part.
= Sources =
-Sources:
All of these links contributed to teach me the way to produce this repository:
All of theses served me to understand the way to produce this repository:
http://downright-amazed.blogspot.com/2011/09/hosting-maven-repository-on-github-for.html
https://docs.gradle.org/current/userguide/maven_plugin.html
https://github.com/synergian/wagon-git
https://jeroenmols.com/blog/2016/02/05/wagongit/
http://kodbiro.com/use-github-pages-as-your-own-maven-repository/
https://github.com/synergian/wagon-git
http://downright-amazed.blogspot.com/2011/09/hosting-maven-repository-on-github-for.html
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