Compile TdApi.java along native binaries

This commit is contained in:
Andrea Cavalli 2020-12-29 19:33:21 +01:00
parent 18a7f82f40
commit 24f2c1d13f
14 changed files with 420 additions and 64 deletions

View File

@ -1,4 +1,4 @@
name: Build TDLib name: Build TDLib natives
on: on:
push: push:
@ -117,7 +117,7 @@ jobs:
run: | run: |
echo "REVISION: $REVISION" echo "REVISION: $REVISION"
source ./scripts/continuous-integration/github-workflows/build.sh source ./scripts/continuous-integration/github-workflows/build-natives.sh
- id: getfilename - id: getfilename
shell: bash shell: bash
run: echo "::set-output name=file::$(cd generated/target; ls tdli*-natives-*.jar)" run: echo "::set-output name=file::$(cd generated/target; ls tdli*-natives-*.jar)"

137
.github/workflows/tdapi.yaml vendored Normal file
View File

@ -0,0 +1,137 @@
name: Generate TdApi.java
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0' # weekly
jobs:
build:
strategy:
matrix:
include:
- {os: ubuntu-20.04, arch: "linux/amd64", implementation: "tdlight"}
- {os: ubuntu-20.04, arch: "linux/amd64", implementation: "tdlib"}
runs-on: ${{ matrix.os }}
steps:
- name: Install sudo package
if: runner.os == 'Linux'
run: |
(apt-get update || true) 2>/dev/null
(apt-get install -y sudo || true) 2>/dev/null
sudo apt update
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Setup ccache variables
shell: bash
run: |
ARCH=${{ matrix.arch }}
SAFE_ARCH=$(echo $ARCH | sed 's/\//\-/g')
echo "CCACHE_SAFE_ARCH=$SAFE_ARCH" >> $GITHUB_ENV
- name: Cache ccache
if: runner.os == 'Linux'
id: cache-ccache
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{ runner.os }}-${{ env.CCACHE_SAFE_ARCH }}-ccache-all
restore-keys: |
${{ runner.os }}-${{ env.CCACHE_SAFE_ARCH }}-ccache-
- name: Setup Java (Snapshot)
if: github.ref != 'refs/heads/master'
uses: actions/setup-java@v1
with:
java-version: 11
server-id: mchv-snapshot-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Setup Java (Release)
if: github.ref == 'refs/heads/master'
uses: actions/setup-java@v1
with:
java-version: 11
server-id: mchv-release-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Setup variables
shell: bash
run: |
# ====== Variables
export REVISION=${{ github.run_number }}
export GH_MATRIX_OS=${{ matrix.os }}
export GH_MATRIX_ARCH=${{ matrix.arch }}
export IMPLEMENTATION_NAME=${{ matrix.implementation }}
source ./scripts/continuous-integration/github-workflows/setup-variables.sh
echo "REVISION=$REVISION" >> $GITHUB_ENV
echo "IMPLEMENTATION_NAME=$IMPLEMENTATION_NAME" >> $GITHUB_ENV
echo "TD_SRC_DIR=$TD_SRC_DIR" >> $GITHUB_ENV
echo "TD_BIN_DIR=$TD_BIN_DIR" >> $GITHUB_ENV
echo "TDNATIVES_BIN_DIR=$TDNATIVES_BIN_DIR" >> $GITHUB_ENV
echo "TDNATIVES_CPP_SRC_DIR=$TDNATIVES_CPP_SRC_DIR" >> $GITHUB_ENV
echo "TDNATIVES_DOCS_BIN_DIR=$TDNATIVES_DOCS_BIN_DIR" >> $GITHUB_ENV
echo "TD_BUILD_DIR=$TD_BUILD_DIR" >> $GITHUB_ENV
echo "TDNATIVES_CPP_BUILD_DIR=$TDNATIVES_CPP_BUILD_DIR" >> $GITHUB_ENV
echo "JAVA_SRC_DIR=$JAVA_SRC_DIR" >> $GITHUB_ENV
echo "TDLIB_SERIALIZER_DIR=$TDLIB_SERIALIZER_DIR" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "JAVA_INCLUDE_PATH=$JAVA_INCLUDE_PATH" >> $GITHUB_ENV
echo "CMAKE_EXTRA_ARGUMENTS=$CMAKE_EXTRA_ARGUMENTS" >> $GITHUB_ENV
echo "VCPKG_DIR=$VCPKG_DIR" >> $GITHUB_ENV
echo "MAVEN_OPTS=$MAVEN_OPTS" >> $GITHUB_ENV
echo "GH_CPU_ARCH=$GH_CPU_ARCH" >> $GITHUB_ENV
echo "CPU_ARCH_JAVA=$CPU_ARCH_JAVA" >> $GITHUB_ENV
echo "CPU_ARCHITECTURE_NAME=$CPU_ARCHITECTURE_NAME" >> $GITHUB_ENV
echo "CPU_CORES_NUM=$CPU_CORES_NUM" >> $GITHUB_ENV
echo "CPU_CORES=$CPU_CORES" >> $GITHUB_ENV
echo "OPERATING_SYSTEM_NAME=$OPERATING_SYSTEM_NAME" >> $GITHUB_ENV
echo "OPERATING_SYSTEM_NAME_SHORT=$OPERATING_SYSTEM_NAME_SHORT" >> $GITHUB_ENV
echo "SRC_TDJNI_LIBNAME=$SRC_TDJNI_LIBNAME" >> $GITHUB_ENV
echo "DEST_TDJNI_LIBNAME=$DEST_TDJNI_LIBNAME" >> $GITHUB_ENV
- name: Install dependencies
shell: bash
run: |
echo "REVISION: $REVISION"
source ./scripts/continuous-integration/github-workflows/install-dependencies.sh
- name: Build
shell: bash
run: |
echo "REVISION: $REVISION"
source ./scripts/continuous-integration/github-workflows/build-tdapi.sh
- id: getfilename
shell: bash
run: echo "::set-output name=file::$(cd generated/target; ls tdli*-api-*.jar)"
- id: getfilepath
shell: bash
run: echo "::set-output name=file::$(ls generated/target/tdli*-api-*.jar)"
- uses: actions/upload-artifact@v2
with:
name: ${{ steps.getfilename.outputs.file }}
path: ${{ steps.getfilepath.outputs.file }}
- name: Deploy to Maven (Snapshot)
if: github.ref != 'refs/heads/master'
shell: bash
run: |
echo "REVISION: $REVISION"
source ./scripts/continuous-integration/github-workflows/deploy-snapshot.sh
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
- name: Deploy to Maven (Release)
if: github.ref == 'refs/heads/master'
shell: bash
run: |
echo "REVISION: $REVISION"
source ./scripts/continuous-integration/github-workflows/deploy-release.sh
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}

