1*7594170eSAndroid Build Coastguard Worker# Copyright (C) 2021 The Android Open Source Project 2*7594170eSAndroid Build Coastguard Worker# 3*7594170eSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 4*7594170eSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 5*7594170eSAndroid Build Coastguard Worker# You may obtain a copy of the License at 6*7594170eSAndroid Build Coastguard Worker# 7*7594170eSAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 8*7594170eSAndroid Build Coastguard Worker# 9*7594170eSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*7594170eSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 11*7594170eSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*7594170eSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 13*7594170eSAndroid Build Coastguard Worker# limitations under the License. 14*7594170eSAndroid Build Coastguard Worker 15*7594170eSAndroid Build Coastguard Worker"""cc_library_headers is a headers only cc library.""" 16*7594170eSAndroid Build Coastguard Worker 17*7594170eSAndroid Build Coastguard Workerload(":cc_constants.bzl", "constants") 18*7594170eSAndroid Build Coastguard Workerload(":cc_library_common.bzl", "check_absolute_include_dirs_disabled", "create_ccinfo_for_includes") 19*7594170eSAndroid Build Coastguard Worker 20*7594170eSAndroid Build Coastguard Workerdef _cc_headers_impl(ctx): 21*7594170eSAndroid Build Coastguard Worker check_absolute_include_dirs_disabled( 22*7594170eSAndroid Build Coastguard Worker ctx.label.package, 23*7594170eSAndroid Build Coastguard Worker ctx.attr.export_absolute_includes, 24*7594170eSAndroid Build Coastguard Worker ) 25*7594170eSAndroid Build Coastguard Worker 26*7594170eSAndroid Build Coastguard Worker return [ 27*7594170eSAndroid Build Coastguard Worker create_ccinfo_for_includes( 28*7594170eSAndroid Build Coastguard Worker ctx, 29*7594170eSAndroid Build Coastguard Worker hdrs = ctx.files.hdrs, 30*7594170eSAndroid Build Coastguard Worker includes = ctx.attr.export_includes, 31*7594170eSAndroid Build Coastguard Worker absolute_includes = ctx.attr.export_absolute_includes, 32*7594170eSAndroid Build Coastguard Worker system_includes = ctx.attr.export_system_includes, 33*7594170eSAndroid Build Coastguard Worker deps = ctx.attr.deps, 34*7594170eSAndroid Build Coastguard Worker ), 35*7594170eSAndroid Build Coastguard Worker cc_common.CcSharedLibraryHintInfo( 36*7594170eSAndroid Build Coastguard Worker attributes = [], 37*7594170eSAndroid Build Coastguard Worker ), 38*7594170eSAndroid Build Coastguard Worker ] 39*7594170eSAndroid Build Coastguard Worker 40*7594170eSAndroid Build Coastguard Workercc_library_headers = rule( 41*7594170eSAndroid Build Coastguard Worker implementation = _cc_headers_impl, 42*7594170eSAndroid Build Coastguard Worker attrs = { 43*7594170eSAndroid Build Coastguard Worker "export_absolute_includes": attr.string_list(doc = "List of exec-root relative or absolute search paths for headers, usually passed with -I"), 44*7594170eSAndroid Build Coastguard Worker "export_includes": attr.string_list(doc = "Package-relative list of search paths for headers, usually passed with -I"), 45*7594170eSAndroid Build Coastguard Worker "export_system_includes": attr.string_list(doc = "Package-relative list of search paths for headers, usually passed with -isystem"), 46*7594170eSAndroid Build Coastguard Worker "deps": attr.label_list(doc = "Re-propagates the includes obtained from these dependencies.", providers = [CcInfo]), 47*7594170eSAndroid Build Coastguard Worker "hdrs": attr.label_list(doc = "Header files.", allow_files = constants.hdr_dot_exts), 48*7594170eSAndroid Build Coastguard Worker "min_sdk_version": attr.string(), 49*7594170eSAndroid Build Coastguard Worker "sdk_version": attr.string(), 50*7594170eSAndroid Build Coastguard Worker }, 51*7594170eSAndroid Build Coastguard Worker fragments = ["cpp"], 52*7594170eSAndroid Build Coastguard Worker provides = [CcInfo, cc_common.CcSharedLibraryHintInfo], 53*7594170eSAndroid Build Coastguard Worker doc = "A library that contains c/c++ headers which are imported by other targets.", 54*7594170eSAndroid Build Coastguard Worker) 55