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 .mvn/wrapper/maven-wrapper.jar
/generated/ /generated/
/generated-sealed/
/generated-legacy/
/vcpkg/ /vcpkg/
linux-build.sh linux-build.sh
linux-deploy-release.sh linux-deploy-release.sh

View File

@ -1,15 +1,14 @@
#!/bin/bash -e #!/bin/bash -e
set -e set -e
cd ./scripts/core/ cd ./scripts/core/
API_TYPE=legacy ./generate_tdapi_maven_project.sh
./generate_td_tools.sh ./generate_td_tools.sh
./configure_td.sh ./configure_td.sh
API_TYPE=legacy ./generate_tdapi_maven_project.sh
API_TYPE=legacy ./generate_tdapi_java_file.sh API_TYPE=legacy ./generate_tdapi_java_file.sh
API_TYPE=legacy ./build_generated_tdapi_maven_project.sh API_TYPE=legacy ./build_generated_tdapi_maven_project.sh
API_TYPE=sealed ./generate_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 ./generate_tdapi_java_file.sh
API_TYPE=sealed ./build_generated_tdapi_maven_project.sh API_TYPE=sealed ./build_generated_tdapi_maven_project.sh

View File

@ -11,7 +11,7 @@ if [ -z "${API_TYPE}" ]; then
exit 1 exit 1
fi 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>/' {} \; 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 init
git checkout -b "${IMPLEMENTATION_NAME}-${API_TYPE}" git checkout -b "${IMPLEMENTATION_NAME}-${API_TYPE}"

View File

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

View File

@ -13,7 +13,11 @@ fi
source ./setup-variables.sh source ./setup-variables.sh
FALLBACK_API_TYPE="sealed" 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 mvn -B -DrevisionNumber="${REVISION}" "-D${API_TYPE:-${FALLBACK_API_TYPE}}" -DrevisionSuffix="" clean deploy

View File

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

View File

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

View File

@ -67,19 +67,19 @@ fi
# Delete old data # Delete old data
echo "Deleting old data..." echo "Deleting old data..."
[ -d ./generated/tdjni_build/ ] && rm -r ./generated/tdjni_build/ [ -d ./generated-"$API_TYPE"/tdjni_build/ ] && rm -r ./generated-"$API_TYPE"/tdjni_build/
[ -d ./generated/tdjni_bin/ ] && rm -r ./generated/tdjni_bin/ [ -d ./generated-"$API_TYPE"/tdjni_bin/ ] && rm -r ./generated-"$API_TYPE"/tdjni_bin/
[ -d ./generated/tdjni_docs/ ] && rm -r ./generated/tdjni_docs/ [ -d ./generated-"$API_TYPE"/tdjni_docs/ ] && rm -r ./generated-"$API_TYPE"/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-"$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/src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java ] && rm ./generated/src/main/java/${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 # Create missing folders
echo "Creating 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-$API_TYPE/src/main/java/${JAVA_API_PACKAGE_PATH}/" ] || mkdir -p "./generated-$API_TYPE/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-$API_TYPE/src/main/java/${JAVA_LIB_PACKAGE_PATH}/" ] || mkdir -p "./generated-$API_TYPE/src/main/java/${JAVA_LIB_PACKAGE_PATH}/"
[ -d ./generated/tdjni_build/ ] || mkdir ./generated/tdjni_build/ [ -d ./generated-"$API_TYPE"/tdjni_build/ ] || mkdir ./generated-"$API_TYPE"/tdjni_build/
[ -d ./generated/tdjni_bin/ ] || mkdir ./generated/tdjni_bin/ [ -d ./generated-"$API_TYPE"/tdjni_bin/ ] || mkdir ./generated-"$API_TYPE"/tdjni_bin/
[ -d ./generated/tdjni_docs/ ] || mkdir ./generated/tdjni_docs/ [ -d ./generated-"$API_TYPE"/tdjni_docs/ ] || mkdir ./generated-"$API_TYPE"/tdjni_docs/
# Copy executables # Copy executables
echo "Copying executables..." echo "Copying executables..."
@ -98,23 +98,23 @@ echo "Telegram source path: '$(realpath -m ./implementation/)'"
# Run cmake to generate TdApi.java # Run cmake to generate TdApi.java
echo "Generating 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" ./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" "./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java" 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 "./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java" "./src/main/java/${JAVA_API_PACKAGE_PATH}/php_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}..." 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 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 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 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." echo "Done."
exit 0 exit 0

View File

@ -37,21 +37,21 @@ echo "API type: ${API_TYPE}"
# Delete old data # Delete old data
echo "Deleting old data..." echo "Deleting old data..."
[ -d ./generated/ ] && rm -r ./generated/ [ -d "./generated-${API_TYPE}" ] && rm -r "./generated-${API_TYPE}"
# Create missing folders # Create missing folders
echo "Creating missing folders..." echo "Creating missing folders..."
[ -d ./generated/ ] || mkdir ./generated/ [ -d "./generated-${API_TYPE}" ] || mkdir "./generated-${API_TYPE}"
[ -d ./generated/src/main ] || mkdir -p ./generated/src/main [ -d "./generated-${API_TYPE}/src/main" ] || mkdir -p "./generated-${API_TYPE}/src/main"
# Generate pom.xml # Generate pom.xml
echo "Generating 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 # Copy source files
echo "Copying 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-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/src/main/resources [ -d ./src/main/tdapi-resources ] && cp -r ./src/main/tdapi-resources "./generated-${API_TYPE}/src/main/resources"
echo "Done." echo "Done."
exit 0 exit 0

View File

@ -16,15 +16,14 @@ cd ../core
source ./setup-variables.sh source ./setup-variables.sh
./install-dependencies.sh ./install-dependencies.sh
API_TYPE=legacy ./generate_tdapi_maven_project.sh
./generate_td_tools.sh ./generate_td_tools.sh
./configure_td.sh ./configure_td.sh
API_TYPE=legacy ./generate_tdapi_maven_project.sh
API_TYPE=legacy ./generate_tdapi_java_file.sh API_TYPE=legacy ./generate_tdapi_java_file.sh
API_TYPE=legacy ./build_generated_tdapi_maven_project.sh API_TYPE=legacy ./build_generated_tdapi_maven_project.sh
API_TYPE=sealed ./generate_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 ./generate_tdapi_java_file.sh
API_TYPE=sealed ./build_generated_tdapi_maven_project.sh API_TYPE=sealed ./build_generated_tdapi_maven_project.sh