Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
0e6efa0
First step towards building a jar with libringrtc
johanvos Sep 24, 2022
f6b62c0
Add maven code to build a jar with native library.
johanvos Sep 25, 2022
49d78e3
Add first Java function to init logging
johanvos Sep 25, 2022
f155f35
build 0.0.1 version of jar
johanvos Sep 26, 2022
b8bbb92
bump pom and add enable-preview (required by NetBeans IDE)
johanvos Sep 26, 2022
6e575c0
add more functionality. Implement basic types for bridging Java and R…
johanvos Sep 26, 2022
3795e51
add java types
johanvos Sep 26, 2022
f9af9e5
Add more callback API's
johanvos Sep 27, 2022
3775d15
implement flow until ConnectedBeforeAccepted
johanvos Sep 28, 2022
0b91be8
Works with accepting call.
johanvos Sep 28, 2022
ac4bf2f
build 0.0.2 version of tring.
johanvos Sep 28, 2022
3426cc5
Supply classifier to jar build process
johanvos Sep 30, 2022
25ff9c3
Allow building for M1
jperedadnr Oct 1, 2022
df8625e
Merge pull request #1 from jperedadnr/javabuild
johanvos Oct 1, 2022
650d122
Add target as a subdir to linux build directory
johanvos Oct 1, 2022
7db8cb7
create resources dir if it doesn't exist
johanvos Oct 1, 2022
717e53e
correct cp
johanvos Oct 1, 2022
7a80287
required to build a module and export packages
johanvos Oct 1, 2022
8f410cd
Merge branch 'javabuild' of github.com:johanvos/ringrtc into javabuild
johanvos Oct 1, 2022
e66409f
allow clean build for Java
johanvos Oct 1, 2022
3795836
Use library at the root of the resource folder
johanvos Oct 1, 2022
fecac0b
Split tring and tringApi
johanvos Oct 2, 2022
d963ba8
Allow to enable audio recording
johanvos Oct 2, 2022
491fb9a
Use CARGO ARCH as the architecture for the classifier
johanvos Oct 2, 2022
51e5798
Add very basic info on the Java port
johanvos Oct 2, 2022
2e0124d
allow to build releases (tring 0.0.4 and tringapi 0.0.1)
johanvos Oct 2, 2022
9da574b
use 0.0.1 instead of a snapshot
johanvos Oct 2, 2022
e052df7
bump release versions of tring and tringapi
johanvos Oct 2, 2022
7c8a10f
add call ifgnore/hangup flow
johanvos Oct 3, 2022
577409a
first steps for outgoingcall
johanvos Oct 4, 2022
6b24bce
add more debugging
johanvos Oct 5, 2022
4bdc364
send ice messages one by one
johanvos Oct 5, 2022
58f7bf8
cleanup
johanvos Oct 6, 2022
ff1fe58
fix fmt
johanvos Oct 6, 2022
5caf076
Merge pull request #2 from johanvos/outgoingcall
johanvos Oct 6, 2022
eb5a572
changes to build 0.0.2 (tringapi) and 0.0.5 (tring)
johanvos Oct 6, 2022
f5f5375
Tring should depend on a release of TringApi if we want to release Tring
johanvos Oct 6, 2022
9d1a9bf
Use service loader pre JPMS
jperedadnr Oct 6, 2022
594972d
Merge pull request #3 from jperedadnr/service
johanvos Oct 6, 2022
2bfc32e
Use gen-sources
jperedadnr Oct 6, 2022
a995c4a
Bump tringapi version (before bunping the tring version);
johanvos Oct 6, 2022
eb50ba4
And then bump tring version
johanvos Oct 6, 2022
0653164
Merge pull request #4 from jperedadnr/gen
johanvos Oct 6, 2022
51442f3
Pass STUN/TURN server info via proceedcall
johanvos Oct 7, 2022
07ee582
build 0.0.3
johanvos Oct 7, 2022
c32429b
build 0.0.6 with api 0.0.3
johanvos Oct 7, 2022
c10327c
Add workflow to build and release snapshots
abhinayagarwal Oct 7, 2022
5024603
Allow to handle Hangup callbacks
johanvos Oct 7, 2022
3c297b8
fix formatting
johanvos Oct 7, 2022
3e7a09d
bump maven versions
johanvos Oct 7, 2022
7ad9227
Merge pull request #5 from abhinayagarwal/workflow
johanvos Oct 7, 2022
f59febc
Run for every commit of javabuild branch
abhinayagarwal Oct 7, 2022
3c0282f
Merge pull request #6 from abhinayagarwal/fix-wf
johanvos Oct 7, 2022
f5fe559
increase version instead of decreasing it!
johanvos Oct 7, 2022
1c81ac1
Merge branch 'javabuild' of github.com:johanvos/ringrtc into javabuild
johanvos Oct 7, 2022
4bfdf14
build tringapi 0.0.4 with tring 0.0.7
johanvos Oct 8, 2022
d1a5bdb
Hardcode device 1
johanvos Nov 28, 2022
542e61f
Merge pull request #9 from johanvos/8-hangupid
johanvos Nov 28, 2022
78c0a59
Add video functionality
johanvos Dec 4, 2022
0ac7b80
enable incoming and outgoing video.
johanvos Dec 5, 2022
59d736e
Fix rust fmt
johanvos Dec 5, 2022
c56c7de
remove debug info
johanvos Dec 5, 2022
a98f084
Merge pull request #10 from johanvos/video2way
johanvos Dec 5, 2022
339b140
Build tring api 0.0.5
johanvos Dec 5, 2022
f64a7d1
Allow to pass pixelformat when uploading a frame to outgoingVideo
johanvos Dec 6, 2022
3658da8
Increase versions to snapshot versions
johanvos Dec 7, 2022
7f0a603
Merge pull request #11 from johanvos/pixelformat
johanvos Dec 7, 2022
2d711af
New session for video upload
johanvos Dec 7, 2022
399fa0c
Merge pull request #12 from johanvos/newsession
johanvos Dec 7, 2022
c41134a
Asynchonous remote video retrieval
johanvos Dec 8, 2022
859b0bc
Merge pull request #13 from johanvos/retrieve2
johanvos Dec 8, 2022
4d632da
Build tring 0.0.9 and api 0.0.6
johanvos Dec 8, 2022
d807540
Add missing class
johanvos Dec 8, 2022
1e7a464
prepare new snapshots
johanvos Dec 8, 2022
929986e
add real deviceId of accepting device instead of dummy `1`
johanvos Dec 8, 2022
7251e64
Whenever Tring processes a (signaling/status) event that is received …
johanvos Dec 9, 2022
c0834e1
Merge branch 'main' into javabuild
johanvos Dec 9, 2022
def746e
Release tringapi 0.0.7 and tring 0.0.10
johanvos Dec 11, 2022
a01c102
Prepare next snapshots
johanvos Dec 15, 2022
df29a39
get audio inputs
johanvos Dec 9, 2022
4c3d463
make sure it doesn't impact normal flow
johanvos Dec 11, 2022
ece2404
remove debug, fix formatting
johanvos Dec 11, 2022
c70ae62
Allocinjava (#15)
johanvos Dec 27, 2022
2b8ce40
Build 0.0.8 (tringapi) and 0.0.11 (tring)
johanvos Dec 27, 2022
4258b3d
Bump versions to new snapshot version
johanvos Dec 28, 2022
c498e6b
First steps for groupcalls
johanvos Mar 27, 2023
d5e000d
Add entrypoint for httpclient
johanvos Mar 31, 2023
f360421
prepare to send http request required for groupcall
johanvos Mar 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build and publish snapshots
on:
push:
branches: [ javabuild ]

jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
ref: javabuild
- name: Install latest bash on macOS
if: runner.os == 'macOS'
run: |
brew update
brew install bash
brew install coreutils
- name: Set environment variables
run: |
echo "OS=${RUNNER_OS,,}" >> $GITHUB_ENV
echo "ARCH=${RUNNER_ARCH,,}" >> $GITHUB_ENV
if [[ ${{ runner.os }} == "Linux" ]]
then
platform=unix
classifier=linux-x86_64
elif [[ ${{ runner.os }} == "macOS" ]]
then
platform=mac
if [[ ${{ runner.arch }} == "X64" ]]
then
classifier=darwin-x86_64
else
classifier=darwin-aarch64
fi
elif [[ ${{ runner.os }} == "Windows" ]]
then
platform=windows
classifier=win-x86_64
fi
echo "PLATFORM=$platform" >> $GITHUB_ENV
echo "CLASSIFIER=$classifier" >> $GITHUB_ENV
shell: bash
- name: Download OpenJDK 19
id: download
uses: oracle-actions/setup-java@v1
with:
website: jdk.java.net
release: 19
install: false
- name: Setup Java and Apache Maven
uses: actions/setup-java@v3
with:
distribution: jdkfile
jdkFile: ${{ steps.download.outputs.archive }}
java-version: ${{ steps.download.outputs.version }}
server-id: gluon-nexus
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
- name: Checkout tools repo
run: |
echo "print env variables"
echo ${{ env.OS }}
echo ${{ env.ARCH }}
echo ${{ env.PLATFORM }}
echo ${{ env.CLASSIFIER }}
cd $GITHUB_WORKSPACE
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Download and extract JEXTRACT
run: |
download_url="https://download.java.net/java/early_access/jextract/2/openjdk-19-jextract+2-3_${{ env.OS }}-${{ env.ARCH }}_bin.tar.gz"
wget -q --show-progress -O $RUNNER_TEMP/jextract.tar.gz $download_url
tar -xvzf $RUNNER_TEMP/jextract.tar.gz -C $GITHUB_WORKSPACE
- name: Build
run: |
export PATH=$GITHUB_WORKSPACE/depot_tools/:$PATH
make java PLATFORM=${{ env.PLATFORM }} JEXTRACT=$GITHUB_WORKSPACE/jextract-19 JDK=$JAVA_HOME TARGET_ARCH=${{ env.ARCH }} MACOS_SDK_VERSION=12.1
- name: Deploy snapshot
run: |
cd src/java/tring
mvn -Dclassifier=${{ env.CLASSIFIER }} deploy
env:
MAVEN_USERNAME: ${{ secrets.GLUON_NEXUS_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.GLUON_NEXUS_PASSWORD }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ src/jar.list
.project
.classpath
org.eclipse.buildship.core.prefs
src/java/build
src/java/tring/src/gen-sources
src/java/tring/src/main/resources/libringrtc.dylib
src/java/tring/target
src/java/tringapi/target/
src/rust/tringlib.h
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ help:
$(Q) echo " ios -- download WebRTC and build for the iOS platform"
$(Q) echo " android -- download WebRTC and build for the Android platform"
$(Q) echo " electron -- build an Electron library"
$(Q) echo " java -- build a Java library"
$(Q) echo " cli -- build the test cli (1:1 calls)"
$(Q) echo " gctc -- build the test cli (group calls)"
$(Q) echo
$(Q) echo "For the electon/cli/gctc builds, you can specify an optional platform"
$(Q) echo "For the electron/java/cli/gctc builds, you can specify an optional platform"
$(Q) echo "which will download WebRTC. For example:"
$(Q) echo " $ make electron PLATFORM=unix"
$(Q) echo
Expand Down Expand Up @@ -86,6 +87,14 @@ electron:
fi
$(Q) (cd src/node && yarn install && yarn build)

java:
$(Q) if [ "$(PLATFORM)" != "" ] ; then \
echo "java: Preparing workspace for $(PLATFORM)" ; \
./bin/prepare-workspace $(PLATFORM) ; \
fi
echo "java: Release build" ; \
./bin/build-java -r

cli:
$(Q) if [ "$(PLATFORM)" != "" ] ; then \
echo "cli: Preparing workspace for $(PLATFORM)" ; \
Expand Down Expand Up @@ -119,6 +128,7 @@ clean:
$(Q) ./bin/build-gctc --clean
$(Q) ./bin/build-electron --clean
$(Q) ./bin/build-ios --clean
$(Q) ./bin/build-java --clean
$(Q) rm -rf ./src/webrtc/src/out

PHONY += distclean
Expand Down
163 changes: 163 additions & 0 deletions bin/build-java
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#!/bin/sh

#
# Copyright 2019-2021 Signal Messenger, LLC
# SPDX-License-Identifier: AGPL-3.0-only
#

set -e

# shellcheck source=bin/env.sh
. "$(dirname "$0")"/env.sh

JEXTRACT=${JEXTRACT:-/opt/jextract-19}
JDK=${JDK:-/opt/jdk-19}
TARGET_ARCH=${TARGET_ARCH:-x64}

# darwin only
DEFAULT_MACOS_SDK_VERSION="12.3"
MACOS_SDK_VERSION=${MACOS_SDK_VERSION:-$DEFAULT_MACOS_SDK_VERSION}
MACOS_SDK_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${MACOS_SDK_VERSION}.sdk"

usage()
{
echo 'usage: build-java [-d|-r|-c]
where:
-r to create a release build
-d to create a debug build (which may fail to build!)
-c to clean the build artifacts'
}

clean()
{
# Remove all possible artifact directories.
rm -rf ./src/rust/target/debug
rm -rf ./src/rust/target/release
rm -rf ./src/webrtc/src/out/debug
rm -rf ./src/webrtc/src/out/release
mvn -f ./src/java/tring clean
}

BUILD_TYPE=release

while [ "$1" != "" ]; do
case $1 in
-d | --debug )
BUILD_TYPE=debug
;;
-r | --release )
BUILD_TYPE=release
;;
-c | --clean )
clean
exit
;;
-h | --help )
usage
exit
;;
* )
usage
exit 1
esac
shift
done

