mirror of
https://github.com/google/brotli.git
synced 2024-12-25 01:01:07 +00:00
parent
a0c7dafe28
commit
9c75a2a26a
21
BUILD
21
BUILD
@ -23,6 +23,24 @@ config_setting(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "windows",
|
||||
values = {"cpu": "x64_windows"},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "windows_msvc",
|
||||
values = {"cpu": "x64_windows_msvc"},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "windows_msys",
|
||||
values = {"cpu": "x64_windows_msys"},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "copy_link_jni_header",
|
||||
srcs = ["@openjdk_linux//:jni_h"],
|
||||
@ -35,6 +53,9 @@ genrule(
|
||||
srcs = select({
|
||||
":darwin": ["@openjdk_macos//:jni_md_h"],
|
||||
":darwin_x86_64": ["@openjdk_macos//:jni_md_h"],
|
||||
":windows_msys": ["@openjdk_win//:jni_md_h"],
|
||||
":windows_msvc": ["@openjdk_win//:jni_md_h"],
|
||||
":windows": ["@openjdk_win//:jni_md_h"],
|
||||
"//conditions:default": ["@openjdk_linux//:jni_md_h"],
|
||||
}),
|
||||
outs = ["jni/jni_md.h"],
|
||||
|
40
WORKSPACE
40
WORKSPACE
@ -26,33 +26,59 @@ http_archive(
|
||||
|
||||
new_http_archive(
|
||||
name = "openjdk_linux",
|
||||
url = "https://bazel-mirror.storage.googleapis.com/openjdk/azul-zulu-8.20.0.5-jdk8.0.121/zulu8.20.0.5-jdk8.0.121-linux_x64.tar.gz",
|
||||
sha256 = "7fdfb17d890406470b2303d749d3138e7f353749e67a0a22f542e1ab3e482745",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/openjdk/azul-zulu-8.23.0.3-jdk8.0.144/zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz",
|
||||
"https://bazel-mirror.storage.googleapis.com/openjdk/azul-zulu-8.23.0.3-jdk8.0.144/zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz",
|
||||
"https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz",
|
||||
],
|
||||
sha256 = "7e6284739c0e5b7142bc7a9adc61ced70dc5bb26b130b582b18e809013bcb251",
|
||||
build_file_content = """
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
filegroup(
|
||||
name = "jni_h",
|
||||
srcs = ["zulu8.20.0.5-jdk8.0.121-linux_x64/include/jni.h"],
|
||||
srcs = ["zulu8.23.0.3-jdk8.0.144-linux_x64/include/jni.h"],
|
||||
)
|
||||
filegroup(
|
||||
name = "jni_md_h",
|
||||
srcs = ["zulu8.20.0.5-jdk8.0.121-linux_x64/include/linux/jni_md.h"],
|
||||
srcs = ["zulu8.23.0.3-jdk8.0.144-linux_x64/include/linux/jni_md.h"],
|
||||
)""",
|
||||
)
|
||||
|
||||
new_http_archive(
|
||||
name = "openjdk_macos",
|
||||
url = "https://bazel-mirror.storage.googleapis.com/openjdk/azul-zulu-8.20.0.5-jdk8.0.121/zulu8.20.0.5-jdk8.0.121-macosx_x64.zip",
|
||||
sha256 = "2a58bd1d9b0cbf0b3d8d1bcdd117c407e3d5a0ec01e2f53565c9bec5cf9ea78b",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/openjdk/azul-zulu-8.23.0.3-jdk8.0.144/zulu8.23.0.3-jdk8.0.144-macosx_x64.zip",
|
||||
"https://bazel-mirror.storage.googleapis.com/openjdk/azul-zulu-8.23.0.3-jdk8.0.144/zulu8.23.0.3-jdk8.0.144-macosx_x64.zip",
|
||||
"https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-macosx_x64.zip",
|
||||
],
|
||||
sha256 = "ff533364c9cbd3b271ab5328efe28e2dd6d7bae5b630098a5683f742ecf0709d",
|
||||
build_file_content = """
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
filegroup(
|
||||
name = "jni_md_h",
|
||||
srcs = ["zulu8.20.0.5-jdk8.0.121-macosx_x64/include/darwin/jni_md.h"],
|
||||
srcs = ["zulu8.23.0.3-jdk8.0.144-macosx_x64/include/darwin/jni_md.h"],
|
||||
)""",
|
||||
)
|
||||
|
||||
new_http_archive(
|
||||
name = "openjdk_win",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/openjdk/azul-zulu-8.23.0.3-jdk8.0.144/zulu8.23.0.3-jdk8.0.144-win_x64.zip",
|
||||
"https://bazel-mirror.storage.googleapis.com/openjdk/azul-zulu-8.23.0.3-jdk8.0.144/zulu8.23.0.3-jdk8.0.144-win_x64.zip",
|
||||
"https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-win_x64.zip",
|
||||
],
|
||||
sha256 = "f1d9d3341ef7c8c9baff3597953e99a6a7c64f8608ee62c03fdd7574b7655c02",
|
||||
build_file_content = """
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
filegroup(
|
||||
name = "jni_md_h",
|
||||
srcs = ["zulu8.23.0.3-jdk8.0.144-win_x64/include/win32/jni_md.h"],
|
||||
)""",
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
31
scripts/fix-win-bazel-build.py
Normal file
31
scripts/fix-win-bazel-build.py
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user