支持Git提交导入及未提交源码叠加,APK原名下载和完成通知。新增服务端设备安装与按工程维护的私有文件清单,修复Wrapper预检查、布局及IDE读锁和保存状态问题。更新协议、测试和部署记录;服务端0.7.0,插件0.7.1。
57 lines
2.1 KiB
Go
57 lines
2.1 KiB
Go
package main
|
|
|
|
import (
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
// A previous workspace can lack files that the next source sync will supply.
|
|
// Permissions and other environment failures remain fatal before sync.
|
|
func (s *Server) preflightForSync(work, source string, cfg BuildEnvironment) Preflight {
|
|
report := s.preflight(work, cfg)
|
|
s.explainWrapper(&report, work, source, true)
|
|
return report
|
|
}
|
|
|
|
func (s *Server) explainWrapper(report *Preflight, work, source string, beforeSync bool) {
|
|
report.Phase = "before-build"
|
|
if beforeSync {
|
|
report.Phase = "before-sync"
|
|
}
|
|
for i := range report.Items {
|
|
item := &report.Items[i]
|
|
if item.Name != "Gradle" || !strings.Contains(item.Message, "Wrapper 不完整或不可读") {
|
|
continue
|
|
}
|
|
wrapper := "gradlew"
|
|
if runtime.GOOS == "windows" {
|
|
wrapper += ".bat"
|
|
}
|
|
names := []string{wrapper, "gradle/wrapper/gradle-wrapper.jar", "gradle/wrapper/gradle-wrapper.properties"}
|
|
item.Message += "。请确保本机包含 " + strings.Join(names, "、") + ",且未被 .gitignore、.git/info/exclude 或全局忽略规则排除;gradle/ 和 gradlew* 会排除构建必需文件,缓存仅需排除 .gradle/。"
|
|
if source != "" && filepath.Clean(source) != filepath.Clean(work) {
|
|
ignored, _ := gitCommand(source, nil, append([]string{"check-ignore", "-v", "--"}, names...)...)
|
|
if detail := strings.TrimSpace(string(ignored)); detail != "" {
|
|
if len(detail) > 4096 {
|
|
detail = detail[:4096]
|
|
}
|
|
item.Message += " 服务端原工程的忽略规则(本机也需检查):\n" + detail
|
|
}
|
|
}
|
|
if beforeSync {
|
|
item.Status = "warning"
|
|
item.Message += " 当前为同步前检查,允许继续同步补齐;同步后构建前会再次严格检查。"
|
|
} else {
|
|
// Preserve the strict build-time status chosen by the normal preflight.
|
|
item.Message += " 源码已同步但仍缺少所需工具链;请修正本机忽略规则后重新 Remote Run,或在服务端配置匹配版本的 Gradle。"
|
|
}
|
|
}
|
|
report.Ready = true
|
|
for _, item := range report.Items {
|
|
if item.Status == "error" {
|
|
report.Ready = false
|
|
}
|
|
}
|
|
}
|