Loading cc/builder.go +5 −1 Original line number Diff line number Diff line Loading @@ -549,6 +549,10 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no 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 { objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o") Loading Loading @@ -672,7 +676,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no Output: tidyFile, Input: srcFile, Implicits: cFlagsDeps, OrderOnly: pathDeps, OrderOnly: tidyPathDeps, Args: map[string]string{ "ccCmd": ccCmd, "cFlags": shareFlags("cFlags", escapeSingleQuotes(moduleToolingFlags)), Loading cc/ndk_sysroot.go +31 −0 Original line number Diff line number Diff line Loading @@ -82,12 +82,33 @@ func getNdkBaseTimestampFile(ctx android.PathContext) android.WritablePath { 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 // libraries. func getNdkFullTimestampFile(ctx android.PathContext) android.WritablePath { 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 { return &ndkSingleton{} } Loading @@ -96,6 +117,7 @@ type ndkSingleton struct{} func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) { var staticLibInstallPaths android.Paths var headerPaths android.Paths var installPaths android.Paths var licensePaths android.Paths ctx.VisitAllModules(func(module android.Module) { Loading @@ -104,16 +126,19 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) { } if m, ok := module.(*headerModule); ok { headerPaths = append(headerPaths, m.installPaths...) installPaths = append(installPaths, m.installPaths...) licensePaths = append(licensePaths, m.licensePath) } if m, ok := module.(*versionedHeaderModule); ok { headerPaths = append(headerPaths, m.installPaths...) installPaths = append(installPaths, m.installPaths...) licensePaths = append(licensePaths, m.licensePath) } if m, ok := module.(*preprocessedHeadersModule); ok { headerPaths = append(headerPaths, m.installPaths...) installPaths = append(installPaths, m.installPaths...) licensePaths = append(licensePaths, m.licensePath) } Loading Loading @@ -153,6 +178,12 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) { Validation: getNdkAbiDiffTimestampFile(ctx), }) ctx.Build(pctx, android.BuildParams{ Rule: android.Touch, Output: getNdkHeadersTimestampFile(ctx), Implicits: headerPaths, }) fullDepPaths := append(staticLibInstallPaths, getNdkBaseTimestampFile(ctx)) // There's a phony "ndk" rule defined in core/main.mk that depends on this. Loading Loading
cc/builder.go +5 −1 Original line number Diff line number Diff line Loading @@ -549,6 +549,10 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no 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 { objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o") Loading Loading @@ -672,7 +676,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no Output: tidyFile, Input: srcFile, Implicits: cFlagsDeps, OrderOnly: pathDeps, OrderOnly: tidyPathDeps, Args: map[string]string{ "ccCmd": ccCmd, "cFlags": shareFlags("cFlags", escapeSingleQuotes(moduleToolingFlags)), Loading
cc/ndk_sysroot.go +31 −0 Original line number Diff line number Diff line Loading @@ -82,12 +82,33 @@ func getNdkBaseTimestampFile(ctx android.PathContext) android.WritablePath { 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 // libraries. func getNdkFullTimestampFile(ctx android.PathContext) android.WritablePath { 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 { return &ndkSingleton{} } Loading @@ -96,6 +117,7 @@ type ndkSingleton struct{} func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) { var staticLibInstallPaths android.Paths var headerPaths android.Paths var installPaths android.Paths var licensePaths android.Paths ctx.VisitAllModules(func(module android.Module) { Loading @@ -104,16 +126,19 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) { } if m, ok := module.(*headerModule); ok { headerPaths = append(headerPaths, m.installPaths...) installPaths = append(installPaths, m.installPaths...) licensePaths = append(licensePaths, m.licensePath) } if m, ok := module.(*versionedHeaderModule); ok { headerPaths = append(headerPaths, m.installPaths...) installPaths = append(installPaths, m.installPaths...) licensePaths = append(licensePaths, m.licensePath) } if m, ok := module.(*preprocessedHeadersModule); ok { headerPaths = append(headerPaths, m.installPaths...) installPaths = append(installPaths, m.installPaths...) licensePaths = append(licensePaths, m.licensePath) } Loading Loading @@ -153,6 +178,12 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) { Validation: getNdkAbiDiffTimestampFile(ctx), }) ctx.Build(pctx, android.BuildParams{ Rule: android.Touch, Output: getNdkHeadersTimestampFile(ctx), Implicits: headerPaths, }) fullDepPaths := append(staticLibInstallPaths, getNdkBaseTimestampFile(ctx)) // There's a phony "ndk" rule defined in core/main.mk that depends on this. Loading