Merge logtags from cc modules too
Merged logtags files will be used for Soong built filesystem images. Bug: 336189540 Test: m out/soong/.intermediates/all-event-log-tags.txt Test: m out/target/common/obj/all-event-log-tags.txt Change-Id: Ib590c2bc8073e9acee6b45ef08092768237cf9d3
This commit is contained in:
parent
2d5e7579d4
commit
37e0bb0db4
8 changed files with 72 additions and 48 deletions
|
@ -60,6 +60,7 @@ bootstrap_go_package {
|
|||
"license_metadata.go",
|
||||
"license_sdk_member.go",
|
||||
"licenses.go",
|
||||
"logtags.go",
|
||||
"makevars.go",
|
||||
"metrics.go",
|
||||
"module.go",
|
||||
|
|
56
android/logtags.go
Normal file
56
android/logtags.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Copyright 2024 Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package android
|
||||
|
||||
import "github.com/google/blueprint"
|
||||
|
||||
func init() {
|
||||
RegisterParallelSingletonType("logtags", LogtagsSingleton)
|
||||
}
|
||||
|
||||
type LogtagsInfo struct {
|
||||
Logtags Paths
|
||||
}
|
||||
|
||||
var LogtagsProviderKey = blueprint.NewProvider[*LogtagsInfo]()
|
||||
|
||||
func LogtagsSingleton() Singleton {
|
||||
return &logtagsSingleton{}
|
||||
}
|
||||
|
||||
type logtagsSingleton struct{}
|
||||
|
||||
func MergedLogtagsPath(ctx PathContext) OutputPath {
|
||||
return PathForIntermediates(ctx, "all-event-log-tags.txt")
|
||||
}
|
||||
|
||||
func (l *logtagsSingleton) GenerateBuildActions(ctx SingletonContext) {
|
||||
var allLogtags Paths
|
||||
ctx.VisitAllModules(func(module Module) {
|
||||
if !module.ExportedToMake() {
|
||||
return
|
||||
}
|
||||
if logtagsInfo, ok := SingletonModuleProvider(ctx, module, LogtagsProviderKey); ok {
|
||||
allLogtags = append(allLogtags, logtagsInfo.Logtags...)
|
||||
}
|
||||
})
|
||||
|
||||
builder := NewRuleBuilder(pctx, ctx)
|
||||
builder.Command().
|
||||
BuiltTool("merge-event-log-tags").
|
||||
FlagWithOutput("-o ", MergedLogtagsPath(ctx)).
|
||||
Inputs(SortedUniquePaths(allLogtags))
|
||||
builder.Build("all-event-log-tags.txt", "merge logtags")
|
||||
}
|
|
@ -151,7 +151,7 @@ func init() {
|
|||
"LOCAL_CLANG_CFLAGS": "clang_cflags",
|
||||
"LOCAL_YACCFLAGS": "yacc.flags",
|
||||
"LOCAL_SANITIZE_RECOVER": "sanitize.recover",
|
||||
"LOCAL_LOGTAGS_FILES": "logtags",
|
||||
"LOCAL_SOONG_LOGTAGS_FILES": "logtags",
|
||||
"LOCAL_EXPORT_HEADER_LIBRARY_HEADERS": "export_header_lib_headers",
|
||||
"LOCAL_EXPORT_SHARED_LIBRARY_HEADERS": "export_shared_lib_headers",
|
||||
"LOCAL_EXPORT_STATIC_LIBRARY_HEADERS": "export_static_lib_headers",
|
||||
|
|
|
@ -88,7 +88,7 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries {
|
|||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
if len(c.Properties.Logtags) > 0 {
|
||||
entries.AddStrings("LOCAL_LOGTAGS_FILES", c.Properties.Logtags...)
|
||||
entries.AddStrings("LOCAL_SOONG_LOGTAGS_FILES", c.logtagsPaths.Strings()...)
|
||||
}
|
||||
// Note: Pass the exact value of AndroidMkSystemSharedLibs to the Make
|
||||
// world, even if it is an empty list. In the Make world,
|
||||
|
|
9
cc/cc.go
9
cc/cc.go
|
@ -319,7 +319,7 @@ type BaseProperties struct {
|
|||
|
||||
// *.logtags files, to combine together in order to generate the /system/etc/event-log-tags
|
||||
// file
|
||||
Logtags []string
|
||||
Logtags []string `android:"path"`
|
||||
|
||||
// Make this module available when building for ramdisk.
|
||||
// On device without a dedicated recovery partition, the module is only
|
||||
|
@ -908,6 +908,8 @@ type Module struct {
|
|||
|
||||
// Aconfig files for all transitive deps. Also exposed via TransitiveDeclarationsInfo
|
||||
mergedAconfigFiles map[string]android.Paths
|
||||
|
||||
logtagsPaths android.Paths
|
||||
}
|
||||
|
||||
func (c *Module) AddJSONData(d *map[string]interface{}) {
|
||||
|
@ -1997,6 +1999,11 @@ func (d *Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||
ctx := moduleContextFromAndroidModuleContext(actx, c)
|
||||
|
||||
c.logtagsPaths = android.PathsForModuleSrc(actx, c.Properties.Logtags)
|
||||
android.SetProvider(ctx, android.LogtagsProviderKey, &android.LogtagsInfo{
|
||||
Logtags: c.logtagsPaths,
|
||||
})
|
||||
|
||||
// If Test_only is set on a module in bp file, respect the setting, otherwise
|
||||
// see if is a known test module type.
|
||||
testOnly := c.testModule || c.testLibrary()
|
||||
|
|
|
@ -92,11 +92,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
|||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
if len(library.logtagsSrcs) > 0 {
|
||||
var logtags []string
|
||||
for _, l := range library.logtagsSrcs {
|
||||
logtags = append(logtags, l.Rel())
|
||||
}
|
||||
entries.AddStrings("LOCAL_LOGTAGS_FILES", logtags...)
|
||||
entries.AddStrings("LOCAL_SOONG_LOGTAGS_FILES", library.logtagsSrcs.Strings()...)
|
||||
}
|
||||
|
||||
if library.installFile == nil {
|
||||
|
|
43
java/gen.go
43
java/gen.go
|
@ -27,7 +27,6 @@ import (
|
|||
|
||||
func init() {
|
||||
pctx.SourcePathVariable("logtagsCmd", "build/make/tools/java-event-log-tags.py")
|
||||
pctx.SourcePathVariable("mergeLogtagsCmd", "build/make/tools/merge-event-log-tags.py")
|
||||
pctx.SourcePathVariable("logtagsLib", "build/make/tools/event_log_tags.py")
|
||||
}
|
||||
|
||||
|
@ -37,12 +36,6 @@ var (
|
|||
Command: "$logtagsCmd -o $out $in",
|
||||
CommandDeps: []string{"$logtagsCmd", "$logtagsLib"},
|
||||
})
|
||||
|
||||
mergeLogtags = pctx.AndroidStaticRule("mergeLogtags",
|
||||
blueprint.RuleParams{
|
||||
Command: "$mergeLogtagsCmd -o $out $in",
|
||||
CommandDeps: []string{"$mergeLogtagsCmd", "$logtagsLib"},
|
||||
})
|
||||
)
|
||||
|
||||
func genAidl(ctx android.ModuleContext, aidlFiles android.Paths, aidlGlobalFlags string, aidlIndividualFlags map[string]string, deps android.Paths) android.Paths {
|
||||
|
@ -178,37 +171,9 @@ func (j *Module) genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
|||
outSrcFiles = append(outSrcFiles, srcJarFiles...)
|
||||
}
|
||||
|
||||
android.SetProvider(ctx, android.LogtagsProviderKey, &android.LogtagsInfo{
|
||||
Logtags: j.logtagsSrcs,
|
||||
})
|
||||
|
||||
return outSrcFiles
|
||||
}
|
||||
|
||||
func LogtagsSingleton() android.Singleton {
|
||||
return &logtagsSingleton{}
|
||||
}
|
||||
|
||||
type logtagsProducer interface {
|
||||
logtags() android.Paths
|
||||
}
|
||||
|
||||
func (j *Module) logtags() android.Paths {
|
||||
return j.logtagsSrcs
|
||||
}
|
||||
|
||||
var _ logtagsProducer = (*Module)(nil)
|
||||
|
||||
type logtagsSingleton struct{}
|
||||
|
||||
func (l *logtagsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||
var allLogtags android.Paths
|
||||
ctx.VisitAllModules(func(module android.Module) {
|
||||
if logtags, ok := module.(logtagsProducer); ok {
|
||||
allLogtags = append(allLogtags, logtags.logtags()...)
|
||||
}
|
||||
})
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: mergeLogtags,
|
||||
Description: "merge logtags",
|
||||
Output: android.PathForIntermediates(ctx, "all-event-log-tags.txt"),
|
||||
Inputs: allLogtags,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -75,7 +75,6 @@ func registerJavaBuildComponents(ctx android.RegistrationContext) {
|
|||
ctx.BottomUp("jacoco_deps", jacocoDepsMutator).Parallel()
|
||||
})
|
||||
|
||||
ctx.RegisterParallelSingletonType("logtags", LogtagsSingleton)
|
||||
ctx.RegisterParallelSingletonType("kythe_java_extract", kytheExtractJavaFactory)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue