|
|
|
The project is now ready to build VLC 3 and VLC 4.
|
|
|
|
|
|
|
|
### Build VLC 4 from Android studio
|
|
|
|
|
|
|
|
To build vlc-android with VLC 4, gradle needs a property: `-PforceVlc4=true`.
|
|
|
|
|
|
|
|
It can be directly added to the gradle task command line or in Android Studio globally.
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
### Build VLC 4 from `compile.sh`
|
|
|
|
|
|
|
|
A new parameter has been added to the script. Juste use `-vlc4` to build.
|
|
|
|
|
|
|
|
:warning: the script is not able to automatically clean your last build. If you already built vlc 3, you'll have to remove these folders:
|
|
|
|
|
|
|
|
- ./libvlcjni
|
|
|
|
- ./vlc
|
|
|
|
- ./medialibrary/medialibrary
|
|
|
|
|
|
|
|
### CI
|
|
|
|
|
|
|
|
The jobs have been duplicated to build both of these versions. During the transition phase, both jobs will be launched.
|
|
|
|
|
|
|
|
As VLC 4 needs NDK 25 while VLC 3 needs NDK 21, a different docker image is used for the jobs.
|
|
|
|
|
|
|
|
### Technical implementation
|
|
|
|
|
|
|
|
Conditional compilation is not a thing in Java/kt. To make it work, we have to add an abstraction layer and split it in different sourceSet.
|
|
|
|
|
|
|
|
This is done using this line in the `build.gradle` files of `:application:vlc-android` and `:medialibrary`
|
|
|
|
|
|
|
|
```
|
|
|
|
java.srcDirs = rootProject.ext.vlcMajorVersion == 4 ? ['src', 'vlc4/src'] : ['src', 'vlc3/src']
|
|
|
|
```
|
|
|
|
|
|
|
|
The code in these directories is then applied at compile time depending on the VLC version we want to build.
|
|
|
|
|
|
|
|
Keep in mind that any change in one of these two directories has to be replicated in the other one and that the signatures have to be the same. If you fail to do that, it should trigger a pipeline fail in your Merge request. |
|
|
\ No newline at end of file |