Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Android Open Source Project |
| 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 rust |
| 16 | |
| 17 | import ( |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 18 | "fmt" |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 19 | "strings" |
| 20 | |
| 21 | "github.com/google/blueprint" |
| 22 | "github.com/google/blueprint/proptools" |
| 23 | |
| 24 | "android/soong/android" |
| 25 | "android/soong/cc" |
| 26 | "android/soong/rust/config" |
| 27 | ) |
| 28 | |
| 29 | var pctx = android.NewPackageContext("android/soong/rust") |
| 30 | |
| 31 | func init() { |
| 32 | // Only allow rust modules to be defined for certain projects |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 33 | |
| 34 | android.AddNeverAllowRules( |
| 35 | android.NeverAllow(). |
Ivan Lozano | e169ad7 | 2019-09-18 08:42:54 -0700 | [diff] [blame] | 36 | NotIn(config.RustAllowedPaths...). |
| 37 | ModuleType(config.RustModuleTypes...)) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 38 | |
| 39 | android.RegisterModuleType("rust_defaults", defaultsFactory) |
| 40 | android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { |
| 41 | ctx.BottomUp("rust_libraries", LibraryMutator).Parallel() |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 42 | ctx.BottomUp("rust_begin", BeginMutator).Parallel() |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 43 | }) |
| 44 | pctx.Import("android/soong/rust/config") |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 45 | pctx.ImportAs("ccConfig", "android/soong/cc/config") |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | type Flags struct { |
Ivan Lozano | 8a23fa4 | 2020-06-16 10:26:57 -0400 | [diff] [blame] | 49 | GlobalRustFlags []string // Flags that apply globally to rust |
| 50 | GlobalLinkFlags []string // Flags that apply globally to linker |
| 51 | RustFlags []string // Flags that apply to rust |
| 52 | LinkFlags []string // Flags that apply to linker |
Thiébaud Weksteen | 92f703b | 2020-06-22 13:28:02 +0200 | [diff] [blame] | 53 | ClippyFlags []string // Flags that apply to clippy-driver, during the linting |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 54 | Toolchain config.Toolchain |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 55 | Coverage bool |
Thiébaud Weksteen | 92f703b | 2020-06-22 13:28:02 +0200 | [diff] [blame] | 56 | Clippy bool |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | type BaseProperties struct { |
| 60 | AndroidMkRlibs []string |
| 61 | AndroidMkDylibs []string |
| 62 | AndroidMkProcMacroLibs []string |
| 63 | AndroidMkSharedLibs []string |
| 64 | AndroidMkStaticLibs []string |
Ivan Lozano | 4384568 | 2020-07-09 21:03:28 -0400 | [diff] [blame] | 65 | |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 66 | SubName string `blueprint:"mutated"` |
| 67 | |
Ivan Lozano | 4384568 | 2020-07-09 21:03:28 -0400 | [diff] [blame] | 68 | PreventInstall bool |
| 69 | HideFromMake bool |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | type Module struct { |
| 73 | android.ModuleBase |
| 74 | android.DefaultableModuleBase |
| 75 | |
| 76 | Properties BaseProperties |
| 77 | |
| 78 | hod android.HostOrDeviceSupported |
| 79 | multilib android.Multilib |
| 80 | |
| 81 | compiler compiler |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 82 | coverage *coverage |
Thiébaud Weksteen | 92f703b | 2020-06-22 13:28:02 +0200 | [diff] [blame] | 83 | clippy *clippy |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 84 | cachedToolchain config.Toolchain |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 85 | sourceProvider SourceProvider |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 86 | subAndroidMkOnce map[SubAndroidMkProvider]bool |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 87 | |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 88 | outputFile android.OptionalPath |
| 89 | generatedFile android.OptionalPath |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 90 | } |
| 91 | |
Ivan Lozano | 4384568 | 2020-07-09 21:03:28 -0400 | [diff] [blame] | 92 | func (mod *Module) OutputFiles(tag string) (android.Paths, error) { |
| 93 | switch tag { |
| 94 | case "": |
Andrei Homescu | 5db69cc | 2020-08-06 15:27:45 -0700 | [diff] [blame^] | 95 | if mod.sourceProvider != nil && (mod.compiler == nil || mod.compiler.Disabled()) { |
Ivan Lozano | 4384568 | 2020-07-09 21:03:28 -0400 | [diff] [blame] | 96 | return mod.sourceProvider.Srcs(), nil |
| 97 | } else { |
| 98 | if mod.outputFile.Valid() { |
| 99 | return android.Paths{mod.outputFile.Path()}, nil |
| 100 | } |
| 101 | return android.Paths{}, nil |
| 102 | } |
| 103 | default: |
| 104 | return nil, fmt.Errorf("unsupported module reference tag %q", tag) |
| 105 | } |
| 106 | } |
| 107 | |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 108 | var _ android.ImageInterface = (*Module)(nil) |
| 109 | |
| 110 | func (mod *Module) ImageMutatorBegin(ctx android.BaseModuleContext) {} |
| 111 | |
| 112 | func (mod *Module) CoreVariantNeeded(ctx android.BaseModuleContext) bool { |
| 113 | return true |
| 114 | } |
| 115 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 116 | func (mod *Module) RamdiskVariantNeeded(android.BaseModuleContext) bool { |
| 117 | return mod.InRamdisk() |
| 118 | } |
| 119 | |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 120 | func (mod *Module) RecoveryVariantNeeded(android.BaseModuleContext) bool { |
| 121 | return mod.InRecovery() |
| 122 | } |
| 123 | |
| 124 | func (mod *Module) ExtraImageVariations(android.BaseModuleContext) []string { |
| 125 | return nil |
| 126 | } |
| 127 | |
| 128 | func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string, module android.Module) { |
| 129 | } |
| 130 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 131 | func (mod *Module) BuildStubs() bool { |
| 132 | return false |
| 133 | } |
| 134 | |
| 135 | func (mod *Module) HasStubsVariants() bool { |
| 136 | return false |
| 137 | } |
| 138 | |
| 139 | func (mod *Module) SelectedStl() string { |
| 140 | return "" |
| 141 | } |
| 142 | |
Ivan Lozano | 2b26297 | 2019-11-21 12:30:50 -0800 | [diff] [blame] | 143 | func (mod *Module) NonCcVariants() bool { |
| 144 | if mod.compiler != nil { |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 145 | if _, ok := mod.compiler.(libraryInterface); ok { |
| 146 | return false |
Ivan Lozano | 2b26297 | 2019-11-21 12:30:50 -0800 | [diff] [blame] | 147 | } |
| 148 | } |
| 149 | panic(fmt.Errorf("NonCcVariants called on non-library module: %q", mod.BaseModuleName())) |
| 150 | } |
| 151 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 152 | func (mod *Module) ApiLevel() string { |
| 153 | panic(fmt.Errorf("Called ApiLevel on Rust module %q; stubs libraries are not yet supported.", mod.BaseModuleName())) |
| 154 | } |
| 155 | |
| 156 | func (mod *Module) Static() bool { |
| 157 | if mod.compiler != nil { |
| 158 | if library, ok := mod.compiler.(libraryInterface); ok { |
| 159 | return library.static() |
| 160 | } |
| 161 | } |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 162 | return false |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | func (mod *Module) Shared() bool { |
| 166 | if mod.compiler != nil { |
| 167 | if library, ok := mod.compiler.(libraryInterface); ok { |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 168 | return library.shared() |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 169 | } |
| 170 | } |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 171 | return false |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | func (mod *Module) Toc() android.OptionalPath { |
| 175 | if mod.compiler != nil { |
| 176 | if _, ok := mod.compiler.(libraryInterface); ok { |
| 177 | return android.OptionalPath{} |
| 178 | } |
| 179 | } |
| 180 | panic(fmt.Errorf("Toc() called on non-library module: %q", mod.BaseModuleName())) |
| 181 | } |
| 182 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 183 | func (mod *Module) OnlyInRamdisk() bool { |
| 184 | return false |
| 185 | } |
| 186 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 187 | func (mod *Module) OnlyInRecovery() bool { |
| 188 | return false |
| 189 | } |
| 190 | |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 191 | func (mod *Module) UseSdk() bool { |
| 192 | return false |
| 193 | } |
| 194 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 195 | func (mod *Module) UseVndk() bool { |
| 196 | return false |
| 197 | } |
| 198 | |
| 199 | func (mod *Module) MustUseVendorVariant() bool { |
| 200 | return false |
| 201 | } |
| 202 | |
| 203 | func (mod *Module) IsVndk() bool { |
| 204 | return false |
| 205 | } |
| 206 | |
| 207 | func (mod *Module) HasVendorVariant() bool { |
| 208 | return false |
| 209 | } |
| 210 | |
| 211 | func (mod *Module) SdkVersion() string { |
| 212 | return "" |
| 213 | } |
| 214 | |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 215 | func (mod *Module) AlwaysSdk() bool { |
| 216 | return false |
| 217 | } |
| 218 | |
Jiyong Park | 2286afd | 2020-06-16 21:58:53 +0900 | [diff] [blame] | 219 | func (mod *Module) IsSdkVariant() bool { |
| 220 | return false |
| 221 | } |
| 222 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 223 | func (mod *Module) ToolchainLibrary() bool { |
| 224 | return false |
| 225 | } |
| 226 | |
| 227 | func (mod *Module) NdkPrebuiltStl() bool { |
| 228 | return false |
| 229 | } |
| 230 | |
| 231 | func (mod *Module) StubDecorator() bool { |
| 232 | return false |
| 233 | } |
| 234 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 235 | type Deps struct { |
| 236 | Dylibs []string |
| 237 | Rlibs []string |
Matthew Maurer | 0f003b1 | 2020-06-29 14:34:06 -0700 | [diff] [blame] | 238 | Rustlibs []string |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 239 | ProcMacros []string |
| 240 | SharedLibs []string |
| 241 | StaticLibs []string |
| 242 | |
| 243 | CrtBegin, CrtEnd string |
| 244 | } |
| 245 | |
| 246 | type PathDeps struct { |
| 247 | DyLibs RustLibraries |
| 248 | RLibs RustLibraries |
| 249 | SharedLibs android.Paths |
| 250 | StaticLibs android.Paths |
| 251 | ProcMacros RustLibraries |
| 252 | linkDirs []string |
| 253 | depFlags []string |
| 254 | //ReexportedDeps android.Paths |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 255 | |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 256 | // Used by bindgen modules which call clang |
| 257 | depClangFlags []string |
| 258 | depIncludePaths android.Paths |
| 259 | depSystemIncludePaths android.Paths |
| 260 | |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 261 | coverageFiles android.Paths |
| 262 | |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 263 | CrtBegin android.OptionalPath |
| 264 | CrtEnd android.OptionalPath |
Chih-Hung Hsieh | bbd25ae | 2020-05-15 17:36:30 -0700 | [diff] [blame] | 265 | |
| 266 | // Paths to generated source files |
| 267 | SrcDeps android.Paths |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | type RustLibraries []RustLibrary |
| 271 | |
| 272 | type RustLibrary struct { |
| 273 | Path android.Path |
| 274 | CrateName string |
| 275 | } |
| 276 | |
| 277 | type compiler interface { |
| 278 | compilerFlags(ctx ModuleContext, flags Flags) Flags |
| 279 | compilerProps() []interface{} |
| 280 | compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path |
| 281 | compilerDeps(ctx DepsContext, deps Deps) Deps |
| 282 | crateName() string |
| 283 | |
Chih-Hung Hsieh | 9a4a7ba | 2019-12-12 19:36:05 -0800 | [diff] [blame] | 284 | inData() bool |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 285 | install(ctx ModuleContext, path android.Path) |
| 286 | relativeInstallPath() string |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 287 | |
| 288 | nativeCoverage() bool |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 289 | |
| 290 | Disabled() bool |
| 291 | SetDisabled() |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 292 | } |
| 293 | |
Matthew Maurer | bb3add1 | 2020-06-25 09:34:12 -0700 | [diff] [blame] | 294 | type exportedFlagsProducer interface { |
| 295 | exportedLinkDirs() []string |
| 296 | exportedDepFlags() []string |
| 297 | exportLinkDirs(...string) |
| 298 | exportDepFlags(...string) |
| 299 | } |
| 300 | |
| 301 | type flagExporter struct { |
| 302 | depFlags []string |
| 303 | linkDirs []string |
| 304 | } |
| 305 | |
| 306 | func (flagExporter *flagExporter) exportedLinkDirs() []string { |
| 307 | return flagExporter.linkDirs |
| 308 | } |
| 309 | |
| 310 | func (flagExporter *flagExporter) exportedDepFlags() []string { |
| 311 | return flagExporter.depFlags |
| 312 | } |
| 313 | |
| 314 | func (flagExporter *flagExporter) exportLinkDirs(dirs ...string) { |
| 315 | flagExporter.linkDirs = android.FirstUniqueStrings(append(flagExporter.linkDirs, dirs...)) |
| 316 | } |
| 317 | |
| 318 | func (flagExporter *flagExporter) exportDepFlags(flags ...string) { |
| 319 | flagExporter.depFlags = android.FirstUniqueStrings(append(flagExporter.depFlags, flags...)) |
| 320 | } |
| 321 | |
| 322 | var _ exportedFlagsProducer = (*flagExporter)(nil) |
| 323 | |
| 324 | func NewFlagExporter() *flagExporter { |
| 325 | return &flagExporter{ |
| 326 | depFlags: []string{}, |
| 327 | linkDirs: []string{}, |
| 328 | } |
| 329 | } |
| 330 | |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 331 | func (mod *Module) isCoverageVariant() bool { |
| 332 | return mod.coverage.Properties.IsCoverageVariant |
| 333 | } |
| 334 | |
| 335 | var _ cc.Coverage = (*Module)(nil) |
| 336 | |
| 337 | func (mod *Module) IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool { |
| 338 | return mod.coverage != nil && mod.coverage.Properties.NeedCoverageVariant |
| 339 | } |
| 340 | |
| 341 | func (mod *Module) PreventInstall() { |
| 342 | mod.Properties.PreventInstall = true |
| 343 | } |
| 344 | |
| 345 | func (mod *Module) HideFromMake() { |
| 346 | mod.Properties.HideFromMake = true |
| 347 | } |
| 348 | |
| 349 | func (mod *Module) MarkAsCoverageVariant(coverage bool) { |
| 350 | mod.coverage.Properties.IsCoverageVariant = coverage |
| 351 | } |
| 352 | |
| 353 | func (mod *Module) EnableCoverageIfNeeded() { |
| 354 | mod.coverage.Properties.CoverageEnabled = mod.coverage.Properties.NeedCoverageBuild |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | func defaultsFactory() android.Module { |
| 358 | return DefaultsFactory() |
| 359 | } |
| 360 | |
| 361 | type Defaults struct { |
| 362 | android.ModuleBase |
| 363 | android.DefaultsModuleBase |
| 364 | } |
| 365 | |
| 366 | func DefaultsFactory(props ...interface{}) android.Module { |
| 367 | module := &Defaults{} |
| 368 | |
| 369 | module.AddProperties(props...) |
| 370 | module.AddProperties( |
| 371 | &BaseProperties{}, |
| 372 | &BaseCompilerProperties{}, |
| 373 | &BinaryCompilerProperties{}, |
| 374 | &LibraryCompilerProperties{}, |
| 375 | &ProcMacroCompilerProperties{}, |
| 376 | &PrebuiltProperties{}, |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 377 | &SourceProviderProperties{}, |
Chih-Hung Hsieh | 41805be | 2019-10-31 20:56:47 -0700 | [diff] [blame] | 378 | &TestProperties{}, |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 379 | &cc.CoverageProperties{}, |
Thiébaud Weksteen | 92f703b | 2020-06-22 13:28:02 +0200 | [diff] [blame] | 380 | &ClippyProperties{}, |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 381 | ) |
| 382 | |
| 383 | android.InitDefaultsModule(module) |
| 384 | return module |
| 385 | } |
| 386 | |
| 387 | func (mod *Module) CrateName() string { |
Ivan Lozano | ad8b18b | 2019-10-31 19:38:29 -0700 | [diff] [blame] | 388 | return mod.compiler.crateName() |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 389 | } |
| 390 | |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 391 | func (mod *Module) CcLibrary() bool { |
| 392 | if mod.compiler != nil { |
| 393 | if _, ok := mod.compiler.(*libraryDecorator); ok { |
| 394 | return true |
| 395 | } |
| 396 | } |
| 397 | return false |
| 398 | } |
| 399 | |
| 400 | func (mod *Module) CcLibraryInterface() bool { |
| 401 | if mod.compiler != nil { |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 402 | // use build{Static,Shared}() instead of {static,shared}() here because this might be called before |
| 403 | // VariantIs{Static,Shared} is set. |
| 404 | if lib, ok := mod.compiler.(libraryInterface); ok && (lib.buildShared() || lib.buildStatic()) { |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 405 | return true |
| 406 | } |
| 407 | } |
| 408 | return false |
| 409 | } |
| 410 | |
Ivan Lozano | e0833b1 | 2019-11-06 19:15:49 -0800 | [diff] [blame] | 411 | func (mod *Module) IncludeDirs() android.Paths { |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 412 | if mod.compiler != nil { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 413 | if library, ok := mod.compiler.(*libraryDecorator); ok { |
Ivan Lozano | e0833b1 | 2019-11-06 19:15:49 -0800 | [diff] [blame] | 414 | return library.includeDirs |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 415 | } |
| 416 | } |
| 417 | panic(fmt.Errorf("IncludeDirs called on non-library module: %q", mod.BaseModuleName())) |
| 418 | } |
| 419 | |
| 420 | func (mod *Module) SetStatic() { |
| 421 | if mod.compiler != nil { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 422 | if library, ok := mod.compiler.(libraryInterface); ok { |
| 423 | library.setStatic() |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 424 | return |
| 425 | } |
| 426 | } |
| 427 | panic(fmt.Errorf("SetStatic called on non-library module: %q", mod.BaseModuleName())) |
| 428 | } |
| 429 | |
| 430 | func (mod *Module) SetShared() { |
| 431 | if mod.compiler != nil { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 432 | if library, ok := mod.compiler.(libraryInterface); ok { |
| 433 | library.setShared() |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 434 | return |
| 435 | } |
| 436 | } |
| 437 | panic(fmt.Errorf("SetShared called on non-library module: %q", mod.BaseModuleName())) |
| 438 | } |
| 439 | |
| 440 | func (mod *Module) SetBuildStubs() { |
| 441 | panic("SetBuildStubs not yet implemented for rust modules") |
| 442 | } |
| 443 | |
| 444 | func (mod *Module) SetStubsVersions(string) { |
| 445 | panic("SetStubsVersions not yet implemented for rust modules") |
| 446 | } |
| 447 | |
Jooyung Han | 03b5185 | 2020-02-26 22:45:42 +0900 | [diff] [blame] | 448 | func (mod *Module) StubsVersion() string { |
| 449 | panic("SetStubsVersions not yet implemented for rust modules") |
| 450 | } |
| 451 | |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 452 | func (mod *Module) BuildStaticVariant() bool { |
| 453 | if mod.compiler != nil { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 454 | if library, ok := mod.compiler.(libraryInterface); ok { |
| 455 | return library.buildStatic() |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 456 | } |
| 457 | } |
| 458 | panic(fmt.Errorf("BuildStaticVariant called on non-library module: %q", mod.BaseModuleName())) |
| 459 | } |
| 460 | |
| 461 | func (mod *Module) BuildSharedVariant() bool { |
| 462 | if mod.compiler != nil { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 463 | if library, ok := mod.compiler.(libraryInterface); ok { |
| 464 | return library.buildShared() |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 465 | } |
| 466 | } |
| 467 | panic(fmt.Errorf("BuildSharedVariant called on non-library module: %q", mod.BaseModuleName())) |
| 468 | } |
| 469 | |
| 470 | // Rust module deps don't have a link order (?) |
| 471 | func (mod *Module) SetDepsInLinkOrder([]android.Path) {} |
| 472 | |
| 473 | func (mod *Module) GetDepsInLinkOrder() []android.Path { |
| 474 | return []android.Path{} |
| 475 | } |
| 476 | |
| 477 | func (mod *Module) GetStaticVariant() cc.LinkableInterface { |
| 478 | return nil |
| 479 | } |
| 480 | |
| 481 | func (mod *Module) Module() android.Module { |
| 482 | return mod |
| 483 | } |
| 484 | |
| 485 | func (mod *Module) StubsVersions() []string { |
| 486 | // For now, Rust has no stubs versions. |
| 487 | if mod.compiler != nil { |
Matthew Maurer | bb3add1 | 2020-06-25 09:34:12 -0700 | [diff] [blame] | 488 | if _, ok := mod.compiler.(libraryInterface); ok { |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 489 | return []string{} |
| 490 | } |
| 491 | } |
| 492 | panic(fmt.Errorf("StubsVersions called on non-library module: %q", mod.BaseModuleName())) |
| 493 | } |
| 494 | |
| 495 | func (mod *Module) OutputFile() android.OptionalPath { |
| 496 | return mod.outputFile |
| 497 | } |
| 498 | |
| 499 | func (mod *Module) InRecovery() bool { |
| 500 | // For now, Rust has no notion of the recovery image |
| 501 | return false |
| 502 | } |
| 503 | func (mod *Module) HasStaticVariant() bool { |
| 504 | if mod.GetStaticVariant() != nil { |
| 505 | return true |
| 506 | } |
| 507 | return false |
| 508 | } |
| 509 | |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 510 | func (mod *Module) CoverageFiles() android.Paths { |
| 511 | if mod.compiler != nil { |
Matthew Maurer | c761eec | 2020-06-25 00:47:46 -0700 | [diff] [blame] | 512 | if !mod.compiler.nativeCoverage() { |
| 513 | return android.Paths{} |
| 514 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 515 | if library, ok := mod.compiler.(*libraryDecorator); ok { |
| 516 | if library.coverageFile != nil { |
| 517 | return android.Paths{library.coverageFile} |
| 518 | } |
| 519 | return android.Paths{} |
| 520 | } |
| 521 | } |
| 522 | panic(fmt.Errorf("CoverageFiles called on non-library module: %q", mod.BaseModuleName())) |
| 523 | } |
| 524 | |
Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 525 | var _ cc.LinkableInterface = (*Module)(nil) |
| 526 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 527 | func (mod *Module) Init() android.Module { |
| 528 | mod.AddProperties(&mod.Properties) |
| 529 | |
| 530 | if mod.compiler != nil { |
| 531 | mod.AddProperties(mod.compiler.compilerProps()...) |
| 532 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 533 | if mod.coverage != nil { |
| 534 | mod.AddProperties(mod.coverage.props()...) |
| 535 | } |
Thiébaud Weksteen | 92f703b | 2020-06-22 13:28:02 +0200 | [diff] [blame] | 536 | if mod.clippy != nil { |
| 537 | mod.AddProperties(mod.clippy.props()...) |
| 538 | } |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 539 | if mod.sourceProvider != nil { |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 540 | mod.AddProperties(mod.sourceProvider.SourceProviderProps()...) |
Ivan Lozano | 4fef93c | 2020-07-08 08:39:44 -0400 | [diff] [blame] | 541 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 542 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 543 | android.InitAndroidArchModule(mod, mod.hod, mod.multilib) |
| 544 | |
| 545 | android.InitDefaultableModule(mod) |
| 546 | |
Ivan Lozano | de25291 | 2019-09-06 15:29:52 -0700 | [diff] [blame] | 547 | // Explicitly disable unsupported targets. |
| 548 | android.AddLoadHook(mod, func(ctx android.LoadHookContext) { |
| 549 | disableTargets := struct { |
| 550 | Target struct { |
Ivan Lozano | de25291 | 2019-09-06 15:29:52 -0700 | [diff] [blame] | 551 | Linux_bionic struct { |
| 552 | Enabled *bool |
| 553 | } |
| 554 | } |
| 555 | }{} |
Ivan Lozano | de25291 | 2019-09-06 15:29:52 -0700 | [diff] [blame] | 556 | disableTargets.Target.Linux_bionic.Enabled = proptools.BoolPtr(false) |
| 557 | |
| 558 | ctx.AppendProperties(&disableTargets) |
| 559 | }) |
| 560 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 561 | return mod |
| 562 | } |
| 563 | |
| 564 | func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module { |
| 565 | return &Module{ |
| 566 | hod: hod, |
| 567 | multilib: multilib, |
| 568 | } |
| 569 | } |
| 570 | func newModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module { |
| 571 | module := newBaseModule(hod, multilib) |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 572 | module.coverage = &coverage{} |
Thiébaud Weksteen | 92f703b | 2020-06-22 13:28:02 +0200 | [diff] [blame] | 573 | module.clippy = &clippy{} |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 574 | return module |
| 575 | } |
| 576 | |
| 577 | type ModuleContext interface { |
| 578 | android.ModuleContext |
| 579 | ModuleContextIntf |
| 580 | } |
| 581 | |
| 582 | type BaseModuleContext interface { |
| 583 | android.BaseModuleContext |
| 584 | ModuleContextIntf |
| 585 | } |
| 586 | |
| 587 | type DepsContext interface { |
| 588 | android.BottomUpMutatorContext |
| 589 | ModuleContextIntf |
| 590 | } |
| 591 | |
| 592 | type ModuleContextIntf interface { |
Thiébaud Weksteen | 1f7f70f | 2020-06-24 11:32:48 +0200 | [diff] [blame] | 593 | RustModule() *Module |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 594 | toolchain() config.Toolchain |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 595 | } |
| 596 | |
| 597 | type depsContext struct { |
| 598 | android.BottomUpMutatorContext |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 599 | } |
| 600 | |
| 601 | type moduleContext struct { |
| 602 | android.ModuleContext |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 603 | } |
| 604 | |
Thiébaud Weksteen | 1f7f70f | 2020-06-24 11:32:48 +0200 | [diff] [blame] | 605 | type baseModuleContext struct { |
| 606 | android.BaseModuleContext |
| 607 | } |
| 608 | |
| 609 | func (ctx *moduleContext) RustModule() *Module { |
| 610 | return ctx.Module().(*Module) |
| 611 | } |
| 612 | |
| 613 | func (ctx *moduleContext) toolchain() config.Toolchain { |
| 614 | return ctx.RustModule().toolchain(ctx) |
| 615 | } |
| 616 | |
| 617 | func (ctx *depsContext) RustModule() *Module { |
| 618 | return ctx.Module().(*Module) |
| 619 | } |
| 620 | |
| 621 | func (ctx *depsContext) toolchain() config.Toolchain { |
| 622 | return ctx.RustModule().toolchain(ctx) |
| 623 | } |
| 624 | |
| 625 | func (ctx *baseModuleContext) RustModule() *Module { |
| 626 | return ctx.Module().(*Module) |
| 627 | } |
| 628 | |
| 629 | func (ctx *baseModuleContext) toolchain() config.Toolchain { |
| 630 | return ctx.RustModule().toolchain(ctx) |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 631 | } |
| 632 | |
| 633 | func (mod *Module) nativeCoverage() bool { |
| 634 | return mod.compiler != nil && mod.compiler.nativeCoverage() |
| 635 | } |
| 636 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 637 | func (mod *Module) toolchain(ctx android.BaseModuleContext) config.Toolchain { |
| 638 | if mod.cachedToolchain == nil { |
| 639 | mod.cachedToolchain = config.FindToolchain(ctx.Os(), ctx.Arch()) |
| 640 | } |
| 641 | return mod.cachedToolchain |
| 642 | } |
| 643 | |
| 644 | func (d *Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 645 | } |
| 646 | |
| 647 | func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { |
| 648 | ctx := &moduleContext{ |
| 649 | ModuleContext: actx, |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 650 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 651 | |
| 652 | toolchain := mod.toolchain(ctx) |
| 653 | |
| 654 | if !toolchain.Supported() { |
| 655 | // This toolchain's unsupported, there's nothing to do for this mod. |
| 656 | return |
| 657 | } |
| 658 | |
| 659 | deps := mod.depsToPaths(ctx) |
| 660 | flags := Flags{ |
| 661 | Toolchain: toolchain, |
| 662 | } |
| 663 | |
| 664 | if mod.compiler != nil { |
| 665 | flags = mod.compiler.compilerFlags(ctx, flags) |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 666 | } |
| 667 | if mod.coverage != nil { |
| 668 | flags, deps = mod.coverage.flags(ctx, flags, deps) |
| 669 | } |
Thiébaud Weksteen | 92f703b | 2020-06-22 13:28:02 +0200 | [diff] [blame] | 670 | if mod.clippy != nil { |
| 671 | flags, deps = mod.clippy.flags(ctx, flags, deps) |
| 672 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 673 | |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 674 | // SourceProvider needs to call GenerateSource() before compiler calls compile() so it can provide the source. |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 675 | // TODO(b/162588681) This shouldn't have to run for every variant. |
| 676 | if mod.sourceProvider != nil { |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 677 | generatedFile := mod.sourceProvider.GenerateSource(ctx, deps) |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 678 | mod.generatedFile = android.OptionalPathForPath(generatedFile) |
| 679 | mod.sourceProvider.setSubName(ctx.ModuleSubDir()) |
| 680 | } |
| 681 | |
| 682 | if mod.compiler != nil && !mod.compiler.Disabled() { |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 683 | outputFile := mod.compiler.compile(ctx, flags, deps) |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 684 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 685 | mod.outputFile = android.OptionalPathForPath(outputFile) |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 686 | if mod.outputFile.Valid() && !mod.Properties.PreventInstall { |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 687 | mod.compiler.install(ctx, mod.outputFile.Path()) |
| 688 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 689 | } |
| 690 | } |
| 691 | |
| 692 | func (mod *Module) deps(ctx DepsContext) Deps { |
| 693 | deps := Deps{} |
| 694 | |
| 695 | if mod.compiler != nil { |
| 696 | deps = mod.compiler.compilerDeps(ctx, deps) |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 697 | } |
| 698 | if mod.sourceProvider != nil { |
Andrei Homescu | c776792 | 2020-08-05 06:36:19 -0700 | [diff] [blame] | 699 | deps = mod.sourceProvider.SourceProviderDeps(ctx, deps) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 700 | } |
| 701 | |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 702 | if mod.coverage != nil { |
| 703 | deps = mod.coverage.deps(ctx, deps) |
| 704 | } |
| 705 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 706 | deps.Rlibs = android.LastUniqueStrings(deps.Rlibs) |
| 707 | deps.Dylibs = android.LastUniqueStrings(deps.Dylibs) |
Matthew Maurer | 0f003b1 | 2020-06-29 14:34:06 -0700 | [diff] [blame] | 708 | deps.Rustlibs = android.LastUniqueStrings(deps.Rustlibs) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 709 | deps.ProcMacros = android.LastUniqueStrings(deps.ProcMacros) |
| 710 | deps.SharedLibs = android.LastUniqueStrings(deps.SharedLibs) |
| 711 | deps.StaticLibs = android.LastUniqueStrings(deps.StaticLibs) |
| 712 | |
| 713 | return deps |
| 714 | |
| 715 | } |
| 716 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 717 | type dependencyTag struct { |
| 718 | blueprint.BaseDependencyTag |
| 719 | name string |
| 720 | library bool |
| 721 | proc_macro bool |
| 722 | } |
| 723 | |
| 724 | var ( |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 725 | customBindgenDepTag = dependencyTag{name: "customBindgenTag"} |
| 726 | rlibDepTag = dependencyTag{name: "rlibTag", library: true} |
| 727 | dylibDepTag = dependencyTag{name: "dylib", library: true} |
| 728 | procMacroDepTag = dependencyTag{name: "procMacro", proc_macro: true} |
| 729 | testPerSrcDepTag = dependencyTag{name: "rust_unit_tests"} |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 730 | ) |
| 731 | |
Matthew Maurer | 0f003b1 | 2020-06-29 14:34:06 -0700 | [diff] [blame] | 732 | type autoDep struct { |
| 733 | variation string |
| 734 | depTag dependencyTag |
| 735 | } |
| 736 | |
| 737 | var ( |
| 738 | rlibAutoDep = autoDep{variation: "rlib", depTag: rlibDepTag} |
| 739 | dylibAutoDep = autoDep{variation: "dylib", depTag: dylibDepTag} |
| 740 | ) |
| 741 | |
| 742 | type autoDeppable interface { |
| 743 | autoDep() autoDep |
| 744 | } |
| 745 | |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 746 | func (mod *Module) begin(ctx BaseModuleContext) { |
| 747 | if mod.coverage != nil { |
| 748 | mod.coverage.begin(ctx) |
| 749 | } |
| 750 | } |
| 751 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 752 | func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { |
| 753 | var depPaths PathDeps |
| 754 | |
| 755 | directRlibDeps := []*Module{} |
| 756 | directDylibDeps := []*Module{} |
| 757 | directProcMacroDeps := []*Module{} |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 758 | directSharedLibDeps := [](cc.LinkableInterface){} |
| 759 | directStaticLibDeps := [](cc.LinkableInterface){} |
Ivan Lozano | 07cbaf4 | 2020-07-22 16:09:13 -0400 | [diff] [blame] | 760 | directSrcProvidersDeps := []*Module{} |
| 761 | directSrcDeps := [](android.SourceFileProducer){} |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 762 | |
| 763 | ctx.VisitDirectDeps(func(dep android.Module) { |
| 764 | depName := ctx.OtherModuleName(dep) |
| 765 | depTag := ctx.OtherModuleDependencyTag(dep) |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 766 | if rustDep, ok := dep.(*Module); ok && !rustDep.CcLibraryInterface() { |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 767 | //Handle Rust Modules |
Ivan Lozano | 70e0a07 | 2019-09-13 14:23:15 -0700 | [diff] [blame] | 768 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 769 | switch depTag { |
| 770 | case dylibDepTag: |
| 771 | dylib, ok := rustDep.compiler.(libraryInterface) |
| 772 | if !ok || !dylib.dylib() { |
| 773 | ctx.ModuleErrorf("mod %q not an dylib library", depName) |
| 774 | return |
| 775 | } |
| 776 | directDylibDeps = append(directDylibDeps, rustDep) |
| 777 | mod.Properties.AndroidMkDylibs = append(mod.Properties.AndroidMkDylibs, depName) |
| 778 | case rlibDepTag: |
| 779 | rlib, ok := rustDep.compiler.(libraryInterface) |
| 780 | if !ok || !rlib.rlib() { |
| 781 | ctx.ModuleErrorf("mod %q not an rlib library", depName) |
| 782 | return |
| 783 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 784 | depPaths.coverageFiles = append(depPaths.coverageFiles, rustDep.CoverageFiles()...) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 785 | directRlibDeps = append(directRlibDeps, rustDep) |
| 786 | mod.Properties.AndroidMkRlibs = append(mod.Properties.AndroidMkRlibs, depName) |
| 787 | case procMacroDepTag: |
| 788 | directProcMacroDeps = append(directProcMacroDeps, rustDep) |
| 789 | mod.Properties.AndroidMkProcMacroLibs = append(mod.Properties.AndroidMkProcMacroLibs, depName) |
Ivan Lozano | 07cbaf4 | 2020-07-22 16:09:13 -0400 | [diff] [blame] | 790 | case android.SourceDepTag: |
| 791 | // Since these deps are added in path_properties.go via AddDependencies, we need to ensure the correct |
| 792 | // OS/Arch variant is used. |
| 793 | var helper string |
| 794 | if ctx.Host() { |
| 795 | helper = "missing 'host_supported'?" |
| 796 | } else { |
| 797 | helper = "device module defined?" |
| 798 | } |
| 799 | |
| 800 | if dep.Target().Os != ctx.Os() { |
| 801 | ctx.ModuleErrorf("OS mismatch on dependency %q (%s)", dep.Name(), helper) |
| 802 | return |
| 803 | } else if dep.Target().Arch.ArchType != ctx.Arch().ArchType { |
| 804 | ctx.ModuleErrorf("Arch mismatch on dependency %q (%s)", dep.Name(), helper) |
| 805 | return |
| 806 | } |
| 807 | directSrcProvidersDeps = append(directSrcProvidersDeps, rustDep) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 808 | } |
| 809 | |
Ivan Lozano | 2bbcacf | 2020-08-07 09:00:50 -0400 | [diff] [blame] | 810 | //Append the dependencies exportedDirs, except for proc-macros which target a different arch/OS |
| 811 | if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok && depTag != procMacroDepTag { |
Matthew Maurer | bb3add1 | 2020-06-25 09:34:12 -0700 | [diff] [blame] | 812 | depPaths.linkDirs = append(depPaths.linkDirs, lib.exportedLinkDirs()...) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 813 | depPaths.depFlags = append(depPaths.depFlags, lib.exportedDepFlags()...) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 814 | } |
| 815 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 816 | if depTag == dylibDepTag || depTag == rlibDepTag || depTag == procMacroDepTag { |
Ivan Lozano | 26ecd6c | 2020-07-31 13:40:31 -0400 | [diff] [blame] | 817 | linkFile := rustDep.outputFile |
| 818 | if !linkFile.Valid() { |
| 819 | ctx.ModuleErrorf("Invalid output file when adding dep %q to %q", |
| 820 | depName, ctx.ModuleName()) |
| 821 | return |
| 822 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 823 | linkDir := linkPathFromFilePath(linkFile.Path()) |
Matthew Maurer | bb3add1 | 2020-06-25 09:34:12 -0700 | [diff] [blame] | 824 | if lib, ok := mod.compiler.(exportedFlagsProducer); ok { |
| 825 | lib.exportLinkDirs(linkDir) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 826 | } |
| 827 | } |
| 828 | |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 829 | } else if ccDep, ok := dep.(cc.LinkableInterface); ok { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 830 | //Handle C dependencies |
| 831 | if _, ok := ccDep.(*Module); !ok { |
| 832 | if ccDep.Module().Target().Os != ctx.Os() { |
| 833 | ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), depName) |
| 834 | return |
| 835 | } |
| 836 | if ccDep.Module().Target().Arch.ArchType != ctx.Arch().ArchType { |
| 837 | ctx.ModuleErrorf("Arch mismatch between %q and %q", ctx.ModuleName(), depName) |
| 838 | return |
| 839 | } |
Ivan Lozano | 70e0a07 | 2019-09-13 14:23:15 -0700 | [diff] [blame] | 840 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 841 | linkFile := ccDep.OutputFile() |
| 842 | linkPath := linkPathFromFilePath(linkFile.Path()) |
| 843 | libName := libNameFromFilePath(linkFile.Path()) |
Ivan Lozano | 6aa6602 | 2020-02-06 13:22:43 -0500 | [diff] [blame] | 844 | depFlag := "-l" + libName |
| 845 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 846 | if !linkFile.Valid() { |
| 847 | ctx.ModuleErrorf("Invalid output file when adding dep %q to %q", depName, ctx.ModuleName()) |
| 848 | } |
| 849 | |
| 850 | exportDep := false |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 851 | switch { |
| 852 | case cc.IsStaticDepTag(depTag): |
Ivan Lozano | 6aa6602 | 2020-02-06 13:22:43 -0500 | [diff] [blame] | 853 | depFlag = "-lstatic=" + libName |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 854 | depPaths.linkDirs = append(depPaths.linkDirs, linkPath) |
Ivan Lozano | 6aa6602 | 2020-02-06 13:22:43 -0500 | [diff] [blame] | 855 | depPaths.depFlags = append(depPaths.depFlags, depFlag) |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 856 | depPaths.depIncludePaths = append(depPaths.depIncludePaths, ccDep.IncludeDirs()...) |
| 857 | if mod, ok := ccDep.(*cc.Module); ok { |
| 858 | depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, mod.ExportedSystemIncludeDirs()...) |
| 859 | depPaths.depClangFlags = append(depPaths.depClangFlags, mod.ExportedFlags()...) |
| 860 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 861 | depPaths.coverageFiles = append(depPaths.coverageFiles, ccDep.CoverageFiles()...) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 862 | directStaticLibDeps = append(directStaticLibDeps, ccDep) |
| 863 | mod.Properties.AndroidMkStaticLibs = append(mod.Properties.AndroidMkStaticLibs, depName) |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 864 | case cc.IsSharedDepTag(depTag): |
Ivan Lozano | 6aa6602 | 2020-02-06 13:22:43 -0500 | [diff] [blame] | 865 | depFlag = "-ldylib=" + libName |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 866 | depPaths.linkDirs = append(depPaths.linkDirs, linkPath) |
Ivan Lozano | 6aa6602 | 2020-02-06 13:22:43 -0500 | [diff] [blame] | 867 | depPaths.depFlags = append(depPaths.depFlags, depFlag) |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 868 | depPaths.depIncludePaths = append(depPaths.depIncludePaths, ccDep.IncludeDirs()...) |
| 869 | if mod, ok := ccDep.(*cc.Module); ok { |
| 870 | depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, mod.ExportedSystemIncludeDirs()...) |
| 871 | depPaths.depClangFlags = append(depPaths.depClangFlags, mod.ExportedFlags()...) |
| 872 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 873 | directSharedLibDeps = append(directSharedLibDeps, ccDep) |
| 874 | mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, depName) |
| 875 | exportDep = true |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 876 | case depTag == cc.CrtBeginDepTag: |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 877 | depPaths.CrtBegin = linkFile |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 878 | case depTag == cc.CrtEndDepTag: |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 879 | depPaths.CrtEnd = linkFile |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 880 | } |
| 881 | |
| 882 | // Make sure these dependencies are propagated |
Matthew Maurer | bb3add1 | 2020-06-25 09:34:12 -0700 | [diff] [blame] | 883 | if lib, ok := mod.compiler.(exportedFlagsProducer); ok && exportDep { |
| 884 | lib.exportLinkDirs(linkPath) |
| 885 | lib.exportDepFlags(depFlag) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 886 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 887 | } |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 888 | |
| 889 | if srcDep, ok := dep.(android.SourceFileProducer); ok { |
| 890 | switch depTag { |
| 891 | case android.SourceDepTag: |
| 892 | // These are usually genrules which don't have per-target variants. |
| 893 | directSrcDeps = append(directSrcDeps, srcDep) |
| 894 | } |
| 895 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 896 | }) |
| 897 | |
| 898 | var rlibDepFiles RustLibraries |
| 899 | for _, dep := range directRlibDeps { |
| 900 | rlibDepFiles = append(rlibDepFiles, RustLibrary{Path: dep.outputFile.Path(), CrateName: dep.CrateName()}) |
| 901 | } |
| 902 | var dylibDepFiles RustLibraries |
| 903 | for _, dep := range directDylibDeps { |
| 904 | dylibDepFiles = append(dylibDepFiles, RustLibrary{Path: dep.outputFile.Path(), CrateName: dep.CrateName()}) |
| 905 | } |
| 906 | var procMacroDepFiles RustLibraries |
| 907 | for _, dep := range directProcMacroDeps { |
| 908 | procMacroDepFiles = append(procMacroDepFiles, RustLibrary{Path: dep.outputFile.Path(), CrateName: dep.CrateName()}) |
| 909 | } |
| 910 | |
| 911 | var staticLibDepFiles android.Paths |
| 912 | for _, dep := range directStaticLibDeps { |
| 913 | staticLibDepFiles = append(staticLibDepFiles, dep.OutputFile().Path()) |
| 914 | } |
| 915 | |
| 916 | var sharedLibDepFiles android.Paths |
| 917 | for _, dep := range directSharedLibDeps { |
| 918 | sharedLibDepFiles = append(sharedLibDepFiles, dep.OutputFile().Path()) |
| 919 | } |
| 920 | |
Ivan Lozano | 07cbaf4 | 2020-07-22 16:09:13 -0400 | [diff] [blame] | 921 | var srcProviderDepFiles android.Paths |
| 922 | for _, dep := range directSrcProvidersDeps { |
| 923 | srcs, _ := dep.OutputFiles("") |
| 924 | srcProviderDepFiles = append(srcProviderDepFiles, srcs...) |
| 925 | } |
| 926 | for _, dep := range directSrcDeps { |
| 927 | srcs := dep.Srcs() |
| 928 | srcProviderDepFiles = append(srcProviderDepFiles, srcs...) |
| 929 | } |
| 930 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 931 | depPaths.RLibs = append(depPaths.RLibs, rlibDepFiles...) |
| 932 | depPaths.DyLibs = append(depPaths.DyLibs, dylibDepFiles...) |
| 933 | depPaths.SharedLibs = append(depPaths.SharedLibs, sharedLibDepFiles...) |
| 934 | depPaths.StaticLibs = append(depPaths.StaticLibs, staticLibDepFiles...) |
| 935 | depPaths.ProcMacros = append(depPaths.ProcMacros, procMacroDepFiles...) |
Ivan Lozano | 07cbaf4 | 2020-07-22 16:09:13 -0400 | [diff] [blame] | 936 | depPaths.SrcDeps = append(depPaths.SrcDeps, srcProviderDepFiles...) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 937 | |
| 938 | // Dedup exported flags from dependencies |
| 939 | depPaths.linkDirs = android.FirstUniqueStrings(depPaths.linkDirs) |
| 940 | depPaths.depFlags = android.FirstUniqueStrings(depPaths.depFlags) |
Ivan Lozano | 45901ed | 2020-07-24 16:05:01 -0400 | [diff] [blame] | 941 | depPaths.depClangFlags = android.FirstUniqueStrings(depPaths.depClangFlags) |
| 942 | depPaths.depIncludePaths = android.FirstUniquePaths(depPaths.depIncludePaths) |
| 943 | depPaths.depSystemIncludePaths = android.FirstUniquePaths(depPaths.depSystemIncludePaths) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 944 | |
| 945 | return depPaths |
| 946 | } |
| 947 | |
Chih-Hung Hsieh | 9a4a7ba | 2019-12-12 19:36:05 -0800 | [diff] [blame] | 948 | func (mod *Module) InstallInData() bool { |
| 949 | if mod.compiler == nil { |
| 950 | return false |
| 951 | } |
| 952 | return mod.compiler.inData() |
| 953 | } |
| 954 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 955 | func linkPathFromFilePath(filepath android.Path) string { |
| 956 | return strings.Split(filepath.String(), filepath.Base())[0] |
| 957 | } |
Ivan Lozano | d648c43 | 2020-02-06 12:05:10 -0500 | [diff] [blame] | 958 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 959 | func libNameFromFilePath(filepath android.Path) string { |
Ivan Lozano | d648c43 | 2020-02-06 12:05:10 -0500 | [diff] [blame] | 960 | libName := strings.TrimSuffix(filepath.Base(), filepath.Ext()) |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 961 | if strings.HasPrefix(libName, "lib") { |
| 962 | libName = libName[3:] |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 963 | } |
| 964 | return libName |
| 965 | } |
Ivan Lozano | d648c43 | 2020-02-06 12:05:10 -0500 | [diff] [blame] | 966 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 967 | func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) { |
| 968 | ctx := &depsContext{ |
| 969 | BottomUpMutatorContext: actx, |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 970 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 971 | |
| 972 | deps := mod.deps(ctx) |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 973 | commonDepVariations := []blueprint.Variation{} |
Jooyung Han | 624d35c | 2020-04-10 12:57:24 +0900 | [diff] [blame] | 974 | if cc.VersionVariantAvailable(mod) { |
| 975 | commonDepVariations = append(commonDepVariations, |
| 976 | blueprint.Variation{Mutator: "version", Variation: ""}) |
| 977 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 978 | if !mod.Host() { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 979 | commonDepVariations = append(commonDepVariations, |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 980 | blueprint.Variation{Mutator: "image", Variation: android.CoreVariation}) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 981 | } |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 982 | actx.AddVariationDependencies( |
| 983 | append(commonDepVariations, []blueprint.Variation{ |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 984 | {Mutator: "rust_libraries", Variation: "rlib"}}...), |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 985 | rlibDepTag, deps.Rlibs...) |
| 986 | actx.AddVariationDependencies( |
| 987 | append(commonDepVariations, []blueprint.Variation{ |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 988 | {Mutator: "rust_libraries", Variation: "dylib"}}...), |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 989 | dylibDepTag, deps.Dylibs...) |
| 990 | |
Matthew Maurer | 0f003b1 | 2020-06-29 14:34:06 -0700 | [diff] [blame] | 991 | if deps.Rustlibs != nil { |
| 992 | autoDep := mod.compiler.(autoDeppable).autoDep() |
| 993 | actx.AddVariationDependencies( |
| 994 | append(commonDepVariations, []blueprint.Variation{ |
Ivan Lozano | 89435d1 | 2020-07-31 11:01:18 -0400 | [diff] [blame] | 995 | {Mutator: "rust_libraries", Variation: autoDep.variation}}...), |
Matthew Maurer | 0f003b1 | 2020-06-29 14:34:06 -0700 | [diff] [blame] | 996 | autoDep.depTag, deps.Rustlibs...) |
| 997 | } |
| 998 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 999 | actx.AddVariationDependencies(append(commonDepVariations, |
| 1000 | blueprint.Variation{Mutator: "link", Variation: "shared"}), |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 1001 | cc.SharedDepTag(), deps.SharedLibs...) |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 1002 | actx.AddVariationDependencies(append(commonDepVariations, |
| 1003 | blueprint.Variation{Mutator: "link", Variation: "static"}), |
Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 1004 | cc.StaticDepTag(), deps.StaticLibs...) |
Ivan Lozano | 5ca5ef6 | 2019-09-23 10:10:40 -0700 | [diff] [blame] | 1005 | |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 1006 | if deps.CrtBegin != "" { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 1007 | actx.AddVariationDependencies(commonDepVariations, cc.CrtBeginDepTag, deps.CrtBegin) |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 1008 | } |
| 1009 | if deps.CrtEnd != "" { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 1010 | actx.AddVariationDependencies(commonDepVariations, cc.CrtEndDepTag, deps.CrtEnd) |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 1011 | } |
| 1012 | |
Ivan Lozano | c564d2d | 2020-08-04 15:43:37 -0400 | [diff] [blame] | 1013 | if mod.sourceProvider != nil { |
| 1014 | if bindgen, ok := mod.sourceProvider.(*bindgenDecorator); ok && |
| 1015 | bindgen.Properties.Custom_bindgen != "" { |
| 1016 | actx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), customBindgenDepTag, |
| 1017 | bindgen.Properties.Custom_bindgen) |
| 1018 | } |
| 1019 | } |
Ivan Lozano | 5ca5ef6 | 2019-09-23 10:10:40 -0700 | [diff] [blame] | 1020 | // proc_macros are compiler plugins, and so we need the host arch variant as a dependendcy. |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1021 | actx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), procMacroDepTag, deps.ProcMacros...) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 1022 | } |
| 1023 | |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 1024 | func BeginMutator(ctx android.BottomUpMutatorContext) { |
| 1025 | if mod, ok := ctx.Module().(*Module); ok && mod.Enabled() { |
| 1026 | mod.beginMutator(ctx) |
| 1027 | } |
| 1028 | } |
| 1029 | |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 1030 | func (mod *Module) beginMutator(actx android.BottomUpMutatorContext) { |
| 1031 | ctx := &baseModuleContext{ |
| 1032 | BaseModuleContext: actx, |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 1033 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 1034 | |
| 1035 | mod.begin(ctx) |
| 1036 | } |
| 1037 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 1038 | func (mod *Module) Name() string { |
| 1039 | name := mod.ModuleBase.Name() |
| 1040 | if p, ok := mod.compiler.(interface { |
| 1041 | Name(string) string |
| 1042 | }); ok { |
| 1043 | name = p.Name(name) |
| 1044 | } |
| 1045 | return name |
| 1046 | } |
| 1047 | |
Ivan Lozano | 32267c8 | 2020-08-04 16:27:16 -0400 | [diff] [blame] | 1048 | func (mod *Module) setClippy(clippy bool) { |
| 1049 | if mod.clippy != nil { |
| 1050 | mod.clippy.Properties.Clippy = proptools.BoolPtr(clippy) |
| 1051 | } |
| 1052 | } |
| 1053 | |
Chih-Hung Hsieh | 5c4e489 | 2020-05-15 17:36:30 -0700 | [diff] [blame] | 1054 | var _ android.HostToolProvider = (*Module)(nil) |
| 1055 | |
| 1056 | func (mod *Module) HostToolPath() android.OptionalPath { |
| 1057 | if !mod.Host() { |
| 1058 | return android.OptionalPath{} |
| 1059 | } |
| 1060 | if _, ok := mod.compiler.(*binaryDecorator); ok { |
| 1061 | return mod.outputFile |
| 1062 | } |
| 1063 | return android.OptionalPath{} |
| 1064 | } |
| 1065 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 1066 | var Bool = proptools.Bool |
| 1067 | var BoolDefault = proptools.BoolDefault |
| 1068 | var String = proptools.String |
| 1069 | var StringPtr = proptools.StringPtr |
Ivan Lozano | 4384568 | 2020-07-09 21:03:28 -0400 | [diff] [blame] | 1070 | |
| 1071 | var _ android.OutputFileProducer = (*Module)(nil) |