Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 1 | package cc |
| 2 | |
| 3 | import ( |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 4 | "android/soong/android" |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 5 | |
| 6 | "github.com/google/blueprint" |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 7 | ) |
| 8 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 9 | // LinkableInterface is an interface for a type of module that is linkable in a C++ library. |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 10 | type LinkableInterface interface { |
Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 11 | android.Module |
| 12 | |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 13 | Module() android.Module |
| 14 | CcLibrary() bool |
| 15 | CcLibraryInterface() bool |
| 16 | |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 17 | OutputFile() android.OptionalPath |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 18 | CoverageFiles() android.Paths |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 19 | |
Ivan Lozano | 2b26297 | 2019-11-21 12:30:50 -0800 | [diff] [blame] | 20 | NonCcVariants() bool |
| 21 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 22 | SelectedStl() string |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 23 | |
| 24 | BuildStaticVariant() bool |
| 25 | BuildSharedVariant() bool |
| 26 | SetStatic() |
| 27 | SetShared() |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 28 | Static() bool |
| 29 | Shared() bool |
| 30 | Toc() android.OptionalPath |
| 31 | |
Jooyung Han | 624d35c | 2020-04-10 12:57:24 +0900 | [diff] [blame] | 32 | Host() bool |
| 33 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 34 | InRamdisk() bool |
| 35 | OnlyInRamdisk() bool |
| 36 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 37 | InVendorRamdisk() bool |
| 38 | OnlyInVendorRamdisk() bool |
| 39 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 40 | InRecovery() bool |
| 41 | OnlyInRecovery() bool |
| 42 | |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 43 | UseSdk() bool |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 44 | UseVndk() bool |
| 45 | MustUseVendorVariant() bool |
Colin Cross | 127bb8b | 2020-12-16 16:46:01 -0800 | [diff] [blame] | 46 | IsLlndk() bool |
| 47 | IsLlndkPublic() bool |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 48 | IsVndk() bool |
Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 49 | IsVndkExt() bool |
Colin Cross | 127bb8b | 2020-12-16 16:46:01 -0800 | [diff] [blame] | 50 | IsVndkPrivate() bool |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 51 | HasVendorVariant() bool |
Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 52 | InProduct() bool |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 53 | |
| 54 | SdkVersion() string |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 55 | AlwaysSdk() bool |
Jiyong Park | 2286afd | 2020-06-16 21:58:53 +0900 | [diff] [blame] | 56 | IsSdkVariant() bool |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 57 | |
Colin Cross | 1348ce3 | 2020-10-01 13:37:16 -0700 | [diff] [blame] | 58 | SplitPerApiLevel() bool |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 59 | } |
| 60 | |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 61 | var ( |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 62 | // Dependency tag for crtbegin, an object file responsible for initialization. |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 63 | CrtBeginDepTag = dependencyTag{name: "crtbegin"} |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 64 | // Dependency tag for crtend, an object file responsible for program termination. |
| 65 | CrtEndDepTag = dependencyTag{name: "crtend"} |
| 66 | // Dependency tag for coverage library. |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 67 | CoverageDepTag = dependencyTag{name: "coverage"} |
| 68 | ) |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 69 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 70 | // SharedDepTag returns the dependency tag for any C++ shared libraries. |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 71 | func SharedDepTag() blueprint.DependencyTag { |
| 72 | return libraryDependencyTag{Kind: sharedLibraryDependency} |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 73 | } |
| 74 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 75 | // StaticDepTag returns the dependency tag for any C++ static libraries. |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 76 | func StaticDepTag() blueprint.DependencyTag { |
| 77 | return libraryDependencyTag{Kind: staticLibraryDependency} |
| 78 | } |
Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 79 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 80 | // HeaderDepTag returns the dependency tag for any C++ "header-only" libraries. |
Zach Johnson | 3df4e63 | 2020-11-06 11:56:27 -0800 | [diff] [blame] | 81 | func HeaderDepTag() blueprint.DependencyTag { |
| 82 | return libraryDependencyTag{Kind: headerLibraryDependency} |
| 83 | } |
| 84 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 85 | // SharedLibraryInfo is a provider to propagate information about a shared C++ library. |
Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 86 | type SharedLibraryInfo struct { |
| 87 | SharedLibrary android.Path |
| 88 | UnstrippedSharedLibrary android.Path |
| 89 | |
| 90 | TableOfContents android.OptionalPath |
| 91 | CoverageSharedLibrary android.OptionalPath |
| 92 | |
| 93 | StaticAnalogue *StaticLibraryInfo |
| 94 | } |
| 95 | |
| 96 | var SharedLibraryInfoProvider = blueprint.NewProvider(SharedLibraryInfo{}) |
| 97 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 98 | // SharedStubLibrary is a struct containing information about a stub shared library. |
| 99 | // Stub libraries are used for cross-APEX dependencies; when a library is to depend on a shared |
| 100 | // library in another APEX, it must depend on the stub version of that library. |
| 101 | type SharedStubLibrary struct { |
| 102 | // The version of the stub (corresponding to the stable version of the shared library being |
| 103 | // stubbed). |
Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 104 | Version string |
| 105 | SharedLibraryInfo SharedLibraryInfo |
| 106 | FlagExporterInfo FlagExporterInfo |
| 107 | } |
| 108 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 109 | // SharedLibraryStubsInfo is a provider to propagate information about all shared library stubs |
| 110 | // which are dependencies of a library. |
| 111 | // Stub libraries are used for cross-APEX dependencies; when a library is to depend on a shared |
| 112 | // library in another APEX, it must depend on the stub version of that library. |
| 113 | type SharedLibraryStubsInfo struct { |
| 114 | SharedStubLibraries []SharedStubLibrary |
Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 115 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 116 | IsLLNDK bool |
| 117 | } |
| 118 | |
| 119 | var SharedLibraryStubsProvider = blueprint.NewProvider(SharedLibraryStubsInfo{}) |
| 120 | |
| 121 | // StaticLibraryInfo is a provider to propagate information about a static C++ library. |
Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 122 | type StaticLibraryInfo struct { |
| 123 | StaticLibrary android.Path |
| 124 | Objects Objects |
| 125 | ReuseObjects Objects |
| 126 | |
| 127 | // This isn't the actual transitive DepSet, shared library dependencies have been |
| 128 | // converted into static library analogues. It is only used to order the static |
| 129 | // library dependencies that were specified for the current module. |
| 130 | TransitiveStaticLibrariesForOrdering *android.DepSet |
| 131 | } |
| 132 | |
| 133 | var StaticLibraryInfoProvider = blueprint.NewProvider(StaticLibraryInfo{}) |
| 134 | |
Colin Cross | 649d817 | 2020-12-10 12:30:21 -0800 | [diff] [blame] | 135 | // HeaderLibraryInfo is a marker provider that identifies a module as a header library. |
| 136 | type HeaderLibraryInfo struct { |
| 137 | } |
| 138 | |
| 139 | // HeaderLibraryInfoProvider is a marker provider that identifies a module as a header library. |
| 140 | var HeaderLibraryInfoProvider = blueprint.NewProvider(HeaderLibraryInfo{}) |
| 141 | |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 142 | // FlagExporterInfo is a provider to propagate transitive library information |
| 143 | // pertaining to exported include paths and flags. |
Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 144 | type FlagExporterInfo struct { |
Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 145 | IncludeDirs android.Paths // Include directories to be included with -I |
| 146 | SystemIncludeDirs android.Paths // System include directories to be included with -isystem |
| 147 | Flags []string // Exported raw flags. |
Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 148 | Deps android.Paths |
| 149 | GeneratedHeaders android.Paths |
| 150 | } |
| 151 | |
| 152 | var FlagExporterInfoProvider = blueprint.NewProvider(FlagExporterInfo{}) |