Skip to content

Commit

Permalink
Reduce the Windows packaging task size by deleting the .tgz and not b…
Browse files Browse the repository at this point in the history
…uilding tests. (#1606)

* When uncompressing a tgz into a package, delete the tgz after uncompressing it.

* Fix bug.

* Add some disk space printing.

* Format.

* Remove libraries after they are blastdoored.

Add more debug printing of disk space usage.

* Comment out --build_tests on windows to see what happens.

* Don't delete non-library files.

* Remove disk space printing.

* Remove commented-out code.

* Removed commented lines.
  • Loading branch information
jonsimantov authored Jun 14, 2024
1 parent 3cbccb4 commit 2ce9f33
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,10 @@ jobs:
include:
- os: windows-latest
vcpkg_triplet_suffix: "windows-static"
additional_build_flags: "--build_tests"
sdk_platform: "windows"
- os: windows-latest
msvc_runtime: "dynamic"
vcpkg_triplet_suffix: "windows-static-md"
additional_build_flags: "--build_tests"
sdk_platform: "windows"
- os: ubuntu-20.04
vcpkg_triplet_suffix: "linux"
Expand Down Expand Up @@ -543,6 +541,7 @@ jobs:
fi
declare -a additional_flags
tar -xvzf artifacts/packaging-tools-${tools_platform}/packaging-tools.tgz -C bin
rm -rf artifacts/packaging-tools-*.tgz
chmod -R u+x bin
# To save space, delete any artifacts that we don't need for packaging.
for pkg in artifacts/firebase-cpp-sdk-*; do
Expand All @@ -567,7 +566,7 @@ jobs:
# Windows x86: force input and output target format
additional_flags+=(-f pe-i386,pe-bigobj-i386)
fi
sdk-src/build_scripts/desktop/package.sh -b ${pkg} -o firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package -p ${{ matrix.sdk_platform }} -t bin -d ${variant} -P python3 -j ${additional_flags[*]}
sdk-src/build_scripts/desktop/package.sh -D -b ${pkg} -o firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package -p ${{ matrix.sdk_platform }} -t bin -d ${variant} -P python3 -j ${additional_flags[*]}
done
if [[ "${{ matrix.sdk_platform }}" == "darwin" ]]; then
# Darwin has a final step after all the variants are done,
Expand Down
27 changes: 19 additions & 8 deletions build_scripts/desktop/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ options:
-L, use LLVM binutils
-R, print rename prefix and exit
-N, print allowed namespaces and exit
-D, delete package files after using them to save disk space
example:
build_scripts/desktop/package.sh -b firebase-cpp-sdk-linux -p linux -o package_out -v x86 -j"
}
Expand All @@ -31,6 +32,7 @@ platform=
python_cmd=python
variant=.
verbose=0
delete_files_after_using=0
root_dir=$(cd $(dirname $0)/../..; pwd -P)
merge_libraries_script=${root_dir}/scripts/merge_libraries.py
tools_path=~/bin
Expand All @@ -57,14 +59,17 @@ abspath(){
fi
}

while getopts "f:b:o:p:d:m:P:t:NRhjLv" opt; do
while getopts "f:b:o:p:d:m:P:t:NRhjLDv" opt; do
case $opt in
f)
binutils_format=$OPTARG
;;
b)
built_sdk_path=$OPTARG
;;
D)
delete_files_after_using=1
;;
j)
run_in_parallel=1
;;
Expand Down Expand Up @@ -157,6 +162,9 @@ if [[ ! -d "${built_sdk_path}" && -f "${built_sdk_path}" ]]; then
trap "rm -rf \"\${temp_dir}\"" SIGKILL SIGTERM SIGQUIT EXIT
echo "Uncompressing tarfile into temporary directory..."
tar -xf "${built_sdk_path}" -C "${temp_dir}"
if [[ ${delete_files_after_using} -eq 1 ]]; then
rm -f "${built_sdk_path}"
fi
built_sdk_path="${temp_dir}"
fi

Expand Down Expand Up @@ -363,13 +371,16 @@ for product in ${product_list[*]}; do
--scan_libs=\"${allfiles}\" \\
--hide_c_symbols=\"${deps_hidden}\" \\
\"${libfile_src}\" ${deps[*]}" >> "${merge_libraries_tmp}/merge_${product}.sh"
chmod u+x "${merge_libraries_tmp}/merge_${product}.sh"
if [[ ${run_in_parallel} -eq 0 ]]; then
# Run immediately if not set to run in parallel.
"${merge_libraries_tmp}/merge_${product}.sh"
else
echo "echo \"${libfile_out}\" DONE" >> "${merge_libraries_tmp}/merge_${product}.sh"
fi
if [[ ${delete_files_after_using} -eq 1 ]]; then
echo "rm -f ${deps[*]}" >> "${merge_libraries_tmp}/merge_${product}.sh"
fi
chmod u+x "${merge_libraries_tmp}/merge_${product}.sh"
if [[ ${run_in_parallel} -eq 0 ]]; then
# Run immediately if not set to run in parallel.
"${merge_libraries_tmp}/merge_${product}.sh"
else
echo "echo \"${libfile_out}\" DONE" >> "${merge_libraries_tmp}/merge_${product}.sh"
fi
done

if [[ ${run_in_parallel} -ne 0 ]]; then
Expand Down

0 comments on commit 2ce9f33

Please sign in to comment.