diff options
| -rw-r--r-- | android/compliance_metadata.go | 22 | ||||
| -rw-r--r-- | android/module_test.go | 11 | ||||
| -rw-r--r-- | cc/builder.go | 7 | ||||
| -rw-r--r-- | cc/compiler.go | 6 | ||||
| -rw-r--r-- | cc/library.go | 17 | ||||
| -rw-r--r-- | filesystem/android_device_product_out.go | 11 | ||||
| -rw-r--r-- | rust/rust.go | 3 |
7 files changed, 48 insertions, 29 deletions
diff --git a/android/compliance_metadata.go b/android/compliance_metadata.go index 1e1f4bc60..35805a2a8 100644 --- a/android/compliance_metadata.go +++ b/android/compliance_metadata.go @@ -244,18 +244,6 @@ var ( `${sqlite3} $out ".import --csv ${make_modules} make_modules"`, CommandDeps: []string{"${sqlite3}"}, }, "make_metadata", "make_modules") - - buildMakeMetadataCsv = pctx.AndroidStaticRule("buildMakeMetadataCsv", - blueprint.RuleParams{ - Command: `rm -rf $out && ` + - `echo "installed_file,module_path,is_soong_module,is_prebuilt_make_module,product_copy_files,kernel_module_copy_files,is_platform_generated,static_libs,whole_static_libs,license_text" > $out`, - }) - - buildMakeModulesCsv = pctx.AndroidStaticRule("buildMakeModulesCsv", - blueprint.RuleParams{ - Command: `rm -rf $out && ` + - `echo "name,module_path,module_class,module_type,static_libs,whole_static_libs,built_files,installed_files" > $out`, - }) ) func complianceMetadataSingletonFactory() Singleton { @@ -328,14 +316,8 @@ func (c *complianceMetadataSingleton) GenerateBuildActions(ctx SingletonContext) makeModulesCsv := PathForOutput(ctx, "compliance-metadata", deviceProduct, "make-modules.csv") if !ctx.Config().KatiEnabled() { - ctx.Build(pctx, BuildParams{ - Rule: buildMakeMetadataCsv, - Output: makeMetadataCsv, - }) - ctx.Build(pctx, BuildParams{ - Rule: buildMakeModulesCsv, - Output: makeModulesCsv, - }) + WriteFileRule(ctx, makeMetadataCsv, "installed_file,module_path,is_soong_module,is_prebuilt_make_module,product_copy_files,kernel_module_copy_files,is_platform_generated,static_libs,whole_static_libs,license_text") + WriteFileRule(ctx, makeModulesCsv, "name,module_path,module_class,module_type,static_libs,whole_static_libs,built_files,installed_files") } // Import metadata from Make and Soong to sqlite3 database diff --git a/android/module_test.go b/android/module_test.go index 6e6d44909..3b81dedc7 100644 --- a/android/module_test.go +++ b/android/module_test.go @@ -1110,3 +1110,14 @@ func TestVintfFragmentModulesChecksPartition(t *testing.T) { "Module .+ and Vintf_fragment .+ are installed to different partitions.")). RunTestWithBp(t, bp) } + +func TestInvalidModuleName(t *testing.T) { + bp := ` + deps { + name: "fo o", + } + ` + prepareForModuleTests. + ExtendWithErrorHandler(FixtureExpectsOneErrorPattern(`should use a valid name`)). + RunTestWithBp(t, bp) +} diff --git a/cc/builder.go b/cc/builder.go index c94a6741c..16f006d37 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -974,13 +974,18 @@ func transformObjToDynamicBinary(ctx android.ModuleContext, func transformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Paths, soFile android.Path, baseName string, exportedIncludeDirs []string, symbolFile android.OptionalPath, excludedSymbolVersions, excludedSymbolTags, includedSymbolTags []string, - api string) android.Path { + api string, commonGlobalIncludes bool) android.Path { outputFile := android.PathForModuleOut(ctx, baseName+".lsdump") implicits := android.Paths{soFile} symbolFilterStr := "-so " + soFile.String() exportedHeaderFlags := android.JoinWithPrefix(exportedIncludeDirs, "-I") + // If this library does not export any include directory, do not append the flags + // so that the ABI tool dumps everything without filtering by the include directories. + if commonGlobalIncludes && len(exportedIncludeDirs) > 0 { + exportedHeaderFlags += " ${config.CommonGlobalIncludes}" + } if symbolFile.Valid() { implicits = append(implicits, symbolFile.Path()) diff --git a/cc/compiler.go b/cc/compiler.go index 3730bbe66..949603e40 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -324,6 +324,10 @@ func addToModuleList(ctx ModuleContext, key android.OnceKey, module string) { getNamedMapForConfig(ctx.Config(), key).Store(module, true) } +func requiresGlobalIncludes(ctx ModuleContext) bool { + return !(ctx.useSdk() || ctx.InVendorOrProduct()) || ctx.Host() +} + func useGnuExtensions(gnuExtensions *bool) bool { return proptools.BoolDefault(gnuExtensions, true) } @@ -452,7 +456,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps flags.Local.YasmFlags = append(flags.Local.YasmFlags, "-I"+modulePath) } - if !(ctx.useSdk() || ctx.InVendorOrProduct()) || ctx.Host() { + if requiresGlobalIncludes(ctx) { flags.SystemIncludeFlags = append(flags.SystemIncludeFlags, "${config.CommonGlobalIncludes}", tc.IncludeFlags()) diff --git a/cc/library.go b/cc/library.go index 950ea9134..789190cd1 100644 --- a/cc/library.go +++ b/cc/library.go @@ -630,10 +630,17 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa } if library.sabi.shouldCreateSourceAbiDump() { dirs := library.exportedIncludeDirsForAbiCheck(ctx) - flags.SAbiFlags = make([]string, 0, len(dirs)) + flags.SAbiFlags = make([]string, 0, len(dirs)+1) for _, dir := range dirs { flags.SAbiFlags = append(flags.SAbiFlags, "-I"+dir) } + // If this library does not export any include directory, do not append the flags + // so that the ABI tool dumps everything without filtering by the include directories. + // requiresGlobalIncludes returns whether this library can include CommonGlobalIncludes. + // If the library cannot include them, it cannot export them. + if len(dirs) > 0 && requiresGlobalIncludes(ctx) { + flags.SAbiFlags = append(flags.SAbiFlags, "${config.CommonGlobalIncludes}") + } totalLength := len(srcs) + len(deps.GeneratedSources) + len(sharedSrcs) + len(staticSrcs) if totalLength > 0 { @@ -1362,13 +1369,15 @@ func (library *libraryDecorator) linkLlndkSAbiDumpFiles(ctx ModuleContext, deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string, excludeSymbolVersions, excludeSymbolTags []string, sdkVersionForVendorApiLevel string) android.Path { + // Though LLNDK is implemented in system, the callers in vendor cannot include CommonGlobalIncludes, + // so commonGlobalIncludes is false. return transformDumpToLinkedDump(ctx, sAbiDumpFiles, soFile, libFileName+".llndk", library.llndkIncludeDirsForAbiCheck(ctx, deps), android.OptionalPathForModuleSrc(ctx, library.Properties.Llndk.Symbol_file), append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...), append([]string{"platform-only"}, excludeSymbolTags...), - []string{"llndk"}, sdkVersionForVendorApiLevel) + []string{"llndk"}, sdkVersionForVendorApiLevel, false /* commonGlobalIncludes */) } func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext, @@ -1381,7 +1390,7 @@ func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext, android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file), append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...), append([]string{"platform-only"}, excludeSymbolTags...), - []string{"apex", "systemapi"}, sdkVersion) + []string{"apex", "systemapi"}, sdkVersion, requiresGlobalIncludes(ctx)) } func getRefAbiDumpFile(ctx android.ModuleInstallPathContext, @@ -1524,7 +1533,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)), headerAbiChecker.Exclude_symbol_versions, headerAbiChecker.Exclude_symbol_tags, - []string{} /* includeSymbolTags */, currSdkVersion) + []string{} /* includeSymbolTags */, currSdkVersion, requiresGlobalIncludes(ctx)) var llndkDump, apexVariantDump android.Path tags := classifySourceAbiDump(ctx.Module().(*Module)) diff --git a/filesystem/android_device_product_out.go b/filesystem/android_device_product_out.go index c06715ab8..6ac89ad6e 100644 --- a/filesystem/android_device_product_out.go +++ b/filesystem/android_device_product_out.go @@ -177,6 +177,17 @@ func (a *androidDevice) copyFilesToProductOutForSoongOnly(ctx android.ModuleCont Implicits: deps, }) + emptyFile := android.PathForModuleOut(ctx, "empty_file") + android.WriteFileRule(ctx, emptyFile, "") + + // TODO: We don't have these tests building in soong yet. Add phonies for them so that CI builds + // that try to build them don't error out. + ctx.Phony("continuous_instrumentation_tests", emptyFile) + ctx.Phony("continuous_native_tests", emptyFile) + ctx.Phony("device-tests", emptyFile) + ctx.Phony("device-platinum-tests", emptyFile) + ctx.Phony("platform_tests", emptyFile) + return copyToProductOutTimestamp } diff --git a/rust/rust.go b/rust/rust.go index 7880dee8c..81c33e688 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -377,9 +377,6 @@ func (mod *Module) Toc() android.OptionalPath { } func (mod *Module) UseSdk() bool { - if cc.CanUseSdk(mod) { - return String(mod.Properties.Sdk_version) != "" - } return false } |