View File

@ -3,6 +3,7 @@ set -e
cd ./scripts/core/ cd ./scripts/core/
./generate_maven_project.sh ./generate_maven_project.sh
./generate_td_tools.sh ./generate_td_tools.sh
./configure_td.sh
./compile_td.sh ./compile_td.sh
./compile_tdjni.sh ./compile_tdjni.sh
./build_generated_maven_project.sh ./build_generated_maven_project.sh

View File

@ -0,0 +1,11 @@
#!/bin/bash -e
set -e
cd ./scripts/core/
./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
./generate_tdapi_java_file.sh
./build_generated_tdapi_maven_project.sh
echo "Done."
exit 0

View File

@ -0,0 +1,7 @@
#!/bin/bash -e
cd ../../generated
mvn clean package
echo "Done."
exit 0

View File

@ -38,31 +38,16 @@ echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'"
# Delete old data # Delete old data
echo "Deleting old data..." echo "Deleting old data..."
[ -d ./generated/td_build/ ] && rm -r ./generated/td_build/
[ -d ./generated/td_bin/ ] && rm -r ./generated/td_bin/ [ -d ./generated/td_bin/ ] && rm -r ./generated/td_bin/
# Create missing folders # Create missing folders
echo "Creating missing folders..." echo "Creating missing folders..."
[ -d ./generated/td_build/ ] || mkdir ./generated/td_build/
[ -d ./generated/td_bin/ ] || mkdir ./generated/td_bin/ [ -d ./generated/td_bin/ ] || mkdir ./generated/td_bin/
# Configure cmake
echo "Configuring CMake..."
cd ./generated/td_build/
if [[ "$IMPLEMENTATION_NAME" = "tdlight" ]]; then
export CMAKE_EXTRA_ARGUMENTS_TD="-DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=ON -DTD_SKIP_TG_CLI=ON"
else
export CMAKE_EXTRA_ARGUMENTS_TD=""
fi
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH=$(realpath -m ../td_bin/) \
-DTD_ENABLE_JNI=ON \
${CMAKE_EXTRA_ARGUMENTS_TD} \
${CMAKE_EXTRA_ARGUMENTS} \
../implementation
# Build # Build
echo "Compiling ${IMPLEMENTATION_NAME} td..." echo "Compiling ${IMPLEMENTATION_NAME} td..."
cd ./generated/td_build/
cmake --build . --target install --config Release ${CPU_CORES} cmake --build . --target install --config Release ${CPU_CORES}

