mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Auto merge of #6306 - metajack:shared-target-dir, r=mbrubeck
This speeds up `./mach build --dev` followed by `./mach build-cef` by 25%. When rust-lang/cargo#497 is fixed, this speedup will increase dramatically. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6306) <!-- Reviewable:end -->
This commit is contained in:
commit
d6263c9b6e
14 changed files with 31 additions and 30 deletions
|
@ -1 +1 @@
|
||||||
2015-04-14
|
2015-06-15
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
paths = ["../../support/android-rs-glue"]
|
paths = ["../../support/android-rs-glue"]
|
||||||
|
|
||||||
[target.arm-linux-androideabi]
|
[target.arm-linux-androideabi]
|
||||||
linker = "../../support/android-rs-glue/apk-builder/target/debug/apk-builder"
|
linker = "../../target/debug/apk-builder"
|
||||||
ar = "arm-linux-androideabi-ar"
|
ar = "arm-linux-androideabi-ar"
|
||||||
|
|
|
@ -21,26 +21,22 @@ pub fn resources_dir_path() -> PathBuf {
|
||||||
Some(ref path) => PathBuf::from(path),
|
Some(ref path) => PathBuf::from(path),
|
||||||
None => {
|
None => {
|
||||||
// FIXME: Find a way to not rely on the executable being
|
// FIXME: Find a way to not rely on the executable being
|
||||||
// under `<servo source>/components/servo/target`
|
// under `<servo source>[/$target_triple]/target/debug`
|
||||||
// or `<servo source>/components/servo/target/release`.
|
// or `<servo source>[/$target_triple]/target/release`.
|
||||||
let mut path = env::current_exe().ok().expect("can't get exe path");
|
let mut path = env::current_exe().ok().expect("can't get exe path");
|
||||||
path.pop();
|
path.pop();
|
||||||
path.push("resources");
|
path.push("resources");
|
||||||
if !path.is_dir() { // resources dir not in same dir as exe?
|
if !path.is_dir() { // resources dir not in same dir as exe?
|
||||||
path.pop();
|
// exe is probably in target/{debug,release} so we need to go back to topdir
|
||||||
path.pop();
|
path.pop();
|
||||||
path.pop();
|
path.pop();
|
||||||
path.pop();
|
path.pop();
|
||||||
path.push("resources");
|
path.push("resources");
|
||||||
if !path.is_dir() { // self_exe_path() is probably in .../target/release
|
if !path.is_dir() {
|
||||||
|
// exe is probably in target/$target_triple/{debug,release} so go back one more
|
||||||
path.pop();
|
path.pop();
|
||||||
path.pop();
|
path.pop();
|
||||||
path.push("resources");
|
path.push("resources");
|
||||||
if !path.is_dir() { // self_exe_path() is probably in .../target/release
|
|
||||||
path.pop();
|
|
||||||
path.pop();
|
|
||||||
path.push("resources");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
path
|
path
|
||||||
|
@ -48,7 +44,6 @@ pub fn resources_dir_path() -> PathBuf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn read_resource_file(relative_path_components: &[&str]) -> io::Result<Vec<u8>> {
|
pub fn read_resource_file(relative_path_components: &[&str]) -> io::Result<Vec<u8>> {
|
||||||
let mut path = resources_dir_path();
|
let mut path = resources_dir_path();
|
||||||
for component in relative_path_components {
|
for component in relative_path_components {
|
||||||
|
|
|
@ -10,7 +10,7 @@ cd "$(dirname $0)/../.."
|
||||||
|
|
||||||
./mach doc
|
./mach doc
|
||||||
# etc/doc.servo.org/index.html overwrites $(mach rust-root)/doc/index.html
|
# etc/doc.servo.org/index.html overwrites $(mach rust-root)/doc/index.html
|
||||||
cp etc/doc.servo.org/* components/servo/target/doc/
|
cp etc/doc.servo.org/* target/doc/
|
||||||
|
|
||||||
ghp-import -n components/servo/target/doc
|
ghp-import -n target/doc
|
||||||
git push -qf https://${TOKEN}@github.com/servo/doc.servo.org.git gh-pages
|
git push -qf https://${TOKEN}@github.com/servo/doc.servo.org.git gh-pages
|
||||||
|
|
|
@ -12,7 +12,6 @@ crate-type = ["dylib"]
|
||||||
log = "*"
|
log = "*"
|
||||||
url = "*"
|
url = "*"
|
||||||
libc = "*"
|
libc = "*"
|
||||||
objc = "0.1"
|
|
||||||
|
|
||||||
[dependencies.servo]
|
[dependencies.servo]
|
||||||
path = "../../components/servo"
|
path = "../../components/servo"
|
||||||
|
@ -72,6 +71,7 @@ git = "https://github.com/servo/rust-stb-image"
|
||||||
git = "https://github.com/servo/gleam"
|
git = "https://github.com/servo/gleam"
|
||||||
|
|
||||||
[target.x86_64-apple-darwin.dependencies]
|
[target.x86_64-apple-darwin.dependencies]
|
||||||
|
objc = "0.1"
|
||||||
cocoa = "*"
|
cocoa = "*"
|
||||||
core-foundation = "*"
|
core-foundation = "*"
|
||||||
core-graphics = "*"
|
core-graphics = "*"
|
||||||
|
|
|
@ -51,7 +51,7 @@ Run `./mach build-gonk` from the root directory
|
||||||
|
|
||||||
## Copy the files to the Flame
|
## Copy the files to the Flame
|
||||||
|
|
||||||
To reduce the size of libmozjs.so (`ports/gonk/target/arm-linux-androideabi/build/mozjs-sys-*/out/libmozjs.so`),
|
To reduce the size of libmozjs.so (`target/arm-linux-androideabi/build/mozjs-sys-*/out/libmozjs.so`),
|
||||||
you can run `strip` on it. Use the one in your toolchain (`$ANDROID_TOOLCHAIN/bin/arm-linux-androideabi-strip libmozjs.so`).
|
you can run `strip` on it. Use the one in your toolchain (`$ANDROID_TOOLCHAIN/bin/arm-linux-androideabi-strip libmozjs.so`).
|
||||||
|
|
||||||
Make sure the device is on, connected to wifi, with high or no screen timeout.
|
Make sure the device is on, connected to wifi, with high or no screen timeout.
|
||||||
|
@ -64,7 +64,7 @@ adb remount
|
||||||
adb push /path/to/stripped/mozjs.so system/lib
|
adb push /path/to/stripped/mozjs.so system/lib
|
||||||
|
|
||||||
# Copy b2s
|
# Copy b2s
|
||||||
adb push ports/gonk/target/arm-linux-androideabi system/bin
|
adb push target/arm-linux-androideabi system/bin
|
||||||
|
|
||||||
# Copy resources
|
# Copy resources
|
||||||
adb shell mkdir sdcard/servo
|
adb shell mkdir sdcard/servo
|
||||||
|
|
|
@ -147,7 +147,7 @@ class MachCommands(CommandBase):
|
||||||
opts = params or []
|
opts = params or []
|
||||||
features = []
|
features = []
|
||||||
|
|
||||||
base_path = path.join("components", "servo", "target")
|
base_path = self.get_target_dir()
|
||||||
release_path = path.join(base_path, "release", "servo")
|
release_path = path.join(base_path, "release", "servo")
|
||||||
dev_path = path.join(base_path, "debug", "servo")
|
dev_path = path.join(base_path, "debug", "servo")
|
||||||
|
|
||||||
|
|
|
@ -130,8 +130,14 @@ class CommandBase(object):
|
||||||
self._cargo_build_id = open(filename).read().strip()
|
self._cargo_build_id = open(filename).read().strip()
|
||||||
return self._cargo_build_id
|
return self._cargo_build_id
|
||||||
|
|
||||||
|
def get_target_dir(self):
|
||||||
|
if "CARGO_TARGET_DIR" in os.environ:
|
||||||
|
return os.environ["CARGO_TARGET_DIR"]
|
||||||
|
else:
|
||||||
|
return path.join(self.context.topdir, "target")
|
||||||
|
|
||||||
def get_binary_path(self, release, dev):
|
def get_binary_path(self, release, dev):
|
||||||
base_path = path.join("components", "servo", "target")
|
base_path = self.get_target_dir()
|
||||||
release_path = path.join(base_path, "release", "servo")
|
release_path = path.join(base_path, "release", "servo")
|
||||||
dev_path = path.join(base_path, "debug", "servo")
|
dev_path = path.join(base_path, "debug", "servo")
|
||||||
|
|
||||||
|
@ -199,6 +205,9 @@ class CommandBase(object):
|
||||||
if "CARGO_HOME" not in env:
|
if "CARGO_HOME" not in env:
|
||||||
env["CARGO_HOME"] = self.config["tools"]["cargo-home-dir"]
|
env["CARGO_HOME"] = self.config["tools"]["cargo-home-dir"]
|
||||||
|
|
||||||
|
if "CARGO_TARGET_DIR" not in env:
|
||||||
|
env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target")
|
||||||
|
|
||||||
if extra_lib:
|
if extra_lib:
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
env["DYLD_LIBRARY_PATH"] = "%s%s%s" % \
|
env["DYLD_LIBRARY_PATH"] = "%s%s%s" % \
|
||||||
|
|
|
@ -137,8 +137,7 @@ class MachCommands(CommandBase):
|
||||||
if not path.exists(path.join(self.config["tools"]["rust-root"], "doc")):
|
if not path.exists(path.join(self.config["tools"]["rust-root"], "doc")):
|
||||||
Registrar.dispatch("bootstrap-rust-docs", context=self.context)
|
Registrar.dispatch("bootstrap-rust-docs", context=self.context)
|
||||||
rust_docs = path.join(self.config["tools"]["rust-root"], "doc")
|
rust_docs = path.join(self.config["tools"]["rust-root"], "doc")
|
||||||
docs = path.join(
|
docs = path.join(self.get_target_dir(), "doc")
|
||||||
self.context.topdir, "components", "servo", "target", "doc")
|
|
||||||
if not path.exists(docs):
|
if not path.exists(docs):
|
||||||
os.makedirs(docs)
|
os.makedirs(docs)
|
||||||
|
|
||||||
|
@ -167,4 +166,4 @@ class MachCommands(CommandBase):
|
||||||
self.doc([])
|
self.doc([])
|
||||||
import webbrowser
|
import webbrowser
|
||||||
webbrowser.open("file://" + path.abspath(path.join(
|
webbrowser.open("file://" + path.abspath(path.join(
|
||||||
self.servo_crate(), "target", "doc", "servo", "index.html")))
|
self.get_target_dir(), "doc", "servo", "index.html")))
|
||||||
|
|
|
@ -50,12 +50,11 @@ class MachCommands(CommandBase):
|
||||||
|
|
||||||
def find_test(self, prefix):
|
def find_test(self, prefix):
|
||||||
target_contents = os.listdir(path.join(
|
target_contents = os.listdir(path.join(
|
||||||
self.context.topdir, "components", "servo", "target", "debug"))
|
self.get_target_dir(), "debug"))
|
||||||
for filename in target_contents:
|
for filename in target_contents:
|
||||||
if filename.startswith(prefix + "-"):
|
if filename.startswith(prefix + "-"):
|
||||||
filepath = path.join(
|
filepath = path.join(
|
||||||
self.context.topdir, "components", "servo",
|
self.get_target_dir(), "debug", filename)
|
||||||
"target", "debug", filename)
|
|
||||||
|
|
||||||
if path.isfile(filepath) and os.access(filepath, os.X_OK):
|
if path.isfile(filepath) and os.access(filepath, os.X_OK):
|
||||||
return filepath
|
return filepath
|
||||||
|
|
|
@ -36,8 +36,7 @@ ignored_files = [
|
||||||
# Generated and upstream code combined with our own. Could use cleanup
|
# Generated and upstream code combined with our own. Could use cleanup
|
||||||
"components/script/dom/bindings/codegen/*",
|
"components/script/dom/bindings/codegen/*",
|
||||||
"components/style/properties/mod.rs",
|
"components/style/properties/mod.rs",
|
||||||
"components/servo/target/*",
|
"target/*",
|
||||||
"ports/gonk/target/*",
|
|
||||||
"ports/gonk/src/native_window_glue.cpp",
|
"ports/gonk/src/native_window_glue.cpp",
|
||||||
"ports/cef/*",
|
"ports/cef/*",
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ def PowerCollector(OutputDir, Benchmarks, LayoutThreads, Renderer):
|
||||||
power_dir, "power-Layout%d-set%d.csv" % (layoutT, ExpNum))
|
power_dir, "power-Layout%d-set%d.csv" % (layoutT, ExpNum))
|
||||||
TimeFiles = path.join(
|
TimeFiles = path.join(
|
||||||
time_dir, "time-Layout%d-set%d.csv" % (layoutT, ExpNum))
|
time_dir, "time-Layout%d-set%d.csv" % (layoutT, ExpNum))
|
||||||
ServoCmd = "(time ../../components/servo/target/release/servo -x -y %d %s %s) 2> %s" % \
|
ServoCmd = "(time ../../target/release/servo -x -y %d %s %s) 2> %s" % \
|
||||||
(layoutT, Renderer, Benchmarks, TimeFiles)
|
(layoutT, Renderer, Benchmarks, TimeFiles)
|
||||||
Metrics = path.join(
|
Metrics = path.join(
|
||||||
etc_dir, "metrics-Layout%d-set%d-css.csv" % (layoutT, ExpNum))
|
etc_dir, "metrics-Layout%d-set%d-css.csv" % (layoutT, ExpNum))
|
||||||
|
|
|
@ -8,7 +8,7 @@ ssl-type=none
|
||||||
# prefs-root=/path/to/gecko-src/testing/profiles/
|
# prefs-root=/path/to/gecko-src/testing/profiles/
|
||||||
|
|
||||||
# [servo]
|
# [servo]
|
||||||
# binary=/path/to/servo-src/components/servo/target/servo
|
# binary=/path/to/servo-src/target/release/servo
|
||||||
# exclude=testharness # Because it needs a special testharness.js
|
# exclude=testharness # Because it needs a special testharness.js
|
||||||
|
|
||||||
# [chrome]
|
# [chrome]
|
||||||
|
|
|
@ -40,7 +40,7 @@ def set_defaults(paths, kwargs):
|
||||||
|
|
||||||
if kwargs["binary"] is None:
|
if kwargs["binary"] is None:
|
||||||
bin_dir = "release" if kwargs["release"] else "debug"
|
bin_dir = "release" if kwargs["release"] else "debug"
|
||||||
bin_path = servo_path("components", "servo", "target", bin_dir, "servo")
|
bin_path = servo_path("target", bin_dir, "servo")
|
||||||
|
|
||||||
kwargs["binary"] = bin_path
|
kwargs["binary"] = bin_path
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue