Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(capture_webrender): write webrender revision into text #20320

Merged
merged 5 commits into from Mar 23, 2018
Next

build(mach): generate webrender revision via cargo lockfile

  • Loading branch information
kwonoj committed Mar 19, 2018
commit 6b16e712e79b3d97863745c291c3d4e1873db4af
@@ -23,6 +23,7 @@ Servo.app
.config.mk.last
/glfw
capture_webrender/
/components/compositing/webrender_revision.rs

This comment has been minimized.

@kvark

kvark Mar 17, 2018

Member

Is there a particular reason for routing the revision through rust code? could just generate a "wr.txt" and just copy it, alternatively

This comment has been minimized.

@kwonoj

kwonoj Mar 17, 2018

Author Contributor

Yes, I mentioned in PR body if this is an acceptable approach. I wasn't entirely sure about copying text file for cases if user downloaded nightly build wanted to capture it, does lookup generated text file would works with same path resolution to dev build? Thought having constant in build itself will makes those always working.

This comment has been minimized.

@kvark

kvark Mar 19, 2018

Member

Sorry, I don't understand the concern "does lookup generated text file would works with same path resolution to dev build". Please rephrase?

This comment has been minimized.

@kwonoj

kwonoj Mar 19, 2018

Author Contributor

I guess it's my misunderstanding mostly. in short, does packaged nightly build can lookup where wr.txt same as mach run on dev build?

This comment has been minimized.

@kvark

kvark Mar 19, 2018

Member

oh, I see. So it's a question to package builders on how to make sure "wr.txt" is included. @jdm do you know who forward this to?


# Editors

@@ -213,6 +213,36 @@ def set_osmesa_env(bin_path, env):
return env


def generate_webrender_revision():
"""Read current package id of web render to generate revision"""

lockfile_path = path.join(os.getcwd(), "Cargo.lock")
if not os.path.isfile(lockfile_path):
return

with open(lockfile_path) as f:
lockfile = toml.loads(f.read())

webrender_revision = ""
for package in lockfile.get("package", []):
pkgName = package.get("name")
if ("webrender" == pkgName):
webrender_revision = package.get("source")

revision = '''/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// auto-generated by mach. do not manually modify.
pub const REVISION: &'static str = \"%s\";''' % webrender_revision

compositor_path = os.path.join(os.getcwd(), "components", "compositing", "webrender_revision.rs")

revision_file = open(compositor_path, "w")
revision_file.write(revision)
revision_file.close()


class BuildNotFound(Exception):
def __init__(self, message):
self.message = message
@@ -660,6 +690,8 @@ def ensure_bootstrapped(self, target=None):
if "msvc" in target_platform:
Registrar.dispatch("bootstrap", context=self.context)

generate_webrender_revision()

self.context.bootstrapped = True

def ensure_clobbered(self, target_dir=None):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.