aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Wankadia <junyer@google.com>2019-01-31 09:09:54 -0800
committerPaul Wankadia <junyer@google.com>2019-01-31 17:14:19 +0000
commit05f7d011e473f74d3d07028855ef589d7bc3d84f (patch)
treede646c533442e43e6c90655a882c6f3145faa34c
parent4b787623c216c444b2ea295183ded7a100e1b593 (diff)
downloadregex-re2-05f7d011e473f74d3d07028855ef589d7bc3d84f.tar.gz
Refactor the CMake scripts.
Change-Id: Ib5df245afaa639be21eae1df579dda1e66aa73ee Reviewed-on: https://code-review.googlesource.com/c/37953 Reviewed-by: Paul Wankadia <junyer@google.com>
-rwxr-xr-xkokoro/cmake.sh23
-rwxr-xr-xkokoro/macos-cmake.sh14
-rwxr-xr-xkokoro/windows-cmake.bat2
-rwxr-xr-xkokoro/windows-cmake.sh14
4 files changed, 26 insertions, 27 deletions
diff --git a/kokoro/cmake.sh b/kokoro/cmake.sh
new file mode 100755
index 0000000..0cb79f5
--- /dev/null
+++ b/kokoro/cmake.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -eux
+
+cd git/re2
+
+case "${KOKORO_JOB_NAME}" in
+ */windows-*)
+ CMAKE_G_A_FLAGS=('-G' 'Visual Studio 14 2015' '-A' 'x64')
+ ;;
+ *)
+ CMAKE_G_A_FLAGS=()
+ ;;
+esac
+
+cmake -D CMAKE_BUILD_TYPE=Debug "${CMAKE_G_A_FLAGS[@]}" .
+cmake --build . --config Debug --clean-first
+ctest -C Debug --output-on-failure -E 'dfa|exhaustive|random'
+
+cmake -D CMAKE_BUILD_TYPE=Release "${CMAKE_G_A_FLAGS[@]}" .
+cmake --build . --config Release --clean-first
+ctest -C Release --output-on-failure -E 'dfa|exhaustive|random'
+
+exit 0
diff --git a/kokoro/macos-cmake.sh b/kokoro/macos-cmake.sh
index a87931f..ef4b7dc 100755
--- a/kokoro/macos-cmake.sh
+++ b/kokoro/macos-cmake.sh
@@ -1,14 +1,4 @@
#!/bin/bash
set -eux
-
-cd git/re2
-
-cmake -D CMAKE_BUILD_TYPE=Debug .
-cmake --build . --config Debug --clean-first
-ctest -C Debug --output-on-failure -E 'dfa|exhaustive|random'
-
-cmake -D CMAKE_BUILD_TYPE=Release .
-cmake --build . --config Release --clean-first
-ctest -C Release --output-on-failure -E 'dfa|exhaustive|random'
-
-exit 0
+bash git/re2/kokoro/cmake.sh
+exit $?
diff --git a/kokoro/windows-cmake.bat b/kokoro/windows-cmake.bat
index 90363bc..77a4db9 100755
--- a/kokoro/windows-cmake.bat
+++ b/kokoro/windows-cmake.bat
@@ -1,2 +1,2 @@
-bash git/re2/kokoro/windows-cmake.sh
+bash git/re2/kokoro/cmake.sh
EXIT /B %ERRORLEVEL%
diff --git a/kokoro/windows-cmake.sh b/kokoro/windows-cmake.sh
deleted file mode 100755
index f43b2b3..0000000
--- a/kokoro/windows-cmake.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-set -eux
-
-cd git/re2
-
-cmake -D CMAKE_BUILD_TYPE=Debug -G 'Visual Studio 14 2015' -A x64 .
-cmake --build . --config Debug --clean-first
-ctest -C Debug --output-on-failure -E 'dfa|exhaustive|random'
-
-cmake -D CMAKE_BUILD_TYPE=Release -G 'Visual Studio 14 2015' -A x64 .
-cmake --build . --config Release --clean-first
-ctest -C Release --output-on-failure -E 'dfa|exhaustive|random'
-
-exit 0