69
scripts/core/configure_td.sh Executable file
View File

@ -0,0 +1,69 @@
#!/bin/bash -e
# MAIN REQUIRED ENVIRONMENT VARIABLES:
# OPERATING_SYSTEM_NAME = <windows | linux | osx>
# CPU_ARCHITECTURE_NAME = <amd64 | aarch64 | 386 | armv6 | armv7 | ppc64le>
# IMPLEMENTATION_NAME = <tdlib | tdlight>
# CPU_CORES = "-- -j<cores>" or "-m" on Windows
# OTHER REQUIRED ENVIRONMENT VARIABLES:
# CMAKE_EXTRA_ARGUMENTS = <args>
# Check variables correctness
if [ -z "${OPERATING_SYSTEM_NAME}" ]; then
echo "Missing parameter: OPERATING_SYSTEM_NAME"
exit 1
fi
if [ -z "${CPU_ARCHITECTURE_NAME}" ]; then
echo "Missing parameter: CPU_ARCHITECTURE_NAME"
exit 1
fi
if [ -z "${IMPLEMENTATION_NAME}" ]; then
echo "Missing parameter: IMPLEMENTATION_NAME"
exit 1
fi
if [ -z "${CPU_CORES}" ]; then
echo "Missing parameter: CPU_CORES"
exit 1
fi
cd ../../
# Print details
echo "Configuring td..."
echo "Current directory: $(pwd)"
echo "Operating system: ${OPERATING_SYSTEM_NAME}"
echo "Architecture: ${CPU_ARCHITECTURE_NAME}"
echo "Td implementation: ${IMPLEMENTATION_NAME}"
echo "CPU cores count: ${CPU_CORES}"
echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'"
# Delete old data
echo "Deleting old data..."
[ -d ./generated/td_build/ ] && rm -r ./generated/td_build/
# Create missing folders
echo "Creating missing folders..."
[ -d ./generated/td_build/ ] || mkdir ./generated/td_build/
# Configure cmake
echo "Configuring CMake..."
cd ./generated/td_build/
export CMAKE_EXTRA_ARGUMENTS_TD;
if [[ "$IMPLEMENTATION_NAME" = "tdlight" ]]; then
CMAKE_EXTRA_ARGUMENTS_TD="-DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=ON -DTD_SKIP_TG_CLI=ON"
else
CMAKE_EXTRA_ARGUMENTS_TD=""
fi
INSTALL_PREFIX="$(realpath -m ../td_bin/)"
INSTALL_BINDIR="$(realpath -m ../td_bin/bin)"
echo "Install prefix: $INSTALL_PREFIX"
echo "Install bindir: $INSTALL_BINDIR"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \
-DTD_ENABLE_JNI=ON \
${CMAKE_EXTRA_ARGUMENTS_TD} \
${CMAKE_EXTRA_ARGUMENTS} \
../implementation
echo "Done."
exit 0

View File

