Remove GetPythonBinary request type
This has been dead code for over a year. Fixes: 232976601 Test: m nothing Change-Id: Ida305fc8fa61d8ac83d74ea2cf007073a0019cec
This commit is contained in:
committed by
Christopher Parsons
parent
a2244043ea
commit
6b49888a17
@@ -183,10 +183,6 @@ type BazelContext interface {
|
|||||||
// Returns the results of GetOutputFiles and GetCcObjectFiles in a single query (in that order).
|
// Returns the results of GetOutputFiles and GetCcObjectFiles in a single query (in that order).
|
||||||
GetCcInfo(label string, cfgKey configKey) (cquery.CcInfo, error)
|
GetCcInfo(label string, cfgKey configKey) (cquery.CcInfo, error)
|
||||||
|
|
||||||
// Returns the executable binary resultant from building together the python sources
|
|
||||||
// TODO(b/232976601): Remove.
|
|
||||||
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.ApexInfo, error)
|
GetApexInfo(label string, cfgkey configKey) (cquery.ApexInfo, error)
|
||||||
|
|
||||||
@@ -315,14 +311,6 @@ func (m MockBazelContext) GetCcInfo(label string, cfgKey configKey) (cquery.CcIn
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m MockBazelContext) GetPythonBinary(label string, _ configKey) (string, error) {
|
|
||||||
result, ok := m.LabelToPythonBinary[label]
|
|
||||||
if !ok {
|
|
||||||
return "", fmt.Errorf("no target with label %q in LabelToPythonBinary", label)
|
|
||||||
}
|
|
||||||
return result, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m MockBazelContext) GetApexInfo(label string, _ configKey) (cquery.ApexInfo, error) {
|
func (m MockBazelContext) GetApexInfo(label string, _ configKey) (cquery.ApexInfo, error) {
|
||||||
result, ok := m.LabelToApexInfo[label]
|
result, ok := m.LabelToApexInfo[label]
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -431,15 +419,6 @@ func (bazelCtx *mixedBuildBazelContext) GetCcInfo(label string, cfgKey configKey
|
|||||||
return cquery.CcInfo{}, fmt.Errorf("no bazel response found for %v", key)
|
return cquery.CcInfo{}, fmt.Errorf("no bazel response found for %v", key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bazelCtx *mixedBuildBazelContext) GetPythonBinary(label string, cfgKey configKey) (string, error) {
|
|
||||||
key := makeCqueryKey(label, cquery.GetPythonBinary, cfgKey)
|
|
||||||
if rawString, ok := bazelCtx.results[key]; ok {
|
|
||||||
bazelOutput := strings.TrimSpace(rawString)
|
|
||||||
return cquery.GetPythonBinary.ParseResult(bazelOutput), nil
|
|
||||||
}
|
|
||||||
return "", fmt.Errorf("no bazel response found for %v", key)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (bazelCtx *mixedBuildBazelContext) GetApexInfo(label string, cfgKey configKey) (cquery.ApexInfo, error) {
|
func (bazelCtx *mixedBuildBazelContext) 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 {
|
||||||
@@ -468,10 +447,6 @@ func (n noopBazelContext) GetCcInfo(_ string, _ configKey) (cquery.CcInfo, error
|
|||||||
panic("unimplemented")
|
panic("unimplemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n noopBazelContext) GetPythonBinary(_ string, _ configKey) (string, error) {
|
|
||||||
panic("unimplemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n noopBazelContext) GetApexInfo(_ string, _ configKey) (cquery.ApexInfo, error) {
|
func (n noopBazelContext) GetApexInfo(_ string, _ configKey) (cquery.ApexInfo, error) {
|
||||||
panic("unimplemented")
|
panic("unimplemented")
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
GetOutputFiles = &getOutputFilesRequestType{}
|
GetOutputFiles = &getOutputFilesRequestType{}
|
||||||
GetPythonBinary = &getPythonBinaryRequestType{}
|
|
||||||
GetCcInfo = &getCcInfoType{}
|
GetCcInfo = &getCcInfoType{}
|
||||||
GetApexInfo = &getApexInfoType{}
|
GetApexInfo = &getApexInfoType{}
|
||||||
GetCcUnstrippedInfo = &getCcUnstrippedInfoType{}
|
GetCcUnstrippedInfo = &getCcUnstrippedInfoType{}
|
||||||
@@ -45,8 +44,6 @@ type CcInfo struct {
|
|||||||
|
|
||||||
type getOutputFilesRequestType struct{}
|
type getOutputFilesRequestType struct{}
|
||||||
|
|
||||||
type getPythonBinaryRequestType struct{}
|
|
||||||
|
|
||||||
// Name returns a string name for this request type. Such request type names must be unique,
|
// Name returns a string name for this request type. Such request type names must be unique,
|
||||||
// and must only consist of alphanumeric characters.
|
// and must only consist of alphanumeric characters.
|
||||||
func (g getOutputFilesRequestType) Name() string {
|
func (g getOutputFilesRequestType) Name() string {
|
||||||
@@ -72,31 +69,6 @@ func (g getOutputFilesRequestType) ParseResult(rawString string) []string {
|
|||||||
return splitOrEmpty(rawString, ", ")
|
return splitOrEmpty(rawString, ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name returns a string name for this request type. Such request type names must be unique,
|
|
||||||
// and must only consist of alphanumeric characters.
|
|
||||||
func (g getPythonBinaryRequestType) Name() string {
|
|
||||||
return "getPythonBinary"
|
|
||||||
}
|
|
||||||
|
|
||||||
// StarlarkFunctionBody returns a starlark function body to process this request type.
|
|
||||||
// The returned string is the body of a Starlark function which obtains
|
|
||||||
// all request-relevant information about a target and returns a string containing
|
|
||||||
// this information.
|
|
||||||
// The function should have the following properties:
|
|
||||||
// - The arguments are `target` (a configured target) and `id_string` (the label + configuration).
|
|
||||||
// - The return value must be a string.
|
|
||||||
// - The function body should not be indented outside of its own scope.
|
|
||||||
func (g getPythonBinaryRequestType) StarlarkFunctionBody() string {
|
|
||||||
return "return providers(target)['FilesToRunProvider'].executable.path"
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
|
||||||
// Starlark given in StarlarkFunctionBody.
|
|
||||||
func (g getPythonBinaryRequestType) ParseResult(rawString string) string {
|
|
||||||
return rawString
|
|
||||||
}
|
|
||||||
|
|
||||||
type getCcInfoType struct{}
|
type getCcInfoType struct{}
|
||||||
|
|
||||||
// Name returns a string name for this request type. Such request type names must be unique,
|
// Name returns a string name for this request type. Such request type names must be unique,
|
||||||
|
@@ -40,34 +40,6 @@ func TestGetOutputFilesParseResults(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetPythonBinaryParseResults(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
testCases := []struct {
|
|
||||||
description string
|
|
||||||
input string
|
|
||||||
expectedOutput string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
description: "no result",
|
|
||||||
input: "",
|
|
||||||
expectedOutput: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: "one result",
|
|
||||||
input: "test",
|
|
||||||
expectedOutput: "test",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, tc := range testCases {
|
|
||||||
t.Run(tc.description, func(t *testing.T) {
|
|
||||||
actualOutput := GetPythonBinary.ParseResult(tc.input)
|
|
||||||
if !reflect.DeepEqual(tc.expectedOutput, actualOutput) {
|
|
||||||
t.Errorf("expected %#v != actual %#v", tc.expectedOutput, actualOutput)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetCcInfoParseResults(t *testing.T) {
|
func TestGetCcInfoParseResults(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
|
Reference in New Issue
Block a user