From 5eb64a6f3e47b570f544524ef48dc6ef0e4dce59 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 17 Jul 2017 22:45:17 +0200 Subject: [PATCH] Revert "Merge pull request #1931 from centricular/use-patched-ninja" This reverts commit aab7ada356e02033e4030143cf363d06d975283b, reversing changes made to e1b24765afd9e7d2d8043a408d69c7ad814d3551. --- .appveyor.yml | 8 +++++--- .travis.yml | 8 +++----- ci/appveyor-install.bat | 4 +--- mesonbuild/backend/ninjabackend.py | 11 ++++++----- mesonbuild/environment.py | 5 +---- run_tests.py | 6 ------ 6 files changed, 16 insertions(+), 26 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a78a328b5..655144599 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -49,15 +49,17 @@ branches: only: - master +skip_commits: + files: + - docs/**/* + install: - cmd: set "ORIG_PATH=%PATH%" # Boost 1.56.0: https://www.appveyor.com/docs/build-environment/#boost #- cmd: set "BOOST_ROOT=C:\Libraries\boost" - # Use a Ninja with QuLogic's patch: https://github.com/ninja-build/ninja/issues/1219 - - cmd: set "MESON_FIXED_NINJA=1" - - ps: (new-object net.webclient).DownloadFile('http://nirbheek.in/files/binaries/ninja/win32/ninja.exe', 'C:\projects\meson\ninja.exe') # Use the x86 python only when building for x86 for the cpython tests. # For all other archs (including, say, arm), use the x64 python. + - ps: (new-object net.webclient).DownloadFile('https://www.dropbox.com/s/bbzvepq85hv47x1/ninja.exe?dl=1', 'C:\projects\meson\ninja.exe') - cmd: if %arch%==x86 (set MESON_PYTHON_PATH=C:\python34) else (set MESON_PYTHON_PATH=C:\python34-x64) # Set paths and config for each build type. diff --git a/.travis.yml b/.travis.yml index 662b769b4..724f9adbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,7 @@ matrix: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi - # Use a Ninja with QuLogic's patch: https://github.com/ninja-build/ninja/issues/1219 - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p $HOME/tools; curl -L http://nirbheek.in/files/binaries/ninja/macos/ninja -o $HOME/tools/ninja; chmod +x $HOME/tools/ninja; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ninja python3; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull jpakkane/mesonci:zesty; fi - pip3 install codecov - mkdir .coverage @@ -49,9 +47,9 @@ script: ci_env=`bash <(curl -s https://codecov.io/env)` docker run $ci_env -v ${PWD}/.coverage:/root/.coverage \ withgit \ - /bin/sh -c "cd /root && mkdir -p tools; wget -c http://nirbheek.in/files/binaries/ninja/linux-amd64/ninja -O /root/tools/ninja; chmod +x /root/tools/ninja; CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX PATH=/root/tools:$PATH MESON_FIXED_NINJA=1 ./run_tests.py --cov -- $MESON_ARGS && chmod -R a+rwX .coverage" + /bin/sh -c "cd /root && CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX ./run_tests.py --cov -- $MESON_ARGS && chmod -R a+rwX .coverage" fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) OBJC=$CC OBJCXX=$CXX PATH=$HOME/tools:$PATH MESON_FIXED_NINJA=1 ./run_tests.py --cov --backend=ninja -- $MESON_ARGS ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) OBJC=$CC OBJCXX=$CXX ./run_tests.py --cov --backend=ninja -- $MESON_ARGS ; fi after_success: - coverage3 combine diff --git a/ci/appveyor-install.bat b/ci/appveyor-install.bat index 9eddeac70..becc80a1f 100644 --- a/ci/appveyor-install.bat +++ b/ci/appveyor-install.bat @@ -1,7 +1,5 @@ set CACHE=C:\cache set CYGWIN_MIRROR="http://cygwin.mirror.constant.com" -set CYGWIN_ADDITIONAL_REPO="http://www.dronecode.org.uk/cygwin/" -set CYGWIN_ADDITIONAL_REPO_KEY="http://www.dronecode.org.uk/cygwin/dronecode.gpg" if _%arch%_ == _x64_ set SETUP=setup-x86_64.exe && set CYGWIN_ROOT=C:\cygwin64 if _%arch%_ == _x86_ set SETUP=setup-x86.exe && set CYGWIN_ROOT=C:\cygwin @@ -9,5 +7,5 @@ if _%arch%_ == _x86_ set SETUP=setup-x86.exe && set CYGWIN_ROOT=C:\cygwin if not exist %CACHE% mkdir %CACHE% echo Updating Cygwin and installing ninja and test prerequisites -%CYGWIN_ROOT%\%SETUP% -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -s "%CYGWIN_ADDITIONAL_REPO%" -K "%CYGWIN_ADDITIONAL_REPO_KEY%" -l "%CACHE%" -g -P "ninja,gcc-objc,gcc-objc++,libglib2.0-devel,zlib-devel,python3-pip" +%CYGWIN_ROOT%\%SETUP% -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -l "%CACHE%" -g -P "ninja,gcc-objc,gcc-objc++,libglib2.0-devel,zlib-devel,python3-pip" echo Install done diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index ece4e8be7..7f974ee98 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -177,9 +177,6 @@ int dummy; def generate(self, interp): self.interpreter = interp - self.ninja_command = environment.detect_ninja(log=True) - if self.ninja_command is None: - raise MesonException('Could not detect Ninja v1.5 or newer') outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename) tempfilename = outfilename + '~' with open(tempfilename, 'w') as outfile: @@ -213,9 +210,10 @@ int dummy; # http://clang.llvm.org/docs/JSONCompilationDatabase.html def generate_compdb(self): + ninja_exe = environment.detect_ninja() native_compilers = ['%s_COMPILER' % i for i in self.build.compilers] cross_compilers = ['%s_CROSS_COMPILER' % i for i in self.build.cross_compilers] - ninja_compdb = [self.ninja_command, '-t', 'compdb'] + native_compilers + cross_compilers + ninja_compdb = [ninja_exe, '-t', 'compdb'] + native_compilers + cross_compilers builddir = self.environment.get_build_dir() try: jsondb = subprocess.check_output(ninja_compdb, cwd=builddir) @@ -2511,8 +2509,11 @@ rule FORTRAN_DEP_HACK default = 'default all\n\n' outfile.write(default) + ninja_command = environment.detect_ninja() + if ninja_command is None: + raise MesonException('Could not detect Ninja v1.6 or newer') elem = NinjaBuildElement(self.all_outputs, 'clean', 'CUSTOM_COMMAND', 'PHONY') - elem.add_item('COMMAND', [self.ninja_command, '-t', 'clean']) + elem.add_item('COMMAND', [ninja_command, '-t', 'clean']) elem.add_item('description', 'Cleaning.') # If we have custom targets in this project, add all their outputs to diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index b3d72e664..b0002a044 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -89,19 +89,16 @@ def find_coverage_tools(): genhtml_exe = None return gcovr_exe, lcov_exe, genhtml_exe -def detect_ninja(version='1.5', log=False): +def detect_ninja(version='1.5'): for n in ['ninja', 'ninja-build']: try: p, found = Popen_safe([n, '--version'])[0:2] except (FileNotFoundError, PermissionError): # Doesn't exist in PATH or isn't executable continue - found = found.strip() # Perhaps we should add a way for the caller to know the failure mode # (not found or too old) if p.returncode == 0 and mesonlib.version_compare(found, '>=' + version): - if log: - mlog.log('Found ninja-{} at {}'.format(found, shlex.quote(shutil.which(n)))) return n def detect_native_windows_arch(): diff --git a/run_tests.py b/run_tests.py index b17e0cb5d..040f9587f 100755 --- a/run_tests.py +++ b/run_tests.py @@ -104,12 +104,6 @@ def get_backend_commands(backend, debug=False): return cmd, clean_cmd, test_cmd, install_cmd, uninstall_cmd def ensure_backend_detects_changes(backend): - # We're using a ninja with QuLogic's patch for sub-1s resolution timestamps - # and not running on HFS+ which only stores dates in seconds: - # https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#HFSPlusDates - # FIXME: Upgrade Travis image to Apple FS when that becomes available - if 'MESON_FIXED_NINJA' in os.environ and not mesonlib.is_osx(): - return # This is needed to increase the difference between build.ninja's # timestamp and the timestamp of whatever you changed due to a Ninja # bug: https://github.com/ninja-build/ninja/issues/371