Merge "No NDK libraries in clang-tidy pathDeps" am: 23d5d986fe
am: 60b3edb494
am: 3ae86d3ee8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1906094 Change-Id: I844c069188abdddd8bc5235e304f853bb4d33a44
This commit is contained in:
@@ -549,6 +549,10 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no
|
|||||||
return "$" + kind + n
|
return "$" + kind + n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clang-tidy checks source files and does not need to link with libraries.
|
||||||
|
// tidyPathDeps should contain pathDeps but not libraries.
|
||||||
|
tidyPathDeps := skipNdkLibraryDeps(ctx, pathDeps)
|
||||||
|
|
||||||
for i, srcFile := range srcFiles {
|
for i, srcFile := range srcFiles {
|
||||||
objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o")
|
objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o")
|
||||||
|
|
||||||
@@ -672,7 +676,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no
|
|||||||
Output: tidyFile,
|
Output: tidyFile,
|
||||||
Input: srcFile,
|
Input: srcFile,
|
||||||
Implicits: cFlagsDeps,
|
Implicits: cFlagsDeps,
|
||||||
OrderOnly: pathDeps,
|
OrderOnly: tidyPathDeps,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"ccCmd": ccCmd,
|
"ccCmd": ccCmd,
|
||||||
"cFlags": shareFlags("cFlags", escapeSingleQuotes(moduleToolingFlags)),
|
"cFlags": shareFlags("cFlags", escapeSingleQuotes(moduleToolingFlags)),
|
||||||
|
@@ -82,12 +82,33 @@ func getNdkBaseTimestampFile(ctx android.PathContext) android.WritablePath {
|
|||||||
return android.PathForOutput(ctx, "ndk_base.timestamp")
|
return android.PathForOutput(ctx, "ndk_base.timestamp")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The headers timestamp file depends only on the NDK headers.
|
||||||
|
// This is used mainly for .tidy files that do not need any stub libraries.
|
||||||
|
func getNdkHeadersTimestampFile(ctx android.PathContext) android.WritablePath {
|
||||||
|
return android.PathForOutput(ctx, "ndk_headers.timestamp")
|
||||||
|
}
|
||||||
|
|
||||||
// The full timestamp file depends on the base timestamp *and* the static
|
// The full timestamp file depends on the base timestamp *and* the static
|
||||||
// libraries.
|
// libraries.
|
||||||
func getNdkFullTimestampFile(ctx android.PathContext) android.WritablePath {
|
func getNdkFullTimestampFile(ctx android.PathContext) android.WritablePath {
|
||||||
return android.PathForOutput(ctx, "ndk.timestamp")
|
return android.PathForOutput(ctx, "ndk.timestamp")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace ndk_base.timestamp and ndk.timestamp with ndk_headers.timestamp.
|
||||||
|
func skipNdkLibraryDeps(ctx android.ModuleContext, paths android.Paths) android.Paths {
|
||||||
|
var newPaths android.Paths
|
||||||
|
baseTimestamp := getNdkBaseTimestampFile(ctx)
|
||||||
|
fullTimestamp := getNdkFullTimestampFile(ctx)
|
||||||
|
headersTimestamp := getNdkHeadersTimestampFile(ctx)
|
||||||
|
for _, path := range paths {
|
||||||
|
if path == baseTimestamp || path == fullTimestamp {
|
||||||
|
path = headersTimestamp
|
||||||
|
}
|
||||||
|
newPaths = append(newPaths, path)
|
||||||
|
}
|
||||||
|
return newPaths
|
||||||
|
}
|
||||||
|
|
||||||
func NdkSingleton() android.Singleton {
|
func NdkSingleton() android.Singleton {
|
||||||
return &ndkSingleton{}
|
return &ndkSingleton{}
|
||||||
}
|
}
|
||||||
@@ -96,6 +117,7 @@ type ndkSingleton struct{}
|
|||||||
|
|
||||||
func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
var staticLibInstallPaths android.Paths
|
var staticLibInstallPaths android.Paths
|
||||||
|
var headerPaths android.Paths
|
||||||
var installPaths android.Paths
|
var installPaths android.Paths
|
||||||
var licensePaths android.Paths
|
var licensePaths android.Paths
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
@@ -104,16 +126,19 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if m, ok := module.(*headerModule); ok {
|
if m, ok := module.(*headerModule); ok {
|
||||||
|
headerPaths = append(headerPaths, m.installPaths...)
|
||||||
installPaths = append(installPaths, m.installPaths...)
|
installPaths = append(installPaths, m.installPaths...)
|
||||||
licensePaths = append(licensePaths, m.licensePath)
|
licensePaths = append(licensePaths, m.licensePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if m, ok := module.(*versionedHeaderModule); ok {
|
if m, ok := module.(*versionedHeaderModule); ok {
|
||||||
|
headerPaths = append(headerPaths, m.installPaths...)
|
||||||
installPaths = append(installPaths, m.installPaths...)
|
installPaths = append(installPaths, m.installPaths...)
|
||||||
licensePaths = append(licensePaths, m.licensePath)
|
licensePaths = append(licensePaths, m.licensePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if m, ok := module.(*preprocessedHeadersModule); ok {
|
if m, ok := module.(*preprocessedHeadersModule); ok {
|
||||||
|
headerPaths = append(headerPaths, m.installPaths...)
|
||||||
installPaths = append(installPaths, m.installPaths...)
|
installPaths = append(installPaths, m.installPaths...)
|
||||||
licensePaths = append(licensePaths, m.licensePath)
|
licensePaths = append(licensePaths, m.licensePath)
|
||||||
}
|
}
|
||||||
@@ -153,6 +178,12 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
Validation: getNdkAbiDiffTimestampFile(ctx),
|
Validation: getNdkAbiDiffTimestampFile(ctx),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: android.Touch,
|
||||||
|
Output: getNdkHeadersTimestampFile(ctx),
|
||||||
|
Implicits: headerPaths,
|
||||||
|
})
|
||||||
|
|
||||||
fullDepPaths := append(staticLibInstallPaths, getNdkBaseTimestampFile(ctx))
|
fullDepPaths := append(staticLibInstallPaths, getNdkBaseTimestampFile(ctx))
|
||||||
|
|
||||||
// There's a phony "ndk" rule defined in core/main.mk that depends on this.
|
// There's a phony "ndk" rule defined in core/main.mk that depends on this.
|
||||||
|
Reference in New Issue
Block a user