From 91631f2ca3e1d03d2421ea05b6acc44006f026ab Mon Sep 17 00:00:00 2001 From: hoisie Date: Thu, 2 Dec 2021 10:47:26 -0800 Subject: [PATCH] Switch to Ninja for building the native runtime The version of `make` provided in the MSYS2 does not work well with CMake on Windows. This makes it impossible to do incremental nativeruntme builds on Windows. See https://stackoverflow.com/questions/2401976 for more details on the issue. Switch to using Ninja everywhere, which seems to be more reliable across platforms. PiperOrigin-RevId: 413717789 --- .github/workflows/build_native_runtime.yml | 12 ++++++++++-- .github/workflows/tests.yml | 8 ++++++++ nativeruntime/build.gradle | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_native_runtime.yml b/.github/workflows/build_native_runtime.yml index 2d4f95e6df8..d403062a99c 100644 --- a/.github/workflows/build_native_runtime.yml +++ b/.github/workflows/build_native_runtime.yml @@ -32,6 +32,14 @@ jobs: with: java-version: 11.0.8 + - name: Install Ninja (Mac OS) + if: runner.os =='macOS' + run: brew install ninja + + - name: Install Ninja (Linux) + if: runner.os =='Linux' + run: sudo apt-get install ninja-build + - name: Cache ICU build output id: cache-icu uses: actions/cache@v2 @@ -61,8 +69,8 @@ jobs: run: | mkdir build cd build - ICU_ROOT_DIR=$HOME/icu-bin cmake -B . -S ../nativeruntime/cpp - make + ICU_ROOT_DIR=$HOME/icu-bin cmake -B . -S ../nativeruntime/cpp -G Ninja + ninja - name: Rename libnativeruntime for Linux if: runner.os == 'Linux' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index da64f19bf8b..42624559c09 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,6 +52,10 @@ jobs: make -j4 make install + - name: Install Ninja (Linux) + if: runner.os =='Linux' + run: sudo apt-get install ninja-build + - name: Build run: ICU_ROOT_DIR=$HOME/icu-bin SKIP_ERRORPRONE=true SKIP_JAVADOC=true ./gradlew clean assemble testClasses --parallel --stacktrace --no-watch-fs @@ -93,6 +97,10 @@ jobs: path: ~/icu-bin key: ${{ runner.os }}-${{env.CPU_ARCH}}-icu-${{ hashFiles('nativeruntime/external/icu/**') }} + - name: Install Ninja + if: runner.os =='Linux' + run: sudo apt-get install ninja-build + - name: Run unit tests run: | ICU_ROOT_DIR=$HOME/icu-bin SKIP_ERRORPRONE=true SKIP_JAVADOC=true ./gradlew test --info --stacktrace --continue \ diff --git a/nativeruntime/build.gradle b/nativeruntime/build.gradle index 1c3262488e9..9a7ef90de47 100644 --- a/nativeruntime/build.gradle +++ b/nativeruntime/build.gradle @@ -29,7 +29,7 @@ task cmakeNativeRuntime { mkdir "$buildDir/cpp" exec { workingDir "$buildDir/cpp" - commandLine 'cmake', "-B", ".", "-S","$projectDir/cpp/" + commandLine 'cmake', "-B", ".", "-S","$projectDir/cpp/", "-G", "Ninja" } } } @@ -80,7 +80,7 @@ task makeNativeRuntime { doLast { exec { workingDir "$buildDir/cpp" - commandLine 'make' + commandLine 'ninja' } } }