The current soong_api_query.py script relies on an external binary called "Evans" to perform queries. It downloads this binary from GitHub at runtime, which violates AOSP security policies regarding executing unverified binaries from the internet. This change refactors the tool to use the native Python gRPC library. It leverages the existing soong_api_client_python_lib to perform queries directly, providing a safer and more integrated experience. Key improvements: 1. Removed all logic related to downloading Evans from GitHub. 2. Implemented native query execution using google.protobuf.json_format. 3. Added a --port flag to allow the script to act as a client for persistent server instances. 4. Enhanced interactive hints to provide copy-pasteable commands for developers. 5. Updated help descriptions with clear usage examples. Bug: 492024469 Test: out/host/linux-x86/bin/soong_api_query GetModule --name libc Test: out/host/linux-x86/bin/soong_api_query -i Test: Run query via --port in a separate terminal. Change-Id: I23275a33e72374d5fbe62680b5ebb0ac03bcc91a
32 lines
973 B
Plaintext
32 lines
973 B
Plaintext
// Copyright (C) 2026 The Android Open Source Project
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package {
|
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
|
default_team: "trendy_team_build",
|
|
}
|
|
|
|
python_binary_host {
|
|
name: "soong_api_query",
|
|
main: "soong_api_query.py",
|
|
srcs: [
|
|
"soong_api_query.py",
|
|
],
|
|
libs: [
|
|
"soong_api_client_python_lib",
|
|
"libprotobuf-python",
|
|
],
|
|
embedded_launcher: true,
|
|
}
|