Skip to content

Commit

Permalink
servo: Merge #19017 - Print the full path for errors occurring in the…
Browse files Browse the repository at this point in the history
… servo crate (from tigercosmos:test); r=jdm

<!-- Please describe your changes on the following line: -->
`Cargo` will print the path where it runs.
Origin python script `cd` into the crate folder, so the root path is set in  the crate.
Now I use `--manifest-path PATH` to `cargo build`, so the root path is at `servo`.

Origin path in error message:
```
error: expected one of `!` or `::`, found `#`
  --> lib.rs:24:1
```

Now it would be:
```
error: expected one of `!` or `::`, found `use`
  --> ports/geckolib/glue.rs:11:1
```

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #9895 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: 4df647ed758730dd82a3eae5e78c296e495239d5

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : c56cbdaf45e2d8c9bc4a27d13801cd5011f7be1d
  • Loading branch information
tigercosmos committed Nov 3, 2017
1 parent 494fce0 commit 5da0cad
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
8 changes: 4 additions & 4 deletions servo/ports/servo/.cargo/config → servo/.cargo/config
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[target.arm-linux-androideabi]
linker = "./fake-ld-arm.sh"
linker = "./ports/servo/fake-ld-arm.sh"
ar = "arm-linux-androideabi-ar"

[target.armv7-linux-androideabi]
linker = "./fake-ld-armv7.sh"
linker = "./ports/servo/fake-ld-armv7.sh"
ar = "arm-linux-androideabi-ar"

[target.aarch64-linux-android]
linker = "./fake-ld-arm64.sh"
linker = "./ports/servo/fake-ld-arm64.sh"
ar = "aarch64-linux-android-ar"

[target.arm-unknown-linux-gnueabihf]
Expand All @@ -19,4 +19,4 @@ linker = "aarch64-linux-gnu-gcc"
ar = "aarch64-linux-gnu-ar"

[target.'cfg(target_os=windows)']
linker = "./fake-ld.cmd"
linker = "./ports/servo/fake-ld.cmd"
3 changes: 2 additions & 1 deletion servo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.servo
/.cargo
/.cargo/*
!/.cargo/config.*
/.servobuild
/target
/ports/android/bin
Expand Down
2 changes: 1 addition & 1 deletion servo/ports/servo/fake-ld-arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -o errexit
set -o nounset
set -o pipefail

source fake-ld.sh
source ./ports/servo/fake-ld.sh

export _GCC_PARAMS="${@}"
call_gcc "arch-arm" "arm-linux-androideabi" "android-18" "armeabi"
2 changes: 1 addition & 1 deletion servo/ports/servo/fake-ld-arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -o errexit
set -o nounset
set -o pipefail

source fake-ld.sh
source ./ports/servo/fake-ld.sh

export _GCC_PARAMS="${@}"
call_gcc "arch-arm64" "aarch64-linux-android" "android-21" "arm64-v8a"
2 changes: 1 addition & 1 deletion servo/ports/servo/fake-ld-armv7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -o errexit
set -o nounset
set -o pipefail

source fake-ld.sh
source ./ports/servo/fake-ld.sh

export _GCC_PARAMS="${@}"
call_gcc "arch-arm" "arm-linux-androideabi" "android-18" "armeabi-v7a"
22 changes: 11 additions & 11 deletions servo/python/servo/build_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ class MachCommands(CommandBase):
def build(self, target=None, release=False, dev=False, jobs=None,
features=None, android=None, verbose=False, debug_mozjs=False, params=None,
with_debug_assertions=False):

opts = params or []
opts += ["--manifest-path", self.servo_manifest()]

if android is None:
android = self.config["build"]["android"]
features = features or self.servo_features()

opts = params or []

base_path = self.get_target_dir()
release_path = path.join(base_path, "release", "servo")
dev_path = path.join(base_path, "debug", "servo")
Expand Down Expand Up @@ -326,8 +328,7 @@ def build(self, target=None, release=False, dev=False, jobs=None,
cargo_binary = "cargo" + BIN_SUFFIX

status = call(
[cargo_binary, "build"] + opts,
env=env, cwd=self.servo_crate(), verbose=verbose)
[cargo_binary, "build"] + opts, env=env, verbose=verbose)
elapsed = time() - build_start

# Do some additional things if the build succeeded
Expand Down Expand Up @@ -392,6 +393,8 @@ def build_cef(self, jobs=None, verbose=False, release=False,

ret = None
opts = []
opts += ["--manifest-path", self.cef_manifest()]

if jobs is not None:
opts += ["-j", jobs]
if verbose:
Expand All @@ -415,10 +418,7 @@ def build_cef(self, jobs=None, verbose=False, release=False,
# common dependencies with the same flags.
opts += ["--", "-C", "link-args=-Xlinker -undefined -Xlinker dynamic_lookup"]

with cd(path.join("ports", "cef")):
ret = call(["cargo", "rustc"] + opts,
env=env,
verbose=verbose)
ret = call(["cargo", "rustc"] + opts, env=env, verbose=verbose)
elapsed = time() - build_start

# Generate Desktop Notification if elapsed-time > some threshold value
Expand Down Expand Up @@ -449,20 +449,20 @@ def build_geckolib(self, jobs=None, verbose=False, release=False):

ret = None
opts = []
opts += ["--manifest-path", self.geckolib_manifest()]
features = []

if jobs is not None:
opts += ["-j", jobs]
if verbose:
opts += ["-v"]
if release:
opts += ["--release"]

if features:
opts += ["--features", ' '.join(features)]

build_start = time()
with cd(path.join("ports", "geckolib")):
ret = call(["cargo", "build"] + opts, env=env, verbose=verbose)
ret = call(["cargo", "build"] + opts, env=env, verbose=verbose)
elapsed = time() - build_start

# Generate Desktop Notification if elapsed-time > some threshold value
Expand Down
9 changes: 9 additions & 0 deletions servo/python/servo/command_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,15 @@ def package_dir(package):
def servo_crate(self):
return path.join(self.context.topdir, "ports", "servo")

def servo_manifest(self):
return path.join(self.context.topdir, "ports", "servo", "Cargo.toml")

def geckolib_manifest(self):
return path.join(self.context.topdir, "ports", "geckolib", "Cargo.toml")

def cef_manifest(self):
return path.join(self.context.topdir, "ports", "cef", "Cargo.toml")

def servo_features(self):
"""Return a list of optional features to enable for the Servo crate"""
features = []
Expand Down

0 comments on commit 5da0cad

Please sign in to comment.