SCons: Pass env to modules can_build method

This allows to disable modules based on the environment,
in particular `env[tools]` which tells us if we are
building the editor or not.
This commit is contained in:
Rémi Verschelde 2018-05-30 19:11:33 +02:00
parent 28fa82c2de
commit 3334209a73
33 changed files with 53 additions and 61 deletions

View file

@ -396,7 +396,17 @@ if selected_platform in platform_list:
sys.path.append(tmppath)
env.current_module = x
import config
if (config.can_build(selected_platform)):
# can_build changed number of arguments between 3.0 (1) and 3.1 (2),
# so try both to preserve compatibility for 3.0 modules
can_build = False
try:
can_build = config.can_build(env, selected_platform)
except TypeError:
print("Warning: module '%s' uses a deprecated `can_build` "
"signature in its config.py file, it should be "
"`can_build(env, platform)`." % x)
can_build = config.can_build(selected_platform)
if (can_build):
config.configure(env)
env.module_list.append(x)
try:

View file

@ -1,7 +1,5 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):
pass

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,9 +1,5 @@
def can_build(platform):
return True
def can_build(env, platform):
return env['tools']
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
if not env['tools']:
env['module_etc_enabled'] = False
env.disabled_modules.append("etc")
pass

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
# should probably change this to only be true on iOS and Android
return False

View file

@ -19,7 +19,7 @@ def find_file_in_dir(directory, files, prefix='', extension=''):
return ''
def can_build(platform):
def can_build(env, platform):
if platform in ["javascript"]:
return False # Not yet supported
return True

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,5 +1,5 @@
def can_build(platform):
return platform != "android"
def can_build(env, platform):
return env['tools']
def configure(env):
pass

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,9 +1,5 @@
def can_build(platform):
return True
def can_build(env, platform):
return env['tools']
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
if not env['tools']:
env['module_squish_enabled'] = False
env.disabled_modules.append("squish")
pass

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,7 +1,5 @@
def can_build(platform):
return platform != "android" and platform != "ios"
def can_build(env, platform):
return (env['tools'] and platform not in ["android", "ios"])
def configure(env):
if not env['tools']:
env['builtin_thekla_atlas'] = False
env.disabled_modules.append("thekla_unwrap")
pass

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,9 +1,5 @@
def can_build(platform):
return True
def can_build(env, platform):
return env['tools']
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
if not env['tools']:
env['module_tinyexr_enabled'] = False
env.disabled_modules.append("tinyexr")
pass

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,5 +1,5 @@
def can_build(platform):
return platform != 'iphone'
def can_build(env, platform):
return platform not in ['iphone']
def configure(env):
pass

View file

@ -1,4 +1,4 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):

View file

@ -1,8 +1,6 @@
def can_build(platform):
def can_build(env, platform):
return True
def configure(env):
pass