[infra] Change CMake build to use a temporary directory This prevents Docker from creating a root-owned out directory which persists on bots and causes failures for other tasks. Bug: skia:9749 Change-Id: I79382d3d7a4b6d8ac61a429750ff99bde20d306d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264018 Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Eric Boren <borenet@google.com> (cherry picked from commit edae1b3e044e5755a7b05a9776525fc6a00f0f7b) Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264297 Reviewed-by: Eric Boren <borenet@google.com>
diff --git a/gn/gn_to_cmake.py b/gn/gn_to_cmake.py index 7dbf82c..9375be7 100644 --- a/gn/gn_to_cmake.py +++ b/gn/gn_to_cmake.py
@@ -162,12 +162,11 @@ self.targets = project_json['targets'] build_settings = project_json['build_settings'] self.root_path = build_settings['root_path'] - self.build_path = posixpath.join(self.root_path, - build_settings['build_dir'][2:]) + self.build_path = self.GetAbsolutePath(build_settings['build_dir']) def GetAbsolutePath(self, path): - if path.startswith("//"): - return self.root_path + "/" + path[2:] + if path.startswith('//'): + return posixpath.join(self.root_path, path[2:]) else: return path
diff --git a/infra/cmake/build_skia.sh b/infra/cmake/build_skia.sh index dbd50dc..cb88147 100755 --- a/infra/cmake/build_skia.sh +++ b/infra/cmake/build_skia.sh
@@ -16,21 +16,21 @@ #BASE_DIR is the dir this script is in ($SKIA_ROOT/infra/cmake) BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd` -SKIA_DIR=`cd $BASE_DIR/../.. && pwd` +SKIA_DIR=`cd ${BASE_DIR}/../.. && pwd` -# Delete everything to do a clean build -rm -rf $SKIA_DIR/out/CMAKE -mkdir --mode=0777 -p $SKIA_DIR/out/CMAKE +OUT="$(mktemp -d)/CMAKE" -cd $SKIA_DIR +cd ${SKIA_DIR} ./bin/fetch-gn -gn gen out/CMAKE --args='is_debug=false' --ide=json --json-ide-script=../../gn/gn_to_cmake.py +gn gen ${OUT} --args='is_debug=false' --ide=json --json-ide-script=$SKIA_DIR/gn/gn_to_cmake.py -cd $SKIA_DIR/out/CMAKE +cd ${OUT} +export CC=/usr/local/bin/clang +export CXX=/usr/local/bin/clang++ cmake -G"CodeBlocks - Unix Makefiles" . cmake --build . --parallel 8 # Copy build products, ignoring the warning # for not copying directories. -cp $SKIA_DIR/out/CMAKE/* /OUT || true +cp ${OUT}/* /OUT || true chmod +rw /OUT/*