README.md 5.1 KB
Newer Older
Lucas Legrand's avatar
Lucas Legrand committed
1
= Introduction =
2

Lucas Legrand's avatar
Lucas Legrand committed
3

Lucas Legrand's avatar
Lucas Legrand committed
4
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
5 6 7
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.
8 9


Lucas Legrand's avatar
Lucas Legrand committed
10
= How to produce and host Liblinphone SDK on our Maven repository =
11

12
To host Liblinphone SDK and allow future remote import, follow theses steps:
13

Lucas Legrand's avatar
Lucas Legrand committed
14
== Get Linphone-Android and deploy locally Liblinphone SDK ==
15 16


Lucas Legrand's avatar
Lucas Legrand committed
17 18 19
    git clone git@gitlab.linphone.org:BC/public/linphone-android.git
    cd linphone-android
    git checkout -b master origin/master
Lucas Legrand's avatar
Lucas Legrand committed
20
    git submodule sync && git submodule update ~-~-init ~-~-recursive
Lucas Legrand's avatar
Lucas Legrand committed
21
    ./prepare.py -c && ./prepare.py && make
22 23 24



Lucas Legrand's avatar
Lucas Legrand committed
25
== Binary and Maven files production ==
26

Lucas Legrand's avatar
Lucas Legrand committed
27 28
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.
29

Lucas Legrand's avatar
Lucas Legrand committed
30
=== Settings ===
31

Lucas Legrand's avatar
Lucas Legrand committed
32
Set the liblinphone-sdk/build.gradle and gradle.properties files as in the maven_repository Git project.
33

Lucas Legrand's avatar
Lucas Legrand committed
34
liblinphone-sdk/build.gradle:
35

Lucas Legrand's avatar
Lucas Legrand committed
36 37 38 39 40 41 42 43 44 45
    allprojects {
        repositories {
            ...
            maven { url "https://raw.github.com/synergian/wagon-git/releases"}
        }
    }
    configurations {
        ...
        deployerJars
    }
Lucas Legrand's avatar
Lucas Legrand committed
46 47
    apply plugin: 'maven'
    ...
Lucas Legrand's avatar
Lucas Legrand committed
48 49 50 51
    dependencies {
        ...
        deployerJars "ar.com.synergian:wagon-git:0.2.5"
    }
Lucas Legrand's avatar
Lucas Legrand committed
52 53 54 55
    ///////////// Task /////////////
    uploadArchives {
        repositories {
            mavenDeployer {
Lucas Legrand's avatar
Lucas Legrand committed
56 57 58 59
                configuration = configurations.deployerJars
                repository(url: 'git:master://git@gitlab.linphone.org:BC/public/maven_repository.git'){
                    authentication(privateKey: privateKey)
                }
Lucas Legrand's avatar
Lucas Legrand committed
60 61 62
                pom.project {
                    groupId 'org.linphone.maven'
                    artifactId 'liblinphone-sdk'
Lucas Legrand's avatar
Lucas Legrand committed
63 64
                    version project.hasProperty("debug") ? "4.0.1-DEBUG": "4.0.1"
    
Lucas Legrand's avatar
Lucas Legrand committed
65
                }
66 67 68 69
            }
        }
    }

Lucas Legrand's avatar
Lucas Legrand committed
70

Lucas Legrand's avatar
Lucas Legrand committed
71
gradle.properties:
72

Lucas Legrand's avatar
Lucas Legrand committed
73
    privateKey=./maven_rsa
74 75


Lucas Legrand's avatar
Lucas Legrand committed
76
=== Options explanation ===
77

Lucas Legrand's avatar
Lucas Legrand committed
78
-configuration: uses settings and deployment forms from wagon-git project, which allows gradle to push right to maven_repository.
79

Lucas Legrand's avatar
Lucas Legrand committed
80
-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.
81

Lucas Legrand's avatar
Lucas Legrand committed
82
-authentification: uses a private key corresponding to the deploy key assigned to this project , defined in gradle.properties.
83

Lucas Legrand's avatar
Lucas Legrand committed
84
-pom.project: theses options will define the way we call the dependency in the last part, as following:
Lucas Legrand's avatar
Lucas Legrand committed
85

Lucas Legrand's avatar
Lucas Legrand committed
86
'groupId:artifactId:version'
87

Lucas Legrand's avatar
Lucas Legrand committed
88 89
For other libraries or versions, just edit artifactId or version.
Keep the -DEBUG part in the code. Maven favors convention over configuration.
90

91

Lucas Legrand's avatar
Lucas Legrand committed
92 93 94 95
=== Production ===

Check if linphone-android builds on the right device.
Then, in a terminal located at linphone-android's root, type:
96 97


Lucas Legrand's avatar
Lucas Legrand committed
98 99 100 101 102 103 104 105 106
    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.

107

Lucas Legrand's avatar
Lucas Legrand committed
108
= How to use hosted Liblinphone SDK as a remote dependency =
109

Lucas Legrand's avatar
Lucas Legrand committed
110
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:
111 112


Lucas Legrand's avatar
Lucas Legrand committed
113
== Set our Maven repository source ==
Lucas Legrand's avatar
Lucas Legrand committed
114

115

Lucas Legrand's avatar
Lucas Legrand committed
116 117 118 119 120
    allprojects {
        repositories {
            maven{
                url "https://gitlab.linphone.org/BC/public/maven_repository/raw/master"
            }
121 122
        }
    }
123 124


Lucas Legrand's avatar
Lucas Legrand committed
125 126 127 128
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 ==

129

Lucas Legrand's avatar
Lucas Legrand committed
130 131
    dependencies {
    //    implementation project(':liblinphone-sdk')
Lucas Legrand's avatar
Lucas Legrand committed
132 133
        releaseImplementation 'org.linphone.maven:liblinphone-sdk:4.0.1'
        debugImplementation 'org.linphone.maven:liblinphone-sdk:4.0.1-DEBUG'
Lucas Legrand's avatar
Lucas Legrand committed
134
    }
135

Lucas Legrand's avatar
Lucas Legrand committed
136

137
Comment release or debug line if no remote library is available for it.
Lucas Legrand's avatar
Lucas Legrand committed
138
Use the settings provided in the creation part so gradle can find the right dependency:
139

140
'groupId:artifactId:version'
141

Lucas Legrand's avatar
Lucas Legrand committed
142
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.
Lucas Legrand's avatar
Lucas Legrand committed
143

Lucas Legrand's avatar
Lucas Legrand committed
144
= Sources =
Lucas Legrand's avatar
Lucas Legrand committed
145

Lucas Legrand's avatar
Lucas Legrand committed
146
All of these links contributed to teach me the way to produce this repository:
Lucas Legrand's avatar
Lucas Legrand committed
147

Lucas Legrand's avatar
Lucas Legrand committed
148

Lucas Legrand's avatar
Lucas Legrand committed
149
https://docs.gradle.org/current/userguide/maven_plugin.html
Lucas Legrand's avatar
Lucas Legrand committed
150

Lucas Legrand's avatar
Lucas Legrand committed
151 152
https://github.com/synergian/wagon-git

Lucas Legrand's avatar
Lucas Legrand committed
153
https://jeroenmols.com/blog/2016/02/05/wagongit/
Lucas Legrand's avatar
Lucas Legrand committed
154

155
http://kodbiro.com/use-github-pages-as-your-own-maven-repository/
156

Lucas Legrand's avatar
Lucas Legrand committed
157
http://downright-amazed.blogspot.com/2011/09/hosting-maven-repository-on-github-for.html