def flush_cache(args = None, silent = False): if not silent: print "[flush-cache]" utils.store_nodejs_output(None, ".") if not silent: print "Done"
def flush_cache(silent=False): if not silent: print "[flush-cache]" utils.store_nodejs_output(None, ".") if not silent: print "Done"
def git_init(): print "[git-init]" # TODO: add CLI overide options # - Node version # - J2V8 version utils.store_nodejs_output(None, ".") if (not os.path.exists("node")): print "Cloning Node.js version: " + settings.NODE_VERSION # NOTE: autocrlf=false is very important for linux based cross-compiles of Node.js to work on a windows docker host utils.execute( "git clone https://github.com/nodejs/node --config core.autocrlf=false --depth 1 --branch v" + settings.NODE_VERSION) else: print "Node.js is already cloned & checked out" apply_diff(True) print "Done"
def execute_build(params): if (params.target is None): sys.exit("ERROR: No target platform specified") if (not params.target in avail_targets): sys.exit("ERROR: Unrecognized target platform: " + params.target) build_target = avail_targets.get(params.target) if (params.arch is None): sys.exit("ERROR: No target architecture specified") build_architectures = build_target.architectures if (not params.arch in build_architectures): sys.exit("ERROR: Unsupported architecture: \"" + params.arch + "\" for selected target platform: " + params.target) if (params.buildsteps is None): sys.exit("ERROR: No build-step specified, valid values are: " + ", ".join(avail_build_steps)) if (not params.buildsteps is None and not isinstance(params.buildsteps, list)): params.buildsteps = [params.buildsteps] # apply default values for unspecified params params.build_agent = params.build_agent if (hasattr( params, "build_agent")) else None global parsed_steps parsed_steps.clear() for step in params.buildsteps: parse_build_step_option(step)() # force build-steps into defined order (see: http://stackoverflow.com/a/23529016) parsed_steps = [ step for step in build_step_sequence if step in parsed_steps ] platform_steps = build_target.steps build_cwd = utils.get_cwd() if (platform_steps.get("cross") is None): sys.exit( "ERROR: cross-compilation is not available/supported for platform: " + params.target) # if we are the build-instigator (not a cross-compile build-agent) we run some initial checks & setups for the build if (hasattr(params, "build_agent") and not params.build_agent): print "Checking Node.js builtins integration consistency..." check_node_builtins() print "Caching Node.js artifacts..." curr_node_tag = params.target + "." + params.arch utils.store_nodejs_output(curr_node_tag, build_cwd) def execute_build_step(compiler, build_step): """Executes an immutable copy of the given build-step configuration""" # from this point on, make the build-input immutable to ensure consistency across the whole build process # any actions during the build-step should only be made based on the initial set of variables & conditions # NOTE: this restriction makes it much more easy to reason about the build-process as a whole build_step = immutable.freeze(build_step) compiler.build(build_step) # a cross-compile was requested, we just launch the build-environment and then delegate the requested build-process to the cross-compile environment if (params.cross_compile): x_compiler = build_target.cross_compiler() x_step = platform_steps.get("cross") # prepare any additional/dynamic parameters for the build and put them into the build-step config x_step.arch = params.arch x_step.custom_cmd = "python ./build.py --build-agent -t $PLATFORM -a $ARCH " + ( "-ne" if params.node_enabled else "") + " " + " ".join(parsed_steps) x_step.compiler = x_compiler x_step.target = build_target execute_build_step(x_compiler, x_step) # run the requested build-steps with the given parameters to produce the build-artifacts else: target_compiler = ShellBuildSystem() target_steps = dict(platform_steps) if (target_steps.has_key("cross")): x_step = target_steps.get("cross") del target_steps["cross"] # this is a build-agent for a cross-compile if (params.build_agent): # the cross-compile step dictates which directory will be used to run the actual build build_cwd = x_step.build_cwd # execute all requested build steps for step in parsed_steps: target_step = target_steps[step] # prepare any additional/dynamic parameters for the build and put them into the build-step config target_step.cross_compile = params.cross_compile target_step.build_agent = params.build_agent if (hasattr( params, "build_agent")) else None target_step.arch = params.arch target_step.build_cwd = build_cwd target_step.compiler = target_compiler target_step.target = build_target execute_build_step(target_compiler, target_step)
import os import sys import build_system.build_utils as utils import build_settings as settings # TODO: add CLI overide options # - Node version # - J2V8 version utils.store_nodejs_output(None, ".") if (not os.path.exists("node")): print "Cloning Node.js version: " + settings.NODE_VERSION # NOTE: autocrlf=false is very important for linux based cross-compiles of Node.js to work on a windows docker host utils.execute( "git clone https://github.com/nodejs/node --config core.autocrlf=false --depth 1 --branch v" + settings.NODE_VERSION) else: print "Node.js is already cloned & checked out" branch = utils.get_node_branch_version() if (branch != settings.NODE_VERSION): sys.exit( "ERROR: The checked out Node.js version (" + branch + ") does not match the version specified in build_settings.py (" + settings.NODE_VERSION + ")") branch_patch_file = os.path.join("node.patches", settings.NODE_VERSION + ".diff")