blob: 06cd0686f629a81033209cb3d6b07ed4a36147bd [file] [log] [blame]
Romain Jobredeaux9afe61a2023-02-24 13:59:50 -05001# Copyright (C) 2023 The Android Open Source Project
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
Alix05ebd132023-05-04 17:44:48 +000015load("@rules_java//java:defs.bzl", "java_binary")
16load("//build/bazel/rules/java:import.bzl", "java_import")
17load("//build/bazel/rules/java:library.bzl", "java_library")
Alixf20c8b42023-05-08 15:47:11 +000018load("//build/bazel/rules/kotlin:kt_jvm_library.bzl", "kt_jvm_library")
Romain Jobredeaux9afe61a2023-02-24 13:59:50 -050019
20package(default_applicable_licenses = ["//build/soong/licenses:Android-Apache-2.0"])
21
Romain Jobredeaux9d3fe1c2021-08-26 14:44:30 +000022java_binary(
Cole Fausta66188c2022-07-13 11:31:11 -070023 name = "hello_java",
24 srcs = ["example/HelloWorld.java"],
25 main_class = "com.bazel.example.HelloWorld",
Romain Jobredeaux9afe61a2023-02-24 13:59:50 -050026 target_compatible_with = select({
Jingwen Chen17861482023-10-11 10:51:23 +000027 "//build/bazel_common_rules/platforms/os:android": ["@platforms//:incompatible"],
Romain Jobredeaux9afe61a2023-02-24 13:59:50 -050028 "//conditions:default": [],
29 }),
30 deps = [
31 ":hello_java_lib",
32 ":some_kotlin_lib",
33 ],
Romain Jobredeaux9d3fe1c2021-08-26 14:44:30 +000034)
35
36java_library(
Cole Fausta66188c2022-07-13 11:31:11 -070037 name = "hello_java_lib",
38 srcs = ["example_lib/HelloLib.java"],
Romain Jobredeaux9afe61a2023-02-24 13:59:50 -050039 sdk_version = "current",
40)
41
42java_import(
43 name = "hello_java_import",
44 jars = ["hello_java_import.jar"],
45)
46
47kt_jvm_library(
48 name = "some_kotlin_lib",
49 srcs = ["example_lib/SomeKotlin.kt"],
50 sdk_version = "current",
Romain Jobredeaux9d3fe1c2021-08-26 14:44:30 +000051)