Merge "Add CcUnstrippedInfo provider and use it in mixed builds"

This commit is contained in:
Alexander Smundak
2022-10-13 21:04:40 +00:00
committed by Gerrit Code Review
7 changed files with 118 additions and 18 deletions

View File

@@ -144,6 +144,9 @@ type BazelContext interface {
// Returns the results of the GetApexInfo query (including output files)
GetApexInfo(label string, cfgkey configKey) (cquery.ApexCqueryInfo, error)
// Returns the results of the GetCcUnstrippedInfo query
GetCcUnstrippedInfo(label string, cfgkey configKey) (cquery.CcUnstrippedInfo, error)
// ** end Cquery Results Retrieval Functions
// Issues commands to Bazel to receive results for all cquery requests
@@ -224,6 +227,7 @@ type MockBazelContext struct {
LabelToCcInfo map[string]cquery.CcInfo
LabelToPythonBinary map[string]string
LabelToApexInfo map[string]cquery.ApexCqueryInfo
LabelToCcBinary map[string]cquery.CcUnstrippedInfo
}
func (m MockBazelContext) QueueBazelRequest(_ string, _ cqueryRequest, _ configKey) {
@@ -249,6 +253,11 @@ func (n MockBazelContext) GetApexInfo(_ string, _ configKey) (cquery.ApexCqueryI
panic("unimplemented")
}
func (m MockBazelContext) GetCcUnstrippedInfo(label string, _ configKey) (cquery.CcUnstrippedInfo, error) {
result, _ := m.LabelToCcBinary[label]
return result, nil
}
func (m MockBazelContext) InvokeBazel(_ Config) error {
panic("unimplemented")
}
@@ -312,6 +321,14 @@ func (bazelCtx *bazelContext) GetApexInfo(label string, cfgKey configKey) (cquer
return cquery.ApexCqueryInfo{}, fmt.Errorf("no bazel response found for %v", key)
}
func (bazelCtx *bazelContext) GetCcUnstrippedInfo(label string, cfgKey configKey) (cquery.CcUnstrippedInfo, error) {
key := makeCqueryKey(label, cquery.GetCcUnstrippedInfo, cfgKey)
if rawString, ok := bazelCtx.results[key]; ok {
return cquery.GetCcUnstrippedInfo.ParseResult(strings.TrimSpace(rawString)), nil
}
return cquery.CcUnstrippedInfo{}, fmt.Errorf("no bazel response for %s", key)
}
func (n noopBazelContext) QueueBazelRequest(_ string, _ cqueryRequest, _ configKey) {
panic("unimplemented")
}
@@ -332,6 +349,11 @@ func (n noopBazelContext) GetApexInfo(_ string, _ configKey) (cquery.ApexCqueryI
panic("unimplemented")
}
func (n noopBazelContext) GetCcUnstrippedInfo(_ string, _ configKey) (cquery.CcUnstrippedInfo, error) {
//TODO implement me
panic("implement me")
}
func (n noopBazelContext) InvokeBazel(_ Config) error {
panic("unimplemented")
}