@ -26,6 +26,7 @@ if [ -z "${CPU_CORES}" ]; then
fi fi
cd ../../ cd ../../
JAVA_PACKAGE_PATH="it/tdlight/jni"
# Print details # Print details
echo "Generating TdApi.java..." echo "Generating TdApi.java..."
@ -35,6 +36,7 @@ echo "Architecture: ${CPU_ARCHITECTURE_NAME}"
echo "Td implementation: ${IMPLEMENTATION_NAME}" echo "Td implementation: ${IMPLEMENTATION_NAME}"
echo "CPU cores count: ${CPU_CORES}" echo "CPU cores count: ${CPU_CORES}"
echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'" echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'"
echo "JAVA_PACKAGE_PATH: '${JAVA_PACKAGE_PATH}'"
# Setup constants # Setup constants
if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then
@ -43,78 +45,49 @@ else
export PYTHON_EXECUTABLE="python3" export PYTHON_EXECUTABLE="python3"
fi fi
# Delete old data # Delete old data
echo "Deleting old data..." echo "Deleting old data..."
[ -d ./generated/tdapi_java_build/ ] && rm -r ./generated/tdapi_java_build/
[ -d ./generated/tdjni_build/ ] && rm -r ./generated/tdjni_build/ [ -d ./generated/tdjni_build/ ] && rm -r ./generated/tdjni_build/
[ -d ./generated/tdjni_bin/ ] && rm -r ./generated/tdjni_bin/ [ -d ./generated/tdjni_bin/ ] && rm -r ./generated/tdjni_bin/
[ -d ./generated/tdjni_docs/ ] && rm -r ./generated/tdjni_docs/ [ -d ./generated/tdjni_docs/ ] && rm -r ./generated/tdjni_docs/
[ -d ./generated/src/main/jni-cpp-src/ ] && rm -r ./generated/src/main/jni-cpp-src/ [ -f ./generated/src/main/java/${JAVA_PACKAGE_PATH}/TdApi.java ] && rm ./generated/src/main/java/${JAVA_PACKAGE_PATH}/TdApi.java
[ -d ./generated/src/main/jni-java-src/ ] && rm -r ./generated/src/main/jni-java-src/
[ -f ./generated/src/main/java/it/tdlight/jni/TdApi.java ] && rm ./generated/src/main/java/it/tdlight/jni/TdApi.java
# Create missing folders # Create missing folders
echo "Creating missing folders..." echo "Creating missing folders..."
[ -d ./generated/tdapi_java_build/ ] || mkdir ./generated/tdapi_java_build/ [ -d "./generated/src/main/java/${JAVA_PACKAGE_PATH}/" ] || mkdir -p "./generated/src/main/java/${JAVA_PACKAGE_PATH}/"
[ -d ./generated/tdjni_build/ ] || mkdir ./generated/tdjni_build/ [ -d ./generated/tdjni_build/ ] || mkdir ./generated/tdjni_build/
[ -d ./generated/tdjni_bin/ ] || mkdir ./generated/tdjni_bin/ [ -d ./generated/tdjni_bin/ ] || mkdir ./generated/tdjni_bin/
[ -d ./generated/tdjni_docs/ ] || mkdir ./generated/tdjni_docs/ [ -d ./generated/tdjni_docs/ ] || mkdir ./generated/tdjni_docs/
# Copy source files
echo "Copying source files..."
cp -r ./src/main/jni-cpp-src/common/. ./generated/src/main/jni-cpp-src
cp -r ./src/main/jni-cpp-src/${IMPLEMENTATION_NAME}/. ./generated/src/main/jni-cpp-src
cp -r ./src/main/jni-java-src ./generated/src/main/jni-java-src
# Copy executables # Copy executables
echo "Copying executables..." echo "Copying executables..."
export TD_GENERATED_BINARIES_DIR;
if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then
export TD_GENERATED_BINARIES_DIR=$(realpath -m ./generated/td_tools/td/generate/Release) TD_GENERATED_BINARIES_DIR="$(realpath -m ./generated/td_tools/td/generate/Release)"
else else
export TD_GENERATED_BINARIES_DIR=$(realpath -m ./generated/td_tools/td/generate) TD_GENERATED_BINARIES_DIR="$(realpath -m ./generated/td_tools/td/generate)"
fi fi
# Configure cmake # Configure cmake
echo "Configuring CMake..." echo "Configuring CMake..."
cd ./generated/tdapi_java_build/ cd ./generated/
echo "Telegram source path: '$(realpath -m ../implementation/)'" echo "Telegram source path: '$(realpath -m ./implementation/)'"
echo "Td bin path: '$(realpath -m ../td_bin/)'"
echo "Td bin files: $(ls $(realpath -m ../td_bin/))"
echo "Td bin/lib path: '$(realpath -m ../td_bin/lib/)'"
echo "Td bin/lib files: $(ls $(realpath -m ../td_bin/lib/))"
echo "Td CMake path: '$(realpath -m ../td_bin/lib/cmake/)'"
echo "Td CMake files: $(ls $(realpath -m ../td_bin/lib/cmake/))"
echo "Td CMake/td path: '$(realpath -m ../td_bin/lib/cmake/Td/)'"
echo "Td CMake/td files: $(ls $(realpath -m ../td_bin/lib/cmake/Td/))"
cmake -DCMAKE_BUILD_TYPE=Release \
-DTD_SRC_DIR=$(realpath -m ../implementation/) \
-DTD_GENERATED_BINARIES_DIR=${TD_GENERATED_BINARIES_DIR} \
-DTd_DIR=$(realpath -m ../td_bin/lib/cmake/Td/) \
-DTDNATIVES_BIN_DIR=$(realpath -m ../tdjni_bin/) \
-DTDNATIVES_DOCS_BIN_DIR=$(realpath -m ../tdjni_docs/) \
-DJAVA_SRC_DIR=$(realpath -m ../src/main/jni-java-src/) \
${CMAKE_EXTRA_ARGUMENTS} \
$(realpath -m ../src/main/jni-cpp-src/)
# Run cmake to generate TdApi.java # Run cmake to generate TdApi.java
echo "Generating TdApi.java..." echo "Generating TdApi.java..."
cmake --build . --target td_generate_java_api --config Release ${CPU_CORES} ./td_tools/td/generate/td_generate_java_api TdApi "./implementation/td/generate/scheme/td_api.tlo" "./src/main/java" "$JAVA_PACKAGE_PATH"
cd .. php ./implementation/td/generate/JavadocTlDocumentationGenerator.php "./implementation/td/generate/scheme/td_api.tl" "./src/main/java/${JAVA_PACKAGE_PATH}/TdApi.java"
echo "Patching TdApi.java..." echo "Patching TdApi.java..."
${PYTHON_EXECUTABLE} ../scripts/core/tdlib-serializer/tdlib-serializer/ $(realpath -m ./src/main/jni-java-src/it/tdlight/jni/TdApi.java) $(realpath -m ./src/main/jni-java-src/it/tdlight/jni/new_TdApi.java) $(realpath -m ../scripts/core/tdlib-serializer/tdlib-serializer/headers.txt) ${PYTHON_EXECUTABLE} ../scripts/core/tdlib-serializer "$(realpath -m ./src/main/java/${JAVA_PACKAGE_PATH}/TdApi.java)" "$(realpath -m ./src/main/java/${JAVA_PACKAGE_PATH}/new_TdApi.java)" "$(realpath -m ../scripts/core/tdlib-serializer/headers.txt)"
rm ./src/main/jni-java-src/it/tdlight/jni/TdApi.java rm ./src/main/java/${JAVA_PACKAGE_PATH}/TdApi.java
if [[ "$OPERATING_SYSTEM_NAME" == "osx" ]]; then if [[ "$OPERATING_SYSTEM_NAME" == "osx" ]]; then
unexpand --tabs=2 ./src/main/jni-java-src/it/tdlight/jni/new_TdApi.java > ./src/main/jni-java-src/it/tdlight/jni/TdApi.java unexpand --tabs=2 ./src/main/java/${JAVA_PACKAGE_PATH}/new_TdApi.java > ./src/main/java/${JAVA_PACKAGE_PATH}/TdApi.java
else else
unexpand -t 2 ./src/main/jni-java-src/it/tdlight/jni/new_TdApi.java > ./src/main/jni-java-src/it/tdlight/jni/TdApi.java unexpand -t 2 ./src/main/java/${JAVA_PACKAGE_PATH}/new_TdApi.java > ./src/main/java/${JAVA_PACKAGE_PATH}/TdApi.java
fi fi
rm ./src/main/jni-java-src/it/tdlight/jni/new_TdApi.java rm ./src/main/java/${JAVA_PACKAGE_PATH}/new_TdApi.java
cp ./src/main/jni-java-src/it/tdlight/jni/TdApi.java ./src/main/java/it/tdlight/jni/TdApi.java
echo "Generated '$(realpath -m ./src/main/java/it/tdlight/jni/TdApi.java)'" echo "Generated '$(realpath -m ./src/main/java/${JAVA_PACKAGE_PATH}/TdApi.java)'"
echo "Done." echo "Done."
exit 0 exit 0

