Copy scene files from content -> engine during release builds. (#70)
This commit is contained in:
committed by
GitHub
parent
85b4be3ff4
commit
f6b4f23362
@@ -40,6 +40,7 @@ SERVER_IGNORED_RESOURCES = {
|
|||||||
|
|
||||||
GODOT = None
|
GODOT = None
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global GODOT
|
global GODOT
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
@@ -69,12 +70,14 @@ def main():
|
|||||||
platforms = ["windows", "mac", "linux"]
|
platforms = ["windows", "mac", "linux"]
|
||||||
|
|
||||||
if os.path.exists("release"):
|
if os.path.exists("release"):
|
||||||
print(Fore.BLUE+Style.DIM +
|
print(Fore.BLUE + Style.DIM +
|
||||||
"Cleaning old release packages (release/)..." + Style.RESET_ALL)
|
"Cleaning old release packages (release/)..." + Style.RESET_ALL)
|
||||||
shutil.rmtree("release")
|
shutil.rmtree("release")
|
||||||
|
|
||||||
os.mkdir("release")
|
os.mkdir("release")
|
||||||
|
|
||||||
|
copy_godot_scenes()
|
||||||
|
|
||||||
if "windows" in platforms:
|
if "windows" in platforms:
|
||||||
wipe_bin()
|
wipe_bin()
|
||||||
if not args.windows_godot_build:
|
if not args.windows_godot_build:
|
||||||
@@ -113,7 +116,7 @@ def build_windows(godot_build):
|
|||||||
"/v:m",
|
"/v:m",
|
||||||
"/p:TargetOS=Windows",
|
"/p:TargetOS=Windows",
|
||||||
"/t:Rebuild"
|
"/t:Rebuild"
|
||||||
], check=True)
|
], check=True)
|
||||||
|
|
||||||
print(Fore.GREEN + "Packaging Windows x64 client..." + Style.RESET_ALL)
|
print(Fore.GREEN + "Packaging Windows x64 client..." + Style.RESET_ALL)
|
||||||
|
|
||||||
@@ -167,7 +170,6 @@ def build_linux():
|
|||||||
server_zip.close()
|
server_zip.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def build_macos():
|
def build_macos():
|
||||||
print(Fore.GREEN + "Building project for MacOS x64..." + Style.RESET_ALL)
|
print(Fore.GREEN + "Building project for MacOS x64..." + Style.RESET_ALL)
|
||||||
subprocess.run(["msbuild",
|
subprocess.run(["msbuild",
|
||||||
@@ -195,10 +197,10 @@ def build_macos():
|
|||||||
p(bundle, "Contents", "MacOS", "bin", "Client"))
|
p(bundle, "Contents", "MacOS", "bin", "Client"))
|
||||||
|
|
||||||
copy_resources(p(bundle, "Contents",
|
copy_resources(p(bundle, "Contents",
|
||||||
"MacOS", "bin", "Client", "Resources"), server=False)
|
"MacOS", "bin", "Client", "Resources"), server=False)
|
||||||
|
|
||||||
os.makedirs(p(bundle, "Contents", "MacOS",
|
os.makedirs(p(bundle, "Contents", "MacOS",
|
||||||
"SS14.Client.Godot"), exist_ok=True)
|
"SS14.Client.Godot"), exist_ok=True)
|
||||||
|
|
||||||
_copytree(p("engine", "SS14.Client.Godot"),
|
_copytree(p("engine", "SS14.Client.Godot"),
|
||||||
p(bundle, "Contents", "MacOS", "SS14.Client.Godot"))
|
p(bundle, "Contents", "MacOS", "SS14.Client.Godot"))
|
||||||
@@ -208,7 +210,7 @@ def build_macos():
|
|||||||
|
|
||||||
print(Fore.GREEN + "Packaging MacOS x64 server..." + Style.RESET_ALL)
|
print(Fore.GREEN + "Packaging MacOS x64 server..." + Style.RESET_ALL)
|
||||||
copy_resources(p("engine", "bin",
|
copy_resources(p("engine", "bin",
|
||||||
"Server", "Resources"), server=True)
|
"Server", "Resources"), server=True)
|
||||||
|
|
||||||
package_zip(p("engine", "bin", "Server"),
|
package_zip(p("engine", "bin", "Server"),
|
||||||
p("release", "SS14.Server_MacOS.zip"))
|
p("release", "SS14.Server_MacOS.zip"))
|
||||||
@@ -269,5 +271,44 @@ def copy_dir_into_zip(directory, basepath, zipf):
|
|||||||
zipf.write(filepath, zippath)
|
zipf.write(filepath, zippath)
|
||||||
|
|
||||||
|
|
||||||
|
def copy_godot_scenes():
|
||||||
|
target_dir = p("engine", "SS14.Client.Godot", "Scenes")
|
||||||
|
from_dir = p("Resources", "Scenes")
|
||||||
|
for path in os.listdir(from_dir):
|
||||||
|
if path.startswith("."):
|
||||||
|
continue
|
||||||
|
|
||||||
|
frompath = p(from_dir, path)
|
||||||
|
targetpath = p(target_dir, path)
|
||||||
|
if os.path.exists(targetpath):
|
||||||
|
if os.path.isfile(targetpath):
|
||||||
|
os.remove(targetpath)
|
||||||
|
|
||||||
|
elif os.path.isdir(targetpath):
|
||||||
|
shutil.rmtree(targetpath)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("So, what the hell is {} exactly and how did it get there?"
|
||||||
|
.format(targetpath))
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
copy_dir_or_file(frompath, targetpath)
|
||||||
|
|
||||||
|
|
||||||
|
def copy_dir_or_file(src, dst):
|
||||||
|
"""
|
||||||
|
Just something from src to dst. If src is a dir it gets copied recursively.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if os.path.isfile(src):
|
||||||
|
shutil.copy2(src, dst)
|
||||||
|
|
||||||
|
elif os.path.isdir(src):
|
||||||
|
shutil.copytree(src, dst)
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise IOError("{} is neither file nor directory. Can't copy.".format(src))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user