Remove 3 make vars related globals from cc.
Replace them with providers.
Bug: 358427516
Test: Manually compare the generated ninja files.
Change-Id: Ifbf217974542a0adbe8e4b1953a96f6533008cb3
diff --git a/cc/cc.go b/cc/cc.go
index 551f2cd..5dee32e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -35,6 +35,14 @@
"android/soong/genrule"
)
+type CcMakeVarsInfo struct {
+ WarningsAllowed string
+ UsingWnoError string
+ MissingProfile string
+}
+
+var CcMakeVarsInfoProvider = blueprint.NewProvider[*CcMakeVarsInfo]()
+
func init() {
RegisterCCBuildComponents(android.InitRegistrationContext)
@@ -531,6 +539,7 @@
getSharedFlags() *SharedFlags
notInPlatform() bool
optimizeForSize() bool
+ getOrCreateMakeVarsInfo() *CcMakeVarsInfo
}
type SharedFlags struct {
@@ -845,9 +854,10 @@
sourceProperties android.SourceProperties
// initialize before calling Init
- hod android.HostOrDeviceSupported
- multilib android.Multilib
- testModule bool
+ hod android.HostOrDeviceSupported
+ multilib android.Multilib
+ testModule bool
+ incremental bool
// Allowable SdkMemberTypes of this module type.
sdkMemberTypes []android.SdkMemberType
@@ -913,8 +923,16 @@
hasSysprop bool
hasWinMsg bool
hasYacc bool
+
+ makeVarsInfo *CcMakeVarsInfo
}
+func (c *Module) IncrementalSupported() bool {
+ return c.incremental
+}
+
+var _ blueprint.Incremental = (*Module)(nil)
+
func (c *Module) AddJSONData(d *map[string]interface{}) {
c.AndroidModuleBase().AddJSONData(d)
(*d)["Cc"] = map[string]interface{}{
@@ -1700,6 +1718,13 @@
return ctx.mod.NotInPlatform()
}
+func (ctx *moduleContextImpl) getOrCreateMakeVarsInfo() *CcMakeVarsInfo {
+ if ctx.mod.makeVarsInfo == nil {
+ ctx.mod.makeVarsInfo = &CcMakeVarsInfo{}
+ }
+ return ctx.mod.makeVarsInfo
+}
+
func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module {
return &Module{
hod: hod,
@@ -2091,6 +2116,10 @@
}
c.setOutputFiles(ctx)
+
+ if c.makeVarsInfo != nil {
+ android.SetProvider(ctx, CcMakeVarsInfoProvider, c.makeVarsInfo)
+ }
}
func (c *Module) setOutputFiles(ctx ModuleContext) {