!30 [CI] Delete unnecessary build scripts

Merge pull request !30 from wuhuiquan/master
This commit is contained in:
openharmony_ci
2025-01-10 10:02:04 +00:00
committed by Gitee
4 changed files with 17 additions and 179 deletions
+10 -20
View File
@@ -13,6 +13,12 @@ detect_platform() {
esac
}
clean() {
rm -rf ${rust_source_dir}/build/*
rm -rf ${root_build_dir}/output/*
echo "Cleaning up the previous build result is complete"
}
copy_config() {
if [ "${host_platform}" = "linux" ] && [ "${host_cpu}" = "x86_64" ]; then
cp ${shell_path}/config.toml ${rust_source_dir}
@@ -28,6 +34,7 @@ copy_config() {
echo "Unsupported platform: $(uname -s) $(uname -m)"
exit 1
fi
echo "Copy config.toml to the source code directory"
}
update_config_clang_path() {
@@ -78,6 +85,7 @@ move_static_rust_source() {
cp -r src/doc/{book,edition-guide,embedded-book,nomicon} ${2}/src/doc/
cp -r src/doc/{reference,rust-by-example,rustc-dev-guide} ${2}/src/doc/
cp -r src/tools/cargo/* ${2}/src/tools/cargo/
echo "Copy the static source code completely."
popd
popd
}
@@ -120,6 +128,7 @@ download_rust_at_net() {
echo "Unsupported platform: $(uname -s) $(uname -m)"
exit 1
fi
echo "Download ${host_platform} ${host_cpu} static source code completely"
}
check_build_result() {
@@ -135,7 +144,7 @@ check_build_result() {
echo "${file_name} size exceed 1.2M, size is ${file_size}"
exit 1;
fi
echo "so size is ${file_size}"
echo "The so size is ${file_size}"
popd
}
@@ -146,25 +155,6 @@ export_ohos_path() {
fi
}
download_rust() {
local pre_rust_date="2023-07-13"
mkdir -p ${rust_source_dir}/build/cache/${pre_rust_date}
if [ "${host_platform}" = "linux" ] && [ ${host_cpu} = "x86_64" ]; then
if [ ! -d "${root_build_dir}/opensource" ]; then
artget pull -ap "${root_build_dir}/opensource" -os "${ci_shell_dir}/rust1.72.0.xml" -at opensource
artget pull -ap "${root_build_dir}/opensource" -os "${ci_shell_dir}/rust1.71.0_linux.xml" -at opensource
fi
elif [ "${host_platform}" = "darwin" ]; then
artget pull -ap "${root_build_dir}/opensource" -os "${ci_shell_dir}/rust1.72.0.xml" -at opensource
if [ ${host_cpu} = "x86_64" ]; then
artget pull -ap "${root_build_dir}/opensource" -os "${ci_shell_dir}/rust1.71.0_mac_x86.xml" -at opensource
elif [ ${host_cpu} = "arm64" ]; then
artget pull -ap "${root_build_dir}/opensource" -os "${ci_shell_dir}/rust1.71.0_mac_arm.xml" -at opensource
fi
fi
cp ${root_build_dir}/opensource/Rust/1.71.0/* ${rust_source_dir}/build/cache/${pre_rust_date}
}
get_exclude_file() {
while read line; do
if [ -z "$line" ]; then
-155
View File
@@ -1,155 +0,0 @@
#!/bin/bash
set -e
readonly shell_path=$(cd $(dirname $0); pwd)
readonly root_build_dir="${shell_path}/../.."
readonly rust_source_dir="${shell_path}/.."
readonly ci_shell_dir="${root_build_dir}/build/rustbuild/"
readonly install_path="${rust_source_dir}/build/dist"
readonly output_install="${root_build_dir}/output/"
readonly oh_tools="/opt/buildtools/mobile_cpu/BiSheng/bin"
readonly mingw_tools="/opt/buildtools/llvm-mingw-20220906/bin"
readonly bep_home="/opt/buildtools/secBepkit-2.2.0.2"
readonly old_version="xxxxx"
new_version="xxxxx"
bep_build=false
bep_time="2024-09-29 12:00:00"
source ${shell_path}/function.sh
export PATH=$rust_source_dir:/usr/local/bin:$PATH
show_help() {
echo "Usage: $0 [OPTIONS] [ARGUMENTS]"
echo "Options:"
echo " -h Display this help message"
echo " -v Set build version"
echo " -b Bep build, warning: will delete git information"
echo " -t Set bep build time"
echo "Arguments:"
echo " ARGUMENTS are additional values passed to the script"
}
parse_options() {
local OPTIND=1
while getopts "hv:b:t:" opt; do
case $opt in
h) show_help; exit 0 ;;
v) new_version="$OPTARG" ;;
b) bep_build="$OPTARG" ;;
t) bep_time="$OPTARG" ;;
\?) echo "unsupport arguments -$OPTARG" >&2
exit 1 ;;
esac
done
shift $((OPTIND - 1))
return 0
}
bep_prepare() {
# bep patch
if [ -n "$(grep -rn "HashMap" $root_build_dir/rust/vendor/compiler_builtins/build.rs)" ];then
pushd ${rust_source_dir}/vendor/compiler_builtins/
patch < ${ci_shell_dir}/vendor.patch
popd
fi
if [ -n "$(grep -rn "3f2f9589f896c5dc7e7ce39f5809f4f63d1199e5f80ae23b343a7f1d889d0206" $root_build_dir/rust/vendor/compiler_builtins/.cargo-checksum.json)" ];then
cp ${ci_shell_dir}/.cargo-checksum.json ${rust_source_dir}/vendor/compiler_builtins/
fi
# remove .git .gitlab .gitattributes for bep
pushd ${rust_source_dir}
(find . -name ".git" -print && find . -name ".gitlab" -print && find . -name ".gitattributes" -print) | xargs rm -rf
(find . -name ".gitignore" -print && find . -name ".github" -print && find . -name ".gitkeep" -print) | xargs rm -rf
popd
}
lock_bep_time() {
if [ "${host_platform}" = "linux" ] && [ ${host_cpu} = "x86_64" ]; then
sed -i "2s/.*/bep_timestamp=${bep_time}/" ${ci_shell_dir}/bep_env.conf
sed -i "3s/.*/second=${bep_time}/" ${ci_shell_dir}/bep_env.conf
sed -i "4s/.*/third=${bep_time}/" ${ci_shell_dir}/bep_env.conf
source ${bep_home}/bep_env.sh -s ${ci_shell_dir}/bep_env.conf
fi
}
unlock_bep_time() {
if [ "${host_platform}" = "linux" ] && [ ${host_cpu} = "x86_64" ]; then
source ${bep_home}/bep_env.sh -u
fi
}
collect_linux_build_result() {
# $1:file name
pushd ${install_path}
tar -xf ${1}.tar.gz
rm ${1}.tar.gz
chmod 750 $install_path/${1} -R
tar --format=gnu -czf ${1}.tar.gz ${1}
cp $install_path/${1}.tar.gz ${output_install}
popd
}
collect_mac_build_result() {
# $1:file name
pushd ${install_path}
tar -xf ${1}.tar.gz
rm ${1}.tar.gz
find ${1}/* -exec touch -h -m -d "$bep_time" {} \;
touch -h -m -d "$bep_time" ${1}
chmod -R 750 ${1}
tar -cf ${1}.tar ${1}
gzip -n ${1}.tar
rm -rf ${1}
cp ${install_path}/${1}.tar.gz ${output_install}
popd
}
collect_build_result() {
mkdir -p ${output_install}
if [ "${host_platform}" = "linux" ] && [ ${host_cpu} = "x86_64" ]; then
collect_linux_build_result rust-nightly-x86_64-unknown-linux-gnu
collect_linux_build_result rust-std-nightly-x86_64-pc-windows-gnullvm
collect_linux_build_result rust-std-nightly-aarch64-unknown-linux-ohos
collect_linux_build_result rust-std-nightly-armv7-unknown-linux-ohos
collect_linux_build_result rust-std-nightly-x86_64-unknown-linux-ohos
elif [ "${host_platform}" = "darwin" ] && [ ${host_cpu} = "x86_64" ]; then
collect_mac_build_result rust-nightly-x86_64-apple-darwin
elif [ "${host_platform}" = "darwin" ] && [ ${host_cpu} = "arm64" ]; then
collect_mac_build_result rust-nightly-aarch64-apple-darwin
fi
}
main() {
parse_options "$@"
detect_platform
download_rust
copy_config
update_config_clang ${oh_tools} ${mingw_tools}
update_version
move_static_rust_source "${root_build_dir}/opensource/Rust/1.72.0/" ${rust_source_dir}
rm -rf ${rust_source_dir}/src/llvm-project/*
cp -r ${root_build_dir}/llvm/* ${rust_source_dir}/src/llvm-project
if [ ${bep_build} = true ]; then
bep_prepare
lock_bep_time
fi
pushd ${rust_source_dir}
python3 ./x.py dist
popd
if [ ${bep_build} = true ]; then
collect_build_result
unlock_bep_time
fi
if [ "${host_platform}" = "linux" ]; then
check_build_result aarch64-unknown-linux-ohos
fi
echo "Building the rust toolchain Completed"
}
main "$@"
+4 -2
View File
@@ -20,6 +20,7 @@ get_new_version() {
local commit_id_full=$(git rev-parse HEAD)
local commit_id_short=${commit_id_full:0:10}
new_version="OHOS llvm-project $commit_id_short"
echo "New version is 'OHOS llvm-project $commit_id_short'"
popd
}
@@ -40,19 +41,20 @@ collect_build_result() {
main() {
detect_platform
rm -rf ${rust_source_dir}/build/*
clean
download_rust_at_net
copy_config
update_config_clang ${oh_tools} ${mingw_tools}
get_new_version
update_version
move_static_rust_source ${rust_static_dir} ${rust_source_dir}
rm -rf ${rust_source_dir}/src/llvm-project/*
cp -r ${root_build_dir}/third_party/llvm-project/* ${rust_source_dir}/src/llvm-project/
echo "Copy the llvm source code completely"
pushd ${rust_source_dir}
export_ohos_path
echo "Building the rust toolchain begin"
python3 ./x.py dist
collect_build_result
if [ "${host_platform}" = "linux" ]; then
+3 -2
View File
@@ -21,18 +21,19 @@ main() {
update_config_clang ${oh_tools} ${mingw_tools}
sed -i "s/target = .*/target = [\"x86_64-unknown-linux-gnu\"]/g" ${rust_source_dir}/config.toml
move_static_rust_source ${rust_static_dir} ${rust_source_dir}
rm -rf ${rust_source_dir}/src/llvm-project/*
cp -r ${root_build_dir}/third_party/llvm-project/* ${rust_source_dir}/src/llvm-project/
echo "Copy the llvm source code completely"
pushd ${rust_source_dir}
export_ohos_path
get_test_suite
get_exclude_file "ohos"
echo "Test the rust toolchain begin"
python3 ./x.py test --stage=2 ${all_test_suite} $exclude_file --no-fail-fast
popd
echo "test the rust toolchain Completed"
echo "Test the rust toolchain Completed"
}
main