2019-11-24 01:05:25 +01:00
|
|
|
#!/usr/bin/env python
|
2020-08-08 20:08:27 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2021-04-15 11:52:32 +02:00
|
|
|
# Copyright (c) 2019-2021 Péter Magyar
|
2019-12-22 19:20:38 +01:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included in all
|
|
|
|
# copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
# SOFTWARE.
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
EnsureSConsVersion(0, 98, 1)
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import json
|
|
|
|
import shutil
|
2020-03-24 16:58:37 +01:00
|
|
|
import traceback
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2019-12-01 23:32:36 +01:00
|
|
|
repository_index = 0
|
2019-11-24 01:05:25 +01:00
|
|
|
module_clone_path = '/modules/'
|
|
|
|
clone_command = 'git clone {0} {1}'
|
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
visual_studio_call_vcvarsall = False
|
|
|
|
visual_studio_vcvarsall_path = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat'
|
|
|
|
visual_studio_arch = 'amd64'
|
|
|
|
|
|
|
|
exports = {
|
|
|
|
'global': [],
|
|
|
|
'linux': [],
|
|
|
|
'windows': [],
|
|
|
|
'android': [],
|
|
|
|
'javascript': [],
|
|
|
|
}
|
|
|
|
|
2019-12-22 22:14:58 +01:00
|
|
|
engine_repository = [ ['https://github.com/godotengine/godot.git', 'git@github.com:godotengine/godot.git'], 'engine', '' ]
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
module_repositories = [
|
2019-12-01 23:32:36 +01:00
|
|
|
[ ['https://github.com/Relintai/world_generator.git', 'git@github.com:Relintai/world_generator.git'], 'world_generator', '' ],
|
|
|
|
[ ['https://github.com/Relintai/entity_spell_system.git', 'git@github.com:Relintai/entity_spell_system.git'], 'entity_spell_system', '' ],
|
|
|
|
[ ['https://github.com/Relintai/ui_extensions.git', 'git@github.com:Relintai/ui_extensions.git'], 'ui_extensions', '' ],
|
|
|
|
[ ['https://github.com/Relintai/texture_packer.git', 'git@github.com:Relintai/texture_packer.git'], 'texture_packer', '' ],
|
|
|
|
[ ['https://github.com/Relintai/godot_fastnoise.git', 'git@github.com:Relintai/godot_fastnoise.git'], 'fastnoise', '' ],
|
2019-12-22 22:14:58 +01:00
|
|
|
[ ['https://github.com/Relintai/mesh_data_resource.git', 'git@github.com:Relintai/mesh_data_resource.git'], 'mesh_data_resource', '' ],
|
2020-04-03 12:09:21 +02:00
|
|
|
[ ['https://github.com/Relintai/props.git', 'git@github.com:Relintai/props.git'], 'props', '' ],
|
2020-05-23 20:19:04 +02:00
|
|
|
[ ['https://github.com/Relintai/mesh_utils.git', 'git@github.com:Relintai/mesh_utils.git'], 'mesh_utils', '' ],
|
2020-05-23 20:31:00 +02:00
|
|
|
[ ['https://github.com/Relintai/broken_seals_module.git', 'git@github.com:Relintai/broken_seals_module.git'], 'broken_seals_module', '' ],
|
2020-06-10 09:42:57 +02:00
|
|
|
[ ['https://github.com/Relintai/thread_pool.git', 'git@github.com:Relintai/thread_pool.git'], 'thread_pool', '' ],
|
2021-04-15 11:53:17 +02:00
|
|
|
[ ['https://github.com/Relintai/terraman.git', 'git@github.com:Relintai/terraman.git'], 'terraman', '' ],
|
2019-11-24 01:05:25 +01:00
|
|
|
]
|
|
|
|
|
2021-04-19 10:19:10 +02:00
|
|
|
removed_modules = [
|
|
|
|
[ ['https://github.com/Relintai/voxelman.git', 'git@github.com:Relintai/voxelman.git'], 'voxelman', '' ],
|
2021-07-20 20:00:10 +02:00
|
|
|
[ ['https://github.com/Relintai/procedural_animations.git', 'git@github.com:Relintai/procedural_animations.git'], 'procedural_animations', '' ],
|
2021-04-19 10:19:10 +02:00
|
|
|
]
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
addon_repositories = [
|
|
|
|
]
|
|
|
|
|
|
|
|
third_party_addon_repositories = [
|
|
|
|
]
|
|
|
|
|
|
|
|
target_commits = {}
|
|
|
|
|
2021-04-15 12:11:19 +02:00
|
|
|
godot_branch = '3.x'
|
2020-02-11 17:06:06 +01:00
|
|
|
|
2020-03-24 16:58:37 +01:00
|
|
|
def onerror(func, path, exc_info):
|
|
|
|
"""
|
|
|
|
https://stackoverflow.com/questions/2656322/shutil-rmtree-fails-on-windows-with-access-is-denied
|
|
|
|
|
|
|
|
Because Windows.
|
|
|
|
|
|
|
|
Error handler for ``shutil.rmtree``.
|
|
|
|
|
|
|
|
If the error is due to an access error (read only file)
|
|
|
|
it attempts to add write permission and then retries.
|
|
|
|
|
|
|
|
If the error is for another reason it re-raises the error.
|
|
|
|
|
|
|
|
Usage : ``shutil.rmtree(path, onerror=onerror)``
|
|
|
|
"""
|
|
|
|
import stat
|
|
|
|
if not os.access(path, os.W_OK):
|
|
|
|
# Is the error an access error ?
|
|
|
|
os.chmod(path, stat.S_IWUSR)
|
|
|
|
func(path)
|
|
|
|
else:
|
|
|
|
raise
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
def load_target_commits_array():
|
2019-12-03 19:30:12 +01:00
|
|
|
global target_commits
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
if os.path.isfile('./HEADS'):
|
|
|
|
with open('./HEADS', 'r') as infile:
|
|
|
|
target_commits = json.load(infile)
|
|
|
|
else:
|
2019-12-03 19:30:12 +01:00
|
|
|
target_commits = {}
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
def save_target_commits_array():
|
|
|
|
with open('./HEADS', 'w') as outfile:
|
|
|
|
json.dump(target_commits, outfile)
|
|
|
|
|
2020-02-11 17:06:06 +01:00
|
|
|
def update_repository(data, clone_path, branch = 'master'):
|
2019-11-24 01:05:25 +01:00
|
|
|
cwd = os.getcwd()
|
|
|
|
|
|
|
|
full_path = cwd + clone_path + data[1] + '/'
|
|
|
|
|
|
|
|
if not os.path.isdir(full_path):
|
|
|
|
os.chdir(cwd + clone_path)
|
|
|
|
|
2019-12-01 23:32:36 +01:00
|
|
|
subprocess.call(clone_command.format(data[0][repository_index], data[1]), shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
os.chdir(full_path)
|
|
|
|
|
2020-03-24 16:58:37 +01:00
|
|
|
subprocess.call('git reset', shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
subprocess.call('git reset --hard', shell=True)
|
2020-04-09 15:15:22 +02:00
|
|
|
subprocess.call('git clean -f -d', shell=True)
|
2020-02-11 17:06:06 +01:00
|
|
|
subprocess.call('git checkout -B ' + branch + ' origin/' + branch, shell=True)
|
2020-03-24 16:58:37 +01:00
|
|
|
subprocess.call('git reset', shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
subprocess.call('git reset --hard', shell=True)
|
2020-04-09 15:15:22 +02:00
|
|
|
subprocess.call('git clean -f -d', shell=True)
|
2020-02-11 17:06:06 +01:00
|
|
|
subprocess.call('git pull origin ' + branch, shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
process = subprocess.Popen('git rev-parse HEAD', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
|
|
output = process.communicate()[0].decode().strip()
|
2020-02-11 17:06:06 +01:00
|
|
|
|
|
|
|
if data[1] not in target_commits:
|
|
|
|
target_commits[data[1]] = {}
|
|
|
|
|
|
|
|
target_commits[data[1]][branch] = output
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
os.chdir(cwd)
|
|
|
|
|
2020-02-11 17:06:06 +01:00
|
|
|
def setup_repository(data, clone_path, branch = 'master'):
|
2019-11-24 01:05:25 +01:00
|
|
|
cwd = os.getcwd()
|
|
|
|
|
|
|
|
full_path = cwd + clone_path + data[1] + '/'
|
|
|
|
|
|
|
|
if not os.path.isdir(full_path):
|
2020-03-24 16:58:37 +01:00
|
|
|
os.chdir(cwd + clone_path)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2019-12-01 23:32:36 +01:00
|
|
|
subprocess.call(clone_command.format(data[0][repository_index], data[1]), shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
os.chdir(full_path)
|
|
|
|
|
2020-03-24 16:58:37 +01:00
|
|
|
subprocess.call('git reset', shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
subprocess.call('git reset --hard', shell=True)
|
2020-04-09 15:15:22 +02:00
|
|
|
subprocess.call('git clean -f -d', shell=True)
|
2020-02-11 17:45:58 +01:00
|
|
|
subprocess.call('git checkout -B ' + branch + ' origin/' + branch, shell=True)
|
2020-06-18 11:35:05 +02:00
|
|
|
subprocess.call('git pull origin ' + branch, shell=True)
|
|
|
|
subprocess.call('git reset', shell=True)
|
|
|
|
subprocess.call('git reset --hard', shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
if data[1] in target_commits:
|
2020-02-11 17:06:06 +01:00
|
|
|
target = target_commits[data[1]][branch]
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2020-02-11 17:45:58 +01:00
|
|
|
subprocess.call('git checkout -B ' + branch + ' ' + target, shell=True)
|
2020-04-09 15:15:22 +02:00
|
|
|
subprocess.call('git clean -f -d', shell=True)
|
2020-03-24 16:58:37 +01:00
|
|
|
subprocess.call('git reset', shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
subprocess.call('git reset --hard', shell=True)
|
|
|
|
|
|
|
|
os.chdir(cwd)
|
|
|
|
|
|
|
|
def copy_repository(data, target_folder, clone_path):
|
2019-11-24 17:00:16 +01:00
|
|
|
copytree(os.path.abspath(clone_path + data[1] + '/' + data[2]), os.path.abspath(target_folder + data[1]))
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
def copytree(src, dst):
|
|
|
|
for item in os.listdir(src):
|
|
|
|
sp = os.path.join(src, item)
|
|
|
|
dp = os.path.join(dst, item)
|
|
|
|
|
|
|
|
if os.path.isdir(sp):
|
|
|
|
if os.path.isdir(dp):
|
2020-03-24 16:58:37 +01:00
|
|
|
shutil.rmtree(dp, onerror=onerror)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2020-06-10 12:42:04 +02:00
|
|
|
shutil.copytree(sp, dp)
|
2019-11-24 01:05:25 +01:00
|
|
|
else:
|
2019-12-14 00:03:29 +01:00
|
|
|
if not os.path.isdir(dst):
|
|
|
|
os.makedirs(dst)
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
shutil.copy2(sp, dp)
|
|
|
|
|
2021-04-19 10:19:10 +02:00
|
|
|
def remove_repository(data, target_folder):
|
|
|
|
folder = os.path.abspath(target_folder + data[1])
|
|
|
|
|
|
|
|
if os.path.isdir(folder):
|
|
|
|
shutil.rmtree(folder)
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
def update_engine():
|
2020-02-11 17:06:06 +01:00
|
|
|
update_repository(engine_repository, '/', godot_branch)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
def update_modules():
|
|
|
|
for rep in module_repositories:
|
|
|
|
update_repository(rep, module_clone_path)
|
|
|
|
copy_repository(rep, './engine/modules/', '.' + module_clone_path)
|
|
|
|
|
|
|
|
def update_addons():
|
|
|
|
for rep in addon_repositories:
|
|
|
|
update_repository(rep, module_clone_path)
|
2019-12-22 22:14:58 +01:00
|
|
|
copy_repository(rep, './game/addons/', '.' + module_clone_path)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
def update_addons_third_party_addons():
|
|
|
|
for rep in third_party_addon_repositories:
|
|
|
|
update_repository(rep, module_clone_path)
|
2019-12-22 22:14:58 +01:00
|
|
|
copy_repository(rep, './game/addons/', '.' + module_clone_path)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
def update_all():
|
|
|
|
update_engine()
|
|
|
|
update_modules()
|
|
|
|
update_addons()
|
|
|
|
update_addons_third_party_addons()
|
|
|
|
|
|
|
|
save_target_commits_array()
|
|
|
|
|
|
|
|
|
|
|
|
def setup_engine():
|
2020-02-11 17:06:06 +01:00
|
|
|
setup_repository(engine_repository, '/', godot_branch)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
def setup_modules():
|
|
|
|
for rep in module_repositories:
|
|
|
|
setup_repository(rep, module_clone_path)
|
|
|
|
copy_repository(rep, './engine/modules/', '.' + module_clone_path)
|
|
|
|
|
2021-04-19 10:19:10 +02:00
|
|
|
for rep in removed_modules:
|
|
|
|
remove_repository(rep, './engine/modules/')
|
|
|
|
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
def setup_addons():
|
|
|
|
for rep in addon_repositories:
|
|
|
|
setup_repository(rep, module_clone_path)
|
2019-12-22 22:14:58 +01:00
|
|
|
copy_repository(rep, './game/addons/', '.' + module_clone_path)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
def setup_addons_third_party_addons():
|
|
|
|
for rep in third_party_addon_repositories:
|
|
|
|
setup_repository(rep, module_clone_path)
|
2019-12-22 22:14:58 +01:00
|
|
|
copy_repository(rep, './game/addons/', '.' + module_clone_path)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
def setup_all():
|
|
|
|
setup_engine()
|
|
|
|
setup_modules()
|
|
|
|
setup_addons()
|
|
|
|
setup_addons_third_party_addons()
|
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
def format_path(path):
|
|
|
|
if 'win' in sys.platform:
|
|
|
|
path = path.replace('/', '\\')
|
|
|
|
path = path.replace('~', '%userprofile%')
|
|
|
|
|
|
|
|
return path
|
|
|
|
|
|
|
|
def get_exports_for(platform):
|
|
|
|
export_command = 'export '
|
|
|
|
command_separator = ';'
|
|
|
|
|
|
|
|
if 'win' in sys.platform:
|
2020-06-12 10:46:38 +02:00
|
|
|
command_separator = '&'
|
2020-06-12 10:35:20 +02:00
|
|
|
export_command = 'set '
|
|
|
|
|
|
|
|
command = ''
|
|
|
|
|
|
|
|
for p in exports[platform]:
|
|
|
|
command += export_command + p + command_separator
|
|
|
|
|
|
|
|
return command
|
|
|
|
|
|
|
|
|
|
|
|
def parse_config():
|
|
|
|
global visual_studio_vcvarsall_path
|
|
|
|
global visual_studio_arch
|
|
|
|
global visual_studio_call_vcvarsall
|
|
|
|
global exports
|
|
|
|
|
|
|
|
if not os.path.isfile('build.config'):
|
|
|
|
return
|
|
|
|
|
|
|
|
with open('build.config', 'r') as f:
|
|
|
|
|
|
|
|
for line in f:
|
|
|
|
ls = line.strip()
|
|
|
|
if ls == '' or ls.startswith('#'):
|
|
|
|
continue
|
|
|
|
|
|
|
|
words = line.split()
|
|
|
|
|
|
|
|
if (len(words) < 2):
|
|
|
|
print('This build.config line is malformed, and got ignored: ' + ls)
|
|
|
|
continue
|
|
|
|
|
|
|
|
if words[0] == 'visual_studio_vcvarsall_path':
|
|
|
|
visual_studio_vcvarsall_path = format_path(ls[29:])
|
|
|
|
elif words[0] == 'visual_studio_arch':
|
|
|
|
visual_studio_arch = format_path(ls[19:])
|
|
|
|
elif words[0] == 'visual_studio_call_vcvarsall':
|
|
|
|
visual_studio_call_vcvarsall = words[1].lower() in [ 'true', '1', 't', 'y', 'yes' ]
|
|
|
|
elif words[0] == 'export':
|
|
|
|
if (len(words) < 3) or not words[1] in exports:
|
|
|
|
print('This build.config line is malformed, and got ignored: ' + ls)
|
|
|
|
continue
|
|
|
|
|
|
|
|
export_path = format_path(ls[8 + len(words[1]):])
|
|
|
|
|
|
|
|
exports[words[1]].append(export_path)
|
|
|
|
|
|
|
|
parse_config()
|
2020-02-11 17:06:06 +01:00
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
env = Environment()
|
2020-01-06 16:59:54 +01:00
|
|
|
|
|
|
|
if len(sys.argv) > 1:
|
|
|
|
|
|
|
|
arg = sys.argv[1]
|
|
|
|
|
2020-12-22 15:55:31 +01:00
|
|
|
arg_split = arg.split('_')
|
|
|
|
arg = arg_split[0]
|
2020-12-22 16:01:38 +01:00
|
|
|
arg_split = arg_split[1:]
|
2020-12-22 15:55:31 +01:00
|
|
|
|
2020-01-06 16:59:54 +01:00
|
|
|
if arg[0] == 'b':
|
2020-06-12 10:35:20 +02:00
|
|
|
build_string = get_exports_for('global') + 'scons '
|
2020-01-06 16:59:54 +01:00
|
|
|
|
|
|
|
build_string += 'tools='
|
|
|
|
if 'e' in arg:
|
|
|
|
build_string += 'yes'
|
|
|
|
else:
|
|
|
|
build_string += 'no'
|
|
|
|
build_string += ' '
|
|
|
|
|
|
|
|
build_string += 'target='
|
|
|
|
if 'r' in arg:
|
|
|
|
build_string += 'release'
|
2020-02-14 21:41:22 +01:00
|
|
|
elif 'd' in arg:
|
2020-01-06 16:59:54 +01:00
|
|
|
build_string += 'debug'
|
|
|
|
else:
|
|
|
|
build_string += 'release_debug'
|
|
|
|
build_string += ' '
|
|
|
|
|
|
|
|
build_string += 'custom_modules_shared='
|
|
|
|
if 's' in arg:
|
|
|
|
build_string += 'yes'
|
|
|
|
else:
|
|
|
|
build_string += 'no'
|
|
|
|
build_string += ' '
|
|
|
|
|
2020-03-24 16:58:37 +01:00
|
|
|
if 'm' in arg:
|
|
|
|
build_string += 'use_mingw=yes'
|
|
|
|
else:
|
2020-06-12 10:35:20 +02:00
|
|
|
if 'win' in sys.platform and visual_studio_call_vcvarsall:
|
|
|
|
build_string = 'call "{0}" {1}&'.format(visual_studio_vcvarsall_path, visual_studio_arch) + build_string
|
2020-03-24 16:58:37 +01:00
|
|
|
|
2020-03-24 19:05:53 +01:00
|
|
|
if 'o' in arg:
|
|
|
|
build_string += 'use_llvm=yes'
|
|
|
|
|
2020-03-24 16:58:37 +01:00
|
|
|
if 'v' in arg:
|
|
|
|
build_string += 'vsproj=yes'
|
|
|
|
|
2020-01-06 16:59:54 +01:00
|
|
|
for i in range(2, len(sys.argv)):
|
|
|
|
build_string += ' ' + sys.argv[i] + ' '
|
|
|
|
|
2020-12-22 16:01:38 +01:00
|
|
|
if 'slim' in arg_split:
|
2021-07-19 22:59:24 +02:00
|
|
|
build_string += 'module_webm_enabled=no module_arkit_enabled=no module_visual_script_enabled=no module_gdnative_enabled=no module_mobile_vr_enabled=no module_theora_enabled=no module_xatlas_unwrap_enabled=no'
|
2020-12-22 15:55:31 +01:00
|
|
|
build_string += ' '
|
|
|
|
|
2021-03-09 16:17:11 +01:00
|
|
|
if 'latomic' in arg_split:
|
|
|
|
build_string += 'LINKFLAGS="-latomic"'
|
2021-03-09 16:26:30 +01:00
|
|
|
build_string += ' '
|
2021-03-09 16:17:11 +01:00
|
|
|
|
2021-03-24 09:49:06 +01:00
|
|
|
if 'strip' in arg_split:
|
|
|
|
build_string += 'debug_symbols=no'
|
|
|
|
build_string += ' '
|
|
|
|
|
2020-03-24 16:58:37 +01:00
|
|
|
target = ' '
|
2020-01-19 01:14:09 +01:00
|
|
|
|
|
|
|
if 'E' in arg:
|
|
|
|
target += 'bin/libess.x11.opt.tools.64.so'
|
|
|
|
elif 'T' in arg:
|
|
|
|
target += 'bin/libtexture_packer.x11.opt.tools.64.so'
|
|
|
|
elif 'V' in arg:
|
|
|
|
target += 'bin/libvoxelman.x11.opt.tools.64.so'
|
|
|
|
elif 'W' in arg:
|
|
|
|
target += 'bin/libworld_generator.x11.opt.tools.64.so'
|
2020-01-24 16:30:52 +01:00
|
|
|
elif 'P' in arg:
|
|
|
|
target += 'bin/libprocedural_animations.x11.opt.tools.64.so'
|
2020-01-19 01:14:09 +01:00
|
|
|
|
2020-01-06 16:59:54 +01:00
|
|
|
cwd = os.getcwd()
|
|
|
|
full_path = cwd + '/engine/'
|
|
|
|
|
|
|
|
if not os.path.isdir(full_path):
|
2020-03-24 16:58:37 +01:00
|
|
|
print('engine directory doesnt exists.')
|
2020-01-06 16:59:54 +01:00
|
|
|
exit()
|
|
|
|
|
|
|
|
os.chdir(full_path)
|
|
|
|
|
2020-01-07 15:59:39 +01:00
|
|
|
if 'l' in arg:
|
|
|
|
build_string += 'platform=x11'
|
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
build_string = get_exports_for('linux') + build_string + target
|
|
|
|
|
|
|
|
print('Running command: ' + build_string)
|
|
|
|
|
|
|
|
subprocess.call(build_string, shell=True)
|
2020-01-07 15:59:39 +01:00
|
|
|
elif 'w' in arg:
|
|
|
|
build_string += 'platform=windows'
|
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
build_string = get_exports_for('windows') + build_string
|
|
|
|
|
|
|
|
print('Running command: ' + build_string)
|
|
|
|
|
|
|
|
subprocess.call(build_string, shell=True)
|
2020-01-07 15:59:39 +01:00
|
|
|
elif 'a' in arg:
|
|
|
|
build_string += 'platform=android'
|
2020-01-06 16:59:54 +01:00
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
build_string = get_exports_for('android') + build_string
|
2020-03-24 16:58:37 +01:00
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
print('Running command: ' + build_string + ' android_arch=armv7')
|
|
|
|
subprocess.call(build_string + ' android_arch=armv7', shell=True)
|
|
|
|
print('Running command: ' + build_string + ' android_arch=arm64v8')
|
|
|
|
subprocess.call(build_string + ' android_arch=arm64v8', shell=True)
|
|
|
|
print('Running command: ' + build_string + ' android_arch=x86')
|
|
|
|
subprocess.call(build_string + ' android_arch=x86', shell=True)
|
2020-01-07 15:59:39 +01:00
|
|
|
|
|
|
|
os.chdir(full_path + 'platform/android/java/')
|
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
print('Running command: ' + get_exports_for('global') + get_exports_for('android') + './gradlew generateGodotTemplates')
|
|
|
|
subprocess.call(get_exports_for('global') + get_exports_for('android') + './gradlew generateGodotTemplates', shell=True)
|
2020-01-07 15:59:39 +01:00
|
|
|
elif 'j' in arg:
|
|
|
|
build_string += 'platform=javascript'
|
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
build_string = get_exports_for('javascript') + build_string
|
|
|
|
|
|
|
|
print('Running command: ' + build_string)
|
|
|
|
subprocess.call(build_string, shell=True)
|
2020-01-07 15:59:39 +01:00
|
|
|
elif 'i' in arg:
|
|
|
|
build_string += 'platform=iphone'
|
|
|
|
|
2020-06-12 10:35:20 +02:00
|
|
|
subprocess.call(build_string + ' arch=arm', shell=True)
|
|
|
|
subprocess.call(build_string + ' arch=arm64', shell=True)
|
2020-01-07 15:59:39 +01:00
|
|
|
|
|
|
|
#subprocess.call('lipo -create bin/libgodot.iphone.{0}.arm.a bin/libgodot.iphone.{0}.arm64.a -output bin/libgodot.iphone.{1}.fat.a'.fomat(), shell=True)
|
|
|
|
|
|
|
|
#lipo -create bin/libgodot.iphone.opt.debug.arm.a bin/libgodot.iphone.opt.debug.arm64.a -output bin/libgodot.iphone.debug.fat.a
|
|
|
|
#rm bin/ios_xcode/libgodot.iphone.debug.fat.a
|
|
|
|
#cp bin/libgodot.iphone.debug.fat.a bin/ios_xcode/libgodot.iphone.debug.fat.a
|
|
|
|
|
|
|
|
#lipo -create bin/libgodot.iphone.opt.arm.a bin/libgodot.iphone.opt.arm64.a -output bin/libgodot.iphone.release.fat.a
|
|
|
|
#rm bin/ios_xcode/libgodot.iphone.release.fat.a
|
|
|
|
#cp bin/libgodot.iphone.release.fat.a bin/ios_xcode/libgodot.iphone.release.fat.a
|
|
|
|
|
|
|
|
subprocess.call('rm bin/iphone.zip', shell=True)
|
|
|
|
#cd bin/ios_xcode
|
2020-06-12 10:35:20 +02:00
|
|
|
subprocess.call(build_string + ' arch=arm64', shell=True)
|
2020-01-07 15:59:39 +01:00
|
|
|
subprocess.call('zip -r -X ../iphone.zip .', shell=True)
|
|
|
|
|
|
|
|
else:
|
|
|
|
print('No platform specified')
|
|
|
|
exit()
|
2020-01-06 16:59:54 +01:00
|
|
|
|
2020-01-06 22:37:24 +01:00
|
|
|
exit()
|
2020-02-12 01:23:12 +01:00
|
|
|
elif arg[0] == 'p':
|
2020-03-28 11:49:03 +01:00
|
|
|
if arg == 'p':
|
2021-02-23 01:30:54 +01:00
|
|
|
print("Applies a patch. No Patches right now.Append s for the skeleton editor patch. For example: ps ")
|
2020-03-28 11:49:03 +01:00
|
|
|
exit()
|
|
|
|
|
2020-02-12 01:23:12 +01:00
|
|
|
cwd = os.getcwd()
|
|
|
|
full_path = cwd + '/engine/'
|
|
|
|
|
|
|
|
if not os.path.isdir(full_path):
|
2021-02-23 10:25:11 +01:00
|
|
|
print('engine directory does not exists.')
|
2020-02-12 01:23:12 +01:00
|
|
|
exit()
|
|
|
|
|
|
|
|
os.chdir(full_path)
|
|
|
|
|
2020-03-28 11:49:03 +01:00
|
|
|
#apply the patch to just the working directory, without creating a commit
|
|
|
|
|
2021-02-23 01:30:54 +01:00
|
|
|
if 's' in arg:
|
|
|
|
subprocess.call('git apply --index ../patches/custom_skeleton_3d_editor_plugin.patch', shell=True)
|
2020-03-28 11:49:03 +01:00
|
|
|
|
2021-02-23 10:25:11 +01:00
|
|
|
#unstage all files
|
|
|
|
subprocess.call('git reset', shell=True)
|
|
|
|
|
|
|
|
vman_full_path = cwd + '/engine/modules/voxelman/'
|
|
|
|
|
|
|
|
#also patch voxelman as the plugin changes forward_spatial_gui_input's definition
|
|
|
|
if os.path.isdir(vman_full_path):
|
|
|
|
os.chdir(vman_full_path)
|
|
|
|
|
|
|
|
subprocess.call('git apply --index ../../../patches/fix-voxel-editor-after-the-skeleton-editor-patch.patch', shell=True)
|
|
|
|
|
|
|
|
#unstage all files
|
|
|
|
subprocess.call('git reset', shell=True)
|
|
|
|
else:
|
|
|
|
print('Voxelman directory does not exists, skipping patch.')
|
|
|
|
|
|
|
|
|
2020-02-12 01:23:12 +01:00
|
|
|
|
|
|
|
exit()
|
2020-01-06 22:37:24 +01:00
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
opts = Variables(args=ARGUMENTS)
|
|
|
|
|
|
|
|
opts.Add('a', 'What to do', '')
|
|
|
|
opts.Add(EnumVariable('action', 'What to do', 'setup', ('setup', 'update')))
|
|
|
|
opts.Add('t', 'Action target', '')
|
|
|
|
opts.Add(EnumVariable('target', 'Action target', 'all', ('all', 'engine', 'modules', 'all_addons', 'addons', 'third_party_addons')))
|
2019-12-01 23:32:36 +01:00
|
|
|
opts.Add(EnumVariable('repository_type', 'Type of repositories to clone from first', 'http', ('http', 'ssh')))
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
opts.Update(env)
|
|
|
|
Help(opts.GenerateHelpText(env))
|
|
|
|
|
2019-12-03 19:30:12 +01:00
|
|
|
load_target_commits_array()
|
|
|
|
|
2019-12-01 23:38:22 +01:00
|
|
|
rt = env['repository_type']
|
2019-12-01 23:32:36 +01:00
|
|
|
|
|
|
|
if rt == 'ssh':
|
|
|
|
repository_index = 1
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
action = env['action']
|
|
|
|
target = env['target']
|
|
|
|
|
|
|
|
if env['a']:
|
|
|
|
action = env['a']
|
|
|
|
|
|
|
|
if env['t']:
|
|
|
|
target = env['t']
|
|
|
|
|
|
|
|
if not os.path.isdir('./modules'):
|
|
|
|
os.mkdir('./modules')
|
|
|
|
|
2020-02-11 17:45:58 +01:00
|
|
|
if 'm' in action:
|
2020-03-24 16:58:37 +01:00
|
|
|
godot_branch = 'master'
|
2020-02-11 17:06:06 +01:00
|
|
|
|
2020-02-11 17:45:58 +01:00
|
|
|
if 'setup' in action or action[0] == 's':
|
2019-11-24 01:05:25 +01:00
|
|
|
if target == 'all':
|
|
|
|
setup_all()
|
|
|
|
elif target == 'engine':
|
|
|
|
setup_engine()
|
|
|
|
elif target == 'modules':
|
|
|
|
setup_modules()
|
|
|
|
elif target == 'all_addons':
|
|
|
|
setup_addons()
|
|
|
|
setup_addons_third_party_addons()
|
|
|
|
elif target == 'addons':
|
|
|
|
setup_addons()
|
|
|
|
elif target == 'third_party_addons':
|
|
|
|
setup_addons_third_party_addons()
|
2020-02-11 17:45:58 +01:00
|
|
|
elif 'update' in action or action[0] == 'u':
|
2019-11-24 01:05:25 +01:00
|
|
|
if target == 'all':
|
|
|
|
update_all()
|
|
|
|
elif target == 'engine':
|
|
|
|
update_engine()
|
2019-11-25 12:11:41 +01:00
|
|
|
save_target_commits_array()
|
2019-11-24 01:05:25 +01:00
|
|
|
elif target == 'modules':
|
|
|
|
update_modules()
|
2019-11-25 12:11:41 +01:00
|
|
|
save_target_commits_array()
|
2019-11-24 01:05:25 +01:00
|
|
|
elif target == 'all_addons':
|
|
|
|
update_addons()
|
|
|
|
update_addons_third_party_addons()
|
2019-11-25 12:11:41 +01:00
|
|
|
save_target_commits_array()
|
2019-11-24 01:05:25 +01:00
|
|
|
elif target == 'addons':
|
|
|
|
update_addons()
|
2019-11-25 12:11:41 +01:00
|
|
|
save_target_commits_array()
|
2019-11-24 01:05:25 +01:00
|
|
|
elif target == 'third_party_addons':
|
|
|
|
update_addons_third_party_addons()
|
2019-11-25 12:11:41 +01:00
|
|
|
save_target_commits_array()
|
|
|
|
|