1// Copyright (C) 2021 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 15package aidl 16 17import ( 18 "android/soong/android" 19 "android/soong/cc" 20 "android/soong/java" 21 "android/soong/rust" 22 23 "fmt" 24 "path/filepath" 25 "strings" 26 27 "github.com/google/blueprint/proptools" 28) 29 30func addLibrary(mctx android.DefaultableHookContext, i *aidlInterface, version string, lang string, notFrozen bool, requireFrozenReason string) string { 31 if lang == langJava { 32 return addJavaLibrary(mctx, i, version, notFrozen, requireFrozenReason) 33 } else if lang == langRust { 34 return addRustLibrary(mctx, i, version, notFrozen, requireFrozenReason) 35 } else if lang == langCppAnalyzer { 36 return addCppAnalyzerLibrary(mctx, i, version, notFrozen, requireFrozenReason) 37 } else if lang == langCpp || lang == langNdk || lang == langNdkPlatform { 38 return addCppLibrary(mctx, i, version, lang, notFrozen, requireFrozenReason) 39 } else { 40 panic(fmt.Errorf("unsupported language backend %q\n", lang)) 41 } 42} 43 44func addCppLibrary(mctx android.DefaultableHookContext, i *aidlInterface, version string, lang string, notFrozen bool, requireFrozenReason string) string { 45 cppSourceGen := i.versionedName(version) + "-" + lang + "-source" 46 cppModuleGen := i.versionedName(version) + "-" + lang 47 48 srcs, aidlRoot := i.srcsForVersion(mctx, version) 49 if len(srcs) == 0 { 50 // This can happen when the version is about to be frozen; the version 51 // directory is created but API dump hasn't been copied there. 52 // Don't create a library for the yet-to-be-frozen version. 53 return "" 54 } 55 56 var overrideVndkProperties cc.VndkProperties 57 58 if !i.isModuleForVndk(version) { 59 // We only want the VNDK to include the latest interface. For interfaces in 60 // development, they will be frozen, so we put their latest version in the 61 // VNDK. For interfaces which are already frozen, we put their latest version 62 // in the VNDK, and when that version is frozen, the version in the VNDK can 63 // be updated. Otherwise, we remove this library from the VNDK, to avoid adding 64 // multiple versions of the same library to the VNDK. 65 overrideVndkProperties.Vndk.Enabled = proptools.BoolPtr(false) 66 overrideVndkProperties.Vndk.Support_system_process = proptools.BoolPtr(false) 67 } 68 69 var commonProperties *CommonNativeBackendProperties 70 if lang == langCpp { 71 commonProperties = &i.properties.Backend.Cpp.CommonNativeBackendProperties 72 } else if lang == langNdk || lang == langNdkPlatform { 73 commonProperties = &i.properties.Backend.Ndk.CommonNativeBackendProperties 74 } 75 76 genLog := proptools.Bool(commonProperties.Gen_log) 77 genTrace := i.genTrace(lang) 78 79 mctx.CreateModule(aidlGenFactory, &nameProperties{ 80 Name: proptools.StringPtr(cppSourceGen), 81 }, &aidlGenProperties{ 82 Srcs: srcs, 83 AidlRoot: aidlRoot, 84 Imports: i.getImportsForVersion(version), 85 Headers: i.properties.Headers, 86 Stability: i.properties.Stability, 87 Min_sdk_version: i.minSdkVersion(lang), 88 Lang: lang, 89 BaseName: i.ModuleBase.Name(), 90 GenLog: genLog, 91 Version: i.versionForInitVersionCompat(version), 92 GenTrace: genTrace, 93 Unstable: i.properties.Unstable, 94 NotFrozen: notFrozen, 95 RequireFrozenReason: requireFrozenReason, 96 Flags: i.flagsForAidlGenRule(version), 97 }) 98 99 importExportDependencies := []string{} 100 sharedLibDependency := commonProperties.Additional_shared_libraries 101 var headerLibs []string 102 var sdkVersion *string 103 var stl *string 104 var cpp_std *string 105 var hostSupported *bool 106 addCflags := commonProperties.Cflags 107 targetProp := ccTargetProperties{ 108 Darwin: darwinProperties{Enabled: proptools.BoolPtr(false)}, 109 } 110 111 if lang == langCpp { 112 importExportDependencies = append(importExportDependencies, "libbinder", "libutils") 113 if genTrace { 114 sharedLibDependency = append(sharedLibDependency, "libcutils") 115 } 116 hostSupported = i.properties.Host_supported 117 } else if lang == langNdk || lang == langNdkPlatform { 118 importExportDependencies = append(importExportDependencies, "libbinder_ndk") 119 nonAppProps := imageProperties{ 120 Cflags: []string{"-DBINDER_STABILITY_SUPPORT"}, 121 } 122 if genTrace { 123 sharedLibDependency = append(sharedLibDependency, "libandroid") 124 nonAppProps.Exclude_shared_libs = []string{"libandroid"} 125 nonAppProps.Header_libs = []string{"libandroid_aidltrace"} 126 nonAppProps.Shared_libs = []string{"libcutils"} 127 } 128 targetProp.Platform = nonAppProps 129 targetProp.Vendor = nonAppProps 130 targetProp.Product = nonAppProps 131 hostSupported = i.properties.Host_supported 132 if lang == langNdk && i.shouldGenerateAppNdkBackend() { 133 sdkVersion = i.properties.Backend.Ndk.Sdk_version 134 if sdkVersion == nil { 135 sdkVersion = proptools.StringPtr("current") 136 } 137 138 // Don't worry! This maps to libc++.so for the platform variant. 139 stl = proptools.StringPtr("c++_shared") 140 } 141 } else { 142 panic("Unrecognized language: " + lang) 143 } 144 145 vendorAvailable := i.properties.Vendor_available 146 odmAvailable := i.properties.Odm_available 147 productAvailable := i.properties.Product_available 148 recoveryAvailable := i.properties.Recovery_available 149 if lang == langCpp { 150 // Vendor and product modules cannot use the libbinder (cpp) backend of AIDL in a 151 // way that is stable. So, in order to prevent accidental usage of these library by 152 // vendor and product forcibly disabling this version of the library. 153 // 154 // It may be the case in the future that we will want to enable this (if some generic 155 // helper should be used by both libbinder vendor things using /dev/vndbinder as well 156 // as those things using /dev/binder + libbinder_ndk to talk to stable interfaces). 157 if "vintf" == proptools.String(i.properties.Stability) { 158 overrideVndkProperties.Vndk.Private = proptools.BoolPtr(true) 159 } 160 // As libbinder is not available for the product processes, we must not create 161 // product variant for the aidl_interface 162 productAvailable = nil 163 } 164 165 mctx.CreateModule(aidlImplementationGeneratorFactory, &nameProperties{ 166 Name: proptools.StringPtr(cppModuleGen + "-generator"), 167 }, &aidlImplementationGeneratorProperties{ 168 Lang: lang, 169 AidlInterfaceName: i.ModuleBase.Name(), 170 Version: version, 171 Imports: i.getImportsForVersion(version), 172 ModuleProperties: []interface{}{ 173 &ccProperties{ 174 Name: proptools.StringPtr(cppModuleGen), 175 Vendor_available: vendorAvailable, 176 Odm_available: odmAvailable, 177 Product_available: productAvailable, 178 Recovery_available: recoveryAvailable, 179 Host_supported: hostSupported, 180 Defaults: []string{"aidl-cpp-module-defaults"}, 181 Double_loadable: i.properties.Double_loadable, 182 Generated_sources: []string{cppSourceGen}, 183 Generated_headers: []string{cppSourceGen}, 184 Export_generated_headers: []string{cppSourceGen}, 185 Shared_libs: append(importExportDependencies, sharedLibDependency...), 186 Header_libs: headerLibs, 187 Export_shared_lib_headers: importExportDependencies, 188 Sdk_version: sdkVersion, 189 Stl: stl, 190 Cpp_std: cpp_std, 191 Cflags: append(addCflags, "-Wextra", "-Wall", "-Werror", "-Wextra-semi"), 192 Apex_available: commonProperties.Apex_available, 193 Min_sdk_version: i.minSdkVersion(lang), 194 Target: targetProp, 195 Tidy: proptools.BoolPtr(true), 196 // Do the tidy check only for the generated headers 197 Tidy_flags: []string{"--header-filter=" + android.PathForOutput(mctx).String() + ".*"}, 198 Tidy_checks_as_errors: []string{ 199 "*", 200 "-clang-analyzer-deadcode.DeadStores", // b/253079031 201 "-clang-analyzer-cplusplus.NewDeleteLeaks", // b/253079031 202 "-clang-analyzer-optin.performance.Padding", // b/253079031 203 }, 204 Include_build_directory: proptools.BoolPtr(false), // b/254682497 205 }, &i.properties.VndkProperties, 206 &commonProperties.VndkProperties, 207 &overrideVndkProperties, 208 // the logic to create implementation libraries has been reimplemented 209 // in a Bazel macro, so these libraries should not be converted with 210 // bp2build 211 // TODO(b/237810289) perhaps do something different here so that we aren't 212 // also disabling these modules in mixed builds 213 &bazelProperties{ 214 &Bazel_module{ 215 Bp2build_available: proptools.BoolPtr(false), 216 }, 217 }, 218 }, 219 }) 220 221 return cppModuleGen 222} 223 224func addCppAnalyzerLibrary(mctx android.DefaultableHookContext, i *aidlInterface, version string, notFrozen bool, requireFrozenReason string) string { 225 cppAnalyzerSourceGen := i.versionedName("") + "-cpp-analyzer-source" 226 cppAnalyzerModuleGen := i.versionedName("") + "-cpp-analyzer" 227 228 srcs, aidlRoot := i.srcsForVersion(mctx, version) 229 if len(srcs) == 0 { 230 return "" 231 } 232 233 mctx.CreateModule(aidlGenFactory, &nameProperties{ 234 Name: proptools.StringPtr(cppAnalyzerSourceGen), 235 }, &aidlGenProperties{ 236 Srcs: srcs, 237 AidlRoot: aidlRoot, 238 Imports: i.getImportsForVersion(version), 239 Stability: i.properties.Stability, 240 Min_sdk_version: i.minSdkVersion(langCpp), 241 Lang: langCppAnalyzer, 242 BaseName: i.ModuleBase.Name(), 243 Version: i.versionForInitVersionCompat(version), 244 Unstable: i.properties.Unstable, 245 NotFrozen: notFrozen, 246 RequireFrozenReason: requireFrozenReason, 247 Flags: i.flagsForAidlGenRule(version), 248 }) 249 250 importExportDependencies := []string{} 251 var hostSupported *bool 252 var addCflags []string // not using cpp backend cflags for now 253 targetProp := ccTargetProperties{ 254 Darwin: darwinProperties{Enabled: proptools.BoolPtr(false)}, 255 } 256 257 importExportDependencies = append(importExportDependencies, "libbinder", "libutils") 258 hostSupported = i.properties.Host_supported 259 260 vendorAvailable := i.properties.Vendor_available 261 odmAvailable := i.properties.Odm_available 262 productAvailable := i.properties.Product_available 263 recoveryAvailable := i.properties.Recovery_available 264 productAvailable = nil 265 266 g := aidlImplementationGeneratorProperties{ 267 ModuleProperties: []interface{}{ 268 &ccProperties{ 269 Name: proptools.StringPtr(cppAnalyzerModuleGen), 270 Vendor_available: vendorAvailable, 271 Odm_available: odmAvailable, 272 Product_available: productAvailable, 273 Recovery_available: recoveryAvailable, 274 Host_supported: hostSupported, 275 Defaults: []string{"aidl-cpp-module-defaults"}, 276 Double_loadable: i.properties.Double_loadable, 277 Installable: proptools.BoolPtr(true), 278 Generated_sources: []string{cppAnalyzerSourceGen}, 279 Generated_headers: []string{cppAnalyzerSourceGen}, 280 Export_generated_headers: []string{cppAnalyzerSourceGen}, 281 Shared_libs: append(importExportDependencies, i.versionedName(version)+"-"+langCpp), 282 Static_libs: []string{"aidl-analyzer-main"}, 283 Export_shared_lib_headers: importExportDependencies, 284 Cflags: append(addCflags, "-Wextra", "-Wall", "-Werror", "-Wextra-semi"), 285 Min_sdk_version: i.minSdkVersion(langCpp), 286 Target: targetProp, 287 Tidy: proptools.BoolPtr(true), 288 // Do the tidy check only for the generated headers 289 Tidy_flags: []string{"--header-filter=" + android.PathForOutput(mctx).String() + ".*"}, 290 Tidy_checks_as_errors: []string{ 291 "*", 292 "-clang-diagnostic-deprecated-declarations", // b/253081572 293 "-clang-analyzer-deadcode.DeadStores", // b/253079031 294 "-clang-analyzer-cplusplus.NewDeleteLeaks", // b/253079031 295 "-clang-analyzer-optin.performance.Padding", // b/253079031 296 }, 297 }, 298 // TODO(b/237810289) disable converting -cpp-analyzer module in bp2build 299 &bazelProperties{ 300 &Bazel_module{ 301 Bp2build_available: proptools.BoolPtr(false), 302 }, 303 }, 304 }, 305 } 306 307 mctx.CreateModule(wrapLibraryFactory(cc.BinaryFactory), g.ModuleProperties...) 308 return cppAnalyzerModuleGen 309} 310 311func addJavaLibrary(mctx android.DefaultableHookContext, i *aidlInterface, version string, notFrozen bool, requireFrozenReason string) string { 312 javaSourceGen := i.versionedName(version) + "-java-source" 313 javaModuleGen := i.versionedName(version) + "-java" 314 srcs, aidlRoot := i.srcsForVersion(mctx, version) 315 if len(srcs) == 0 { 316 // This can happen when the version is about to be frozen; the version 317 // directory is created but API dump hasn't been copied there. 318 // Don't create a library for the yet-to-be-frozen version. 319 return "" 320 } 321 minSdkVersion := i.minSdkVersion(langJava) 322 sdkVersion := i.properties.Backend.Java.Sdk_version 323 if !proptools.Bool(i.properties.Backend.Java.Platform_apis) && sdkVersion == nil { 324 // platform apis requires no default 325 sdkVersion = proptools.StringPtr("system_current") 326 } 327 // use sdkVersion if minSdkVersion is not set 328 if sdkVersion != nil && minSdkVersion == nil { 329 minSdkVersion = proptools.StringPtr(android.SdkSpecFrom(mctx, *sdkVersion).ApiLevel.String()) 330 } 331 332 mctx.CreateModule(aidlGenFactory, &nameProperties{ 333 Name: proptools.StringPtr(javaSourceGen), 334 }, &aidlGenProperties{ 335 Srcs: srcs, 336 AidlRoot: aidlRoot, 337 Imports: i.getImportsForVersion(version), 338 Headers: i.properties.Headers, 339 Stability: i.properties.Stability, 340 Min_sdk_version: minSdkVersion, 341 Platform_apis: proptools.Bool(i.properties.Backend.Java.Platform_apis), 342 Lang: langJava, 343 BaseName: i.ModuleBase.Name(), 344 Version: version, 345 GenRpc: proptools.Bool(i.properties.Backend.Java.Gen_rpc), 346 GenTrace: i.genTrace(langJava), 347 Unstable: i.properties.Unstable, 348 NotFrozen: notFrozen, 349 RequireFrozenReason: requireFrozenReason, 350 Flags: i.flagsForAidlGenRule(version), 351 }) 352 353 mctx.CreateModule(aidlImplementationGeneratorFactory, &nameProperties{ 354 Name: proptools.StringPtr(javaModuleGen + "-generator"), 355 }, &aidlImplementationGeneratorProperties{ 356 Lang: langJava, 357 AidlInterfaceName: i.ModuleBase.Name(), 358 Version: version, 359 Imports: i.getImportsForVersion(version), 360 ModuleProperties: []interface{}{ 361 &javaProperties{ 362 Name: proptools.StringPtr(javaModuleGen), 363 Installable: proptools.BoolPtr(true), 364 Defaults: []string{"aidl-java-module-defaults"}, 365 Sdk_version: sdkVersion, 366 Platform_apis: i.properties.Backend.Java.Platform_apis, 367 Srcs: []string{":" + javaSourceGen}, 368 Apex_available: i.properties.Backend.Java.Apex_available, 369 Min_sdk_version: i.minSdkVersion(langJava), 370 }, 371 &i.properties.Backend.Java.LintProperties, 372 // the logic to create implementation libraries has been reimplemented 373 // in a Bazel macro, so these libraries should not be converted with 374 // bp2build 375 // TODO(b/237810289) perhaps do something different here so that we aren't 376 // also disabling these modules in mixed builds 377 &bazelProperties{ 378 &Bazel_module{ 379 Bp2build_available: proptools.BoolPtr(false), 380 }, 381 }, 382 }, 383 }) 384 385 return javaModuleGen 386} 387 388func addRustLibrary(mctx android.DefaultableHookContext, i *aidlInterface, version string, notFrozen bool, requireFrozenReason string) string { 389 rustSourceGen := i.versionedName(version) + "-rust-source" 390 rustModuleGen := i.versionedName(version) + "-rust" 391 srcs, aidlRoot := i.srcsForVersion(mctx, version) 392 if len(srcs) == 0 { 393 // This can happen when the version is about to be frozen; the version 394 // directory is created but API dump hasn't been copied there. 395 // Don't create a library for the yet-to-be-frozen version. 396 return "" 397 } 398 399 mctx.CreateModule(aidlGenFactory, &nameProperties{ 400 Name: proptools.StringPtr(rustSourceGen), 401 }, &aidlGenProperties{ 402 Srcs: srcs, 403 AidlRoot: aidlRoot, 404 Imports: i.getImportsForVersion(version), 405 Headers: i.properties.Headers, 406 Stability: i.properties.Stability, 407 Min_sdk_version: i.minSdkVersion(langRust), 408 Lang: langRust, 409 BaseName: i.ModuleBase.Name(), 410 Version: i.versionForInitVersionCompat(version), 411 Unstable: i.properties.Unstable, 412 NotFrozen: notFrozen, 413 RequireFrozenReason: requireFrozenReason, 414 Flags: i.flagsForAidlGenRule(version), 415 }) 416 417 versionedRustName := fixRustName(i.versionedName(version)) 418 rustCrateName := fixRustName(i.ModuleBase.Name()) 419 420 mctx.CreateModule(wrapLibraryFactory(aidlRustLibraryFactory), &rustProperties{ 421 Name: proptools.StringPtr(rustModuleGen), 422 Crate_name: rustCrateName, 423 Stem: proptools.StringPtr("lib" + versionedRustName), 424 Defaults: []string{"aidl-rust-module-defaults"}, 425 Host_supported: i.properties.Host_supported, 426 Vendor_available: i.properties.Vendor_available, 427 Product_available: i.properties.Product_available, 428 Apex_available: i.properties.Backend.Rust.Apex_available, 429 Min_sdk_version: i.minSdkVersion(langRust), 430 Target: rustTargetProperties{Darwin: darwinProperties{Enabled: proptools.BoolPtr(false)}}, 431 }, &rust.SourceProviderProperties{ 432 Source_stem: proptools.StringPtr(versionedRustName), 433 }, &aidlRustSourceProviderProperties{ 434 SourceGen: rustSourceGen, 435 Imports: i.getImportsForVersion(version), 436 Version: version, 437 AidlInterfaceName: i.ModuleBase.Name(), 438 }) 439 440 return rustModuleGen 441} 442 443// This function returns module name with version. Assume that there is foo of which latest version is 2 444// Version -> Module name 445// "1"->foo-V1 446// "2"->foo-V2 447// "3"->foo-V3 448// And assume that there is 'bar' which is an 'unstable' interface. 449// ""->bar 450func (i *aidlInterface) versionedName(version string) string { 451 name := i.ModuleBase.Name() 452 if version == "" { 453 return name 454 } 455 return name + "-V" + version 456} 457 458func (i *aidlInterface) srcsForVersion(mctx android.EarlyModuleContext, version string) (srcs []string, aidlRoot string) { 459 if version == i.nextVersion() { 460 return i.properties.Srcs, i.properties.Local_include_dir 461 } else { 462 aidlRoot = filepath.Join(aidlApiDir, i.ModuleBase.Name(), version) 463 full_paths, err := mctx.GlobWithDeps(filepath.Join(mctx.ModuleDir(), aidlRoot, "**/*.aidl"), nil) 464 if err != nil { 465 panic(err) 466 } 467 for _, path := range full_paths { 468 // Here, we need path local to the module 469 srcs = append(srcs, strings.TrimPrefix(path, mctx.ModuleDir()+"/")) 470 } 471 return srcs, aidlRoot 472 } 473} 474 475// For certain backend, avoid a difference between the initial version of a versioned 476// interface and an unversioned interface. This ensures that prebuilts can't prevent 477// an interface from switching from unversioned to versioned. 478func (i *aidlInterface) versionForInitVersionCompat(version string) string { 479 if !i.hasVersion() { 480 return "" 481 } 482 return version 483} 484 485func (i *aidlInterface) flagsForAidlGenRule(version string) (flags []string) { 486 flags = append(flags, i.properties.Flags...) 487 // For ToT, turn on "-Weverything" (enable all warnings) 488 if version == i.nextVersion() { 489 flags = append(flags, "-Weverything -Wno-missing-permission-annotation") 490 } 491 return 492} 493 494func (i *aidlInterface) isModuleForVndk(version string) bool { 495 if i.properties.Vndk_use_version != nil { 496 if !i.hasVersion() && version != *i.properties.Vndk_use_version { 497 panic("unrecognized vndk_use_version") 498 } 499 // Will be exactly one of the version numbers 500 return version == *i.properties.Vndk_use_version 501 } 502 503 // For an interface with no versions, this is the ToT interface. 504 if !i.hasVersion() { 505 return version == i.nextVersion() 506 } 507 508 return version == i.latestVersion() 509} 510 511// importing aidl_interface's version | imported aidl_interface | imported aidl_interface's version 512// -------------------------------------------------------------------------------------------------- 513// whatever | unstable | unstable version 514// ToT version(including unstable) | whatever | ToT version(unstable if unstable) 515// otherwise | whatever | the latest stable version 516// In the case that import specifies the version which it wants to use, use that version. 517func (i *aidlInterface) getImportWithVersion(version string, anImport string, other *aidlInterface) string { 518 if hasVersionSuffix(anImport) { 519 return anImport 520 } 521 if proptools.Bool(other.properties.Unstable) { 522 return anImport 523 } 524 if version == i.nextVersion() || !other.hasVersion() { 525 return other.versionedName(other.nextVersion()) 526 } 527 return other.versionedName(other.latestVersion()) 528} 529 530// Assuming that the context module has deps to its original aidl_interface and imported 531// aidl_interface modules with interfaceDepTag and importInterfaceDepTag, returns the list of 532// imported interfaces with versions. 533func getImportsWithVersion(ctx android.BaseMutatorContext, interfaceName, version string) []string { 534 i := ctx.GetDirectDepWithTag(interfaceName+aidlInterfaceSuffix, interfaceDep).(*aidlInterface) 535 var imports []string 536 ctx.VisitDirectDeps(func(dep android.Module) { 537 if tag, ok := ctx.OtherModuleDependencyTag(dep).(importInterfaceDepTag); ok { 538 other := dep.(*aidlInterface) 539 imports = append(imports, i.getImportWithVersion(version, tag.anImport, other)) 540 } 541 }) 542 return imports 543} 544 545func aidlImplementationGeneratorFactory() android.Module { 546 g := &aidlImplementationGenerator{} 547 g.AddProperties(&g.properties) 548 android.InitAndroidModule(g) 549 return g 550} 551 552type aidlImplementationGenerator struct { 553 android.ModuleBase 554 properties aidlImplementationGeneratorProperties 555} 556 557type aidlImplementationGeneratorProperties struct { 558 Lang string 559 AidlInterfaceName string 560 Version string 561 Imports []string 562 ModuleProperties []interface{} 563} 564 565func (g *aidlImplementationGenerator) DepsMutator(ctx android.BottomUpMutatorContext) { 566} 567 568func (g *aidlImplementationGenerator) GenerateAndroidBuildActions(ctx android.ModuleContext) { 569} 570 571func (g *aidlImplementationGenerator) GenerateImplementation(ctx android.TopDownMutatorContext) { 572 imports := wrap("", getImportsWithVersion(ctx, g.properties.AidlInterfaceName, g.properties.Version), "-"+g.properties.Lang) 573 if g.properties.Lang == langJava { 574 if p, ok := g.properties.ModuleProperties[0].(*javaProperties); ok { 575 p.Static_libs = imports 576 } 577 ctx.CreateModule(wrapLibraryFactory(java.LibraryFactory), g.properties.ModuleProperties...) 578 } else { 579 if p, ok := g.properties.ModuleProperties[0].(*ccProperties); ok { 580 p.Shared_libs = append(p.Shared_libs, imports...) 581 p.Export_shared_lib_headers = append(p.Export_shared_lib_headers, imports...) 582 } 583 module := ctx.CreateModule(wrapLibraryFactory(cc.LibraryFactory), g.properties.ModuleProperties...) 584 // AIDL-generated CC modules can't be used across system/vendor boundary. So marking it 585 // as MustUseVendorVariant. See build/soong/cc/config/vndk.go 586 module.(*cc.Module).Properties.MustUseVendorVariant = true 587 } 588} 589