1# Copyright (C) 2021 The Dagger Authors. 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# Description: 16# A library containing intermediate representations of the various Hilt 17# aggregating annotations along with logic to process them. 18 19load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") 20 21package(default_visibility = ["//:src"]) 22 23kt_jvm_library( 24 name = "ir", 25 srcs = glob(["*.kt"]), 26 # Dependencies here should be kept to a minimum since this library is 27 # shadowed into the Hilt Gradle Plugin artifact. 28 deps = [ 29 "//third_party/java/javapoet", 30 ], 31) 32 33# Current `kt_jvm_library` does not output source jars and gen_maven_artifact expects one. 34# See: https://github.com/bazelbuild/rules_kotlin/issues/324 35genrule( 36 name = "ir-sources", 37 srcs = glob(["*.kt"]), 38 outs = ["libir-src.jar"], 39 cmd = """ 40 TEMP="$$(mktemp -d)" 41 for file in $(SRCS); do 42 filename="$$TEMP/$${file#java/}" 43 mkdir -p `dirname $$filename` && cp $$file $$filename 44 done 45 jar cf $@ -C $$TEMP . 46 """, 47) 48 49filegroup( 50 name = "srcs_filegroup", 51 srcs = glob(["*"]), 52) 53