(dev) Rewrite tdlib-serializer, reorganize project

This commit is contained in:
Andrea Cavalli 2023-05-07 14:47:17 +02:00
parent d7f777bf15
commit 4f359fd7e3
61 changed files with 434871 additions and 680 deletions

View File

@ -13,15 +13,16 @@ jobs:
strategy:
matrix:
include:
- { os: ubuntu-20.04, type: "linux/386-ssl1" }
- { os: ubuntu-20.04, type: "linux/amd64-ssl1" }
- { os: ubuntu-20.04, type: "linux/arm64-ssl1" }
- { os: ubuntu-20.04, type: "linux/s390x-ssl1" }
- { os: ubuntu-20.04, type: "linux/ppc64le-ssl1" }
- { os: ubuntu-20.04, type: "linux/amd64-ssl3" }
- { os: ubuntu-20.04, type: "linux/arm64-ssl3" }
- { os: windows-2019, type: "windows/amd64", vcpkgCommitId: "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", triplet: "x64-windows-static" }
- { os: macos-12, type: "macos/amd64" }
# todo: re-enable
#- { os: ubuntu-20.04, type: "linux-386-ssl1" }
- { os: ubuntu-20.04, type: "linux-amd64-ssl1" }
- { os: ubuntu-20.04, type: "linux-arm64-ssl1" }
#- { os: ubuntu-20.04, type: "linux-s390x-ssl1" }
#- { os: ubuntu-20.04, type: "linux-ppc64le-ssl1" }
- { os: ubuntu-22.04, type: "linux-amd64-ssl3" }
#- { os: ubuntu-22.04, type: "linux-arm64-ssl3" }
#- { os: windows-2019, type: "windows-amd64", vcpkgCommitId: "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", triplet: "x64-windows-static" }
#- { os: macos-12, type: "macos-amd64" }
steps:
- name: Checkout current repo
uses: actions/checkout@v2
@ -45,7 +46,7 @@ jobs:
HASH_VERSION=$(echo "$HASH_VERSION" | awk '{print tolower($0)}')
VERSION=$(echo "$VERSION" | awk '{print tolower($0)}')
TYPE=${{ matrix.type }}
SAFE_TYPE=${TYPE///} # linux/amd64 -> linuxamd64
SAFE_TYPE=${TYPE///} # linux-amd64 -> linux-amd64
REVISION=${{ github.run_number }}
GH_MATRIX_OS=${{ matrix.os }}
@ -120,6 +121,18 @@ jobs:
with:
php-version: '8.0'
extensions: readline
- name: Install ubuntu 20.04 dependencies
if: matrix.os == 'ubuntu-20.04'
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-10 libc++-dev libc++abi-dev
version: 1.0
- name: Install ubuntu 22.04 dependencies
if: matrix.os == 'ubuntu-22.04'
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-14 libc++-dev libc++abi-dev
version: 1.0
- name: Install MSVC
if: matrix.os == 'windows-2019'
uses: ilammy/msvc-dev-cmd@v1

35
.github/workflows/scripts/build-api.sh vendored Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash -ex
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
#export CC="ccache /usr/bin/clang"
#export CXX="ccache /usr/bin/clang++"
# Create missing dirs
rm -rf implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto
mkdir -p implementations/tdlight/build/java/it/tdlight/jni api/src/main/java-legacy/it/tdlight/jni api/src/main/java-sealed/it/tdlight/jni
# Build tdlib tools
cd implementations/tdlight/build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="" \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \
..
cmake --build . --target prepare_cross_compiling --config Release "-j$(nproc)"
cmake --build . --target td_generate_java_api --config Release "-j$(nproc)"
cd ../../../
# Generate TdApi.java
TEMP_TDAPI_FILE_PATH="./implementations/tdlight/build/java/it/tdlight/jni/TdApi.java"
./implementations/tdlight/build/td/generate/td_generate_java_api TdApi "./implementations/tdlight/td/generate/auto/tlo/td_api.tlo" "./implementations/tdlight/build/java" "it/tdlight/jni"
php ./implementations/tdlight/td/generate/JavadocTlDocumentationGenerator.php "./implementations/tdlight/td/generate/scheme/td_api.tl" "$TEMP_TDAPI_FILE_PATH"
java ./tdlib-serializer/transform.java --source "$TEMP_TDAPI_FILE_PATH" --output "./api/src/main/java-legacy/it/tdlight/jni/TdApi.java" --java17 false --overwrite true --headers ./tdlib-serializer/headers.txt
java ./tdlib-serializer/transform.java --source "$TEMP_TDAPI_FILE_PATH" --output "./api/src/main/java-sealed/it/tdlight/jni/TdApi.java" --java17 true --overwrite true --headers ./tdlib-serializer/headers.txt
# Generate java package
echo "Building legacy package"
mvn -f api/pom.xml package -Dlegacy=true -Drevision="$REVISION"
echo "Building standard package"
mvn -f api/pom.xml package -Drevision="$REVISION"

View File

@ -0,0 +1,71 @@
#!/bin/bash -ex
# Ubuntu 22.04+
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
#export CC="ccache /usr/bin/clang"
#export CXX="ccache /usr/bin/clang++"
export CC="ccache cc"
export CXX="ccache g++"
# Create missing dirs
rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
mkdir -p implementations/tdlight/build implementations/tdlight/build/td_bin/bin implementations/tdlight/td_tools_build/java/it/tdlight/jni api/src/main/java-legacy/it/tdlight/jni api/src/main/java-sealed/it/tdlight/jni natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
# Build tdlib tools
cd implementations/tdlight/td_tools_build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="" \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \
..
cmake --build . --target prepare_cross_compiling "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(nproc)"
cd ../../../
# Generate TdApi.java
./implementations/tdlight/td_tools_build/td/generate/td_generate_java_api TdApi "./implementations/tdlight/td/generate/auto/tlo/td_api.tlo" "./natives/src/main/java" "it/tdlight/jni"
# Optimization flags
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14 -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
export CMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL"
export CMAKE_CXX_FLAGS_MINSIZEREL="${CMAKE_CXX_FLAGS_MINSIZEREL} -flto=thin -Oz"
# Build tdlib
cd implementations/tdlight/build
INSTALL_PREFIX="$(readlink -e ./td_bin/)"
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=ON -DTD_SKIP_TG_CLI=ON \
-DTD_ENABLE_LTO=ON \
-DTD_ENABLE_JNI=ON \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \
..
cmake --build . --target install --config Release "-j$(nproc)"
cd ../../../
cd natives/build
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DTD_GENERATED_BINARIES_DIR=../../implementations/tdlight/build/td/generate \
-DTD_SRC_DIR=../../implementations/tdlight \
-DTD_ENABLE_LTO=ON \
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
-DJAVA_SRC_DIR="../src/main/java" \
-DJava_JAVADOC_EXECUTABLE="/bin/true" \
-DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \
../src/main/cpp
cmake --build . --target install --config Release "-j$(nproc)"
cd ..
mkdir -p src/main/resources/META-INF/tdlight-jni/
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlight-jni/libtdjni.linux-amd64-ssl3.so
mvn package -Dnative.type.classifier=linux-amd64-ssl3 -Drevision="$REVISION"

View File

@ -1 +0,0 @@
#!/bin/bash -e

View File

@ -0,0 +1,70 @@
#!/bin/bash -ex
# Debian 10+
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
export CC="ccache /usr/bin/clang"
export CXX="ccache /usr/bin/clang++"
export CXXFLAGS="-stdlib=libc++"
# Create missing dirs
rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
mkdir -p implementations/tdlight/build implementations/tdlight/build/td_bin/bin implementations/tdlight/td_tools_build/java/it/tdlight/jni api/src/main/java-legacy/it/tdlight/jni api/src/main/java-sealed/it/tdlight/jni natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
# Build tdlib tools
cd implementations/tdlight/td_tools_build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="" \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \
..
cmake --build . --target prepare_cross_compiling "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(nproc)"
cd ../../../
# Generate TdApi.java
./implementations/tdlight/td_tools_build/td/generate/td_generate_java_api TdApi "./implementations/tdlight/td/generate/auto/tlo/td_api.tlo" "./natives/src/main/java" "it/tdlight/jni"
# Optimization flags
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14 -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
export CMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL"
export CMAKE_CXX_FLAGS_MINSIZEREL="${CMAKE_CXX_FLAGS_MINSIZEREL} -flto=thin -Oz"
# Build tdlib
cd implementations/tdlight/build
INSTALL_PREFIX="$(readlink -e ./td_bin/)"
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=ON -DTD_SKIP_TG_CLI=ON \
-DTD_ENABLE_LTO=ON \
-DTD_ENABLE_JNI=ON \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \
..
cmake --build . --target install --config Release "-j$(nproc)"
cd ../../../
cd natives/build
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DTD_GENERATED_BINARIES_DIR=../../implementations/tdlight/build/td/generate \
-DTD_SRC_DIR=../../implementations/tdlight \
-DTD_ENABLE_LTO=ON \
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
-DJAVA_SRC_DIR="../src/main/java" \
-DJava_JAVADOC_EXECUTABLE="/bin/true" \
-DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \
../src/main/cpp
cmake --build . --target install --config Release "-j$(nproc)"
cd ..
mkdir -p src/main/resources/META-INF/tdlight-jni/
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlight-jni/libtdjni.linux-amd64-ssl3.so
mvn package -Dnative.type.classifier=linux-amd64-ssl3 -Drevision="$REVISION"

View File

@ -0,0 +1,69 @@
#!/bin/bash -ex
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
export CC="ccache /usr/bin/clang-14"
export CXX="ccache /usr/bin/clang++-14"
export CXXFLAGS="-stdlib=libc++"
# Create missing dirs
rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
mkdir -p implementations/tdlight/build implementations/tdlight/build/td_bin/bin implementations/tdlight/td_tools_build/java/it/tdlight/jni api/src/main/java-legacy/it/tdlight/jni api/src/main/java-sealed/it/tdlight/jni natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
# Build tdlib tools
cd implementations/tdlight/td_tools_build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="" \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \
..
cmake --build . --target prepare_cross_compiling "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(nproc)"
cd ../../../
# Generate TdApi.java
./implementations/tdlight/td_tools_build/td/generate/td_generate_java_api TdApi "./implementations/tdlight/td/generate/auto/tlo/td_api.tlo" "./natives/src/main/java" "it/tdlight/jni"
# Optimization flags
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14 -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
export CMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL"
export CMAKE_CXX_FLAGS_MINSIZEREL="${CMAKE_CXX_FLAGS_MINSIZEREL} -flto=thin -Oz"
# Build tdlib
cd implementations/tdlight/build
INSTALL_PREFIX="$(readlink -e ./td_bin/)"
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=ON -DTD_SKIP_TG_CLI=ON \
-DTD_ENABLE_LTO=ON \
-DTD_ENABLE_JNI=ON \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \
..
cmake --build . --target install --config Release "-j$(nproc)"
cd ../../../
cd natives/build
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DTD_GENERATED_BINARIES_DIR=../../implementations/tdlight/build/td/generate \
-DTD_SRC_DIR=../../implementations/tdlight \
-DTD_ENABLE_LTO=ON \
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
-DJAVA_SRC_DIR="../src/main/java" \
-DJava_JAVADOC_EXECUTABLE="/bin/true" \
-DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \
../src/main/cpp
cmake --build . --target install --config Release "-j$(nproc)"
cd ..
mkdir -p src/main/resources/META-INF/tdlight-jni/
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlight-jni/libtdjni.linux-amd64-ssl3.so
mvn package -Dnative.type.classifier=linux-amd64-ssl3 -Drevision="$REVISION"

View File

@ -0,0 +1,68 @@
#!/bin/bash -ex
# Debian 10+
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain-arm64.cmake)"
# Create missing dirs
rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
mkdir -p implementations/tdlight/build implementations/tdlight/build/td_bin/bin implementations/tdlight/td_tools_build/java/it/tdlight/jni api/src/main/java-legacy/it/tdlight/jni api/src/main/java-sealed/it/tdlight/jni natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
# Build tdlib tools
cd implementations/tdlight/td_tools_build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="" \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \
..
cmake --build . --target prepare_cross_compiling "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(nproc)"
cd ../../../
# Generate TdApi.java
./implementations/tdlight/td_tools_build/td/generate/td_generate_java_api TdApi "./implementations/tdlight/td/generate/auto/tlo/td_api.tlo" "./natives/src/main/java" "it/tdlight/jni"
# Optimization flags
export CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++14 -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
export CMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL"
export CMAKE_CXX_FLAGS_MINSIZEREL="${CMAKE_CXX_FLAGS_MINSIZEREL} -flto=thin -Oz"
# Build tdlib
cd implementations/tdlight/build
INSTALL_PREFIX="$(readlink -e ./td_bin/)"
INSTALL_BINDIR="$(readlink -e ./td_bin/bin)"
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=ON -DTD_SKIP_TG_CLI=ON \
-DTD_ENABLE_LTO=ON \
-DTD_ENABLE_JNI=ON \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
..
cmake --build . --target install --config Release "-j$(nproc)"
cd ../../../
cd natives/build
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DTD_GENERATED_BINARIES_DIR=../../implementations/tdlight/build/td/generate \
-DTD_SRC_DIR=../../implementations/tdlight \
-DTD_ENABLE_LTO=ON \
-DTDNATIVES_BIN_DIR="$(readlink -e ../tdjni_bin/)" \
-DTDNATIVES_DOCS_BIN_DIR="$(readlink -e ../tdjni_docs/)" \
-DTd_DIR:PATH="$(readlink -e ../../implementations/tdlight/build/td_bin/lib/cmake/Td)" \
-DJAVA_SRC_DIR="../src/main/java" \
-DJava_JAVADOC_EXECUTABLE="/bin/true" \
-DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
../src/main/cpp
cmake --build . --target install --config Release "-j$(nproc)"
cd ..
mkdir -p src/main/resources/META-INF/tdlight-jni/
mv tdjni_bin/libtdjni.so src/main/resources/META-INF/tdlight-jni/libtdjni.linux-amd64-ssl3.so
mvn package -Dnative.type.classifier=linux-amd64-ssl3 -Drevision="$REVISION"

View File

@ -0,0 +1,52 @@
SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(triple arm-linux-gnueabihf)
set(CMAKE_SYSROOT /usr/aarch64-linux-gnu)
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)
set(CMAKE_C_COMPILER clang)
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_AR llvm-ar)
# Set various compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi --specs=nosys.specs -fdata-sections -ffunction-sections -Wl,--gc-sections")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -stdlib=libc++ -fno-exceptions")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi")
# Use our definitions for compiler tools
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Search for libraries and headers in the target directories only
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# Optionally reduce compiler sanity check when cross-compiling.
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
#include_directories("${CROSS_OPENJDK_PATH}/include")
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
#SET(JAVA_HOME "$JAVA_HOME/")
#SET(JAVA_INCLUDE_PATH "$JAVA_HOME/include")
#SET(JAVA_AWT_INCLUDE_PATH "$JAVA_HOME/include")
#SET(JAVA_INCLUDE_PATH2 "$JAVA_HOME/include/linux")
#SET(JAVA_JVM_LIBRARY "$CROSS_OPENJDK_PATH/lib/${JAVA_INSTALLATION_TYPE}/libjvm.so")
#SET(JAVA_AWT_LIBRARY "$CROSS_OPENJDK_PATH/lib/libawt.so")
# Only on aarch64 & armhf architecture
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
# Use LLD on linux
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
add_link_options("-fuse-ld=lld" "-v")

