From 9c75a2a26a2b704ee8895ae298e5bff3e78acc70 Mon Sep 17 00:00:00 2001 From: Eugene Kliuchnikov Date: Wed, 11 Oct 2017 22:26:37 +0200 Subject: Use bazel in appveyor (#612) +publish jni dll --- scripts/appveyor.yml | 16 ++++++++++++++-- scripts/fix-win-bazel-build.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 scripts/fix-win-bazel-build.py (limited to 'scripts') diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 2c98f19..a825b22 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -26,6 +26,8 @@ environment: - BUILD_SYSTEM: make ARCH: "x86_64" + - BUILD_SYSTEM: bazel + install: - IF "%BUILD_SYSTEM%"=="Python" ( SET "PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%" && @@ -39,14 +41,17 @@ install: SET "TOOLCHAIN=x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64" ) ) +- IF "%BUILD_SYSTEM%"=="bazel" ( + appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.6.1/bazel-0.6.1-windows-x86_64.exe -FileName bazel.exe + ) before_build: +- FOR /f %%i in ('C:\cygwin64\bin\date.exe +%%Y-%%m-%%d') DO SET "RELEASE_DATE=%%i" - IF "%BUILD_SYSTEM%"=="CMake" ( mkdir builddir && cd builddir && cmake -G "%GENERATOR%" .. ) - IF "%BUILD_SYSTEM%"=="make" ( SET "CC=gcc" && SET "PATH=C:\mingw-w64\%TOOLCHAIN%\bin;%PATH%" && - COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\%TOOLCHAIN%\bin\make.exe && - FOR /f %%i in ('C:\cygwin64\bin\date.exe +%%Y-%%m-%%d') DO SET "RELEASE_DATE=%%i" + COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\%TOOLCHAIN%\bin\make.exe ) build_script: @@ -57,11 +62,18 @@ build_script: cd bin && 7z a -tzip -mx9 brotli-win-%ARCH%-%RELEASE_DATE%.zip brotli.exe && appveyor PushArtifact brotli-win-%ARCH%-%RELEASE_DATE%.zip && cd .. ) +- IF "%BUILD_SYSTEM%"=="bazel" ( + bazel --batch build -c opt java/org/brotli/wrapper/...:all && + python scripts/fix-win-bazel-build.py && + cd bazel-bin && 7z a -tzip -mx9 brotli-win-bazel-jni-%RELEASE_DATE%.zip brotli_jni.dll && + appveyor PushArtifact brotli-win-bazel-jni-%RELEASE_DATE%.zip && cd .. + ) test_script: - IF "%BUILD_SYSTEM%"=="CMake" ( ctest --output-on-failure --interactive-debug-mode 0 -C Debug ) - IF "%BUILD_SYSTEM%"=="Python" ( python setup.py test ) - IF "%BUILD_SYSTEM%"=="make" ( sh -c "make test" ) +- IF "%BUILD_SYSTEM%"=="bazel" ( bazel --batch test -c opt --test_output streamed java/org/brotli/wrapper/...:all ) deploy: - provider: BinTray diff --git a/scripts/fix-win-bazel-build.py b/scripts/fix-win-bazel-build.py new file mode 100644 index 0000000..fcba6f3 --- /dev/null +++ b/scripts/fix-win-bazel-build.py @@ -0,0 +1,31 @@ +import fnmatch +import os +import os.path +from shutil import copyfile + +matches = [] +for root, dirnames, filenames in os.walk('bazel-bin\\java\\org\\brotli'): + for filename in fnmatch.filter(filenames, '*.runfiles_manifest'): + matches.append(os.path.join(root, filename)) + +for match in matches: + runfiles = match[:-len('_manifest')] + with open(match) as manifest: + for entry in manifest: + entry = entry.strip() + if not entry.startswith("org_brotli"): + continue + if entry.startswith('org_brotli/external'): + continue + (alias, space, link) = entry.partition(' ') + if alias.endswith('.jar') or alias.endswith('.exe'): + continue + link = link.replace('/', '\\') + alias = alias.replace('/', '\\') + dst = os.path.join(runfiles, alias) + if not os.path.exists(dst): + print(link + ' -> ' + dst) + parent = os.path.dirname(dst) + if not os.path.exists(parent): + os.makedirs(parent) + copyfile(link, dst) -- cgit v1.1