Build native libraries used by layoutlib.
Bug: 303904212
Test: m layoutlib dist; CIs
Change-Id: Id77cba97b2f66997431beb78ecc9d9b74b64b803
diff --git a/cc/library.go b/cc/library.go
index 2aa0b1b..4d5a254 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -400,6 +400,8 @@
// 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
@@ -1201,6 +1203,17 @@
}
}
+ // 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...)
@@ -1262,6 +1275,10 @@
return library.unstrippedOutputFile
}
+func (library *libraryDecorator) strippedAllOutputFilePath() android.Path {
+ return library.strippedAllOutputFile
+}
+
func (library *libraryDecorator) disableStripping() {
library.stripper.StripProperties.Strip.None = BoolPtr(true)
}