Skip to content

Commit db947b3

Browse files
committed
build: ensure no permission errors thrown in packages-dist script
Bazel by default makes output files or tree artifacts readonly. This means that the packages-dist script fails in case release output has been built previously. This has only an effect in non-windows environments. We can reasonably fix this by making the folder/files writable before trying to delete them. This is similar to what Bazel internally does when deleting outputs of previous builds. see: https://github.com/bazelbuild/bazel/blob/07924e8260a447b69b18e8248203e1089b46962a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java#L1251
1 parent 50514b2 commit db947b3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

scripts/build-packages-dist.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ dirs=`echo "$targets" | sed -e 's/\/\/src\/\(.*\):npm_package/\1/'`
4444
# do this to ensure that the version placeholders are properly populated.
4545
for pkg in ${dirs}; do
4646
pkg_dir="${bazel_bin_path}/src/${pkg}/npm_package"
47+
# Make all directories in the previous package output writable. Bazel by default
48+
# makes tree artifacts and file outputs readonly. This causes permission errors
49+
# when deleting the folder. To avoid these errors, we make all files writable.
50+
chmod -R u+w ${pkg_dir}
4751
rm -Rf ${pkg_dir}
4852
done
4953

0 commit comments

Comments
 (0)