Loading cc/binary.go +4 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,10 @@ func (binary *binaryDecorator) unstrippedOutputFilePath() android.Path { return binary.unstrippedOutputFile } func (binary *binaryDecorator) strippedAllOutputFilePath() android.Path { panic("Not implemented.") } func (binary *binaryDecorator) setSymlinkList(ctx ModuleContext) { for _, symlink := range binary.Properties.Symlinks { binary.symlinks = append(binary.symlinks, Loading cc/builder.go +3 −0 Original line number Diff line number Diff line Loading @@ -1052,6 +1052,9 @@ func transformStrip(ctx android.ModuleContext, inputFile android.Path, if flags.StripKeepSymbolsAndDebugFrame { args += " --keep-symbols-and-debug-frame" } if ctx.Windows() { args += " --windows" } ctx.Build(pctx, android.BuildParams{ Rule: strip, Loading cc/cc.go +6 −0 Original line number Diff line number Diff line Loading @@ -617,6 +617,7 @@ type linker interface { link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path appendLdflags([]string) unstrippedOutputFilePath() android.Path strippedAllOutputFilePath() android.Path nativeCoverage() bool coverageOutputFilePath() android.OptionalPath Loading Loading @@ -3634,6 +3635,11 @@ func (c *Module) OutputFiles(tag string) (android.Paths, error) { return android.PathsIfNonNil(c.linker.unstrippedOutputFilePath()), nil } return nil, nil case "stripped_all": if c.linker != nil { return android.PathsIfNonNil(c.linker.strippedAllOutputFilePath()), nil } return nil, nil default: return nil, fmt.Errorf("unsupported module reference tag %q", tag) } Loading cc/cc_test.go +26 −0 Original line number Diff line number Diff line Loading @@ -4758,3 +4758,29 @@ func TestCcBuildBrokenClangCFlags(t *testing.T) { }) } } func TestStrippedAllOutputFile(t *testing.T) { t.Parallel() bp := ` cc_library { name: "test_lib", srcs: ["test_lib.cpp"], dist: { targets: [ "dist_target" ], tag: "stripped_all", } } ` config := TestConfig(t.TempDir(), android.Android, nil, bp, nil) ctx := testCcWithConfig(t, config) module := ctx.ModuleForTests("test_lib", "android_arm_armv7-a-neon_shared").Module() outputFile, err := module.(android.OutputFileProducer).OutputFiles("stripped_all") if err != nil { t.Errorf("Expected cc_library to produce output files, error: %s", err) return } if !strings.HasSuffix(outputFile.Strings()[0], "/stripped_all/test_lib.so") { t.Errorf("Unexpected output file: %s", outputFile.Strings()[0]) return } } cc/library.go +17 −0 Original line number Diff line number Diff line Loading @@ -400,6 +400,8 @@ type libraryDecorator struct { // Location of the linked, unstripped library for shared libraries unstrippedOutputFile android.Path // Location of the linked, stripped library for shared libraries, strip: "all" strippedAllOutputFile android.Path // Location of the file that should be copied to dist dir when requested distFile android.Path Loading Loading @@ -1201,6 +1203,17 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext, } } // Generate an output file for dist as if strip: "all" is set on the module. // Currently this is for layoutlib release process only. for _, dist := range ctx.Module().(*Module).Dists() { if dist.Tag != nil && *dist.Tag == "stripped_all" { strippedAllOutputFile := android.PathForModuleOut(ctx, "stripped_all", fileName) transformStrip(ctx, outputFile, strippedAllOutputFile, StripFlags{Toolchain: flags.Toolchain}) library.strippedAllOutputFile = strippedAllOutputFile break } } sharedLibs := deps.EarlySharedLibs sharedLibs = append(sharedLibs, deps.SharedLibs...) sharedLibs = append(sharedLibs, deps.LateSharedLibs...) Loading Loading @@ -1262,6 +1275,10 @@ func (library *libraryDecorator) unstrippedOutputFilePath() android.Path { return library.unstrippedOutputFile } func (library *libraryDecorator) strippedAllOutputFilePath() android.Path { return library.strippedAllOutputFile } func (library *libraryDecorator) disableStripping() { library.stripper.StripProperties.Strip.None = BoolPtr(true) } Loading Loading
cc/binary.go +4 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,10 @@ func (binary *binaryDecorator) unstrippedOutputFilePath() android.Path { return binary.unstrippedOutputFile } func (binary *binaryDecorator) strippedAllOutputFilePath() android.Path { panic("Not implemented.") } func (binary *binaryDecorator) setSymlinkList(ctx ModuleContext) { for _, symlink := range binary.Properties.Symlinks { binary.symlinks = append(binary.symlinks, Loading
cc/builder.go +3 −0 Original line number Diff line number Diff line Loading @@ -1052,6 +1052,9 @@ func transformStrip(ctx android.ModuleContext, inputFile android.Path, if flags.StripKeepSymbolsAndDebugFrame { args += " --keep-symbols-and-debug-frame" } if ctx.Windows() { args += " --windows" } ctx.Build(pctx, android.BuildParams{ Rule: strip, Loading
cc/cc.go +6 −0 Original line number Diff line number Diff line Loading @@ -617,6 +617,7 @@ type linker interface { link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path appendLdflags([]string) unstrippedOutputFilePath() android.Path strippedAllOutputFilePath() android.Path nativeCoverage() bool coverageOutputFilePath() android.OptionalPath Loading Loading @@ -3634,6 +3635,11 @@ func (c *Module) OutputFiles(tag string) (android.Paths, error) { return android.PathsIfNonNil(c.linker.unstrippedOutputFilePath()), nil } return nil, nil case "stripped_all": if c.linker != nil { return android.PathsIfNonNil(c.linker.strippedAllOutputFilePath()), nil } return nil, nil default: return nil, fmt.Errorf("unsupported module reference tag %q", tag) } Loading
cc/cc_test.go +26 −0 Original line number Diff line number Diff line Loading @@ -4758,3 +4758,29 @@ func TestCcBuildBrokenClangCFlags(t *testing.T) { }) } } func TestStrippedAllOutputFile(t *testing.T) { t.Parallel() bp := ` cc_library { name: "test_lib", srcs: ["test_lib.cpp"], dist: { targets: [ "dist_target" ], tag: "stripped_all", } } ` config := TestConfig(t.TempDir(), android.Android, nil, bp, nil) ctx := testCcWithConfig(t, config) module := ctx.ModuleForTests("test_lib", "android_arm_armv7-a-neon_shared").Module() outputFile, err := module.(android.OutputFileProducer).OutputFiles("stripped_all") if err != nil { t.Errorf("Expected cc_library to produce output files, error: %s", err) return } if !strings.HasSuffix(outputFile.Strings()[0], "/stripped_all/test_lib.so") { t.Errorf("Unexpected output file: %s", outputFile.Strings()[0]) return } }
cc/library.go +17 −0 Original line number Diff line number Diff line Loading @@ -400,6 +400,8 @@ type libraryDecorator struct { // Location of the linked, unstripped library for shared libraries unstrippedOutputFile android.Path // Location of the linked, stripped library for shared libraries, strip: "all" strippedAllOutputFile android.Path // Location of the file that should be copied to dist dir when requested distFile android.Path Loading Loading @@ -1201,6 +1203,17 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext, } } // Generate an output file for dist as if strip: "all" is set on the module. // Currently this is for layoutlib release process only. for _, dist := range ctx.Module().(*Module).Dists() { if dist.Tag != nil && *dist.Tag == "stripped_all" { strippedAllOutputFile := android.PathForModuleOut(ctx, "stripped_all", fileName) transformStrip(ctx, outputFile, strippedAllOutputFile, StripFlags{Toolchain: flags.Toolchain}) library.strippedAllOutputFile = strippedAllOutputFile break } } sharedLibs := deps.EarlySharedLibs sharedLibs = append(sharedLibs, deps.SharedLibs...) sharedLibs = append(sharedLibs, deps.LateSharedLibs...) Loading Loading @@ -1262,6 +1275,10 @@ func (library *libraryDecorator) unstrippedOutputFilePath() android.Path { return library.unstrippedOutputFile } func (library *libraryDecorator) strippedAllOutputFilePath() android.Path { return library.strippedAllOutputFile } func (library *libraryDecorator) disableStripping() { library.stripper.StripProperties.Strip.None = BoolPtr(true) } Loading