mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-10 05:22:59 +03:00
Fixes for travic CI build (#3)
Summary: This should fix the Travis CI builds. It adds rust toolchain support inside docker and sets the required THRIFT env variable. Pull Request resolved: https://github.com/facebookexperimental/rust-shed/pull/3 Reviewed By: krallin Differential Revision: D18905608 Pulled By: lukaspiatkowski fbshipit-source-id: 5db1eff6f215a6617d8acaa0c99a62d45225956b
This commit is contained in:
committed by
Facebook Github Bot
parent
4b0975adcf
commit
3af1c72471
@@ -172,6 +172,10 @@ class FBCodeBuilder(object):
|
||||
'Run this bash command'
|
||||
raise NotImplementedError
|
||||
|
||||
def set_env(self, key, value):
|
||||
'Set the environment "key" to value "value"'
|
||||
raise NotImplementedError
|
||||
|
||||
def workdir(self, dir):
|
||||
'Create this directory if it does not exist, and change into it'
|
||||
raise NotImplementedError
|
||||
@@ -276,6 +280,52 @@ class FBCodeBuilder(object):
|
||||
self.python_deps())))))
|
||||
return(actions)
|
||||
|
||||
def enable_rust_toolchain(self, toolchain="stable", is_bootstrap=True):
|
||||
choices = set(["stable", "beta", "nightly"])
|
||||
|
||||
assert toolchain in choices, (
|
||||
"while enabling rust toolchain: {} is not in {}"
|
||||
).format(toolchain, choices)
|
||||
|
||||
rust_toolchain_opt = (toolchain, is_bootstrap)
|
||||
prev_opt = self.option("rust_toolchain", rust_toolchain_opt)
|
||||
assert prev_opt == rust_toolchain_opt, (
|
||||
"while enabling rust toolchain: previous toolchain already set to"
|
||||
" {}, but trying to set it to {} now"
|
||||
).format(prev_opt, rust_toolchain_opt)
|
||||
|
||||
self.add_option("rust_toolchain", rust_toolchain_opt)
|
||||
|
||||
def rust_toolchain(self):
|
||||
actions = []
|
||||
if self.option("rust_toolchain", False):
|
||||
(toolchain, is_bootstrap) = self.option("rust_toolchain")
|
||||
rust_dir = path_join(self.option("prefix"), "rust")
|
||||
actions = [
|
||||
self.set_env("CARGO_HOME", rust_dir),
|
||||
self.set_env("RUSTUP_HOME", rust_dir),
|
||||
self.set_env("RUSTC_BOOTSTRAP", "1" if is_bootstrap else "0"),
|
||||
self.run(
|
||||
ShellQuoted(
|
||||
"curl -sSf https://build.travis-ci.com/files/rustup-init.sh"
|
||||
" | sh -s --"
|
||||
" --default-toolchain={r} "
|
||||
" --profile=minimal"
|
||||
" --no-modify-path"
|
||||
" -y"
|
||||
).format(p=rust_dir, r=toolchain)
|
||||
),
|
||||
self.set_env(
|
||||
"PATH",
|
||||
ShellQuoted("{p}:$PATH").format(p=path_join(rust_dir, "bin")),
|
||||
),
|
||||
self.run(ShellQuoted("rustup update")),
|
||||
self.run(ShellQuoted("rustc --version")),
|
||||
self.run(ShellQuoted("rustup --version")),
|
||||
self.run(ShellQuoted("cargo --version")),
|
||||
]
|
||||
return actions
|
||||
|
||||
def debian_ccache_setup_steps(self):
|
||||
return [] # It's ok to ship a renderer without ccache support.
|
||||
|
||||
@@ -388,6 +438,18 @@ class FBCodeBuilder(object):
|
||||
self.cmake_configure(name, cmake_path) + self.make_and_install()
|
||||
)
|
||||
|
||||
def cargo_build(self, name):
|
||||
return self.step(
|
||||
"Build {0}".format(name),
|
||||
[
|
||||
self.run(
|
||||
ShellQuoted("cargo build -j {n}").format(
|
||||
n=self.option("make_parallelism")
|
||||
)
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
def fb_github_autoconf_install(self, project_and_path, github_org='facebook'):
|
||||
return [
|
||||
self.fb_github_project_workdir(project_and_path, github_org),
|
||||
@@ -399,3 +461,9 @@ class FBCodeBuilder(object):
|
||||
self.fb_github_project_workdir(project_and_path, github_org),
|
||||
self.cmake_install(project_and_path, cmake_path),
|
||||
]
|
||||
|
||||
def fb_github_cargo_build(self, project_and_path, github_org="facebook"):
|
||||
return [
|
||||
self.fb_github_project_workdir(project_and_path, github_org),
|
||||
self.cargo_build(project_and_path),
|
||||
]
|
||||
|
Reference in New Issue
Block a user