Paul Duffin | 1c6c1c7 | 2020-02-21 10:28:43 +0000 | [diff] [blame] | 1 | // Copyright 2020 Google Inc. 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 | package cc |
| 16 | |
| 17 | import "android/soong/android" |
| 18 | |
| 19 | func init() { |
| 20 | RegisterLibraryHeadersBuildComponents(android.InitRegistrationContext) |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 21 | |
| 22 | // Register sdk member types. |
| 23 | android.RegisterSdkMemberType(headersLibrarySdkMemberType) |
| 24 | } |
| 25 | |
| 26 | var headersLibrarySdkMemberType = &librarySdkMemberType{ |
| 27 | SdkMemberTypeBase: android.SdkMemberTypeBase{ |
| 28 | PropertyName: "native_header_libs", |
| 29 | SupportsSdk: true, |
| 30 | }, |
| 31 | prebuiltModuleType: "cc_prebuilt_library_headers", |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 32 | noOutputFiles: true, |
Paul Duffin | 1c6c1c7 | 2020-02-21 10:28:43 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | func RegisterLibraryHeadersBuildComponents(ctx android.RegistrationContext) { |
| 36 | ctx.RegisterModuleType("cc_library_headers", LibraryHeaderFactory) |
Paul Duffin | f5ea9e1 | 2020-02-21 10:57:00 +0000 | [diff] [blame] | 37 | ctx.RegisterModuleType("cc_prebuilt_library_headers", prebuiltLibraryHeaderFactory) |
Paul Duffin | 1c6c1c7 | 2020-02-21 10:28:43 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | // cc_library_headers contains a set of c/c++ headers which are imported by |
| 41 | // other soong cc modules using the header_libs property. For best practices, |
| 42 | // use export_include_dirs property or LOCAL_EXPORT_C_INCLUDE_DIRS for |
| 43 | // Make. |
| 44 | func LibraryHeaderFactory() android.Module { |
| 45 | module, library := NewLibrary(android.HostAndDeviceSupported) |
| 46 | library.HeaderOnly() |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 47 | module.sdkMemberTypes = []android.SdkMemberType{headersLibrarySdkMemberType} |
Paul Duffin | 1c6c1c7 | 2020-02-21 10:28:43 +0000 | [diff] [blame] | 48 | return module.Init() |
| 49 | } |
Paul Duffin | f5ea9e1 | 2020-02-21 10:57:00 +0000 | [diff] [blame] | 50 | |
| 51 | // cc_prebuilt_library_headers is a prebuilt version of cc_library_headers |
| 52 | func prebuiltLibraryHeaderFactory() android.Module { |
| 53 | module, library := NewPrebuiltLibrary(android.HostAndDeviceSupported) |
| 54 | library.HeaderOnly() |
| 55 | return module.Init() |
| 56 | } |