From d9f676827dbce8dbfb5015faf8ed6e0f8004cea7 Mon Sep 17 00:00:00 2001
From: Victor Gaydov
Date: Sat, 12 Oct 2024 22:38:48 +0700
Subject: [PATCH] Build & CI fixes
Closes: #72, #112, #116, #106, #107, #105
- Update requirements:
for build: JDK 17+
for running: JRE 8+
Android SDK: 31+ (Android 12)
Android API: 29+ (Android 10)
- Bump gradle version and fix build on recent JDK versions
- CI:
bump actions versions
cleanup
test JDK 21 and JDK 17
switch to android-actions/setup-android
downgrade roc-toolkit from master to v0.2.6
automatically select best roc-toolkit git tag for release AAR
- README:
document version requirements
cleanup build & devel instructions
document where versions are hard-coded
- Gradle:
use io.freefair.android-lombok on Android
run delombok before javadoc
disable javadoc warnings
switch from "maven" to "maven-publish" plugin
fix cmake warnings due to incorrect invocation
- Sources:
fix javadoc errors
exclude gradle code from javadoc
---
.github/workflows/build.yaml | 141 +++++++-----
README.md | 170 ++++++++++-----
android/build.gradle | 22 +-
android/roc-android/AndroidManifest.xml | 8 +-
android/roc-android/build.gradle | 202 +++++++++++-------
build.gradle | 72 ++++---
cmake-library/build.gradle | 10 +-
.../roctoolkit/gradle/tasks/CMake.java | 28 ++-
commons/build.gradle | 6 +-
.../roctoolkit/util/os/OperatingSystem.java | 5 +-
gradle/wrapper/gradle-wrapper.properties | 2 +-
roc_jni/CMakeLists.txt | 7 +-
roc_jni/build.gradle | 9 +
scripts/android/build_roc.sh | 3 +-
scripts/android/start_emulator.sh | 2 +-
scripts/android_docker.sh | 20 +-
scripts/linux/build_roc.sh | 3 +-
scripts/osx/build_roc.sh | 3 +-
scripts/roc_revision.py | 23 ++
.../org/rocstreaming/roctoolkit/Endpoint.java | 4 +-
.../rocstreaming/roctoolkit/RocContext.java | 2 +-
.../rocstreaming/roctoolkit/RocReceiver.java | 20 +-
.../rocstreaming/roctoolkit/RocSender.java | 16 +-
23 files changed, 506 insertions(+), 272 deletions(-)
create mode 100755 scripts/roc_revision.py
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 0d5e77c1..e8800ffe 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,43 +26,50 @@ concurrency:
jobs:
+ # build natively on desktop
desktop:
strategy:
fail-fast: false
matrix:
include:
+ # latest tested JDK
- os: linux
image: ubuntu-latest
- java: 11
+ jdk: 21
jacoco: yes
- - os: linux
- image: ubuntu-latest
- java: 8
- jacoco: no
-
- os: osx
image: macos-latest
- java: 11
+ jdk: 21
+ jacoco: no
+
+ # oldest supported JDK
+ - os: linux
+ image: ubuntu-latest
+ jdk: 17
jacoco: no
- os: osx
image: macos-latest
- java: 8
+ jdk: 17
jacoco: no
- name: ${{ matrix.os }}/java${{ matrix.java }}
-
+ name: desktop/${{ matrix.os }}-jdk${{ matrix.jdk }}
runs-on: ${{ matrix.image }}
+ env:
+ # TODO: set to master
+ ROC_REVISION: v0.2.6
+
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Install JDK
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v4
with:
- java-version: ${{ matrix.java }}.x.x
+ java-version: ${{ matrix.jdk }}
+ distribution: temurin
- name: Install system dependencies
run: scripts/${{ matrix.os }}/install_dependencies.sh
@@ -74,66 +81,88 @@ jobs:
run: scripts/${{ matrix.os }}/build_bindings.sh
- name: Upload test coverage
- if: ${{ matrix.jacoco == 'yes' }}
+ if: ${{ github.repository_owner == 'roc-streaming' && matrix.jacoco == 'yes' }}
id: jacoco
uses: codecov/codecov-action@v3
with:
files: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
+ # build for Android on Linux (with Docker)
android-linux:
strategy:
fail-fast: false
matrix:
include:
- - java: 11
+ # latest tested JDK, SDK, and NDK
+ - jdk: 21
+ sdk: 34
api: 29
- ndk: 21.1.6352462
+ ndk_r: 26d
+ ndk: 26.3.11579264
- - java: 8
+ # oldest supported JDK, SDK, and NDK
+ - jdk: 17
+ sdk: 31
api: 29
- ndk: 21.1.6352462
-
- name: android/linux-java${{ matrix.java }}-api${{ matrix.api }}-ndk${{ matrix.ndk }}
+ ndk_r: 21e
+ ndk: 21.4.7075529
- runs-on: ubuntu-latest
+ name: android/linux-jdk${{ matrix.jdk }}-sdk${{ matrix.sdk }}-ndk${{ matrix.ndk_r }}
+ runs-on: ubuntu-24.04
env:
- JAVA_VERSION: ${{ matrix.java }}
- API: ${{ matrix.api }}
+ # TODO: set to master
+ ROC_REVISION: v0.2.6
+ JAVA_VERSION: ${{ matrix.jdk }}
+ SDK_LEVEL: ${{ matrix.sdk }}
+ API_LEVEL: ${{ matrix.api }}
NDK_VERSION: ${{ matrix.ndk }}
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Build
run: scripts/android_docker.sh build
+ # build for Android on macOS
android-osx:
strategy:
fail-fast: false
matrix:
include:
- - api: 29
- ndk: 21.1.6352462
- build_tools: 28.0.3
- cmake: 3.10.2.4988404
+ # latest tested JDK, SDK, and NDK
+ - jdk: 21
+ sdk: 34
+ api: 29
+ ndk_r: 26d
+ ndk: 26.3.11579264
+ cmdline_tools: 10406996
+ build_tools: 35.0.0
+ cmake: 3.18.1
avd_image: default
avd_arch: x86_64
- - api: 26
- ndk: 21.1.6352462
+ # oldest tested JDK, SDK, and NDK
+ - jdk: 17
+ sdk: 31
+ api: 29
+ ndk_r: 21e
+ ndk: 21.4.7075529
+ cmdline_tools: 10406996
build_tools: 28.0.3
cmake: 3.10.2.4988404
avd_image: default
avd_arch: x86_64
- name: android/osx-api${{ matrix.api }}-ndk${{ matrix.ndk }}
-
- runs-on: macos-latest
+ name: android/osx-jdk${{ matrix.jdk }}-sdk${{ matrix.sdk }}-ndk${{ matrix.ndk_r }}
+ runs-on: macos-13
env:
- API: ${{ matrix.api }}
+ # TODO: set to master
+ ROC_REVISION: v0.2.6
+ SDK_LEVEL: ${{ matrix.sdk }}
+ API_LEVEL: ${{ matrix.api }}
NDK_VERSION: ${{ matrix.ndk }}
BUILD_TOOLS_VERSION: ${{ matrix.build_tools }}
CMAKE_VERSION: ${{ matrix.cmake }}
@@ -142,19 +171,28 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- - name: Install Android SDK components
- uses: maxim-lobanov/setup-android-tools@v1
+ - name: Install JDK
+ uses: actions/setup-java@v4
with:
- cache: true
- packages: |
- platforms;android-${{ matrix.api }}
- build-tools;${{ matrix.build_tools }}
- ndk;${{ matrix.ndk }}
- cmake;${{ matrix.cmake }}
- system-images;android-${{ matrix.api }};${{ matrix.avd_image }};${{ matrix.avd_arch }}
- emulator
+ java-version: ${{ matrix.jdk }}
+ distribution: temurin
+
+ - name: Install Android SDK
+ uses: android-actions/setup-android@v3
+ with:
+ cmdline-tools-version: ${{ matrix.cmdline_tools }}
+
+ - name: Install Android packages
+ run: |
+ sdkmanager \
+ "platforms;android-${{ matrix.sdk }}" \
+ "build-tools;${{ matrix.build_tools }}" \
+ "ndk;${{ matrix.ndk }}" \
+ "cmake;${{ matrix.cmake }}" \
+ "system-images;android-${{ matrix.sdk }};${{ matrix.avd_image }};${{ matrix.avd_arch }}" \
+ "emulator"
- name: Install system dependencies
run: scripts/android/install_dependencies.sh
@@ -181,13 +219,9 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
name: publish
-
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
env:
- JAVA_VERSION: 8
- API: 29
- NDK_VERSION: 21.1.6352462
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
@@ -196,7 +230,12 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Choose roc-toolkit revision
+ run: echo ROC_REVISION=$(scripts/roc_revision.py) >> $GITHUB_ENV
- name: Publish
run: scripts/android_docker.sh publish
diff --git a/README.md b/README.md
index 5e98f0cf..841c4d59 100644
--- a/README.md
+++ b/README.md
@@ -94,7 +94,7 @@ try (RocContext context = new RocContext()) {
}
```
-## Versioning
+## Bindings version
Java bindings and the C library both use [semantic versioning](https://semver.org/).
@@ -109,7 +109,23 @@ For example, version 1.2.3 of the bindings would be compatible with 1.2.x and 1.
Note that prebuilt AAR package for Android already ships the right version of libroc, so you don't need to bother with compatibility between bindings and libroc if you're using AAR.
-## Using prebuilt AAR for Android
+## Java and Android versions
+
+Minimum Java version:
+
+* on build machine: JDK 17
+* on target machine: JRE 8 (== Java 1.8)
+
+Minimum Android SDK version:
+
+* on build machine: API level 31 (Android 12 SDK)
+* on target machine: API level 29 (Android 10 runtime)
+
+Minimum Android NDK version:
+
+* on build machine: NDK r21e
+
+## Use prebuilt AAR for Android
Add mavenCentral repository in `build.gradle` file:
```
@@ -123,51 +139,74 @@ Add dependency to project ([versions](https://search.maven.org/artifact/org.roc-
implementation 'org.roc-streaming.roctoolkit:roc-android:'
```
-## Building JAR from sources
+## Build JAR for desktop
-First, follow [official instructions](https://roc-streaming.org/toolkit/docs/building.html) to install libroc system-wide. Take care to pick the right version as described above.
+Install JDK 17 or higher.
+
+Follow [official instructions](https://roc-streaming.org/toolkit/docs/building.html) to install libroc system-wide. Take care to pick the right version as described above.
Then run:
```
./gradlew build
```
-## Building AAR from sources (docker way)
+If libroc is not in default path you can specify `ROC_INCLUDE_PATH` (path to roc headers) and `ROC_LIBRARY_PATH` (path to roc library) variables with:
+- environment variables
+- gradle system variables
+
+Additional compilation and linking flags can be specified respectively with `CFLAGS` and `LDFLAGS` gradle system variables.
+
+JAR is located at `build/libs`. It expected that `libroc` shared library is present on system.
+
+## Build AAR for Android (docker way)
-This will install dependencies inside docker and run build:
+Install Docker.
+
+Optionally, export environment variables:
```
-./scripts/android_docker.sh build
+export ROC_REVISION=master
+export SDK_LEVEL=31
+export API_LEVEL=29
+export NDK_VERSION=26.3.11579264
+export BUILD_TOOLS_VERSION=35.0.0
+export CMAKE_VERSION=3.18.1
```
-This will start emulator inside docker and run tests on it:
+This will pull docker image, install dependencies inside container, and run build:
```
-./scripts/android_docker.sh test
+./scripts/android_docker.sh build
```
-## Building AAR from sources (manual way)
+AAR is located at `android/roc-android/build/outputs/aar`. It contains `libroc` built for all Android architectures.
-First, export required environment variables:
+## Build AAR for Android (manual way)
+
+Install JDK 17 or higher and Android SDK.
+
+Optionally, export environment variables:
```
-export API=26
-export NDK_VERSION=21.1.6352462
-export BUILD_TOOLS_VERSION=28.0.3
-export CMAKE_VERSION=3.10.2.4988404
+export ROC_REVISION=master
+export SDK_LEVEL=31
+export API_LEVEL=29
+export NDK_VERSION=26.3.11579264
+export BUILD_TOOLS_VERSION=35.0.0
+export CMAKE_VERSION=3.18.1
```
-Then install Android components:
+Install Android components:
```
-sdkmanager "platforms;android-${API}"
+sdkmanager "platforms;android-${SDK_LEVEL}"
sdkmanager "build-tools;${BUILD_TOOLS_VERSION}"
sdkmanager "ndk;${NDK_VERSION}"
sdkmanager "cmake;${CMAKE_VERSION}"
```
-Also install build-time dependencies of Roc Toolkit, e.g. on macOS run:
+Install build-time dependencies of Roc Toolkit, e.g. on macOS run:
```
brew install scons ragel gengetopt
```
-Now we can download and build Roc Toolkit:
+Download and build Roc Toolkit:
```
./scripts/android/build_roc.sh
```
@@ -178,38 +217,51 @@ cd android
./gradlew build
```
-Optionally, run tests on device or emulator (you'll have to create one):
-```
-cd android
-./gradlew cAT --info --stacktrace
-```
+AAR is located at `android/roc-android/build/outputs/aar`. It contains `libroc` built for all Android architectures.
-## Developer instructions
+## Android variables
-#### Local build
+These variables are used when building for Android, with or without Docker. Each variable has default value and is optional.
-Build (native code and Java code):
-```
-./gradlew build
-```
+When docker is used, corresponding components (SDK, NDK, etc) will be installed automatically according to the specified variables. When docker is not used, you should install them manually before build.
+
+| Variable | Description |
+|-----------------------|----------------------------------------------------|
+| `JAVA_VERSION` | Which JDK to pull (when using docker) |
+| `ROC_REVISION` | Which Roc Toolkit to build (when using docker) |
+| `ROC_DIR` | Which Roc Toolkit to use (when not using docker) |
+| `SDK_LEVEL` | `android-platform` version and `compileSdkVersion` |
+| `API_LEVEL` | `minSdkVersion` and `targetSdkVersion` |
+| `NDK_VERSION` | Which `ndk` to install/use |
+| `BUILD_TOOLS_VERSION` | Which `build-tools` to install/use |
+| `CMAKE_VERSION` | Which `cmake` to install/use |
+
+## Developer instructions
-Build only native code:
+#### Additional gradle targets
+
+Build only native code (on desktop):
```
./gradlew roc_jni:build
```
-Run tests:
+Run tests on desktop:
```
./gradlew test
```
-If libroc is not in default path you can specify `ROC_INCLUDE_PATH` (path to roc headers) and `ROC_LIBRARY_PATH` (path to roc library) variables with:
-- environment variables
-- gradle system variables
+Run tests on device or emulator (you'll have to create one):
+```
+cd android
+./gradlew cAT --info --stacktrace
+```
-Additional compilation and linking flags can be specified respectively with `CFLAGS` and `LDFLAGS` gradle system variables
+Generate documentation:
+```
+./gradlew javadoc
+```
-#### Android build via docker
+#### Android docker commands
This command will pull docker image, install Android SDK and NDK inside it, download and build Roc Toolkit, build JNI bindings, and package everything into AAR:
```
@@ -231,27 +283,49 @@ To remove build results and docker container, run:
./scripts/android_docker.sh purge
```
+(Normally, docker container remains running in the background with a Gradle daemon).
+
If desired, you can export some variables for Android environment configuration; each variable has default value and is optional:
```
-export JAVA_VERSION=8
-export API=26
-export NDK_VERSION=21.1.6352462
-export BUILD_TOOLS_VERSION=28.0.3
-export CMAKE_VERSION=3.10.2.4988404
+export ROC_REVISION=master
+export JAVA_VERSION=17
+export SDK_LEVEL=31
+export API_LEVEL=29
+export NDK_VERSION=26.3.11579264
+export BUILD_TOOLS_VERSION=35.0.0
+export CMAKE_VERSION=3.18.1
export AVD_IMAGE=default
export AVD_ARCH=x86_64
./scripts/android_docker.sh [build|test]
```
-Additional information on the `env-android` docker image, which is used by this script, is available [here](https://roc-streaming.org/toolkit/docs/development/continuous_integration.html#android-environment).
+Additional information on the `env-android` docker image, which is used by this script, is available [here](https://roc-streaming.org/toolkit/docs/portability/android_environment.html).
-#### Documentation build
+#### Compatibility settings in gradle
-Generate docs:
-```
-./gradlew javadoc
-```
+These settings define requirements for build and target machines:
+
+* `gradle/wrapper/gradle-wrapper.properties`
+
+ * `distributionUrl` - Gradle version (places limits on both build and target)
+
+* `build.gradle`, `commons/build.gradle`, `cmake-library/build.gradle`
+
+ * `sourceCompatibility` - Minimum build-time Java version (Desktop)
+ * `targetCompatibility` - Minimum run-time Java version (Desktop)
+
+* `android/build.gradle`
+
+ * `com.android.tools.build:gradle` - Android Gradle Plugin version (must be compatible with gradle)
+
+* `android/roc-android/build.gradle`
+
+ * `sourceCompatibility` - Minimum build-time Java version (Android)
+ * `targetCompatibility` - Minimum run-time Java version (Android)
+ * `compileSdkVersion` - Build-time Android version
+ * `minSdkVersion` - Minimum run-time Android version
+ * `targetSdkVersion` - Tested run-time Android version
#### Publishing Android release
diff --git a/android/build.gradle b/android/build.gradle
index 94c1f56b..73c738dd 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,27 +1,33 @@
-apply from: '../common.gradle'
+apply from: "../common.gradle"
buildscript {
repositories {
google()
- jcenter()
mavenCentral()
+ gradlePluginPortal()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.6.3'
- classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.5.2.0'
- classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0'
+ // must be compatible with gradle gradle/wrapper/gradle-wrapper.properties:
+ // https://developer.android.com/build/releases/gradle-plugin
+ // must be compatible with jdk:
+ // https://docs.gradle.org/current/userguide/compatibility.html
+ classpath "com.android.tools.build:gradle:8.3.0"
+ classpath "io.freefair.gradle:android-gradle-plugins:8.3.0"
+ // must be compatible with gradle:
+ // https://github.com/mannodermaus/android-junit5?tab=readme-ov-file#plugin-compatibility-map
+ classpath "de.mannodermaus.gradle.plugins:android-junit5:1.11.2.0"
+ classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
}
}
-apply plugin: 'io.codearte.nexus-staging'
+apply plugin: "io.codearte.nexus-staging"
allprojects {
- group 'org.roc-streaming.roctoolkit'
+ group "org.roc-streaming.roctoolkit"
version tagVersion
repositories {
google()
- jcenter()
mavenCentral()
}
}
diff --git a/android/roc-android/AndroidManifest.xml b/android/roc-android/AndroidManifest.xml
index 71a88eb1..cabf1918 100644
--- a/android/roc-android/AndroidManifest.xml
+++ b/android/roc-android/AndroidManifest.xml
@@ -1,9 +1,5 @@
-
-
+
-
-
-
\ No newline at end of file
+
diff --git a/android/roc-android/build.gradle b/android/roc-android/build.gradle
index 540c41b7..a043bca5 100644
--- a/android/roc-android/build.gradle
+++ b/android/roc-android/build.gradle
@@ -1,29 +1,45 @@
plugins {
- id 'maven'
- id 'signing'
- id 'com.android.library'
- id 'de.mannodermaus.android-junit5'
+ id "maven-publish"
+ id "signing"
+ id "com.android.library"
+ id "de.mannodermaus.android-junit5"
+ id "io.freefair.android-lombok"
}
+// default values must be in-sync with android_docker.sh
ext {
- apiLevel = System.getProperty('API') ?: System.getenv('API')
- buildToolsVersion = System.getProperty('BUILD_TOOLS_VERSION') ?: System.getenv('BUILD_TOOLS_VERSION')
- androidNdkVersion = System.getProperty('NDK_VERSION') ?: System.getenv('NDK_VERSION')
- ROC_BASE_DIR = System.getProperty('ROC_BASE_DIR') ?: System.getenv('ROC_BASE_DIR') ?: file("../build/libroc").absolutePath
- ossrhUsername = System.getProperty('OSSRH_USERNAME') ?: System.getenv('OSSRH_USERNAME')
- ossrhPassword = System.getProperty('OSSRH_PASSWORD') ?: System.getenv('OSSRH_PASSWORD')
- signingKeyId = System.getProperty('SIGNING_KEY_ID') ?: System.getenv('SIGNING_KEY_ID')
- signingPassword = System.getProperty('SIGNING_PASSWORD') ?: System.getenv('SIGNING_PASSWORD')
- signingKey = System.getProperty('SIGNING_KEY') ?: System.getenv('SIGNING_KEY')
+ sdkLevel = System.getProperty("SDK_LEVEL") ?: System.getenv("SDK_LEVEL") ?: "31"
+ apiLevel = System.getProperty("API_LEVEL") ?: System.getenv("API_LEVEL") ?: "29"
+
+ androidNdkVersion = System.getProperty("NDK_VERSION") ?:
+ System.getenv("NDK_VERSION") ?:
+ "26.3.11579264"
+
+ buildToolsVersion = System.getProperty("BUILD_TOOLS_VERSION") ?:
+ System.getenv("BUILD_TOOLS_VERSION") ?:
+ "35.0.0"
+
+ rocDir = System.getProperty("ROC_DIR") ?:
+ System.getenv("ROC_DIR") ?:
+ file("../build/libroc").absolutePath
+
+ signingKeyId = System.getProperty("SIGNING_KEY_ID") ?: System.getenv("SIGNING_KEY_ID")
+ signingPassword = System.getProperty("SIGNING_PASSWORD") ?: System.getenv("SIGNING_PASSWORD")
+ signingKey = System.getProperty("SIGNING_KEY") ?: System.getenv("SIGNING_KEY")
+
+ ossrhUsername = System.getProperty("OSSRH_USERNAME") ?: System.getenv("OSSRH_USERNAME")
+ ossrhPassword = System.getProperty("OSSRH_PASSWORD") ?: System.getenv("OSSRH_PASSWORD")
}
android {
- compileSdkVersion "${apiLevel}".toInteger()
+ namespace "org.rocstreaming.roctoolkit"
+
+ compileSdkVersion "${sdkLevel}".toInteger()
buildToolsVersion "${buildToolsVersion}"
ndkVersion "${androidNdkVersion}"
defaultConfig {
- minSdkVersion 26
+ minSdkVersion "${apiLevel}".toInteger()
targetSdkVersion "${apiLevel}".toInteger()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -31,10 +47,11 @@ android {
externalNativeBuild {
cmake {
- arguments "-DROC_BASE_DIR=${ROC_BASE_DIR}", "-DANDROID_STL=c++_shared"
+ arguments "-DROC_DIR=${rocDir}", "-DANDROID_STL=c++_shared"
}
}
}
+
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
@@ -47,15 +64,17 @@ android {
buildTypes {
release {
minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
}
}
+
sourceSets {
main {
java.srcDirs += "../../src/main/java"
// pack roc shared library into aar
- jniLibs.srcDirs += "${ROC_BASE_DIR}/lib"
- manifest.srcFile 'AndroidManifest.xml'
+ jniLibs.srcDirs += "${rocDir}/lib"
+ manifest.srcFile "AndroidManifest.xml"
}
androidTest {
java.srcDirs += "../../src/test/java"
@@ -68,45 +87,68 @@ android {
path "../../roc_jni/CMakeLists.txt"
}
}
+
+ publishing {
+ singleVariant("release") {
+ withSourcesJar()
+ withJavadocJar()
+ }
+ }
}
dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
-
- compileOnly 'org.projectlombok:lombok:1.18.26'
- annotationProcessor 'org.projectlombok:lombok:1.18.26'
+ implementation fileTree(dir: "libs", include: ["*.jar"])
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
androidTestImplementation "org.junit.jupiter:junit-jupiter-params:5.6.2"
androidTestImplementation "de.mannodermaus.junit5:android-test-core:1.2.0"
androidTestRuntimeOnly "de.mannodermaus.junit5:android-test-runner:1.2.0"
- androidTestImplementation 'org.awaitility:awaitility:3.1.6'
+ androidTestImplementation "org.awaitility:awaitility:3.1.6"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.6.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
- testImplementation 'org.awaitility:awaitility:3.1.6'
+ testImplementation "org.awaitility:awaitility:3.1.6"
}
+lombok {
+ version.set("1.18.30")
+}
+
+android.libraryVariants.all { variant ->
+ afterEvaluate {
+ tasks.named("delombok${variant.name.capitalize()}") {
+ target.set(file("$buildDir/delombok${variant.name.capitalize()}"))
+ }
+ }
+}
+
task sourcesJar(type: Jar) {
- archiveClassifier.set('sources')
+ archiveClassifier.set("sources")
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc) {
- source = android.sourceSets.main.java.srcDirs
- classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
- failOnError = false
+ dependsOn "delombokDebug"
+ source = file("$buildDir/delombokDebug")
+ options.addStringOption("Xdoclint:none", "-quiet")
}
task javadocJar(type: Jar, dependsOn: javadoc) {
- archiveClassifier.set('javadoc')
+ archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
+afterEvaluate {
+ tasks.javadoc.classpath += files(project.android.getBootClasspath())
+ android.libraryVariants.findAll { it.name == 'debug' }.each { variant ->
+ tasks.javadoc.classpath += variant.javaCompileProvider.get().classpath
+ }
+}
+
artifacts {
archives javadocJar
@@ -114,8 +156,8 @@ artifacts {
}
nexusStaging {
- serverUrl = 'https://s01.oss.sonatype.org/service/local/'
- packageGroup = 'org.roc-streaming'
+ serverUrl = "https://s01.oss.sonatype.org/service/local/"
+ packageGroup = "org.roc-streaming"
username = ossrhUsername
password = ossrhPassword
}
@@ -127,53 +169,67 @@ signing {
}
}
-uploadArchives {
- repositories {
- mavenDeployer {
- beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-
- repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
- authentication(userName: ossrhUsername, password: ossrhPassword)
- }
-
- snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
- authentication(userName: ossrhUsername, password: ossrhPassword)
- }
+project.afterEvaluate {
+ publishing {
+ publications {
+ release(MavenPublication) {
+ from components.release
+
+ pom {
+ name = project.name
+ packaging = "aar"
+ description = "Android library for Roc Toolkit"
+ url = "https://github.com/roc-streaming/roc-java"
+
+ scm {
+ connection = "scm:git:git://github.com/roc-streaming/roc-java.git"
+ developerConnection = "scm:git:ssh://github.com:roc-streaming/roc-java.git"
+ url = "https://github.com/roc-streaming/roc-java"
+ }
- pom.project {
- name project.name
- packaging 'aar'
- description 'Android library for Roc Toolkit'
- url 'https://github.com/roc-streaming/roc-java'
+ licenses {
+ license {
+ name = "MIT"
+ }
+ }
- scm {
- connection 'scm:git:git://github.com/roc-streaming/roc-java.git'
- developerConnection 'scm:git:ssh://github.com:roc-streaming/roc-java.git'
- url 'https://github.com/roc-streaming/roc-java'
+ developers {
+ developer {
+ id = "abushmin"
+ name = "Andrey Bushmin"
+ email = "diskbu@yandex.ru"
+ }
+ developer {
+ id = "gavv"
+ name = "Victor Gaydov"
+ email = "victor@enise.org"
+ }
+ developer {
+ id = "MatteoArella"
+ name = "Matteo Arella"
+ email = "arella.matteo.95@gmail.com"
+ }
+ }
}
+ }
+ }
- licenses {
- license {
- name 'MIT'
- }
+ repositories {
+ maven {
+ name = "Release"
+ url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
+ credentials {
+ username = ossrhUsername
+ password = ossrhPassword
}
+ }
- developers {
- developer {
- id 'abushmin'
- name 'Andrey Bushmin'
- email 'diskbu@yandex.ru'
- }
- developer {
- id 'gavv'
- name 'Victor Gaydov'
- email 'victor@enise.org'
- }
- developer {
- id 'MatteoArella'
- name 'Matteo Arella'
- email 'arella.matteo.95@gmail.com'
- }
+ maven {
+ name = "Snapshot"
+ url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
+ credentials {
+ username = ossrhUsername
+ password = ossrhPassword
}
}
}
diff --git a/build.gradle b/build.gradle
index f6bbed8b..d8909d8f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,14 @@
plugins {
- id 'java-library'
- id 'jacoco'
- id 'com.adarshr.test-logger' version '2.0.0'
+ id "java-library"
+ id "jacoco"
+ id "com.adarshr.test-logger" version "2.0.0"
+ id "io.franzbecker.gradle-lombok" version "5.0.0"
}
-apply from: 'common.gradle'
+apply from: "common.gradle"
allprojects {
- group 'org.roc-streaming.roctoolkit'
+ group "org.roc-streaming.roctoolkit"
version tagVersion
}
@@ -15,19 +16,22 @@ repositories {
mavenCentral()
}
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
dependencies {
implementation project(":commons")
- compileOnly 'org.projectlombok:lombok:1.18.26'
- annotationProcessor 'org.projectlombok:lombok:1.18.26'
+ testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
+ testImplementation "org.junit.jupiter:junit-jupiter-params:5.6.2"
+ testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
+ testImplementation "org.awaitility:awaitility:3.1.6"
+}
- testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
- testImplementation 'org.junit.jupiter:junit-jupiter-params:5.6.2'
- testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2'
- testImplementation 'org.awaitility:awaitility:3.1.6'
+lombok {
+ version = "1.18.30"
}
ext {
@@ -38,14 +42,14 @@ compileJava {
options.headerOutputDirectory = file(project(":roc_jni").projectDir.absolutePath + "/src/main/export")
}
-tasks.register('copyNativeDebugDeps') {
+tasks.register("copyNativeDebugDeps") {
dependsOn ":roc_jni:assembleDebug"
doLast {
copyNativeLibs(project(":roc_jni").buildDir.absolutePath + "/debug", targetLibraryPath)
}
}
-tasks.register('copyNativeReleaseDeps') {
+tasks.register("copyNativeReleaseDeps") {
dependsOn ":roc_jni:assembleRelease"
doLast {
copyNativeLibs(project(":roc_jni").buildDir.absolutePath + "/release", targetLibraryPath)
@@ -65,7 +69,7 @@ test {
systemProperty "java.library.path", targetLibraryPath
useJUnitPlatform {
- includeEngines 'junit-jupiter'
+ includeEngines "junit-jupiter"
}
finalizedBy jacocoTestReport
}
@@ -78,37 +82,43 @@ jacocoTestReport {
}
testlogger {
- theme 'mocha'
+ theme "mocha"
showStandardStreams = false
slowThreshold 5000
}
+import io.franzbecker.gradle.lombok.task.DelombokTask
+
+task delombok(type: DelombokTask, dependsOn: compileJava) {
+ ext.outputDir = file("$buildDir/delombok")
+ outputs.dir(outputDir)
+ sourceSets.main.java.srcDirs.each {
+ inputs.dir(it)
+ args(it, "-d", outputDir)
+ }
+}
+
javadoc {
- options.overview = "${project.rootDir}/docs/javadoc/overview.html"
- options.memberLevel = System.getProperty("visibility") == "private" ? JavadocMemberLevel.PRIVATE : JavadocMemberLevel.PUBLIC
+ dependsOn delombok
+ source = delombok.outputDir
+ options.addStringOption("Xdoclint:none", "-quiet")
}
-task clangFormat {
- description = 'Formats all .h and .cpp files using clang-format'
+task clangFormat {
doLast {
- def hFiles = fileTree(dir: 'roc_jni', include: '**/*.h')
- def cppFiles = fileTree(dir: 'roc_jni', include: '**/*.cpp')
- def excludedFiles = fileTree(dir: 'roc_jni', include: '**/org_rocstreaming_roctoolkit_*')
+ def hFiles = fileTree(dir: "roc_jni", include: "**/*.h")
+ def cppFiles = fileTree(dir: "roc_jni", include: "**/*.cpp")
+ def excludedFiles = fileTree(dir: "roc_jni", include: "**/org_rocstreaming_roctoolkit_*")
hFiles = hFiles.minus(excludedFiles)
cppFiles = cppFiles.minus(excludedFiles)
hFiles.each { file ->
- exec {
- commandLine 'clang-format', '-i', file
- }
+ exec { commandLine "clang-format", "-i", file }
}
-
cppFiles.each { file ->
- exec {
- commandLine 'clang-format', '-i', file
- }
+ exec { commandLine "clang-format", "-i", file }
}
}
}
diff --git a/cmake-library/build.gradle b/cmake-library/build.gradle
index 0870b7a2..f7328f1d 100644
--- a/cmake-library/build.gradle
+++ b/cmake-library/build.gradle
@@ -6,8 +6,10 @@ dependencies {
implementation project(":commons")
}
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
gradlePlugin {
plugins {
@@ -17,7 +19,3 @@ gradlePlugin {
}
}
}
-
-tasks.withType(JavaCompile) {
- options.compilerArgs.addAll("-Werror", "-Xlint:deprecation")
-}
diff --git a/cmake-library/src/main/java/org/rocstreaming/roctoolkit/gradle/tasks/CMake.java b/cmake-library/src/main/java/org/rocstreaming/roctoolkit/gradle/tasks/CMake.java
index 1a0e87e9..1fe1a979 100644
--- a/cmake-library/src/main/java/org/rocstreaming/roctoolkit/gradle/tasks/CMake.java
+++ b/cmake-library/src/main/java/org/rocstreaming/roctoolkit/gradle/tasks/CMake.java
@@ -17,6 +17,7 @@
import org.rocstreaming.roctoolkit.gradle.plugins.cmake.Target;
import java.io.File;
+import java.util.ArrayList;
import java.util.stream.Collectors;
/**
@@ -35,19 +36,28 @@ public void generateCmakeFiles() {
if (target.get().getIsCrossCompiling().get() && System.getenv("CMAKE_TOOLCHAIN_FILE") == null) {
throw new IllegalArgumentException("CMAKE_TOOLCHAIN_FILE env variable is not set.");
}
-
+
String cmakeExecutable = System.getenv().getOrDefault("CMAKE_EXECUTABLE", "cmake");
- Provider targetDirectory = variantDirectory.dir(String.format("%s/%s", getTarget().get().getHost().get(), getTarget().get().getPlatform().get()));
+ Provider targetDirectory = variantDirectory.dir(
+ String.format("%s/%s", getTarget().get().getHost().get(),
+ getTarget().get().getPlatform().get()));
targetDirectory.get().getAsFile().mkdirs();
+
+ ArrayList cliArgs = new ArrayList<>();
+ cliArgs.add(cmakeExecutable);
+ cliArgs.add("-DCMAKE_BUILD_TYPE=" + capitalize(getBuildType()));
+ if (!getArguments().get().isEmpty()) {
+ cliArgs.add(String.join(" ", getArguments().get()));
+ }
+ cliArgs.add("-G" + generator.get());
+ cliArgs.add("-DCMAKE_TOOLCHAIN_FILE=" +
+ System.getenv().getOrDefault("CMAKE_TOOLCHAIN_FILE", ""));
+ cliArgs.add("--no-warn-unused-cli");
+ cliArgs.add(getProjectDirectory().get().getAsFile().getAbsolutePath());
+
getProject().exec(execSpec -> {
execSpec.setWorkingDir(targetDirectory);
- execSpec.commandLine(
- cmakeExecutable,
- "-DCMAKE_BUILD_TYPE=" + capitalize(getBuildType()),
- String.join(" ", getArguments().get()),
- "-G" + generator.get(),
- "-DCMAKE_TOOLCHAIN_FILE=" + System.getenv().getOrDefault("CMAKE_TOOLCHAIN_FILE", ""),
- "--no-warn-unused-cli", getProjectDirectory().get().getAsFile().getAbsolutePath());
+ execSpec.commandLine(cliArgs);
});
}
diff --git a/commons/build.gradle b/commons/build.gradle
index ecc4d3bd..fc1a2c84 100644
--- a/commons/build.gradle
+++ b/commons/build.gradle
@@ -2,5 +2,7 @@ plugins {
id "java-library"
}
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
diff --git a/commons/src/main/java/org/rocstreaming/roctoolkit/util/os/OperatingSystem.java b/commons/src/main/java/org/rocstreaming/roctoolkit/util/os/OperatingSystem.java
index c20fc784..450772de 100644
--- a/commons/src/main/java/org/rocstreaming/roctoolkit/util/os/OperatingSystem.java
+++ b/commons/src/main/java/org/rocstreaming/roctoolkit/util/os/OperatingSystem.java
@@ -2,6 +2,9 @@
import java.util.Locale;
+/**
+ * @hidden
+ */
public abstract class OperatingSystem {
public static final Windows WINDOWS = new Windows();
public static final MacOs MAC_OS = new MacOs();
@@ -12,7 +15,7 @@ public abstract class OperatingSystem {
private static OperatingSystem currentOs = forName(System.getProperty("os.name"));
private final String osName;
protected String osArch;
-
+
public OperatingSystem() {
osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
osArch = System.getProperty("os.arch");
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 4c5803d1..a5952066 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/roc_jni/CMakeLists.txt b/roc_jni/CMakeLists.txt
index 126f153a..e298a923 100644
--- a/roc_jni/CMakeLists.txt
+++ b/roc_jni/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.4.1)
+cmake_minimum_required(VERSION 3.5)
project(RocJni C)
@@ -32,6 +32,7 @@ target_compile_options(roc_jni PRIVATE
-Wall
-Wextra
-Wno-system-headers
+ -Wno-unused-but-set-variable
-Wno-unused-parameter
)
@@ -51,12 +52,12 @@ target_include_directories(roc_jni
if(ANDROID)
# include libroc headers
target_include_directories(roc_jni SYSTEM PRIVATE
- ${ROC_BASE_DIR}/include/${ANDROID_ABI})
+ ${ROC_DIR}/include/${ANDROID_ABI})
# link libroc shared library
add_library(lib_roc SHARED IMPORTED)
set_target_properties(lib_roc PROPERTIES IMPORTED_LOCATION
- ${ROC_BASE_DIR}/lib/${ANDROID_ABI}/libroc.so)
+ ${ROC_DIR}/lib/${ANDROID_ABI}/libroc.so)
target_link_libraries(roc_jni lib_roc)
else()
# include libroc headers
diff --git a/roc_jni/build.gradle b/roc_jni/build.gradle
index b011748a..b75e5fc1 100644
--- a/roc_jni/build.gradle
+++ b/roc_jni/build.gradle
@@ -2,6 +2,7 @@ plugins {
id "org.rocstreaming.roctoolkit.cmake-library"
}
+assemble.dependsOn rootProject.tasks.named("compileJava")
assemble.dependsOn rootProject.classes
cmake {
@@ -16,3 +17,11 @@ cmake {
"-DROC_LIBRARY_PATH=" + System.getProperty("ROC_LIBRARY_PATH"),
"-DJAVA_HOME=" + System.getProperty("TARGET_JAVA_HOME")
}
+
+tasks.matching { it.name.startsWith("cmake") }.configureEach {
+ dependsOn rootProject.tasks.named("compileJava")
+}
+
+tasks.named("cmakeRelease") {
+ dependsOn tasks.named("assembleDebug")
+}
diff --git a/scripts/android/build_roc.sh b/scripts/android/build_roc.sh
index 1c3b1786..27140017 100755
--- a/scripts/android/build_roc.sh
+++ b/scripts/android/build_roc.sh
@@ -48,6 +48,7 @@ if [ ! -d "android/build/roc-toolkit" ]
then
mkdir -p "android/build/roc-toolkit"
git clone -q --recurse-submodules https://github.com/roc-streaming/roc-toolkit.git \
+ -b "${ROC_REVISION:-master}" \
"android/build/roc-toolkit"
fi
@@ -57,7 +58,7 @@ then
fi
for i in "${!target_host[@]}"; do
- host="${target_host[i]}${API}"
+ host="${target_host[i]}${API_LEVEL}"
abi="${target_abi[i]}"
scons -Q -C android/build/roc-toolkit \
diff --git a/scripts/android/start_emulator.sh b/scripts/android/start_emulator.sh
index 9e005c4a..bc0dabf4 100755
--- a/scripts/android/start_emulator.sh
+++ b/scripts/android/start_emulator.sh
@@ -9,7 +9,7 @@ export PATH="${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${PATH}"
if ! avdmanager list avd -c | grep -qF roc_device
then
device --name roc_device \
- --image "${AVD_IMAGE}" --arch "${AVD_ARCH}" --api "${API}" \
+ --image "${AVD_IMAGE}" --arch "${AVD_ARCH}" --api "${API_LEVEL}" \
create
fi
diff --git a/scripts/android_docker.sh b/scripts/android_docker.sh
index e42eeab4..70487b47 100755
--- a/scripts/android_docker.sh
+++ b/scripts/android_docker.sh
@@ -7,12 +7,14 @@ function run_cmd() {
"$@" || exit 1
}
-# setup default values
-: "${JAVA_VERSION:=8}"
-: "${API:=26}"
-: "${NDK_VERSION:=21.1.6352462}"
-: "${BUILD_TOOLS_VERSION:=28.0.3}"
-: "${CMAKE_VERSION:=3.10.2.4988404}"
+# default values must be in-sync with android/roc-android/build.gradle
+: "${ROC_REVISION:=master}"
+: "${JAVA_VERSION:=17}"
+: "${SDK_LEVEL:=31}"
+: "${API_LEVEL:=29}"
+: "${NDK_VERSION:=26.3.11579264}"
+: "${BUILD_TOOLS_VERSION:=35.0.0}"
+: "${CMAKE_VERSION:=3.18.1}"
: "${AVD_IMAGE:=default}"
: "${AVD_ARCH:=x86_64}"
: "${OSSRH_USERNAME:=}"
@@ -88,7 +90,7 @@ fi
# if container exists, but was started with different parameters, remove it
if docker ps -a --format '{{.Names}}' | grep -q roc_android
then
- for var in API BUILD_TOOLS_VERSION NDK_VERSION CMAKE_VERSION AVD_IMAGE AVD_ARCH
+ for var in SDK_LEVEL API_LEVEL BUILD_TOOLS_VERSION NDK_VERSION CMAKE_VERSION AVD_IMAGE AVD_ARCH
do
expected="${!var}"
actual="$(docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' roc_android \
@@ -111,7 +113,9 @@ then
docker_args=(
--env CI="${CI:-false}"
- --env API="${API}"
+ --env ROC_REVISION="${ROC_REVISION}"
+ --env SDK_LEVEL="${SDK_LEVEL}"
+ --env API_LEVEL="${API_LEVEL}"
--env NDK_VERSION="${NDK_VERSION}"
--env BUILD_TOOLS_VERSION="${BUILD_TOOLS_VERSION}"
--env CMAKE_VERSION="${CMAKE_VERSION}"
diff --git a/scripts/linux/build_roc.sh b/scripts/linux/build_roc.sh
index 10ed2172..71ae533a 100755
--- a/scripts/linux/build_roc.sh
+++ b/scripts/linux/build_roc.sh
@@ -2,7 +2,8 @@
set -euxo pipefail
-git clone --recurse-submodules https://github.com/roc-streaming/roc-toolkit.git /tmp/roc
+git clone --recurse-submodules -b ${ROC_REVISION:-master} \
+ https://github.com/roc-streaming/roc-toolkit.git /tmp/roc
scons -C /tmp/roc -Q --compiler=gcc --build-3rdparty=openfec
sudo scons -C /tmp/roc -Q --compiler=gcc --build-3rdparty=openfec install
diff --git a/scripts/osx/build_roc.sh b/scripts/osx/build_roc.sh
index 1bd46190..bd98e47f 100755
--- a/scripts/osx/build_roc.sh
+++ b/scripts/osx/build_roc.sh
@@ -2,7 +2,8 @@
set -euxo pipefail
-git clone --recurse-submodules https://github.com/roc-streaming/roc-toolkit.git /tmp/roc
+git clone --recurse-submodules -b ${ROC_REVISION:-master} \
+ https://github.com/roc-streaming/roc-toolkit.git /tmp/roc
scons -C /tmp/roc -Q --build-3rdparty=openfec
sudo scons -C /tmp/roc -Q --build-3rdparty=openfec install
diff --git a/scripts/roc_revision.py b/scripts/roc_revision.py
new file mode 100755
index 00000000..03754f78
--- /dev/null
+++ b/scripts/roc_revision.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import requests
+import re
+import subprocess
+
+# last roc-java tag, e.g. "v0.2.1"
+git_tag = subprocess.check_output(
+ ['git', 'describe', '--tags', '--abbrev=0'], text=True).strip()
+
+# prefix for matching roc-toolkit tags, e.g. "v0.2."
+tag_prefix = re.sub(r'\.[^.]+$', '.', git_tag)
+
+# list of roc-toolkit tags sorted in version order
+response = requests.get('https://api.github.com/repos/roc-streaming/roc-toolkit/tags')
+tags = sorted([tag['name'] for tag in response.json()],
+ key=lambda v: tuple(map(int, v.lstrip('v').split('.'))))
+
+# last tag matching prefix, e.g. "v0.2.6"
+filtered_tags = [tag for tag in tags if tag.startswith(tag_prefix)]
+latest_tag = filtered_tags[-1]
+
+print(latest_tag)
diff --git a/src/main/java/org/rocstreaming/roctoolkit/Endpoint.java b/src/main/java/org/rocstreaming/roctoolkit/Endpoint.java
index 4b2dd633..c6bfef47 100644
--- a/src/main/java/org/rocstreaming/roctoolkit/Endpoint.java
+++ b/src/main/java/org/rocstreaming/roctoolkit/Endpoint.java
@@ -12,7 +12,7 @@
* resource. All these parts together are unambiguously represented
* by a URI. The user may set or get the entire URI or its individual parts.
*
- * Endpoint URI
+ * Endpoint URI
*
* Endpoint URI syntax is a subset of the syntax defined in RFC 3986:
*
@@ -45,7 +45,7 @@
* The path and query fields are allowed only for protocols that support them.
* For example, they're supported by RTSP, but not by RTP.
*
- *
Thread-safety
+ * Thread-safety
*
* Can't be used concurrently
*/
diff --git a/src/main/java/org/rocstreaming/roctoolkit/RocContext.java b/src/main/java/org/rocstreaming/roctoolkit/RocContext.java
index 6d3812e3..051311c7 100644
--- a/src/main/java/org/rocstreaming/roctoolkit/RocContext.java
+++ b/src/main/java/org/rocstreaming/roctoolkit/RocContext.java
@@ -10,7 +10,7 @@
* to the context. It is allowed both to create a separate context for every object, or
* to create a single context shared between multiple objects.
*
- *
Lifecycle
+ * Lifecycle
* A context is created using {@link #RocContext() RocContext()} or
* {@link #RocContext(RocContextConfig) RocContext(RocContextConfig)} and destroyed using
* {@link #close() close()}. RocContext
class implements
diff --git a/src/main/java/org/rocstreaming/roctoolkit/RocReceiver.java b/src/main/java/org/rocstreaming/roctoolkit/RocReceiver.java
index 91090f13..a9cd797a 100644
--- a/src/main/java/org/rocstreaming/roctoolkit/RocReceiver.java
+++ b/src/main/java/org/rocstreaming/roctoolkit/RocReceiver.java
@@ -10,7 +10,7 @@
* Receiver gets the network packets from multiple senders, decodes audio streams
* from them, mixes multiple streams into a single stream, and returns it to the user.
*
- * Context
+ * Context
*
* Receiver is automatically attached to a context when opened and detached from it when
* closed. The user should not close the context until the receiver is closed.
@@ -19,7 +19,7 @@
* decoding part is performed in the receiver itself, and the reception part is
* performed in the context network worker threads.
*
- *
Lifecycle
+ * Lifecycle
*
* - A receiver is created using {@link RocReceiver#RocReceiver RocReceiver()}.
* - Optionally, the receiver parameters may be fine-tuned using
@@ -34,7 +34,7 @@
* statement the object is closed automatically at the end of the statement.
*
*
- * Slots, interfaces, and endpoints
+ * Slots, interfaces, and endpoints
*
* Receiver has one or multiple slots, which may be independently bound or connected.
* Slots may be used to bind receiver to multiple addresses. Slots are numbered from
@@ -62,7 +62,7 @@
* (e.g. be an RTP/FECFRAME/RTCP sender).
*
*
- *
FEC scheme
+ * FEC scheme
*
* If {@link Interface#CONSOLIDATED} is used, it automatically creates all necessary
* transport interfaces and the user should not bother about them.
@@ -80,7 +80,7 @@
* scheme. For example, if {@link FecEncoding#RS8M} is used, the protocols should be
* {@link Protocol#RTP_RS8M_SOURCE} and {@link Protocol#RS8M_REPAIR}.
*
- *
Sessions
+ * Sessions
* Receiver creates a session object for every sender connected to it. Sessions can appear
* and disappear at any time. Multiple sessions can be active at the same time.
*
@@ -94,7 +94,7 @@
* destroyed on other events like a large latency underrun or overrun or broken playback,
* but if the sender continues to send packets, it will be created again shortly.
*
- *
Mixing
+ * Mixing
* Receiver mixes audio streams from all currently active sessions into a single output
* stream.
*
@@ -104,7 +104,7 @@
* Sessions can be added and removed from the output stream at any time, probably in the
* middle of a frame.
*
- *
Sample rate
+ * Sample rate
* Every session may have a different sample rate. And even if nominally all of them are
* of the same rate, device frequencies usually differ by a few tens of Hertz.
*
@@ -117,7 +117,7 @@
* disabling resampling (at the cost of occasional underruns or overruns) or several
* resampler profiles providing different compromises between CPU consumption and quality.
*
- *
Clock source
+ * Clock source
* Receiver should decode samples at a constant rate that is configured when the receiver
* is created. There are two ways to accomplish this:
*
@@ -140,11 +140,11 @@
*
*
*
- * Thread-safety
+ * Thread-safety
*
* Can be used concurrently
*
- *
Example
+ * Example
*
* {@code
* RocReceiverConfig config = RocReceiverConfig.builder()
diff --git a/src/main/java/org/rocstreaming/roctoolkit/RocSender.java b/src/main/java/org/rocstreaming/roctoolkit/RocSender.java
index 77ee091a..0ed1f766 100644
--- a/src/main/java/org/rocstreaming/roctoolkit/RocSender.java
+++ b/src/main/java/org/rocstreaming/roctoolkit/RocSender.java
@@ -10,7 +10,7 @@
* Sender gets an audio stream from the user, encodes it into network packets, and
* transmits them to a remote receiver.
*
- * Context
+ * Context
*
* Sender is automatically attached to a context when opened and detached from it when
* closed. The user should not close the context until the sender is closed.
@@ -19,7 +19,7 @@
* encoding part is performed in the sender itself, and the transmission part is
* performed in the context network worker threads.
*
- *
Lifecycle
+ * Lifecycle
*
*
* - A sender is created using {@link RocSender#RocSender RocSender()}.
@@ -36,7 +36,7 @@
* RocSender
class implements {@link AutoCloseable AutoCloseable} so if it is used in a
* try-with-resources statement the object is closed automatically at the end of the statement.
*
- * Slots, interfaces, and endpoints
+ * Slots, interfaces, and endpoints
*
* Sender has one or multiple slots, which may be independently bound or connected.
* Slots may be used to connect sender to multiple receivers. Slots are numbered from
@@ -65,7 +65,7 @@
* (e.g. be an RTP/FECFRAME/RTCP sender).
*
*
- * FEC scheme
+ * FEC scheme
*
* If {@link Interface#CONSOLIDATED} is used, it automatically creates all necessary
* transport interfaces and the user should not bother about them.
@@ -83,7 +83,7 @@
* scheme. For example, if {@link FecEncoding#RS8M} is used, the protocols should be
* {@link Protocol#RTP_RS8M_SOURCE} and {@link Protocol#RS8M_REPAIR}.
*
- *
Sample rate
+ * Sample rate
*
* If the sample rate of the user frames and the sample rate of the network packets are
* different, the sender employs resampler to convert one rate to another.
@@ -92,7 +92,7 @@
* disabling resampling (and so use the same rate for frames and packets) or several
* resampler profiles providing different compromises between CPU consumption and quality.
*
- *
Clock source
+ * Clock source
*
* Sender should encode samples at a constant rate that is configured when the sender
* is created. There are two ways to accomplish this:
@@ -118,11 +118,11 @@
*
*
*
- *
Thread-safety
+ * Thread-safety
*
* Can be used concurrently
*
- *
Example
+ * Example
*
* {@code
* RocSenderConfig config = RocSenderConfig.builder()