Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ typescript:
java:
source_root: core/src/main/java/com/google/adk
exclude:
- examples
- com.example

go:
source_root: .
Expand Down
599 changes: 308 additions & 291 deletions playground.ipynb

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion proto/features.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ message Feature {
message FeatureRegistry {
string language = 1; // ADK language (e.g., "GO").
string version = 2; // ADK version (e.g., "1.4.2").
repeated Feature features = 3;
string commit_id = 3; // Last commit id of the repository.
repeated Feature features = 4;
}
1 change: 1 addition & 0 deletions proto2py.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

#!/bin/bash
protoc -I=proto --python_out=src/google/adk/scope proto/features.proto
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies = [
"scipy",
"numpy",
"jellyfish",
"RapidFuzz",
"pandas",
]

Expand Down
17 changes: 8 additions & 9 deletions report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set -e

# Default values
REPORT_TYPE="md"

VERBOSE=""
COMMON=""

Expand All @@ -31,10 +31,7 @@ while [[ "$#" -gt 0 ]]; do
OUTPUT_DIR="$2"
shift 2
;;
--report-type)
REPORT_TYPE="$2"
shift 2
;;

-v|--verbose)
VERBOSE="--verbose"
shift
Expand Down Expand Up @@ -83,9 +80,10 @@ EXTENSION="md"

# Standard 2-way report
OUTPUT_FILENAME="${LANG_CODES[0]}_${LANG_CODES[1]}.${EXTENSION}"
# Ensure report type is 'md' for standard logic so unified generator runs
if [ "$REPORT_TYPE" == "raw" ]; then
REPORT_TYPE="md"

# Check if we are running in matrix mode (CSV inputs)
if [[ "${REGISTRIES[0]}" == *.csv ]]; then
OUTPUT_FILENAME="matrix_report.md"
fi

FULL_OUTPUT_PATH="${OUTPUT_DIR}/${OUTPUT_FILENAME}"
Expand All @@ -100,6 +98,7 @@ export PYTHONPATH="${SCRIPT_DIR}/src:${PYTHONPATH}"
python3 "${SCRIPT_DIR}/src/google/adk/scope/reporter/reporter.py" \
--registries "${REGISTRIES[@]}" \
--output "${FULL_OUTPUT_PATH}" \
--report-type "${REPORT_TYPE}" \

${COMMON} \
${VERBOSE}

10 changes: 5 additions & 5 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ echo "Extracting Go features..."
# Py -> TS

echo "Generating raw and markdown reports..."
./report.sh --base output/py.txtpb --target output/ts.txtpb --output ./output --report-type md
./report.sh --base output/python.txtpb --target output/typescript.txtpb --output ./output

# Py -> Java

echo "Generating raw and markdown reports..."
./report.sh --base output/py.txtpb --target output/java.txtpb --output ./output --report-type md
./report.sh --base output/python.txtpb --target output/java.txtpb --output ./output

# Py -> Go

echo "Generating raw and markdown reports..."
./report.sh --base output/py.txtpb --target output/go.txtpb --output ./output --report-type md
./report.sh --base output/python.txtpb --target output/go.txtpb --output ./output

# Matrix reports

#echo "Generating matrix reports..."
#./report.sh --registries output/py.txtpb output/ts.txtpb output/java.txtpb output/go.txtpb --output ./output --report-type matrix --common
echo "Generating matrix reports..."
# ./report.sh --registries output/py_go.csv output/py_java.csv output/py_ts.csv --output ./output
3 changes: 1 addition & 2 deletions src/google/adk/scope/extractors/converter_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ def _extract_docstring(self, node: Node) -> str:
return "\n".join(comments)

def _extract_interface_name(self, node: Node) -> str:
"""Walk up the AST from a method_spec to find the interface type name.
"""
"""Walk up the AST from a method_spec to find the interface type name."""
parent = node.parent
while parent:
if parent.type == "type_spec":
Expand Down
30 changes: 21 additions & 9 deletions src/google/adk/scope/extractors/extract.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import subprocess
import sys
from pathlib import Path

Expand All @@ -13,6 +14,7 @@
extractor_ts,
)
from google.adk.scope.features_pb2 import FeatureRegistry
from google.adk.scope.utils import string
from google.adk.scope.utils.args import parse_args

logging.basicConfig(
Expand Down Expand Up @@ -79,6 +81,21 @@ def get_search_dir(input_path: Path, language: str) -> Path:
return input_path


def get_latest_commit_id(repo_path: Path) -> str:
"""Gets the latest commit ID from a git repository."""
try:
# Run 'git rev-parse HEAD' to get the full SHA
commit_id = subprocess.check_output(
["git", "rev-parse", "HEAD"],
cwd=str(repo_path),
text=True,
stderr=subprocess.DEVNULL,
).strip()
return commit_id
except (subprocess.CalledProcessError, FileNotFoundError):
return ""


def main():
args = (
parse_args()
Expand Down Expand Up @@ -210,10 +227,13 @@ def main():
repo_root if repo_root else Path(".")
)

commit_id = get_latest_commit_id(repo_root if repo_root else Path("."))

registry = FeatureRegistry(
language=args.language.upper(),
version=version,
features=all_features,
commit_id=commit_id,
)

output_dir = args.output
Expand All @@ -223,15 +243,7 @@ def main():
logger.error("Failed to create output directory %s: %s", output_dir, e)
sys.exit(1)

prefix = (
"py"
if args.language in {"python", "py"}
else (
"ts"
if args.language in {"typescript", "ts"}
else "java" if args.language == "java" else "go"
)
)
prefix = string.get_language_name(args.language).lower()
base_filename = f"{prefix}"

if _JSON_OUTPUT:
Expand Down
8 changes: 4 additions & 4 deletions src/google/adk/scope/features_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading