1# Copyright 2022 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""Macro encapsulating the java_binary implementation 16 17This is needed since the `executable` nature of the target must be computed from 18the supplied value of the `create_executable` attribute. 19""" 20 21load( 22 "//java/common/rules:java_binary_wrapper.bzl", 23 "register_java_binary_rules", 24 "register_legacy_java_binary_rules", 25) 26load("//java/private:native.bzl", "get_internal_java_common") 27load(":bazel_java_binary.bzl", java_bin_exec = "java_binary") 28load(":bazel_java_binary_nonexec.bzl", java_bin_nonexec = "java_binary") 29 30# copybara: default visibility 31 32def java_binary(**kwargs): 33 if get_internal_java_common().incompatible_disable_non_executable_java_binary(): 34 register_java_binary_rules( 35 java_bin_exec, 36 **kwargs 37 ) 38 else: 39 register_legacy_java_binary_rules( 40 java_bin_exec, 41 java_bin_nonexec, 42 **kwargs 43 ) 44