This commit is contained in:
Andrea Cavalli 2021-12-08 00:48:27 +01:00
parent 757fdfe19b
commit 9e3d75dd6f
10 changed files with 47 additions and 35 deletions

2
.gitignore vendored
View File

@ -52,6 +52,8 @@ buildNumber.properties
.mvn/wrapper/maven-wrapper.jar
/generated/
/generated-sealed/
/generated-legacy/
/vcpkg/
linux-build.sh
linux-deploy-release.sh

View File

@ -1,15 +1,14 @@
#!/bin/bash -e
set -e
cd ./scripts/core/
API_TYPE=legacy ./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
API_TYPE=legacy ./generate_tdapi_maven_project.sh
API_TYPE=legacy ./generate_tdapi_java_file.sh
API_TYPE=legacy ./build_generated_tdapi_maven_project.sh
API_TYPE=sealed ./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
API_TYPE=sealed ./generate_tdapi_java_file.sh
API_TYPE=sealed ./build_generated_tdapi_maven_project.sh

View File

@ -11,7 +11,7 @@ if [ -z "${API_TYPE}" ]; then
exit 1
fi
cd ./generated/target/apidocs
cd "./generated-${API_TYPE}/target/apidocs"
find . -name '*.html' -exec sed -i -r 's/<\/title>/<\/title>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><style>\n\t#memberSummary_tabpanel{overflow-x: auto;}\n\tli.blockList{overflow-x: auto;}\n\ttd.colLast div{max-width:30vw;}\n\t#search{width: 400px;max-width: 65vw;}\n\t.title,.subTitle,pre,.inheritance,h1,h2,h3,h4,h5,.memberSummary,.memberSignature,.typeSummary,.blockList,.contentContainer{white-space:normal;word-break:break-word;}\n\tul{padding-left:10px}\n<\/style>/' {} \;
git init
git checkout -b "${IMPLEMENTATION_NAME}-${API_TYPE}"

View File

@ -13,7 +13,7 @@ echo "Building TdApi package..."
echo "Current directory: $(pwd)"
echo "API type: ${API_TYPE}"
cd ../../generated
cd ../../generated-"$API_TYPE"
mvn -B "-D${API_TYPE}" clean install

View File

@ -13,7 +13,11 @@ fi
source ./setup-variables.sh
FALLBACK_API_TYPE="sealed"
cd ../../generated
if [ -z "${API_TYPE}" ]; then
cd ../../generated
else
cd "../../generated-${API_TYPE}"
fi
mvn -B -DrevisionNumber="${REVISION}" "-D${API_TYPE:-${FALLBACK_API_TYPE}}" -DrevisionSuffix="" clean deploy

View File

@ -2,7 +2,11 @@
# OTHER ENVIRONMENT VARIABLES:
# API_TYPE = <legacy|sealed>
cd ../../generated
if [ -z "${API_TYPE}" ]; then
cd ../../generated
else
cd "../../generated-${API_TYPE}"
fi
FALLBACK_API_TYPE="sealed"

View File

@ -43,6 +43,10 @@ echo "Deleting old data..."
[ -d ./generated/implementation/ ] && rm -r ./generated/implementation/
[ -d ./generated/td_tools/ ] && rm -r ./generated/td_tools/
# Create missing folders
echo "Creating missing folders..."
[ -d "./generated" ] || mkdir "./generated"
# Copy implementation files
echo "Copying implementation files..."
cp -r implementations/${IMPLEMENTATION_NAME} ./generated/implementation

View File

