Skip to content

Commit

Permalink
Migrate Flogger from WORKSPACE to Bzlmod and bump bazel version to 7.…
Browse files Browse the repository at this point in the history
…3.1.

Fixes #387.

RELNOTES=n/a
PiperOrigin-RevId: 682479608
  • Loading branch information
chaoren authored and Flogger Team committed Oct 4, 2024
1 parent f07e740 commit febddca
Show file tree
Hide file tree
Showing 7 changed files with 828 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.2
7.3.1
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: ~/.cache/bazel/*/*/external
key: bazel-${{ hashFiles('WORKSPACE') }}
key: bazel-${{ hashFiles('MODULE.bazel') }}
restore-keys: |
bazel-
- name: 'Set up JDK ${{ matrix.java }}'
Expand All @@ -37,4 +37,4 @@ jobs:
distribution: 'zulu'
- name: 'Test'
shell: bash
run: bazel test --test_output=errors //...
run: bazelisk test --lockfile_mode=error --test_output=errors //...
21 changes: 21 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2024 The Flogger Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

bazel_dep(name = "rules_java", version = "7.12.1")
bazel_dep(name = "google_bazel_common")
git_override(
module_name = "google_bazel_common",
commit = "e2204d625d97dda88112af0b0a9e56ed7712d15c",
remote = "https://github.com/google/bazel-common",
)
800 changes: 800 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

55 changes: 0 additions & 55 deletions WORKSPACE

This file was deleted.

6 changes: 2 additions & 4 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ $$JAVABASE/bin/javac -d $$TMPDIR -source 8 -target 8 -cp $${STACK_GETTER_COMMON}
$(location src/main/java/com/google/common/flogger/util/JavaLangAccessStackGetter.java)
cd $$TMPDIR && $$JAR cf $$OUTPUT com/google/common/flogger/util/*StackGetter*.class
""",
toolchains = ["@openjdk8//:runtime"],
tools = ["@openjdk8//:runtime"],
toolchains = ["@rules_java//toolchains:jdk_8"],
)

genrule(
Expand All @@ -104,8 +103,7 @@ $$JAVABASE/bin/javac -d $$TMPDIR -source 8 -target 8 -cp $${STACK_GETTER_COMMON}
$(location src/main/java/com/google/common/flogger/util/StackWalkerStackGetter.java)
cd $$TMPDIR && $$JAR cf $$OUTPUT com/google/common/flogger/util/*StackGetter*.class
""",
toolchains = ["@openjdk11//:runtime"],
tools = ["@openjdk11//:runtime"],
toolchains = ["@rules_java//toolchains:remote_jdk11"],
)

java_library(
Expand Down
5 changes: 2 additions & 3 deletions log4j2/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ java_library(
deps = [
"//api",
"//api:system_backend",
# TODO(cpovirk): Why do we use a mix of google_bazel_common and "direct" deps?
"@com_google_errorprone_error_prone_annotations",
"@google_bazel_common//third_party/java/log4j2",
"@google_bazel_common//third_party/java/error_prone:annotations",
"@google_bazel_common//third_party/java/jspecify_annotations",
"@google_bazel_common//third_party/java/log4j2",
],
)

Expand Down

0 comments on commit febddca

Please sign in to comment.