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