diff --git a/scripts/build.py b/scripts/build.py index 12b6a0f..9093f54 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -23,8 +23,8 @@ def run(context: Context): ProjectInterface(context), ProjectProguard(context), ProjectBuild(context), - ProjectUpload(context), - ProjectEnd(context), + # ProjectUpload(context), + # ProjectEnd(context), ] for task in tasks: diff --git a/scripts/project_init.py b/scripts/project_init.py index 27bafb3..bf76aaf 100644 --- a/scripts/project_init.py +++ b/scripts/project_init.py @@ -12,6 +12,8 @@ def progress(op_code, cur_count, max_count=None, message=''): class ProjectInit(Task): def execute(self): + print("111") + self.context.project_original_path = "/Users/luojian/Documents/project/zicp/Android/GameLauncher" try: repo = Repo(self.context.project_original_path) except Exception: @@ -19,6 +21,7 @@ class ProjectInit(Task): recursive=True, progress=progress) + print("112") # for submodule in repo.submodules: # print(f"子模块 '{submodule.name}' 路径: {submodule.path}") # # print(f"Commit ID: {submodule.module().head.commit}") @@ -31,37 +34,37 @@ class ProjectInit(Task): remote_name = "origin" # 远程仓库默认名称 - repo.git.fetch(remote_name) + # repo.git.fetch(remote_name) - if repo.active_branch.name != branch_name: - # 检查本地是否已存在该分支 - if branch_name in repo.heads: - # 本地分支已存在,直接切换 - repo.heads[branch_name].checkout() - else: - # 2. 创建本地分支并跟踪远程分支 - remote_branch_ref = f"{remote_name}/{branch_name}" - local_branch = repo.create_head(branch_name, remote_branch_ref) # 创建本地分支指向远程 - local_branch.set_tracking_branch(repo.remotes[remote_name].refs[branch_name]) # 设置跟踪 - local_branch.checkout() # 切换到该分支 + # if repo.active_branch.name != branch_name: + # # 检查本地是否已存在该分支 + # if branch_name in repo.heads: + # # 本地分支已存在,直接切换 + # repo.heads[branch_name].checkout() + # else: + # # 2. 创建本地分支并跟踪远程分支 + # remote_branch_ref = f"{remote_name}/{branch_name}" + # local_branch = repo.create_head(branch_name, remote_branch_ref) # 创建本地分支指向远程 + # local_branch.set_tracking_branch(repo.remotes[remote_name].refs[branch_name]) # 设置跟踪 + # local_branch.checkout() # 切换到该分支 self.context.local_repo_branch = repo.active_branch.name self.context.local_repo_commit = repo.head.commit.hexsha[:10] # 拉取最新代码 - repo.remotes.origin.pull() + # repo.remotes.origin.pull() print("当前分支:" + repo.active_branch.name) pass else: raise Exception(f"No commit to {self.context.repo_commit}") - repo.git.submodule('update', '--init', '--recursive') - - for submodule in repo.submodules: - print(submodule.url) - print(submodule.name) - print(submodule.hexsha) - print(submodule.path) - sub_repo = submodule.module() - sub_repo.git.reset("--hard", submodule.hexsha) - print(f"Reset {submodule.name} to {submodule.hexsha[:7]}") + # repo.git.submodule('update', '--init', '--recursive') + # + # for submodule in repo.submodules: + # print(submodule.url) + # print(submodule.name) + # print(submodule.hexsha) + # print(submodule.path) + # sub_repo = submodule.module() + # sub_repo.git.reset("--hard", submodule.hexsha) + # print(f"Reset {submodule.name} to {submodule.hexsha[:7]}")