case "$TARGET_ARCH" in
"x64")
GN_ARCH=x64
CARGO_ARCH=x86_64
;;
"ia32")
GN_ARCH=x86
CARGO_ARCH=i686
;;
"arm64")
GN_ARCH=arm64
CARGO_ARCH=aarch64
;;
*)
echo "Unsupported architecture"
exit 1
;;
esac

hash rustup 2>/dev/null || { echo >&2 "Make sure you have rustup installed and properly configured! Aborting."; exit 1; }

RUSTFLAGS_WIN=

case "$(rustup show active-toolchain)" in
*"x86_64-apple-darwin"* | *"aarch64-apple-darwin"* )
DEFAULT_PLATFORM="darwin"
CARGO_TARGET="${CARGO_ARCH}-apple-darwin"
;;
*"x86_64-pc-windows"* )
DEFAULT_PLATFORM="win32"
CARGO_TARGET="${CARGO_ARCH}-pc-windows-msvc"
# Static linking to prevent build errors on Windows ia32
RUSTFLAGS_WIN="-C target-feature=+crt-static"
;;
*"x86_64-unknown-linux"* )
DEFAULT_PLATFORM="linux"
CARGO_TARGET="${CARGO_ARCH}-unknown-linux-gnu"
;;
* )
printf "Unknown platform detected!\nPlease make sure you have installed a valid Rust toolchain via rustup! Aborting.\n"
exit 1
esac