View File

@ -0,0 +1,49 @@
#!/bin/bash -e
# MAIN REQUIRED ENVIRONMENT VARIABLES:
# OPERATING_SYSTEM_NAME = <windows | linux | osx>
# CPU_ARCHITECTURE_NAME = <amd64 | aarch64 | 386 | armv6 | armv7 | ppc64le>
# IMPLEMENTATION_NAME = <tdlib | tdlight>
# Check variables correctness
if [ -z "${OPERATING_SYSTEM_NAME}" ]; then
echo "Missing parameter: OPERATING_SYSTEM_NAME"
exit 1
fi
if [ -z "${CPU_ARCHITECTURE_NAME}" ]; then
echo "Missing parameter: CPU_ARCHITECTURE_NAME"
exit 1
fi
if [ -z "${IMPLEMENTATION_NAME}" ]; then
echo "Missing parameter: IMPLEMENTATION_NAME"
exit 1
fi
cd ../../
# Print details
echo "Generating maven project..."
echo "Current directory: $(pwd)"
echo "Operating system: ${OPERATING_SYSTEM_NAME}"
echo "Architecture: ${CPU_ARCHITECTURE_NAME}"
echo "Td implementation: ${IMPLEMENTATION_NAME}"
# Delete old data
echo "Deleting old data..."
[ -d ./generated/ ] && rm -r ./generated/
# Create missing folders
echo "Creating missing folders..."
[ -d ./generated/ ] || mkdir ./generated/
[ -d ./generated/src/main ] || mkdir -p ./generated/src/main
# Generate pom.xml
echo "Generating pom.xml..."
sed -f "src/main/replacements/replace-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}-${IMPLEMENTATION_NAME}.sed" src/main/tdapi-project-src/pom.template.xml > generated/pom.xml
# Copy source files
echo "Copying source files..."
cp -r ./src/main/tdapi-java ./generated/src/main/java
cp -r ./src/main/tdapi-resources ./generated/src/main/resources
echo "Done."
exit 0

