forked from googol/benchmark
|
|
||
|---|---|---|
| image | ||
| sql | ||
| src/main/java | ||
| .env.example.yml | ||
| .gitignore | ||
| README.md | ||
| api_example.json | ||
| pom.xml | ||
| requirements.txt | ||
| springf_project.py | ||
| third_library_set.py | ||
README.md
benchmark
开发模式
1. 复制环境变量文件
cp .env.example.yml .env.yml
2. 编辑环境变量文件
打开 .env.yml 文件,添加你的 GitHub Token:
# GitHub Configuration
github_tokens:
- ghp_your_first_github_token_here
- ghp_your_second_github_token_here
3. 创建虚拟环境
使用 uv 工具创建虚拟环境,并指定 Python 版本为 3.13.9:
uv venv -p 3.13.9
4. 激活虚拟环境
-
Windows:
.venv\Scripts\activate -
Linux/macOS:
source .venv/bin/activate
5. 安装依赖
使用 uv 安装项目依赖:
uv pip install -r requirements.txt
6. 运行脚本
爬取项目
python springf_project.py
项目三方包集合
python third_library_set.py
获取并存储methods表数据
mvn clean compile
mvn dependency:build-classpath | Out-File -Encoding UTF8 classpath.txt
Get-Content classpath.txt | Select-String "mysql-connector-j"
java -cp "$cp;target/classes" JavaParser "E:\repo_examole" "..\src\main\java\db_config.properties"
获取并存储method_call表数据
mvn -q exec:java -Dexec.mainClass="UnifiedCallParser" -Dexec.args="..\db_config.properties"
获取并存储api表数据
mvn exec:java -Dexec.mainClass="ApiParser" -Dexec.args="<project-path> ..\config\db_config.properties"
获取并存储api_call表数据
运行qpi_call.sql内的内容
获取并存储method_api_depth表数据
运行method_api_depth.sql内的内容
配置说明
github_tokens:GitHub Token 列表,用于轮训提高请求速率base_url:GitHub API 基础 URLmin_stars:最小星星数筛选条件request_interval:请求间隔时间(秒)max_retry_5xx:5xx 错误最大重试次数clone_retry:克隆仓库最大重试次数clone_timeout:克隆仓库超时时间(秒)
功能说明
该脚本用于:
- 按日期搜索 GitHub 上的 Java 仓库
- 筛选出使用 Spring Framework 和测试框架(JUnit/TestNG)的仓库
- 克隆符合条件的仓库到本地
- 生成包含仓库信息的 JSON 文件
目录结构
data/:存放收集的数据和克隆的仓库logs/:存放日志文件.env.yml:本地配置文件(不提交到 git) -.db_config.properties:数据库配置文件(不提交到 git) -.llm_config.properties:模型调用配置文件(不提交到 git).env.example.yml:示例配置文件requirements.txt:项目依赖列表springf_preject.py:主脚本文件