echo "Building for platform ${DEFAULT_PLATFORM}, TARGET_ARCH=${TARGET_ARCH}, GN_ARCH=${GN_ARCH}, CARGO_TARGET=${CARGO_TARGET}", OUTPUT_DIR=${OUTPUT_DIR}

export MACOSX_DEPLOYMENT_TARGET="10.10"

# Build WebRTC.
(
cd src/webrtc/src
WEBRTC_ARGS="target_cpu=\"${GN_ARCH}\" rtc_build_examples=false rtc_build_tools=false rtc_include_tests=false rtc_enable_protobuf=false rtc_use_x11=false rtc_enable_sctp=false rtc_libvpx_build_vp9=true rtc_include_ilbc=false"

if [ "${BUILD_TYPE}" = "debug" ]
then
gn gen -C "${OUTPUT_DIR}"/debug "--args=${WEBRTC_ARGS}"
ninja -C "${OUTPUT_DIR}"/debug
else
gn gen -C "${OUTPUT_DIR}"/release "--args=${WEBRTC_ARGS} is_debug=false"
ninja -C "${OUTPUT_DIR}"/release
fi
)

# Build and link the final RingRTC library.
(
cd src/rust

if [ "${BUILD_TYPE}" = "debug" ]
then
RUSTFLAGS="${RUSTFLAGS_WIN}" OUTPUT_DIR="${OUTPUT_DIR}" cargo build --target ${CARGO_TARGET} --features java
else
OUTPUT_DIR="${OUTPUT_DIR}" cargo build --target ${CARGO_TARGET} --lib --features java --release
fi

mkdir -p ../java/tring/src/main/resources
if [ $DEFAULT_PLATFORM = "darwin" ]
then
mkdir -p ../java/build/darwin
cp -f target/${CARGO_TARGET}/${BUILD_TYPE}/libringrtc.dylib ../java/tring/src/main/resources/libringrtc.dylib
# cp -f target/${CARGO_TARGET}/${BUILD_TYPE}/libringrtc.dylib ../java/build/darwin/libringrtc-"${TARGET_ARCH}"
${JEXTRACT}/bin/jextract -I${JDK}include -I${JDK}/include/darwin -I${MACOS_SDK_PATH}/usr/include --output ../java/tring/src/gen-sources/java --source -t io.privacyresearch.tring tringlib.h
elif [ $DEFAULT_PLATFORM = "win32" ]
then
mkdir -p ../java/build/win32
cp -f target/${CARGO_TARGET}/${BUILD_TYPE}/ringrtc.dll ../java/build/win32/libringrtc-"${TARGET_ARCH}".java
${JEXTRACT}/bin/jextract -I${JDK}include -I${JDK}/include/win32 --output ../java/tring/src/main/java --source -t io.privacyresearch.tring tringlib.h
elif [ $DEFAULT_PLATFORM = "linux" ]
then
mkdir -p ../java/build/linux
cp -f target/${CARGO_TARGET}/${BUILD_TYPE}/libringrtc.so ../java/tring/src/main/resources/libringrtc.so
#cp -f target/${CARGO_TARGET}/${BUILD_TYPE}/libringrtc.so ../java/build/linux/libringrtc-"${TARGET_ARCH}".java
${JEXTRACT}/bin/jextract -I${JDK}include -I${JDK}/include/linux --output ../java/tring/src/main/java --source -t io.privacyresearch.tring tringlib.h
fi
cd ../java/tringapi
mvn clean install
cd ../tring
echo "mvn -Dclassifier=$DEFAULT_PLATFORM-$CARGO_ARCH clean install"
mvn -Dclassifier=$DEFAULT_PLATFORM-$CARGO_ARCH clean install
)
14 changes: 14 additions & 0 deletions src/java/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
The Java implementation consists of 2 Java projects, and a Rust component.

tringapi: this contains the API that can be accessed by the application,
without any dependencies (no application model classes or ringrtc structs).
It uses the Java ServiceLoader concept to find implementations of the
TringService.

tring: this contains platform-specific implementations of the TringService.
The source code is mainly auto-generated by jextract. The implementation
itself is in TringServiceImpl, and it is made available via module-info.java

Rust component:
java.rs contains the implementation of methods invoked by TringServiceImpl.
It is similar to electron.js
Loading