| Romain Jobredeaux | 9afe61a | 2023-02-24 13:59:50 -0500 | [diff] [blame] | 1 | # 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 | |
| Alix | 05ebd13 | 2023-05-04 17:44:48 +0000 | [diff] [blame] | 15 | load("@rules_java//java:defs.bzl", "java_binary") |
| 16 | load("//build/bazel/rules/java:import.bzl", "java_import") |
| 17 | load("//build/bazel/rules/java:library.bzl", "java_library") |
| Alix | f20c8b4 | 2023-05-08 15:47:11 +0000 | [diff] [blame] | 18 | load("//build/bazel/rules/kotlin:kt_jvm_library.bzl", "kt_jvm_library") |
| Romain Jobredeaux | 9afe61a | 2023-02-24 13:59:50 -0500 | [diff] [blame] | 19 | |
| 20 | package(default_applicable_licenses = ["//build/soong/licenses:Android-Apache-2.0"]) |
| 21 | |
| Romain Jobredeaux | 9d3fe1c | 2021-08-26 14:44:30 +0000 | [diff] [blame] | 22 | java_binary( |
| Cole Faust | a66188c | 2022-07-13 11:31:11 -0700 | [diff] [blame] | 23 | name = "hello_java", |
| 24 | srcs = ["example/HelloWorld.java"], |
| 25 | main_class = "com.bazel.example.HelloWorld", |
| Romain Jobredeaux | 9afe61a | 2023-02-24 13:59:50 -0500 | [diff] [blame] | 26 | target_compatible_with = select({ |
| Jingwen Chen | 1786148 | 2023-10-11 10:51:23 +0000 | [diff] [blame] | 27 | "//build/bazel_common_rules/platforms/os:android": ["@platforms//:incompatible"], |
| Romain Jobredeaux | 9afe61a | 2023-02-24 13:59:50 -0500 | [diff] [blame] | 28 | "//conditions:default": [], |
| 29 | }), |
| 30 | deps = [ |
| 31 | ":hello_java_lib", |
| 32 | ":some_kotlin_lib", |
| 33 | ], |
| Romain Jobredeaux | 9d3fe1c | 2021-08-26 14:44:30 +0000 | [diff] [blame] | 34 | ) |
| 35 | |
| 36 | java_library( |
| Cole Faust | a66188c | 2022-07-13 11:31:11 -0700 | [diff] [blame] | 37 | name = "hello_java_lib", |
| 38 | srcs = ["example_lib/HelloLib.java"], |
| Romain Jobredeaux | 9afe61a | 2023-02-24 13:59:50 -0500 | [diff] [blame] | 39 | sdk_version = "current", |
| 40 | ) |
| 41 | |
| 42 | java_import( |
| 43 | name = "hello_java_import", |
| 44 | jars = ["hello_java_import.jar"], |
| 45 | ) |
| 46 | |
| 47 | kt_jvm_library( |
| 48 | name = "some_kotlin_lib", |
| 49 | srcs = ["example_lib/SomeKotlin.kt"], |
| 50 | sdk_version = "current", |
| Romain Jobredeaux | 9d3fe1c | 2021-08-26 14:44:30 +0000 | [diff] [blame] | 51 | ) |