mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Improve build target argument handling
This commit is contained in:
parent
319f520e4d
commit
200af79c4b
2 changed files with 18 additions and 15 deletions
|
@ -175,21 +175,23 @@ class MachCommands(CommandBase):
|
||||||
print("Please specify either --dev or --release.")
|
print("Please specify either --dev or --release.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
targets = []
|
if target and android:
|
||||||
|
print("Please specify either --target or --android.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if release:
|
if release:
|
||||||
opts += ["--release"]
|
opts += ["--release"]
|
||||||
if target:
|
|
||||||
opts += ["--target", target]
|
|
||||||
targets.append(target)
|
|
||||||
if jobs is not None:
|
if jobs is not None:
|
||||||
opts += ["-j", jobs]
|
opts += ["-j", jobs]
|
||||||
if verbose:
|
if verbose:
|
||||||
opts += ["-v"]
|
opts += ["-v"]
|
||||||
if android:
|
if android:
|
||||||
opts += ["--target", self.config["android"]["target"]]
|
target = self.config["android"]["target"]
|
||||||
targets.append("arm-linux-androideabi")
|
|
||||||
|
|
||||||
self.ensure_bootstrapped(targets=targets)
|
if target:
|
||||||
|
opts += ["--target", target]
|
||||||
|
|
||||||
|
self.ensure_bootstrapped(target=target)
|
||||||
|
|
||||||
if debug_mozjs or self.config["build"]["debug-mozjs"]:
|
if debug_mozjs or self.config["build"]["debug-mozjs"]:
|
||||||
features += ["script/debugmozjs"]
|
features += ["script/debugmozjs"]
|
||||||
|
@ -330,8 +332,8 @@ class MachCommands(CommandBase):
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Build in release mode')
|
help='Build in release mode')
|
||||||
def build_gonk(self, jobs=None, verbose=False, release=False):
|
def build_gonk(self, jobs=None, verbose=False, release=False):
|
||||||
targets = ["arm-linux-androideabi"]
|
target = "arm-linux-androideabi"
|
||||||
self.ensure_bootstrapped(targets=targets)
|
self.ensure_bootstrapped(target=target)
|
||||||
|
|
||||||
opts = []
|
opts = []
|
||||||
if jobs is not None:
|
if jobs is not None:
|
||||||
|
|
|
@ -411,7 +411,7 @@ class CommandBase(object):
|
||||||
def android_build_dir(self, dev):
|
def android_build_dir(self, dev):
|
||||||
return path.join(self.get_target_dir(), "arm-linux-androideabi", "debug" if dev else "release")
|
return path.join(self.get_target_dir(), "arm-linux-androideabi", "debug" if dev else "release")
|
||||||
|
|
||||||
def ensure_bootstrapped(self, targets=[]):
|
def ensure_bootstrapped(self, target=None):
|
||||||
if self.context.bootstrapped:
|
if self.context.bootstrapped:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -422,13 +422,14 @@ class CommandBase(object):
|
||||||
rustc_binary_exists = path.exists(rustc_path)
|
rustc_binary_exists = path.exists(rustc_path)
|
||||||
|
|
||||||
base_target_path = path.join(rust_root, "rustc", "lib", "rustlib")
|
base_target_path = path.join(rust_root, "rustc", "lib", "rustlib")
|
||||||
target_paths = [path.join(base_target_path, t) for t in targets]
|
target_exists = True
|
||||||
all_targets_exist = all([path.exists(p) for p in target_paths])
|
if target is not None:
|
||||||
|
target_path = path.join(base_target_path, target)
|
||||||
|
target_exists = path.exists(target_path)
|
||||||
|
|
||||||
if (not self.config['tools']['system-rust'] and
|
if not (self.config['tools']['system-rust'] or (rustc_binary_exists and target_exists)):
|
||||||
(not rustc_binary_exists or not all_targets_exist)):
|
|
||||||
print("looking for rustc at %s" % (rustc_path))
|
print("looking for rustc at %s" % (rustc_path))
|
||||||
Registrar.dispatch("bootstrap-rust", context=self.context, target=targets)
|
Registrar.dispatch("bootstrap-rust", context=self.context, target=filter(None, [target]))
|
||||||
|
|
||||||
cargo_path = path.join(self.config["tools"]["cargo-root"], "cargo", "bin",
|
cargo_path = path.join(self.config["tools"]["cargo-root"], "cargo", "bin",
|
||||||
"cargo" + BIN_SUFFIX)
|
"cargo" + BIN_SUFFIX)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue