Build Android products independently of WebRTC

This should still be consistent with the previous behavior, down to 
the output aar paths and support for Maven. Some highlights:

- Some Gradle files move to the top level of the repository so IDEs 
  can pick them up when opening the repo root.

- javadoc is now handled through Gradle (though build-javadoc still 
  exists as a thin wrapper).

- The "dependencies" we were pulling down weren't really needed at 
  all.
This commit is contained in:
Jordan Rose 2023-01-03 13:10:59 -08:00 committed by Jim Gustafson
parent e12759d56c
commit d1ccb43d8f
41 changed files with 515 additions and 819 deletions

View file

@ -29,7 +29,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- uses: actions/checkout@v3
- run: rustup toolchain install $(cat rust-toolchain) --profile minimal --component clippy --target aarch64-linux-android,aarch64-apple-ios
- run: shellcheck **/*.sh bin/build-aar bin/build-cli bin/build-electron bin/build-gctc bin/build-ios bin/build-javadoc bin/build-rustdoc bin/build-target bin/fetch-android-deps bin/gsync-webrtc bin/prepare-workspace bin/rust-lint-check src/rust/scripts/run-tests
- run: shellcheck **/*.sh bin/build-aar bin/build-cli bin/build-electron bin/build-gctc bin/build-ios bin/build-javadoc bin/build-rustdoc bin/build-target bin/gsync-webrtc bin/prepare-workspace bin/rust-lint-check src/rust/scripts/run-tests
- name: Clippy
run: cargo clippy --tests --features sim -- -D warnings
working-directory: src/rust

1
.gitignore vendored
View file

@ -4,6 +4,7 @@ cscope.*
.DS_Store
.dir-locals.el
.cargo
.gradle/
*.code-workspace
**/.vscode
.idea

View file

@ -13,6 +13,6 @@ set -e
"${0}.py" \
--build-dir="${OUTPUT_DIR}" \
--webrtc-src-dir="${WEBRTC_SRC_DIR}" \
--gradle-dir="${ANDROID_GRADLE_DIR}" \
--gradle-dir="${PROJECT_DIR}" \
--publish-version="${PROJECT_VERSION}" \
"$@"

View file