@ -67,19 +67,19 @@ fi
# Delete old data
echo "Deleting old data..."
[ -d ./generated/tdjni_build/ ] && rm -r ./generated/tdjni_build/
[ -d ./generated/tdjni_bin/ ] && rm -r ./generated/tdjni_bin/
[ -d ./generated/tdjni_docs/ ] && rm -r ./generated/tdjni_docs/
[ -f ./generated/src/main/java17/${JAVA_API_PACKAGE_PATH}/TdApi.java ] && rm ./generated/src/main/java17/${JAVA_API_PACKAGE_PATH}/TdApi.java
[ -f ./generated/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java ] && rm ./generated/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java
[ -d ./generated-"$API_TYPE"/tdjni_build/ ] && rm -r ./generated-"$API_TYPE"/tdjni_build/
[ -d ./generated-"$API_TYPE"/tdjni_bin/ ] && rm -r ./generated-"$API_TYPE"/tdjni_bin/
[ -d ./generated-"$API_TYPE"/tdjni_docs/ ] && rm -r ./generated-"$API_TYPE"/tdjni_docs/
[ -f ./generated-"$API_TYPE"/src/main/java17/${JAVA_API_PACKAGE_PATH}/TdApi.java ] && rm ./generated-"$API_TYPE"/src/main/java17/${JAVA_API_PACKAGE_PATH}/TdApi.java
[ -f ./generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java ] && rm ./generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java
# Create missing folders
echo "Creating missing folders..."
[ -d "./generated/src/main/java/${JAVA_API_PACKAGE_PATH}/" ] || mkdir -p "./generated/src/main/java/${JAVA_API_PACKAGE_PATH}/"
[ -d "./generated/src/main/java/${JAVA_LIB_PACKAGE_PATH}/" ] || mkdir -p "./generated/src/main/java/${JAVA_LIB_PACKAGE_PATH}/"
[ -d ./generated/tdjni_build/ ] || mkdir ./generated/tdjni_build/
[ -d ./generated/tdjni_bin/ ] || mkdir ./generated/tdjni_bin/
[ -d ./generated/tdjni_docs/ ] || mkdir ./generated/tdjni_docs/
[ -d "./generated-$API_TYPE/src/main/java/${JAVA_API_PACKAGE_PATH}/" ] || mkdir -p "./generated-$API_TYPE/src/main/java/${JAVA_API_PACKAGE_PATH}/"
[ -d "./generated-$API_TYPE/src/main/java/${JAVA_LIB_PACKAGE_PATH}/" ] || mkdir -p "./generated-$API_TYPE/src/main/java/${JAVA_LIB_PACKAGE_PATH}/"
[ -d ./generated-"$API_TYPE"/tdjni_build/ ] || mkdir ./generated-"$API_TYPE"/tdjni_build/
[ -d ./generated-"$API_TYPE"/tdjni_bin/ ] || mkdir ./generated-"$API_TYPE"/tdjni_bin/
[ -d ./generated-"$API_TYPE"/tdjni_docs/ ] || mkdir ./generated-"$API_TYPE"/tdjni_docs/
# Copy executables
echo "Copying executables..."
@ -98,23 +98,23 @@ echo "Telegram source path: '$(realpath -m ./implementation/)'"
# Run cmake to generate TdApi.java
echo "Generating TdApi.java..."
./td_tools/td/generate/td_generate_java_api TdApi "./implementation/td/generate/scheme/td_api.tlo" "./src/main/java" "$JAVA_API_PACKAGE_PATH"
php ./implementation/td/generate/JavadocTlDocumentationGenerator.php "./implementation/td/generate/scheme/td_api.tl" "./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java"
mv "./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java" "./src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java"
./td_tools/td/generate/td_generate_java_api TdApi "./implementation/td/generate/scheme/td_api.tlo" "../generated-$API_TYPE/src/main/java" "$JAVA_API_PACKAGE_PATH"
php ./implementation/td/generate/JavadocTlDocumentationGenerator.php "./implementation/td/generate/scheme/td_api.tl" "../generated-$API_TYPE/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java"
mv "../generated-$API_TYPE/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java" "../generated-$API_TYPE/src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java"
echo "Patching TdApi.java for Java ${MIN_JDK_VERSION}..."
${PYTHON_EXECUTABLE} ../scripts/core/tdlib-serializer "$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java)" "$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java)" "$(realpath -m ../scripts/core/tdlib-serializer/headers.txt)" "$SEALED"
${PYTHON_EXECUTABLE} ../scripts/core/tdlib-serializer "$(realpath -m ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java)" "$(realpath -m ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java)" "$(realpath -m ../scripts/core/tdlib-serializer/headers.txt)" "$SEALED"
if [[ "$OPERATING_SYSTEM_NAME" == "osx" ]]; then
unexpand --tabs=2 ./src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java > ./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java
unexpand --tabs=2 ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java > ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java
else
unexpand -t 2 ./src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java > ./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java
unexpand -t 2 ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java > ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java
fi
rm ./src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java
rm ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java
echo "Generated '$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java)'"
echo "Generated '$(realpath -m ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java)'"
rm ./src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java
rm ../generated-"$API_TYPE"/src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java
echo "Done."
exit 0

View File

@ -37,21 +37,21 @@ echo "API type: ${API_TYPE}"
# Delete old data
echo "Deleting old data..."
[ -d ./generated/ ] && rm -r ./generated/
[ -d "./generated-${API_TYPE}" ] && rm -r "./generated-${API_TYPE}"
# Create missing folders
echo "Creating missing folders..."
[ -d ./generated/ ] || mkdir ./generated/
[ -d ./generated/src/main ] || mkdir -p ./generated/src/main
[ -d "./generated-${API_TYPE}" ] || mkdir "./generated-${API_TYPE}"
[ -d "./generated-${API_TYPE}/src/main" ] || mkdir -p "./generated-${API_TYPE}/src/main"
# Generate pom.xml
echo "Generating pom.xml..."
sed -f "src/main/replacements/replace-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}-${IMPLEMENTATION_NAME}-${API_TYPE}.sed" src/main/tdapi-project-src/pom.template.xml > generated/pom.xml
sed -f "src/main/replacements/replace-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}-${IMPLEMENTATION_NAME}-${API_TYPE}.sed" src/main/tdapi-project-src/pom.template.xml > "./generated-${API_TYPE}/pom.xml"
# Copy source files
echo "Copying source files..."
[ -d ./src/main/tdapi-java ] && cp -r ./src/main/tdapi-java ./generated/src/main/java
[ -d ./src/main/tdapi-resources ] && cp -r ./src/main/tdapi-resources ./generated/src/main/resources
[ -d ./src/main/tdapi-java ] && cp -r ./src/main/tdapi-java "./generated-${API_TYPE}/src/main/java"
[ -d ./src/main/tdapi-resources ] && cp -r ./src/main/tdapi-resources "./generated-${API_TYPE}/src/main/resources"
echo "Done."
exit 0

View File

@ -16,15 +16,14 @@ cd ../core
source ./setup-variables.sh
./install-dependencies.sh
API_TYPE=legacy ./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
API_TYPE=legacy ./generate_tdapi_maven_project.sh
API_TYPE=legacy ./generate_tdapi_java_file.sh
API_TYPE=legacy ./build_generated_tdapi_maven_project.sh
API_TYPE=sealed ./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
API_TYPE=sealed ./generate_tdapi_java_file.sh
API_TYPE=sealed ./build_generated_tdapi_maven_project.sh