Skip to content

Commit

Permalink
Try perl on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion committed Sep 7, 2021
1 parent bcec94c commit bcfe7a4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cargo/cargo_bootstrap.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,17 @@ def cargo_bootstrap(
if build_mode == "release":
args.append("--release")

env = {}

if repository_ctx.attr.include_perl_on_windows and "win" in repository_ctx.os.name:
env["PERL"] = str(repository_ctx.path(Label("@perl_windows//:perl/bin/perl.exe")))

env["RUSTC"] = str(rustc_bin)

repository_ctx.report_progress("Cargo Bootstrapping {}".format(binary))
result = repository_ctx.execute(
args,
environment = {
"RUSTC": str(rustc_bin),
},
environment = env,
quiet = quiet,
)

Expand Down Expand Up @@ -166,6 +171,9 @@ cargo_bootstrap_repository = repository_rule(
allow_single_file = ["Cargo.toml"],
mandatory = True,
),
"include_perl_on_windows": attr.bool(
doc = "If true, set $PERL to point to a working perl binary when running on Windows",
),
"iso_date": attr.string(
doc = "The iso_date of cargo binary the resolver should use. Note: This can only be set if `version` is `beta` or `nightly`",
),
Expand Down
4 changes: 4 additions & 0 deletions crate_universe/bootstrap.bzl
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
"""A module for declaraing a repository for bootstrapping crate_universe"""

load("@examples//third_party/openssl:openssl_repositories.bzl", "openssl_repositories")
load("//cargo:defs.bzl", "cargo_bootstrap_repository")
load("//rust:defs.bzl", "rust_common")

def crate_universe_bootstrap():
openssl_repositories()

cargo_bootstrap_repository(
name = "rules_rust_crate_universe_bootstrap",
cargo_lockfile = Label("//crate_universe:Cargo.lock"),
cargo_toml = Label("//crate_universe:Cargo.toml"),
srcs = [Label("//crate_universe:resolver_srcs")],
version = rust_common.default_version,
binary = "crate_universe_resolver",
include_perl_on_windows = True,
)

0 comments on commit bcfe7a4

Please sign in to comment.