Skip to content

Commit

Permalink
Fix bazel build
Browse files Browse the repository at this point in the history
Drive-by: simplify constraints
  • Loading branch information
eustas committed Dec 29, 2023
1 parent fef82ea commit 735c679
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 83 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ tests/testdata/* binary
BUILD.bazel !export-ignore
CHANGELOG.md !export-ignore
CMakeLists.txt !export-ignore
compiler_config_setting.bzl !export-ignore
CONTRIBUTING.md !export-ignore
LICENSE !export-ignore
MANIFEST.in !export-ignore
Expand Down
34 changes: 8 additions & 26 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Description:
# Brotli is a generic-purpose lossless compression algorithm.

load(":compiler_config_setting.bzl", "create_msvc_config")

package(
default_visibility = ["//visibility:public"],
)
Expand All @@ -12,37 +10,21 @@ licenses(["notice"]) # MIT
exports_files(["LICENSE"])

config_setting(
name = "darwin",
values = {"cpu": "darwin"},
visibility = ["//visibility:public"],
)

config_setting(
name = "darwin_x86_64",
values = {"cpu": "darwin_x86_64"},
visibility = ["//visibility:public"],
)

config_setting(
name = "windows",
values = {"cpu": "x64_windows"},
name = "clang-cl",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "clang-cl",
},
visibility = ["//visibility:public"],
)

config_setting(
name = "windows_msvc",
values = {"cpu": "x64_windows_msvc"},
name = "msvc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
},
visibility = ["//visibility:public"],
)

config_setting(
name = "windows_msys",
values = {"cpu": "x64_windows_msys"},
visibility = ["//visibility:public"],
)

create_msvc_config()

STRICT_C_OPTIONS = select({
":msvc": [],
":clang-cl": [
Expand Down
40 changes: 0 additions & 40 deletions compiler_config_setting.bzl

This file was deleted.

14 changes: 7 additions & 7 deletions go/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
sha256 = "c8035e8ae248b56040a65ad3f0b7434712e2037e5dfdcebfe97576e620422709",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.44.0/rules_go-v0.44.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.44.0/rules_go-v0.44.0.zip",
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(version = "1.17.1")
go_register_toolchains(version = "1.21.5")

http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
],
)

Expand Down
40 changes: 35 additions & 5 deletions java/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@ package(
default_visibility = ["//visibility:public"],
)

config_setting(
name = "darwin",
values = {"cpu": "darwin"},
visibility = ["//visibility:public"],
)

config_setting(
name = "darwin_x86_64",
values = {"cpu": "darwin_x86_64"},
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"],
)

# >>> JNI headers

genrule(
Expand All @@ -14,11 +44,11 @@ genrule(
genrule(
name = "copy_link_jni_md_header",
srcs = select({
"@org_brotli//:darwin": ["@openjdk_macosx_jni_md_h//file"],
"@org_brotli//:darwin_x86_64": ["@openjdk_macosx_jni_md_h//file"],
"@org_brotli//:windows_msys": ["@openjdk_windows_jni_md_h//file"],
"@org_brotli//:windows_msvc": ["@openjdk_windows_jni_md_h//file"],
"@org_brotli//:windows": ["@openjdk_windows_jni_md_h//file"],
":darwin": ["@openjdk_macosx_jni_md_h//file"],
":darwin_x86_64": ["@openjdk_macosx_jni_md_h//file"],
":windows_msys": ["@openjdk_windows_jni_md_h//file"],
":windows_msvc": ["@openjdk_windows_jni_md_h//file"],
":windows": ["@openjdk_windows_jni_md_h//file"],
"//conditions:default": ["@openjdk_solaris_jni_md_h//file"],
}),
outs = ["jni/jni_md.h"],
Expand Down
9 changes: 9 additions & 0 deletions java/org/brotli/wrapper/enc/EncoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.brotli.integration.BundleHelper;
import org.brotli.wrapper.dec.BrotliInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -22,8 +23,16 @@ static InputStream getBundle() throws IOException {
return new FileInputStream(System.getProperty("TEST_BUNDLE"));
}

static void ensureSharding() throws IOException {
String shardingStatusPath = System.getProperty("TEST_SHARD_STATUS_FILE");
if (shardingStatusPath != null) {
new File(shardingStatusPath).createNewFile();
}
}

/** Creates a test suite. */
public static TestSuite suite() throws IOException {
ensureSharding();
TestSuite suite = new TestSuite();
InputStream bundle = getBundle();
try {
Expand Down
8 changes: 4 additions & 4 deletions js/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_closure",
sha256 = "d66deed38a0bb20581c15664f0ab62270af5940786855c7adc3087b27168b529",
strip_prefix = "rules_closure-0.11.0",
sha256 = "9498e57368efb82b985db1ed426a767cbf1ba0398fd7aed632fc3908654e1b1e",
strip_prefix = "rules_closure-0.12.0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.11.0.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/0.11.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.12.0.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/0.12.0.tar.gz",
],
)

Expand Down

0 comments on commit 735c679

Please sign in to comment.