15
.gitignore vendored
View File

@ -64,3 +64,18 @@ win-deps.sh
/.cache/
.idea/
/natives/build/
/natives/src/main/td/
/natives/tdjni_bin/
/natives/tdjni_docs/
/natives/src/main/td_bin/
/natives/src/main/tdjni_docs/
/api/src/main/td/
/api/jni_bin/
/api/target-legacy/
/api/target-sealed/
/api/.ci-friendly-pom.xml
natives/.ci-friendly-pom.xml
*.so

6
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "implementations/tdlight"]
path = implementations/tdlight
url = https://git.ignuranza.net/tdlight-team/tdlight.git
[submodule "scripts/core/tdlib-serializer"]
path = scripts/core/tdlib-serializer
url = https://git.ignuranza.net/windoz/tdlib-serializer.git
[submodule "tdlib-serializer"]
path = tdlib-serializer
url = https://git.ignuranza.net/windoz/tdlib-serializer

258
api/pom.xml Normal file
View File

@ -0,0 +1,258 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-api</artifactId>
<version>${revision}</version>
<name>TDLight API</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>4.0.0-SNAPSHOT</revision>
<safeVersionName>v4_0_0</safeVersionName>
<buildDirectory>${project.basedir}/target</buildDirectory>
</properties>
<profiles>
<profile>
<id>legacy</id>
<activation>
<property>
<name>legacy</name>
<value>true</value>
</property>
</activation>
<properties>
<buildDirectory>${project.basedir}/target-legacy</buildDirectory>
</properties>
<build>
<plugins>
<!-- ensure the project is compiling with JDK 9+ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-jdk9</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.9,)</version>
<message>JDK 9+ is required for compilation</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/main/java-legacy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<!-- compile sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<!-- disable default phase due to fixed id and position in lifecycle -->
<execution>
<id>default-compile</id>
<phase>none</phase>
<!-- specify source/target for IDE integration -->
<configuration>
<release>9</release>
</configuration>
</execution>
<!-- compile sources with Java 9 to generate and validate module-info.java -->
<execution>
<id>java-9-module-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
</configuration>
</execution>
<!-- recompile sources as Java 8 to overwrite Java 9 class files, except module-info.java -->
<execution>
<id>java-8-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<!-- specify JDK 9+ release flag to ensure no classes/methods later than Java 8 are used accidentally -->
<release>8</release>
<!-- exclude module-info.java from the compilation, as it is unsupported by Java 8 -->
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
<classifier>legacy</classifier>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>sealed</id>
<activation>
<property>
<name>legacy</name>
<value>!true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/main/java-sealed</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<!-- compile sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<release>17</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<distributionManagement>
<repository>
<id>mchv-release-distribution</id>
<name>MCHV Release Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv</url>
</repository>
<snapshotRepository>
<id>mchv-snapshot-distribution</id>
<name>MCHV Snapshot Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv-snapshot</url>
</snapshotRepository>
</distributionManagement>
<scm>
<url>https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</url>
<connection>scm:git:https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</connection>
<developerConnection>scm:git:https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</developerConnection>
<tag>HEAD</tag>
</scm>
<build>
<directory>${buildDirectory}</directory>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>main-javadoc</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<release>17</release>
<quiet>true</quiet>
<notimestamp>true</notimestamp>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>com.outbrain.swinfra</groupId>
<artifactId>ci-friendly-flatten-maven-plugin</artifactId>
<version>1.0.14</version>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>flatten</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
/**
* This module contains the TDLib interface type-classes and function-classes.
*/
module tdlight.api {
exports it.tdlight.jni;
}

