[Build] Remove data repos from third_party and fetch during setup

Avoids having to update main repo each time they get updates.
This commit is contained in:
Herman S.
2025-11-24 18:40:11 +09:00
parent f3b1a3b641
commit b0e3dda66d
6 changed files with 71 additions and 27 deletions
+1
View File
@@ -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/
-8
View File
@@ -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
+6 -6
View File
@@ -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,
+64 -11
View File
@@ -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.")