@ -16,6 +16,7 @@ This script generates libringrtc.aar for distribution
try:
import argparse
import enum
import logging
import subprocess
import os
@ -28,7 +29,6 @@ except ImportError as e:
DEFAULT_ARCHS = ['arm', 'arm64', 'x86', 'x64']
NINJA_TARGETS = ['ringrtc']
JAR_FILES = [
'lib.java/ringrtc/libringrtc.jar',
'lib.java/sdk/android/libwebrtc.jar',
]
SO_LIBS = [
@ -36,6 +36,16 @@ SO_LIBS = [
'libringrtc.so',
]
class Project(enum.Flag):
WEBRTC = enum.auto()
RINGRTC = enum.auto()
AAR = enum.auto()
ALL = WEBRTC | RINGRTC | AAR
def __sub__(self, other):
return self & ~other
# ------------------------------------------------------------------------------
#
# Main
@ -125,9 +135,15 @@ def ParseArgs():
parser.add_argument('-u', '--unstripped',
action='store_true',
help='Store the unstripped libraries in the .aar. Default is false')
parser.add_argument('-c', '--compile-only',
action='store_true',
parser.add_argument('-c', '--compile-only', dest='disabled_projects',
action='append_const', const=Project.AAR,
help='Only compile the code, do not build the .aar. Default is false')
parser.add_argument('--webrtc-only', dest='disabled_projects',
action='append_const', const=Project.RINGRTC | Project.AAR,
help='''Compile WebRTC's libraries only, then stop building''')
parser.add_argument('--ringrtc-only', dest='disabled_projects',
action='append_const', const=Project.WEBRTC,
help='Compile RingRTC only, assuming WebRTC is already built')
parser.add_argument('--clean',
action='store_true',
help='Remove all the build products. Default is false')
@ -170,80 +186,82 @@ def GetGradleBuildDir(build_dir):
return os.path.join(build_dir, 'gradle')
def BuildArch(dry_run, project_dir, build_dir, arch, debug_build, extra_gn_args,
extra_gn_flags, extra_ninja_flags, extra_cargo_flags, jobs):
extra_gn_flags, extra_ninja_flags, extra_cargo_flags, jobs, build_projects):
logging.info('Building: {} ...'.format(arch))
output_dir = GetArchBuildDir(build_dir, arch, debug_build)
gn_args = {
'target_os' : '"android"',
'target_cpu' : '"{}"'.format(arch),
'is_debug' : 'false',
'rtc_include_tests' : 'false',
'rtc_build_examples' : 'false',
'rtc_build_tools' : 'false',
'rtc_enable_protobuf' : 'false',
'rtc_enable_sctp' : 'false',
'rtc_libvpx_build_vp9': 'false',
'rtc_include_ilbc' : 'false',
}
if debug_build is True:
gn_args['is_debug'] = 'true'
gn_args['symbol_level'] = '2'
if Project.WEBRTC in build_projects:
gn_args = {
'target_os' : '"android"',
'target_cpu' : '"{}"'.format(arch),
'is_debug' : 'false',
'rtc_include_tests' : 'false',
'rtc_build_examples' : 'false',
'rtc_build_tools' : 'false',
'rtc_enable_protobuf' : 'false',
'rtc_enable_sctp' : 'false',
'rtc_libvpx_build_vp9': 'false',
'rtc_include_ilbc' : 'false',
}
if debug_build is True:
gn_args['is_debug'] = 'true'
gn_args['symbol_level'] = '2'
gn_args_string = '--args=' + ' '.join(
[k + '=' + v for k, v in gn_args.items()] + extra_gn_args)
gn_args_string = '--args=' + ' '.join(
[k + '=' + v for k, v in gn_args.items()] + extra_gn_args)
gn_total_args = [ 'gn', 'gen', output_dir, gn_args_string ] + extra_gn_flags
RunCmd(dry_run, gn_total_args)
gn_total_args = [ 'gn', 'gen', output_dir, gn_args_string ] + extra_gn_flags
RunCmd(dry_run, gn_total_args)
ninja_args = [ 'ninja', '-C', output_dir ] + NINJA_TARGETS + [ '-j', jobs ] + extra_ninja_flags
RunCmd(dry_run, ninja_args)
ninja_args = [ 'ninja', '-C', output_dir ] + NINJA_TARGETS + [ '-j', jobs ] + extra_ninja_flags
RunCmd(dry_run, ninja_args)
# FIXME: Shouldn't hardcode Linux, but eventually this won't use WebRTC's NDK anyway.
ndk_toolchain_dir = os.path.join(
os.getcwd(),
'third_party',
'android_ndk',
'toolchains',
'llvm',
'prebuilt',
'linux-x86_64'
)
cargo_args = [
'cargo', 'rustc',
'--target', GetCargoTarget(arch),
'--target-dir', output_dir,
'--manifest-path', os.path.join(project_dir, 'src', 'rust', 'Cargo.toml'),
]
if not debug_build:
cargo_args += ['--release']
cargo_args += extra_cargo_flags
# Arguments directly for rustc
cargo_args += [
'--',
'-C', 'debuginfo=2',
'-C', 'linker={}/bin/{}{}-clang'.format(ndk_toolchain_dir, GetClangTarget(arch), GetAndroidApiLevel(arch)),
'-C', 'link-arg=-fuse-ld=lld',
'-L', 'native=' + output_dir,
]
RunCmd(dry_run, cargo_args)
if Project.RINGRTC in build_projects:
# FIXME: Shouldn't hardcode Linux, but eventually this won't use WebRTC's NDK anyway.
ndk_toolchain_dir = os.path.join(
os.getcwd(),
'third_party',
'android_ndk',
'toolchains',
'llvm',
'prebuilt',
'linux-x86_64'
)
cargo_args = [
'cargo', 'rustc',
'--target', GetCargoTarget(arch),
'--target-dir', output_dir,
'--manifest-path', os.path.join(project_dir, 'src', 'rust', 'Cargo.toml'),
]
if not debug_build:
cargo_args += ['--release']
cargo_args += extra_cargo_flags
# Arguments directly for rustc
cargo_args += [
'--',
'-C', 'debuginfo=2',
'-C', 'linker={}/bin/{}{}-clang'.format(ndk_toolchain_dir, GetClangTarget(arch), GetAndroidApiLevel(arch)),
'-C', 'link-arg=-fuse-ld=lld',
'-L', 'native=' + output_dir,
]
RunCmd(dry_run, cargo_args)
if dry_run:
return
if dry_run:
return
# Copy the built library alongside libringrtc_rffi.so.
shutil.copyfile(
os.path.join(output_dir, GetCargoTarget(arch), 'debug' if debug_build else 'release', 'libringrtc.so'),
os.path.join(output_dir, 'lib.unstripped', 'libringrtc.so'))
# And strip another copy.
strip_args = [
'{}/bin/llvm-strip'.format(ndk_toolchain_dir),
'-s',
os.path.join(output_dir, 'lib.unstripped', 'libringrtc.so'),
'-o', os.path.join(output_dir, 'libringrtc.so'),
]
RunCmd(dry_run, strip_args)
# Copy the built library alongside libringrtc_rffi.so.
shutil.copyfile(
os.path.join(output_dir, GetCargoTarget(arch), 'debug' if debug_build else 'release', 'libringrtc.so'),
os.path.join(output_dir, 'lib.unstripped', 'libringrtc.so'))
# And strip another copy.
strip_args = [
'{}/bin/llvm-strip'.format(ndk_toolchain_dir),
'-s',
os.path.join(output_dir, 'lib.unstripped', 'libringrtc.so'),
'-o', os.path.join(output_dir, 'libringrtc.so'),
]
RunCmd(dry_run, strip_args)
def GetABI(arch):
if arch == 'arm':
@ -283,13 +301,16 @@ def GetAndroidApiLevel(arch):
def CreateLibs(dry_run, project_dir, build_dir, archs, output, debug_build, unstripped,
extra_gn_args, extra_gn_flags, extra_ninja_flags,
extra_cargo_flags, jobs, compile_only):
extra_cargo_flags, jobs, build_projects):
for arch in archs:
BuildArch(dry_run, project_dir, build_dir, arch, debug_build, extra_gn_args,
extra_gn_flags, extra_ninja_flags, extra_cargo_flags, jobs)
extra_gn_flags, extra_ninja_flags, extra_cargo_flags, jobs, build_projects)
if compile_only is True:
# The rest is considered part of the AAR build rather than the WebRTC or
# RingRTC Rust builds mostly by process of elimination: sometimes we want
# to do a "compile-only" build that skips assembling the libs/ directory.
if Project.AAR not in build_projects:
return
output_dir = os.path.join(GetOutputDir(build_dir, debug_build),
@ -331,7 +352,7 @@ def RunGradle(dry_run, args):
def CreateAar(dry_run, extra_gradle_args, version, gradle_dir,
sonatype_repo, sonatype_user, sonatype_password,
signing_keyid, signing_password, signing_secret_keyring,
compile_only,
build_projects,
install_local, install_dir, project_dir, build_dir, archs,
output, debug_build, release_build, unstripped,
extra_gn_args, extra_gn_flags, extra_ninja_flags,
@ -380,20 +401,22 @@ def CreateAar(dry_run, extra_gradle_args, version, gradle_dir,
output_dir = GetOutputDir(build_dir, build_debug)
lib_dir = os.path.join(output_dir, 'libs')
gradle_args = gradle_args + [
"-PdebugRingrtcLibDirs=['{}']".format(lib_dir),
"-PdebugRingrtcLibDir={}".format(lib_dir),
"-PwebrtcJar={}/libwebrtc.jar".format(lib_dir),
]
else:
build_debug = False
output_dir = GetOutputDir(build_dir, build_debug)
lib_dir = os.path.join(output_dir, 'libs')
gradle_args = gradle_args + [
"-PreleaseRingrtcLibDirs=['{}']".format(lib_dir),
"-PreleaseRingrtcLibDir={}".format(lib_dir),
"-PwebrtcJar={}/libwebrtc.jar".format(lib_dir),
]
CreateLibs(dry_run, project_dir, build_dir, archs, output, build_debug, unstripped,
extra_gn_args, extra_gn_flags, extra_ninja_flags,
extra_cargo_flags, jobs, compile_only)
extra_cargo_flags, jobs, build_projects)
if compile_only is True:
if Project.AAR not in build_projects:
return
gradle_args.extend(('assembleDebug' if build_type == 'debug' else 'assembleRelease' for build_type in build_types))
@ -461,6 +484,10 @@ def main():
args.extra_ninja_flags = args.extra_ninja_flags + ['-v']
args.extra_cargo_flags = args.extra_cargo_flags + ['-v']
build_projects = Project.ALL
for disabled_project in (args.disabled_projects or []):
build_projects -= disabled_project
gradle_dir = os.path.abspath(args.gradle_dir)
logging.debug('Using gradle directory: {}'.format(gradle_dir))
@ -495,7 +522,7 @@ def main():
CreateAar(args.dry_run, args.extra_gradle_args, args.publish_version, args.gradle_dir,
args.upload_sonatype_repo, args.upload_sonatype_user, args.upload_sonatype_password,
args.signing_keyid, args.signing_password, args.signing_secret_keyring,
args.compile_only,
build_projects,
args.install_local, args.install_dir,
args.project_dir, build_dir, args.arch, args.output,
args.debug_build, args.release_build, args.unstripped, args.extra_gn_args,

View file

@ -10,19 +10,7 @@ set -e
# shellcheck source=bin/env.sh
. "$(dirname "$0")"/env.sh
SOURCEPATH="${ANDROID_SRC_DIR}/api"
CLASSPATH="${OUTPUT_DIR}/release/libs/libwebrtc.jar"
ANDROID_SDK="${WEBRTC_SRC_DIR}/third_party/android_sdk/public/platforms/android-28"
ANDROID_ANNOTATIONS="${WEBRTC_SRC_DIR}/third_party/android_deps/libs/androidx_annotation_annotation"
for d in "$ANDROID_DEPS_DIR" "$ANDROID_SDK" "$ANDROID_ANNOTATIONS" ; do
CLASSPATH="$CLASSPATH:$(find -L "$d" -type f -name '*.jar' -print | paste -sd ':' -)"
done
OUTPUT_DIR="${OUTPUT_DIR}/javadoc"
rm -rf "$OUTPUT_DIR"
mkdir "$OUTPUT_DIR"
# Treat all warns as errors
javadoc -quiet -Xdoclint:all -d "$OUTPUT_DIR" -sourcepath "$SOURCEPATH" -classpath "$CLASSPATH" org.signal.ringrtc
cd "${PROJECT_ROOT}"
./gradlew javadoc \
-PwebrtcJar="${OUTPUT_DIR}/release/libs/libwebrtc.jar" \
-PdocsDir="${OUTPUT_DIR}"

View file

@ -9,17 +9,7 @@
# shellcheck disable=SC2034
# Android specific environment variables
ANDROID_CONFIG_DIR="${CONFIG_DIR}/android"
ANDROID_DEPS_DIR="${OUTPUT_DIR}/android-deps"
# android gradle directory
ANDROID_GRADLE_DIR="${PUBLISH_DIR}/android"
ANDROID_SRC_DIR="${RINGRTC_SRC_DIR}/android"
prepare_workspace_platform() {
echo "Preparing workspace for Android..."
"$BIN_DIR"/fetch-android-deps
}

View file

@ -30,9 +30,6 @@ RINGRTC_SRC_DIR="${PROJECT_DIR}/src"
# build products
OUTPUT_DIR=$(realpath "${OUTPUT_DIR:-${PROJECT_DIR}/out}")
# publish directory
PUBLISH_DIR="${PROJECT_DIR}/publish"
# patch hash file
PATCH_HASH="${OUTPUT_DIR}/patch-hash"

View file

@ -1,30 +0,0 @@
#!/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
echo "Fetching Android dependencies..."
cd "$ANDROID_CONFIG_DIR"
rm -rf "${ANDROID_DEPS_DIR}"
./gradlew -PjarCacheDir="${ANDROID_DEPS_DIR}" getDeps
# expand aar files
AAR_FILES=$(ls "${ANDROID_DEPS_DIR}"/*.aar || true)
for aar in $AAR_FILES ; do
DIR="${aar%.aar}"
mkdir -p "$DIR"
cd "$DIR"
jar xf "$aar"
done
JAR_LIST="${RINGRTC_WEBRTC_SRC_DIR}/jar.list"
rm -f "$JAR_LIST"
find "${ANDROID_DEPS_DIR}" -type f -name '*.jar' > "$JAR_LIST"

11
build.gradle Normal file
View file

@ -0,0 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View file

@ -1 +0,0 @@
.gradle/

View file

@ -1,17 +0,0 @@
# Android Dependencies for RingRTC Build Time
This configuration defines the build time Java dependencies for RingRTC.
To add/update dependencies edit `build.gradle` and make modifications
to the `dependencies` section.
These dependencies are fetched as part of `prepare_workspace`.
## SDK versions
There are a few places where minSdkVersion and targetSdkVersion show
up in the build of RingRTC for Android. Generally try to keep them in
sync with Signal-Android/build.gradle.
1. src/android/AndroidManifest.xml -- what supported versions in our .aar

View file

@ -1,22 +0,0 @@
//
// Copyright 2019-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
apply plugin: 'java'
repositories {
jcenter()
}
dependencies {
compile 'org.whispersystems:signal-service-android:2.15.3'
}
task getDeps(type: Copy) {
from sourceSets.main.runtimeClasspath
println "Using JAR cache dir: " + jarCacheDir
into jarCacheDir
}

View file

@ -1,6 +0,0 @@
#
# Copyright 2019-2021 Signal Messenger, LLC
# SPDX-License-Identifier: AGPL-3.0-only
#
org.gradle.jvmargs=-Xmx2048m

View file

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

172
config/android/gradlew vendored
View file

@ -1,172 +0,0 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

View file

@ -1,84 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View file

@ -0,0 +1,5 @@
webrtc.version=5005b
ringrtc.version.major=2
ringrtc.version.minor=22
ringrtc.version.revision=0

21
config/version.sh Normal file → Executable file
View file

@ -8,13 +8,23 @@
# Allow non-exported environment variables
# shellcheck disable=SC2034
if [ -n "${PROJECT_DIR}" ]; then
SCRIPT_DIR="${PROJECT_DIR}/config"
else
SCRIPT_DIR=$(dirname "$0")
fi
property() {
grep "${1}" "${SCRIPT_DIR}/version.properties" | cut -d'=' -f2
}
# Specify WebRTC version. This corresponds to the
# branch or tag of the signalapp/webrtc repository.
WEBRTC_VERSION=5005b
WEBRTC_VERSION=$(property 'webrtc.version')
RINGRTC_MAJOR_VERSION=2
RINGRTC_MINOR_VERSION=22
RINGRTC_REVISION=0
RINGRTC_MAJOR_VERSION=$(property 'ringrtc.version.major')
RINGRTC_MINOR_VERSION=$(property 'ringrtc.version.minor')
RINGRTC_REVISION=$(property 'ringrtc.version.revision')
# Specify RingRTC version to publish.
RINGRTC_VERSION="${RINGRTC_MAJOR_VERSION}.${RINGRTC_MINOR_VERSION}.${RINGRTC_REVISION}"
@ -24,3 +34,6 @@ RINGRTC_VERSION="${RINGRTC_MAJOR_VERSION}.${RINGRTC_MINOR_VERSION}.${RINGRTC_REV
# Project version is the combination of the two
PROJECT_VERSION="${OVERRIDE_VERSION:-${RINGRTC_VERSION}}${RC_VERSION:+-$RC_VERSION}"
echo "WebRTC : ${WEBRTC_VERSION}"
echo "RingRTC: ${RINGRTC_VERSION}"

13
gradle.properties Normal file
View file

@ -0,0 +1,13 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true

View file

@ -0,0 +1,7 @@
# Note: Check https://gradle.org/release-checksums/ before updating wrapper or distribution
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=8cc27038d5dbd815759851ba53e70cf62e481b87494cc97cfd97982ada5ba634
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
gradlew vendored Executable file
View file

@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View file

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -45,34 +64,14 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell

View file

@ -1,4 +1,4 @@
# We ought to be able to put this in .gradle/gradle.properties, but it doesn't work.
sdk.dir=../../src/webrtc/src/third_party/android_sdk/public
sdk.dir=src/webrtc/src/third_party/android_sdk/public
# This one does work in .gradle/gradle.properties, but we might as well have them both here.
ndk.dir=../../src/webrtc/src/third_party/android_ndk
ndk.dir=src/webrtc/src/third_party/android_ndk

View file

@ -1,2 +0,0 @@
.gradle
/build

Binary file not shown.

View file

@ -1,6 +0,0 @@
#Tue Nov 19 15:51:24 PST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip

View file

@ -1,164 +0,0 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View file

@ -1,3 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.signal.ringrtc_android">
</manifest>

13
settings.gradle Normal file
View file

@ -0,0 +1,13 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
rootProject.name = "RingRtcGradle"
include ':ringrtc'
project(':ringrtc').projectDir = file('src')
include ':ringrtc:android'

View file

@ -4,13 +4,11 @@
#
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//webrtc.gni")
group("ringrtc") {
public_deps = [
"android",
"//sdk/android:libwebrtc",
"rffi:libringrtc_rffi",
]
}

1
src/android/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright 2019-2021 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.signal.ringrtc"
android:versionCode="1"
android:versionName="0.1">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="26" />
</manifest>

View file

@ -1,72 +0,0 @@
#
# Copyright 2019-2021 Signal Messenger, LLC
# SPDX-License-Identifier: AGPL-3.0-only
#
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//webrtc.gni")
android_sdk = "//sdk/android"
group("android") {
public_deps = [
":libringrtc",
]
}
dist_jar("libringrtc") {
output = "${root_out_dir}/lib.java/ringrtc/${target_name}.jar"
direct_deps_only = true
use_unprocessed_jars = true
requires_android = true
no_build_hooks = true
deps = [
":ringrtc_java",
]
}
# This is split into a separate target so that the dependency jars
# are considered "indirect" and thus won't get packaged in libringrtc.jar.
java_group("ringrtc_java_deps") {
_libwebrtc_jar_dir = get_label_info("${android_sdk}:libwebrtc", "dir")
libwebrtc_jar_path = "${root_out_dir}/lib.java${_libwebrtc_jar_dir}/libwebrtc.jar"
# Note: "//ringrtc/jar.list" is generated by
# bin/fetch-android-deps during bin/prepare-workspace.
jar_list = read_file("//ringrtc/jar.list", "list lines")
input_jars_paths = [
"$libwebrtc_jar_path",
] + jar_list
}
rtc_android_library("ringrtc_java") {
sources = [
"api/org/signal/ringrtc/BuildInfo.java",
"api/org/signal/ringrtc/CalledByNative.java",
"api/org/signal/ringrtc/CallId.java",
"api/org/signal/ringrtc/CallException.java",
"api/org/signal/ringrtc/CallManager.java",
"api/org/signal/ringrtc/CameraControl.java",
"api/org/signal/ringrtc/Connection.java",
"api/org/signal/ringrtc/GroupCall.java",
"api/org/signal/ringrtc/HttpHeader.java",
"api/org/signal/ringrtc/Log.java",
"api/org/signal/ringrtc/NetworkRoute.java",
"api/org/signal/ringrtc/PeekInfo.java",
"api/org/signal/ringrtc/Remote.java",
"api/org/signal/ringrtc/Testing.java",
"api/org/signal/ringrtc/Util.java",
"api/org/signal/ringrtc/WebRtcLogger.java",
]
deps = [
"//third_party/androidx:androidx_annotation_annotation_java",
"//sdk/android:libwebrtc",
":ringrtc_java_deps"
]
}
}

View file

@ -1 +0,0 @@
Android interface to RingRTC

View file

@ -1,41 +0,0 @@
/*
* Copyright 2019-2021 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.signal.ringrtc;
import java.io.IOException;
import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.ecc.Curve;
import org.whispersystems.libsignal.ecc.ECKeyPair;
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
/**
* Testing is a class for generating various exceptions for the purpose of testing.
*
* A typical use case is in the implementation of the SignalMessageRecipient interface.
*
*/
public class Testing {
/* For testing */
public static IOException fakeIOException() {
return new IOException("fake network problem");
}
/* For testing */
public static UnregisteredUserException fakeUnregisteredUserException() {
return new UnregisteredUserException("+123456", new IOException("fake unregistered user problem"));
}
/* For testing */
public static UntrustedIdentityException fakeUntrustedIdentityException() {
ECKeyPair keyPair = Curve.generateKeyPair();
IdentityKey identityKey = new IdentityKey(keyPair.getPublicKey());
return new UntrustedIdentityException("fake identity problem", "+123456", identityKey);
}
}

View file

@ -1,59 +1,52 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
}
plugins {
id 'com.android.library' version '7.0.0'
id 'maven-publish'
id 'signing'
}
repositories {
jcenter()
google()
mavenCentral()
mavenLocal()
}
ext.version_number = project.hasProperty("ringrtcVersion") ? ringrtcVersion : "0.0.1-SNAPSHOT"
ext.isReleaseVersion = ext.version_number.indexOf("-") == -1;
ext.group_info = "org.signal"
def versionProperties = new Properties()
file("../../config/version.properties").withInputStream { versionProperties.load(it) }
ext.debug_jni_lib_dirs = project.hasProperty("debugRingrtcLibDirs") ? Eval.me(debugRingrtcLibDirs) : []
ext.release_jni_lib_dirs = project.hasProperty("releaseRingrtcLibDirs") ? Eval.me(releaseRingrtcLibDirs) : []
ext.releaseRepoUrl = project.hasProperty("sonatypeRepo") ? sonatypeRepo
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
ext.releaseRepoUsername = project.hasProperty("signalSonatypeUsername") ? signalSonatypeUsername : ""
ext.releaseRepoPassword = project.hasProperty("signalSonatypePassword") ? signalSonatypePassword : ""
ext.proguard_file = rootDir.getAbsolutePath() + '/proguard-rules.pro'
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
if (!project.hasProperty("ringrtcVersion")) {
ext.ringrtcVersion =
"${versionProperties.getProperty("ringrtc.version.major")}." +
"${versionProperties.getProperty("ringrtc.version.minor")}." +
"${versionProperties.getProperty("ringrtc.version.revision")}"
}
ext.isReleaseVersion = ringrtcVersion.indexOf("-") == -1;
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
archivesBaseName = "ringrtc-android"
version = version_number
ext.debug_jni_lib_dirs = project.hasProperty("debugRingrtcLibDir") ? [debugRingrtcLibDir] : ["jniLibs"]
ext.release_jni_lib_dirs = project.hasProperty("releaseRingrtcLibDir") ? [releaseRingrtcLibDir] : ["jniLibs"]
ext.webrtc_jar = project.hasProperty("webrtcJar") ? webrtcJar : "libs/libwebrtc.jar"
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
compileSdk 30
defaultConfig {
minSdk 19
targetSdk 31
versionName ringrtcVersion
archivesBaseName = "ringrtc-android"
consumerProguardFiles "proguard-rules.pro"
}
sourceSets {
release {
jniLibs.srcDirs = release_jni_lib_dirs
java.srcDirs = ['api/']
}
debug {
jniLibs.srcDirs = debug_jni_lib_dirs
java.srcDirs = ['api/']
}
}
defaultConfig {
consumerProguardFiles proguard_file
}
packagingOptions {
// Libraries are already stripped if necessary when linked.
doNotStrip "**/*.so"
@ -61,23 +54,44 @@ android {
}
dependencies {
for (String dir : release_jni_lib_dirs) {
releaseImplementation fileTree(dir: dir, include: ['*.jar'])
api files(webrtc_jar)
api 'androidx.annotation:annotation:1.2.0'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.release.java.sourceFiles
classpath += files(android.bootClasspath)
// There doesn't seem to be a convenient way to do this with just one variant.
android.libraryVariants.all { v ->
classpath += v.getCompileClasspath(null)
}
for (String dir : debug_jni_lib_dirs) {
debugImplementation fileTree(dir: dir, include: ['*.jar'])
// Normally this is set by the 'java' plugin, but that's not compatible with 'android-library'
if (project.hasProperty("docsDir")) {
destinationDir = new File(docsDir, "javadoc")
}
}
ext.releaseRepoUrl = project.hasProperty("sonatypeRepo") ? sonatypeRepo
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
ext.releaseRepoUsername = project.hasProperty("signalSonatypeUsername") ? signalSonatypeUsername : ""
ext.releaseRepoPassword = project.hasProperty("signalSonatypePassword") ? signalSonatypePassword : ""
afterEvaluate {
publishing {
publications {
debug(MavenPublication) {
from components.debug
groupId = 'org.signal'
artifactId = archivesBaseName
version = "${ringrtcVersion}-DEBUG"
}
mavenJava(MavenPublication) {
from components.release
group = group_info
group = 'org.signal'
artifactId = archivesBaseName
version = version_number
version = ringrtcVersion
pom {
name = 'ringrtc-android'
@ -124,3 +138,14 @@ afterEvaluate {
sign publishing.publications.mavenJava
}
}
ext.webrtc_version = "${versionProperties.getProperty("webrtc.version")}"
task version {
group 'Info'
description = 'Prints the versions as read from the version config file.'
doLast {
println "RingRTC version: " + version
println "WebRTC version : " + project.webrtc_version
}
}

4
src/android/jniLibs/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
arm64-v8a/
armeabi-v7a/
x86/
x86_64/

1
src/android/libs/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
libwebrtc.jar

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright 2019-2021 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
-->
<manifest package="org.signal.ringrtc" />