@ -1 +1 @@
Subproject commit 004aa1e74e2af007619bea5cf0eabbca71cb5004
Subproject commit 9c805dc438a3611023aa0fb709746d4f70169539

109
natives/pom.xml Normal file
View File

@ -0,0 +1,109 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>TDLight-natives</artifactId>
<!-- Don't change the version! (or change it also in <shadedPattern>) -->
<version>${revision}</version>
<name>tdlight natives</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>4.0.0-SNAPSHOT</revision>
<native.type.classifier>_invalid_</native.type.classifier>
</properties>
<distributionManagement>
<repository>
<id>mchv-release-distribution</id>
<name>MCHV Release Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv</url>
</repository>
<snapshotRepository>
<id>mchv-snapshot-distribution</id>
<name>MCHV Snapshot Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv-snapshot</url>
</snapshotRepository>
</distributionManagement>
<scm>
<url>https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</url>
<connection>scm:git:https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</connection>
<developerConnection>scm:git:https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</developerConnection>
<tag>HEAD</tag>
</scm>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.outbrain.swinfra</groupId>
<artifactId>ci-friendly-flatten-maven-plugin</artifactId>
<version>1.0.14</version>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>flatten</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<classifier>${native.type.classifier}</classifier>
<excludes>
<exclude>it/tdlight/jni/*</exclude>
<exclude>it/tdlight/tdnative/*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>ssl3</id>
<activation>
<property>
<name>ssl3</name>
<value>True</value>
</property>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<classifier>${native.type.classifier}-ssl3</classifier>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -31,7 +31,7 @@ message(STATUS "PHP Executable: ${PHP_EXECUTABLE}")
set(TD_API_JAVA_PACKAGE "it/tdlight/tdnative")
set(TD_API_SPEC_JAVA_PACKAGE "it/tdlight/jni")
set(TD_API_JAVA_PATH ${JAVA_SRC_DIR})
set(TD_API_TLO_PATH ${TD_SRC_DIR}/td/generate/scheme/td_api.tlo)
set(TD_API_TLO_PATH ${TD_SRC_DIR}/td/generate/auto/tlo/td_api.tlo)
set(TD_API_TL_PATH ${TD_SRC_DIR}/td/generate/scheme/td_api.tl)
set(JAVADOC_TL_DOCUMENTATION_GENERATOR_PATH ${TD_SRC_DIR}/td/generate/JavadocTlDocumentationGenerator.php)
set(GENERATE_JAVA_API_CMD ${TD_GENERATED_BINARIES_DIR}/td_generate_java_api TdApi ${TD_API_TLO_PATH} ${TD_API_JAVA_PATH} ${TD_API_SPEC_JAVA_PACKAGE})

View File

@ -0,0 +1,2 @@
../src/main/java/it/tdlight/jni/TdApi.java
../src/main/java/it/tdlight/tdnative/NativeClient.java

File diff suppressed because it is too large Load Diff

@ -1 +0,0 @@
Subproject commit 52c91733b5743a18303b6346f7d37530e03f4111

View File

@ -1,2 +0,0 @@
../src/main/jni-java-src/it/tdlight/jni/TdApi.java
../src/main/jni-java-src/it/tdlight/tdnative/NativeClient.java

View File

@ -1,182 +0,0 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include <td/telegram/Client.h>
#include <td/telegram/td_api.h>
#include <td/tl/tl_jni_object.h>
#include <cstdint>
#include <cstdlib>
#include <string>
#include <utility>
namespace td_jni {
static td::td_api::object_ptr<td::td_api::Function> fetch_function(JNIEnv *env, jobject function) {
td::jni::reset_parse_error();
auto result = td::td_api::Function::fetch(env, function);
if (td::jni::have_parse_error()) {
std::abort();
}
return result;
}
static td::ClientManager *get_manager() {
return td::ClientManager::get_manager_singleton();
}
static jint Client_createNativeClient(JNIEnv *env, jclass clazz) {
return static_cast<jint>(get_manager()->create_client_id());
}
static void Client_nativeClientSend(JNIEnv *env, jclass clazz, jint client_id, jlong id, jobject function) {
get_manager()->send(static_cast<std::int32_t>(client_id), static_cast<std::uint64_t>(id),
fetch_function(env, function));
}
static jint Client_nativeClientReceive(JNIEnv *env, jclass clazz, jintArray client_ids, jlongArray ids,
jobjectArray events, jdouble timeout) {
jsize events_size = env->GetArrayLength(ids); // client_ids, ids and events must be of equal size
if (events_size == 0) {
return 0;
}
jsize result_size = 0;
auto *manager = get_manager();
auto response = manager->receive(timeout);
while (response.object) {
auto client_id = static_cast<jint>(response.client_id);
env->SetIntArrayRegion(client_ids, result_size, 1, &client_id);
auto request_id = static_cast<jlong>(response.request_id);
env->SetLongArrayRegion(ids, result_size, 1, &request_id);
jobject object;
response.object->store(env, object);
env->SetObjectArrayElement(events, result_size, object);
env->DeleteLocalRef(object);
result_size++;
if (result_size == events_size) {
break;
}
response = manager->receive(0);
}
return result_size;
}
static jobject Client_nativeClientExecute(JNIEnv *env, jclass clazz, jobject function) {
jobject result;
td::ClientManager::execute(fetch_function(env, function))->store(env, result);
return result;
}
static jstring Object_toString(JNIEnv *env, jobject object) {
return td::jni::to_jstring(env, to_string(td::td_api::Object::fetch(env, object)));
}
static jstring Function_toString(JNIEnv *env, jobject object) {
return td::jni::to_jstring(env, to_string(td::td_api::Function::fetch(env, object)));
}
static constexpr jint JAVA_VERSION = JNI_VERSION_1_6;
static JavaVM *java_vm;
static jobject log_message_handler;
static void on_log_message(int verbosity_level, const char *log_message) {
auto env = td::jni::get_jni_env(java_vm, JAVA_VERSION);
if (env == nullptr) {
return;
}
jobject handler = env->NewLocalRef(log_message_handler);
if (!handler) {
return;
}
jclass handler_class = env->GetObjectClass(handler);
if (handler_class) {
jmethodID on_log_message_method = env->GetMethodID(handler_class, "onLogMessage", "(ILjava/lang/String;)V");
if (on_log_message_method) {
jstring log_message_str = td::jni::to_jstring(env.get(), log_message);
if (log_message_str) {
env->CallVoidMethod(handler, on_log_message_method, static_cast<jint>(verbosity_level), log_message_str);
env->DeleteLocalRef((jobject)log_message_str);
}
}
env->DeleteLocalRef((jobject)handler_class);
}
env->DeleteLocalRef(handler);
}
static void Client_nativeClientSetLogMessageHandler(JNIEnv *env, jclass clazz, jint max_verbosity_level,
jobject new_log_message_handler) {
if (log_message_handler) {
td::ClientManager::set_log_message_callback(0, nullptr);
jobject old_log_message_handler = log_message_handler;
log_message_handler = jobject();
env->DeleteGlobalRef(old_log_message_handler);
}
if (new_log_message_handler) {
log_message_handler = env->NewGlobalRef(new_log_message_handler);
if (!log_message_handler) {
// out of memory
return;
}
td::ClientManager::set_log_message_callback(static_cast<int>(max_verbosity_level), on_log_message);
}
}
static jint register_native(JavaVM *vm) {
JNIEnv *env;
if (vm->GetEnv(reinterpret_cast<void **>(&env), JAVA_VERSION) != JNI_OK) {
return -1;
}
java_vm = vm;
auto register_method = [env](jclass clazz, std::string name, std::string signature, auto function_ptr) {
td::jni::register_native_method(env, clazz, std::move(name), std::move(signature),
reinterpret_cast<void *>(function_ptr));
};
auto client_class = td::jni::get_jclass(env, PACKAGE_NAME "/NativeClient");
auto object_class = td::jni::get_jclass(env, API_PACKAGE_NAME "/TdApi$Object");
auto function_class = td::jni::get_jclass(env, API_PACKAGE_NAME "/TdApi$Function");
#define TD_OBJECT "L" API_PACKAGE_NAME "/TdApi$Object;"
#define TD_FUNCTION "L" API_PACKAGE_NAME "/TdApi$Function;"
register_method(client_class, "createNativeClient", "()I", Client_createNativeClient);
register_method(client_class, "nativeClientSend", "(IJ" TD_FUNCTION ")V", Client_nativeClientSend);
register_method(client_class, "nativeClientReceive", "([I[J[" TD_OBJECT "D)I", Client_nativeClientReceive);
register_method(client_class, "nativeClientExecute", "(" TD_FUNCTION ")" TD_OBJECT, Client_nativeClientExecute);
register_method(client_class, "nativeClientSetLogMessageHandler", "(IL" PACKAGE_NAME "/NativeClient$LogMessageHandler;)V",
Client_nativeClientSetLogMessageHandler);
register_method(object_class, "toString", "()Ljava/lang/String;", Object_toString);
register_method(function_class, "toString", "()Ljava/lang/String;", Function_toString);
#undef TD_FUNCTION
#undef TD_OBJECT
td::jni::init_vars(env, API_PACKAGE_NAME);
td::td_api::Object::init_jni_vars(env, API_PACKAGE_NAME);
td::td_api::Function::init_jni_vars(env, API_PACKAGE_NAME);
return JAVA_VERSION;
}
} // namespace td_jni
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
static jint jni_version = td_jni::register_native(vm); // call_once
return jni_version;
}

View File

@ -1,102 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>${IMPLEMENTATION_NAME}-natives-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}</artifactId>
<!-- Don't change the version! (or change it also in <shadedPattern>) -->
<version>${revision}</version>
<name>${IMPLEMENTATION_NAME} natives for ${OPERATING_SYSTEM_NAME} (${CPU_ARCHITECTURE_NAME})</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>4.0.0-SNAPSHOT</revision>
<safeVersionName>v4_0_0</safeVersionName>
</properties>
<distributionManagement>
<repository>
<id>mchv-release-distribution</id>
<name>MCHV Release Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv</url>
</repository>
<snapshotRepository>
<id>mchv-snapshot-distribution</id>
<name>MCHV Snapshot Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv-snapshot</url>
</snapshotRepository>
</distributionManagement>
<scm>
<url>https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</url>
<connection>scm:git:https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</connection>
<developerConnection>scm:git:https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</developerConnection>
<tag>HEAD</tag>
</scm>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.outbrain.swinfra</groupId>
<artifactId>ci-friendly-flatten-maven-plugin</artifactId>
<version>1.0.14</version>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>flatten</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>ssl3</id>
<activation>
<property>
<name>ssl3</name>
<value>True</value>
</property>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<classifier>ssl3</classifier>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1 +0,0 @@
s/tdutils PRIVATE shell32/tdutils PRIVATE shell32 crypt32/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/armhf/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/armhf/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/armhf/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/armhf/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/ppc64le/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/ppc64le/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/ppc64le/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/ppc64le/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/s390x/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/s390x/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/s390x/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/s390x/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/osx/
s/${OPERATING_SYSTEM_NAME_SHORT}/osx/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/osx/
s/${OPERATING_SYSTEM_NAME_SHORT}/osx/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/osx/
s/${OPERATING_SYSTEM_NAME_SHORT}/osx/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/osx/
s/${OPERATING_SYSTEM_NAME_SHORT}/osx/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -1,5 +0,0 @@
s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,3 +0,0 @@
module tdlight.api {
exports it.tdlight.jni;
}

View File

@ -1,213 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>${IMPLEMENTATION_NAME}-api-${API_TYPE}</artifactId>
<version>${revision}</version>
<name>${IMPLEMENTATION_NAME} API</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>4.0.0-SNAPSHOT</revision>
<safeVersionName>v4_0_0</safeVersionName>
</properties>
<profiles>
<profile>
<id>legacy</id>
<activation>
<property>
<name>!sealed</name>
</property>
</activation>
<build>
<plugins>
<!-- ensure the project is compiling with JDK 9+ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-jdk9</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.9,)</version>
<message>JDK 9+ is required for compilation</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<!-- compile sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<!-- disable default phase due to fixed id and position in lifecycle -->
<execution>
<id>default-compile</id>
<phase>none</phase>
<!-- specify source/target for IDE integration -->
<configuration>
<release>9</release>
</configuration>
</execution>
<!-- compile sources with Java 9 to generate and validate module-info.java -->
<execution>
<id>java-9-module-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
</configuration>
</execution>
<!-- recompile sources as Java 8 to overwrite Java 9 class files, except module-info.java -->
<execution>
<id>java-8-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<!-- specify JDK 9+ release flag to ensure no classes/methods later than Java 8 are used accidentally -->
<release>8</release>
<!-- exclude module-info.java from the compilation, as it is unsupported by Java 8 -->
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>sealed</id>
<activation>
<property>
<name>sealed</name>
</property>
</activation>
<build>
<plugins>
<!-- compile sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<distributionManagement>
<repository>
<id>mchv-release-distribution</id>
<name>MCHV Release Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv</url>
</repository>
<snapshotRepository>
<id>mchv-snapshot-distribution</id>
<name>MCHV Snapshot Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv-snapshot</url>
</snapshotRepository>
</distributionManagement>
<scm>
<url>https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</url>
<connection>scm:git:https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</connection>
<developerConnection>scm:git:https://git.ignuranza.net/tdlight-team/tdlight-java-natives.git</developerConnection>
<tag>HEAD</tag>
</scm>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>main-javadoc</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<release>17</release>
<quiet>true</quiet>
<notimestamp>true</notimestamp>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>com.outbrain.swinfra</groupId>
<artifactId>ci-friendly-flatten-maven-plugin</artifactId>
<version>1.0.14</version>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>flatten</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

1
tdlib-serializer Submodule

@ -0,0 +1 @@
Subproject commit c77baa48e306371c5a188c49b553003539132eb5