From 04ff2793dae5e506c70999ad09b930f6908a3052 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Sat, 1 Mar 2025 12:04:17 +0100 Subject: [PATCH] added a clean_repo function to clean the object files when the row is done being processed --- clone_repos.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/clone_repos.py b/clone_repos.py index a966ca6..10b1c56 100644 --- a/clone_repos.py +++ b/clone_repos.py @@ -164,6 +164,15 @@ def test_repo(build_file: str, container, updates: dict) -> bool: return True +def clean_repo(build_file: str, container): + if build_file.endswith("pom.xml") or build_file.endswith("build.xml"): + clean_cmd = "mvn clean" + elif build_file.endswith("build.gradle"): + clean_cmd = "gradle clean" + else: + return + + container.exec_run(clean_cmd) def process_row(repo, client, dest: str, updates: dict, force: bool = False, verbose: bool = False) -> None: with tqdm(total=5, leave=False) as pbar: @@ -211,14 +220,16 @@ def process_row(repo, client, dest: str, updates: dict, force: bool = False, ver compiled = compile_repo(build_file, container, updates) if not compiled: if verbose: print(f"Removing {repo}, failed to compile") + clean_repo(build_file, container) remove_dir(repo_path) return pbar.update(1) pbar.set_postfix_str("Runing tests...") - compiled = test_repo(build_file, container, updates) - if not compiled: - if verbose: print(f"Removing {repo}, failed to compile") + tested = test_repo(build_file, container, updates) + clean_repo(build_file, container) + if not tested: + if verbose: print(f"Removing {repo}, failed to run tests") remove_dir(repo_path) return pbar.update(1)