Skip to content

Commit

Permalink
Internal change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 595413507
Change-Id: I38db2de9e1fed06679ca15184ce422f2173f7e45
  • Loading branch information
zhengwei143 authored and copybara-github committed Jan 3, 2024
1 parent f2376dc commit 239b89a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Packaging

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
load("//src:release_archive.bzl", "release_archive")
load(":embedded_tools.bzl", "srcsfile")
Expand Down Expand Up @@ -600,3 +601,8 @@ filegroup(
"@workspace_repo_cache//:files",
],
)

bzl_library(
name = "build_defs_bzl",
srcs = ["build_defs.bzl"],
)
25 changes: 25 additions & 0 deletions src/build_defs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 The Bazel Authors. All rights reserved.
#
# 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.

"""Utility for restricting java_library to Java 11 APIs."""

load("@rules_java//java:defs.bzl", "java_library")

# Drop in replacement for java_library that builds the library at Java language level 11.
def java_11_library(**attrs):
javacopts = attrs.pop("javacopts", [])
java_library(
javacopts = javacopts + ["-source 11", "-target 11"],
**attrs
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@rules_java//java:defs.bzl", "java_library")
load("//src:build_defs.bzl", "java_11_library")

# Description:
# Zip provides a library for reading and writing zip files, allowing more
Expand All @@ -21,7 +21,7 @@ filegroup(
srcs = glob(["*.java"]),
)

java_library(
java_11_library(
name = "zip",
srcs = glob(["*.java"]),
visibility = ["//visibility:public"],
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/google/devtools/build/lib/util/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//src:build_defs.bzl", "java_11_library")
load("@rules_java//java:defs.bzl", "java_library")

package(
Expand Down Expand Up @@ -30,7 +31,7 @@ java_library(
],
)

java_library(
java_11_library(
name = "os",
srcs = ["OS.java"],
)
Expand Down Expand Up @@ -156,7 +157,7 @@ java_library(
],
)

java_library(
java_11_library(
name = "pair",
srcs = [
"Pair.java",
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/google/devtools/build/lib/windows/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//src:build_defs.bzl", "java_11_library")
load("@rules_java//java:defs.bzl", "java_library")

package(
Expand All @@ -12,7 +13,7 @@ filegroup(
visibility = ["//src:__subpackages__"],
)

java_library(
java_11_library(
name = "file",
srcs = ["WindowsFileOperations.java"],
deps = ["//src/main/java/com/google/devtools/build/lib/jni"],
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/google/devtools/common/options/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("//src:build_defs.bzl", "java_11_library")
load("@rules_java//java:defs.bzl", "java_library")

# Description:
Expand Down Expand Up @@ -33,13 +34,13 @@ java_library(
],
)

java_library(
java_11_library(
name = "options",
exported_plugins = ["//src/main/java/com/google/devtools/common/options/processor:options_preprocessor"],
exports = [":options_internal"],
)

java_library(
java_11_library(
name = "options_internal",
srcs = glob(
["*.java"],
Expand Down

0 comments on commit 239b89a

Please sign in to comment.