Merge "Rename ApexCqueryInfo to ApexInfo" am: d6dec6f51e

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2288160

Change-Id: Ib59a67594c525485f3bf993a1b4778af556506c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-11-05 01:16:32 +00:00
committed by Automerger Merge Worker
3 changed files with 12 additions and 12 deletions

View File

@@ -142,7 +142,7 @@ type BazelContext interface {
GetPythonBinary(label string, cfgKey configKey) (string, error) GetPythonBinary(label string, cfgKey configKey) (string, error)
// Returns the results of the GetApexInfo query (including output files) // Returns the results of the GetApexInfo query (including output files)
GetApexInfo(label string, cfgkey configKey) (cquery.ApexCqueryInfo, error) GetApexInfo(label string, cfgkey configKey) (cquery.ApexInfo, error)
// Returns the results of the GetCcUnstrippedInfo query // Returns the results of the GetCcUnstrippedInfo query
GetCcUnstrippedInfo(label string, cfgkey configKey) (cquery.CcUnstrippedInfo, error) GetCcUnstrippedInfo(label string, cfgkey configKey) (cquery.CcUnstrippedInfo, error)
@@ -226,7 +226,7 @@ type MockBazelContext struct {
LabelToOutputFiles map[string][]string LabelToOutputFiles map[string][]string
LabelToCcInfo map[string]cquery.CcInfo LabelToCcInfo map[string]cquery.CcInfo
LabelToPythonBinary map[string]string LabelToPythonBinary map[string]string
LabelToApexInfo map[string]cquery.ApexCqueryInfo LabelToApexInfo map[string]cquery.ApexInfo
LabelToCcBinary map[string]cquery.CcUnstrippedInfo LabelToCcBinary map[string]cquery.CcUnstrippedInfo
} }
@@ -249,7 +249,7 @@ func (m MockBazelContext) GetPythonBinary(label string, _ configKey) (string, er
return result, nil return result, nil
} }
func (n MockBazelContext) GetApexInfo(_ string, _ configKey) (cquery.ApexCqueryInfo, error) { func (m MockBazelContext) GetApexInfo(label string, _ configKey) (cquery.ApexInfo, error) {
panic("unimplemented") panic("unimplemented")
} }
@@ -313,12 +313,12 @@ func (bazelCtx *bazelContext) GetPythonBinary(label string, cfgKey configKey) (s
return "", fmt.Errorf("no bazel response found for %v", key) return "", fmt.Errorf("no bazel response found for %v", key)
} }
func (bazelCtx *bazelContext) GetApexInfo(label string, cfgKey configKey) (cquery.ApexCqueryInfo, error) { func (bazelCtx *bazelContext) GetApexInfo(label string, cfgKey configKey) (cquery.ApexInfo, error) {
key := makeCqueryKey(label, cquery.GetApexInfo, cfgKey) key := makeCqueryKey(label, cquery.GetApexInfo, cfgKey)
if rawString, ok := bazelCtx.results[key]; ok { if rawString, ok := bazelCtx.results[key]; ok {
return cquery.GetApexInfo.ParseResult(strings.TrimSpace(rawString)), nil return cquery.GetApexInfo.ParseResult(strings.TrimSpace(rawString)), nil
} }
return cquery.ApexCqueryInfo{}, fmt.Errorf("no bazel response found for %v", key) return cquery.ApexInfo{}, fmt.Errorf("no bazel response found for %v", key)
} }
func (bazelCtx *bazelContext) GetCcUnstrippedInfo(label string, cfgKey configKey) (cquery.CcUnstrippedInfo, error) { func (bazelCtx *bazelContext) GetCcUnstrippedInfo(label string, cfgKey configKey) (cquery.CcUnstrippedInfo, error) {
@@ -345,7 +345,7 @@ func (n noopBazelContext) GetPythonBinary(_ string, _ configKey) (string, error)
panic("unimplemented") panic("unimplemented")
} }
func (n noopBazelContext) GetApexInfo(_ string, _ configKey) (cquery.ApexCqueryInfo, error) { func (n noopBazelContext) GetApexInfo(_ string, _ configKey) (cquery.ApexInfo, error) {
panic("unimplemented") panic("unimplemented")
} }

View File

@@ -221,7 +221,7 @@ return json_encode({
})` })`
} }
type ApexCqueryInfo struct { type ApexInfo struct {
SignedOutput string `json:"signed_output"` SignedOutput string `json:"signed_output"`
UnsignedOutput string `json:"unsigned_output"` UnsignedOutput string `json:"unsigned_output"`
ProvidesLibs []string `json:"provides_native_libs"` ProvidesLibs []string `json:"provides_native_libs"`
@@ -234,8 +234,8 @@ type ApexCqueryInfo struct {
// ParseResult returns a value obtained by parsing the result of the request's Starlark function. // ParseResult returns a value obtained by parsing the result of the request's Starlark function.
// The given rawString must correspond to the string output which was created by evaluating the // The given rawString must correspond to the string output which was created by evaluating the
// Starlark given in StarlarkFunctionBody. // Starlark given in StarlarkFunctionBody.
func (g getApexInfoType) ParseResult(rawString string) ApexCqueryInfo { func (g getApexInfoType) ParseResult(rawString string) ApexInfo {
var info ApexCqueryInfo var info ApexInfo
parseJson(rawString, &info) parseJson(rawString, &info)
return info return info
} }

View File

@@ -133,12 +133,12 @@ func TestGetApexInfoParseResults(t *testing.T) {
testCases := []struct { testCases := []struct {
description string description string
input string input string
expectedOutput ApexCqueryInfo expectedOutput ApexInfo
}{ }{
{ {
description: "no result", description: "no result",
input: "{}", input: "{}",
expectedOutput: ApexCqueryInfo{}, expectedOutput: ApexInfo{},
}, },
{ {
description: "one result", description: "one result",
@@ -149,7 +149,7 @@ func TestGetApexInfoParseResults(t *testing.T) {
`"container_key_info":["foo.x509.pem", "foo.pk8", "foo"],` + `"container_key_info":["foo.x509.pem", "foo.pk8", "foo"],` +
`"package_name":"package.name",` + `"package_name":"package.name",` +
`"provides_native_libs":[]}`, `"provides_native_libs":[]}`,
expectedOutput: ApexCqueryInfo{ expectedOutput: ApexInfo{
SignedOutput: "my.apex", SignedOutput: "my.apex",
UnsignedOutput: "my.apex.unsigned", UnsignedOutput: "my.apex.unsigned",
RequiresLibs: []string{"//bionic/libc:libc", "//bionic/libdl:libdl"}, RequiresLibs: []string{"//bionic/libc:libc", "//bionic/libdl:libdl"},