增加持久化构建记录、历史 APK 恢复、断点下载、Gradle 缓存复用、系统代理与按工程选择服务端 JDK。 支持已有工程目录、Git 状态检查、原生忽略规则和文本换行等价比较,修复干净检出与历史同步快照不一致时的误拦截。 优化插件设备可选构建、侧栏滚动、左右日志布局、时间显示和构建变体快速选择,并补充部署与协议文档。 验证:17 项 Go 测试、22 项插件测试及 HTTP/HTTPS 两条端到端测试通过;Linux/macOS 服务端交叉编译通过。
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"unicode/utf8"
|
|
)
|
|
|
|
// Restrict EOL equivalence to source/config text. Executable scripts remain byte-exact.
|
|
func comparableText(path string) bool {
|
|
switch strings.ToLower(filepath.Ext(path)) {
|
|
case ".kt", ".kts", ".java", ".xml", ".gradle", ".properties", ".json", ".toml", ".yaml", ".yml", ".txt", ".md", ".proto", ".c", ".cc", ".cpp", ".h", ".hpp", ".cmake", ".aidl", ".pro", ".cfg", ".ini", ".csv", ".html", ".css", ".js", ".ts", ".svg":
|
|
return true
|
|
}
|
|
switch strings.ToLower(filepath.Base(path)) {
|
|
case ".gitignore", ".gitattributes", ".editorconfig", "cmakelists.txt":
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
func comparisonFile(path string) (File, error) {
|
|
if comparableText(path) {
|
|
info, e := os.Stat(path)
|
|
if e != nil {
|
|
return File{}, e
|
|
}
|
|
if info.Size() <= 64<<20 {
|
|
b, e := os.ReadFile(path)
|
|
if e != nil {
|
|
return File{}, e
|
|
}
|
|
f := File{Hash: digest(b)}
|
|
if utf8.Valid(b) && !bytes.ContainsRune(b, 0) {
|
|
f.TextHash = digest(bytes.ReplaceAll(b, []byte("\r\n"), []byte("\n")))
|
|
}
|
|
return f, nil
|
|
}
|
|
}
|
|
h, e := fileDigest(path)
|
|
return File{Hash: h}, e
|
|
}
|