View File

@ -14,6 +14,7 @@ cd ../core
./generate_maven_project.sh ./generate_maven_project.sh
./generate_td_tools.sh ./generate_td_tools.sh
./configure_td.sh
./compile_td.sh ./compile_td.sh
./compile_tdjni.sh ./compile_tdjni.sh
./build_generated_maven_project.sh ./build_generated_maven_project.sh

View File

@ -0,0 +1,22 @@
#!/bin/bash -e
# This script compiles tdlight/tdlib api for your platform.
# Fill the variables with your system details.
#
# MAIN REQUIRED ENVIRONMENT VARIABLES:
# OPERATING_SYSTEM_NAME = <windows | linux | osx>
# CPU_ARCHITECTURE_NAME = <amd64 | aarch64 | 386 | armv6 | armv7 | ppc64le>
# IMPLEMENTATION_NAME = <tdlib | tdlight>
# CPU_CORES = "-- -j<cores>" or "-m" on Windows
# CMAKE_EXTRA_ARGUMENTS = <args>
# REVISION = <revision>
cd ../core
./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
./generate_tdapi_java_file.sh
./build_generated_tdapi_maven_project.sh
echo "Done."
exit 0

View File

@ -1,4 +1,4 @@
s/${OPERATING_SYSTEM_NAME}/linux/ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/ s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/386/ s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlib/ s/${IMPLEMENTATION_NAME}/tdlib/

View File

@ -1,4 +1,4 @@
s/${OPERATING_SYSTEM_NAME}/linux/ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/ s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/386/ s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlight/ s/${IMPLEMENTATION_NAME}/tdlight/

View File

@ -0,0 +1,101 @@
<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</artifactId>
<version>3.1.${revision}</version>
<name>${IMPLEMENTATION_NAME} API</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0-SNAPSHOT</revision>
</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>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>