diff --git a/.gitignore b/.gitignore index bfc97737a..9d9ab3f31 100644 --- a/.gitignore +++ b/.gitignore @@ -94,6 +94,7 @@ node_modules/.bin/ .vagrant /attic/ /content/ +/.data_repos/ /third_party/binutils/binutils-2.24.tar.gz /third_party/binutils/bin/ /third_party/binutils/powerpc-none-elf/ diff --git a/.gitmodules b/.gitmodules index 612921585..88e041294 100644 --- a/.gitmodules +++ b/.gitmodules @@ -105,11 +105,3 @@ [submodule "third_party/cpplint"] path = third_party/cpplint url = https://github.com/cpplint/cpplint.git -[submodule "third_party/optimized-settings"] - path = third_party/optimized-settings - url = https://github.com/xenia-manager/optimized-settings.git - branch = main -[submodule "third_party/game-patches"] - path = third_party/game-patches - url = https://github.com/xenia-canary/game-patches.git - branch = main diff --git a/src/xenia/app/premake5.lua b/src/xenia/app/premake5.lua index de48f3960..71d0d06e9 100644 --- a/src/xenia/app/premake5.lua +++ b/src/xenia/app/premake5.lua @@ -160,22 +160,22 @@ project("xenia-app") -- Copy optimized-settings JSON files next to executable filter("platforms:Windows") -- Use absolute path to avoid issues with relative paths - local optimized_settings_src = path.translate(path.getabsolute(path.join(project_root, "third_party", "optimized-settings", "settings")), "\\") + local optimized_settings_src = path.translate(path.getabsolute(path.join(project_root, ".data_repos", "optimized-settings", "settings")), "\\") postbuildcommands { 'echo Copying optimized_settings from "' .. optimized_settings_src .. '" to "$(TargetDir)optimized_settings\\"', - 'if exist "' .. optimized_settings_src .. '" (xcopy /I /Y /Q "' .. optimized_settings_src .. '\\*.json" "$(TargetDir)optimized_settings\\") else (echo Warning: optimized-settings not found at ' .. optimized_settings_src .. ')' + 'if exist "' .. optimized_settings_src .. '" (xcopy /I /Y /Q "' .. optimized_settings_src .. '\\*.json" "$(TargetDir)optimized_settings\\") else (echo Warning: optimized-settings not found at ' .. optimized_settings_src .. ' - run: python xenia-build.py fetchdata)' } -- Copy game-patches TOML files next to executable filter("platforms:Windows") - local game_patches_src = path.translate(path.getabsolute(path.join(project_root, "third_party", "game-patches", "patches")), "\\") + local game_patches_src = path.translate(path.getabsolute(path.join(project_root, ".data_repos", "game-patches", "patches")), "\\") postbuildcommands { 'echo Copying game_patches from "' .. game_patches_src .. '" to "$(TargetDir)game_patches\\"', - 'if exist "' .. game_patches_src .. '" (xcopy /I /Y /Q "' .. game_patches_src .. '\\*.toml" "$(TargetDir)game_patches\\") else (echo Warning: game-patches not found at ' .. game_patches_src .. ')' + 'if exist "' .. game_patches_src .. '" (xcopy /I /Y /Q "' .. game_patches_src .. '\\*.toml" "$(TargetDir)game_patches\\") else (echo Warning: game-patches not found at ' .. game_patches_src .. ' - run: python xenia-build.py fetchdata)' } filter("platforms:Linux") - local optimized_settings_src = path.getabsolute(path.join(project_root, "third_party", "optimized-settings", "settings")) + local optimized_settings_src = path.getabsolute(path.join(project_root, ".data_repos", "optimized-settings", "settings")) local optimized_settings_dst = path.getabsolute(path.join(project_root, "build", "bin", "Linux")) .. "/%{cfg.buildcfg}/optimized_settings" postbuildcommands { '{MKDIR} ' .. optimized_settings_dst, @@ -183,7 +183,7 @@ project("xenia-app") } filter("platforms:Linux") - local game_patches_src = path.getabsolute(path.join(project_root, "third_party", "game-patches", "patches")) + local game_patches_src = path.getabsolute(path.join(project_root, ".data_repos", "game-patches", "patches")) local game_patches_dst = path.getabsolute(path.join(project_root, "build", "bin", "Linux")) .. "/%{cfg.buildcfg}/game_patches" postbuildcommands { '{MKDIR} ' .. game_patches_dst, diff --git a/third_party/game-patches b/third_party/game-patches deleted file mode 160000 index 74190849f..000000000 --- a/third_party/game-patches +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 74190849fae71d060a94e239784e9d2c82696be0 diff --git a/third_party/optimized-settings b/third_party/optimized-settings deleted file mode 160000 index 38b6d6d04..000000000 --- a/third_party/optimized-settings +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 38b6d6d04acced84e421d4c511b908fc79d25477 diff --git a/xenia-build.py b/xenia-build.py index f603decbf..267e64fb1 100755 --- a/xenia-build.py +++ b/xenia-build.py @@ -585,17 +585,69 @@ def git_submodule_update(): "-j", f"{os.cpu_count()}", ]) - # Then update only submodules that track branches to their latest - # Currently: optimized-settings and game-patches track 'main' - for submodule in ["third_party/optimized-settings", "third_party/game-patches"]: - shell_call([ - "git", - "submodule", - "update", - "--remote", - "--depth=1", - submodule - ]) + +def fetch_data_repos(): + """Fetches data repositories (game-patches, optimized-settings) into .data_repos/. + + These repos are cloned fresh or updated to their latest versions. They are not + submodules to avoid constant submodule updates in the main repo. + """ + print("- fetching data repositories...") + + data_dir = ".data_repos" + if not os.path.exists(data_dir): + os.makedirs(data_dir) + + # Define data repos + data_repos = [ + { + "name": "game-patches", + "url": "https://github.com/xenia-canary/game-patches.git", + "branch": "main" + }, + { + "name": "optimized-settings", + "url": "https://github.com/xenia-manager/optimized-settings.git", + "branch": "main" + } + ] + + # Clone or update each repo + for repo in data_repos: + repo_path = os.path.join(data_dir, repo["name"]) + + if os.path.exists(repo_path): + print(f" - updating {repo['name']}...") + try: + shell_call([ + "git", + "-C", repo_path, + "pull", + "--depth=1", + "origin", repo["branch"] + ]) + except Exception as e: + print(f" Warning: Failed to update {repo['name']}: {e}") + print(f" Removing and re-cloning...") + rmtree(repo_path) + shell_call([ + "git", + "clone", + "--depth=1", + "--branch", repo["branch"], + repo["url"], + repo_path + ]) + else: + print(f" - cloning {repo['name']}...") + shell_call([ + "git", + "clone", + "--depth=1", + "--branch", repo["branch"], + repo["url"], + repo_path + ]) def get_cc(cc=None): @@ -946,6 +998,7 @@ class SetupCommand(Command): print("- git submodule init / update...") if git_is_repository(): git_submodule_update() + fetch_data_repos() else: print("WARNING: Git not available or not a repository. Dependencies may be missing.")