• Home
  • Raw
  • Download

Lines Matching +full:script +full:- +full:output

4 # Use of this source code is governed by a BSD-style license that can be
7 # This is a wrapper script which runs a Cargo build.rs build script
8 # executable in a Cargo-like environment. Build scripts can do arbitrary
11 # Code review processes must be applied to ensure that the build script
15 # https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-carg…
16 # * Output from rustc commands, e.g. to figure out the Rust version.
18 # Similarly, the only allowable output from such a build script
22 # * cargo:rustc-cfg output.
24 # That's it. We don't even support the other standard cargo:rustc-
25 # output messages.
55 args = [rustc_path, "-vV"]
58 for line in io.TextIOWrapper(proc.stdout, encoding="utf-8"):
66 """ Sets CARGO_CFG_TARGET_... based on output from rustc. """
70 # TODO(lukasza): Check if command-line flags other `--target` may affect the
71 # output of `--print-cfg`. If so, then consider also passing extra `args`
73 args = [rustc_path, "--print=cfg", f"--target={target_triple}"]
76 for line in io.TextIOWrapper(proc.stdout, encoding="utf-8"):
89 # Before 1.77, the format was `cargo:rustc-cfg=`. As of 1.77 the format is now
90 # `cargo::rustc-cfg=`.
91 RUSTC_CFG_LINE = re.compile("cargo::?rustc-cfg=(.*)")
95 parser = argparse.ArgumentParser(description='Run Rust build script.')
96 parser.add_argument('--build-script',
98 help='build script to run')
99 parser.add_argument('--output',
101 help='where to write output rustc flags')
102 parser.add_argument('--target', help='rust target triple')
103 parser.add_argument('--target-abi', help='rust target_abi')
104 parser.add_argument('--features', help='features', nargs='+')
105 parser.add_argument('--env', help='environment variable', nargs='+')
106 parser.add_argument('--rustflags',
107 help=('path to a file of newline-separated command line '
109 parser.add_argument('--rust-prefix', required=True, help='rust path prefix')
110 parser.add_argument('--generated-files', nargs='+', help='any generated file')
111 parser.add_argument('--out-dir', required=True, help='target out dir')
112 parser.add_argument('--src-dir', required=True, help='target source dir')
118 # We give the build script an OUT_DIR of a temporary directory,
121 # create those files, but it also serves to avoid side-effects
122 # from the build script.
123 # In the future, we could consider isolating this build script
126 # build script is deterministic and trustworthy, so this would
141 feature_name = f.upper().replace("-", "_")
146 if "-Copt-level" in flag:
165 …# https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo
182 flags = "%s--cfg\n%s\n" % (flags, m.group(1))
186 with action_helpers.atomic_output(args.output) as output:
187 output.write(flags.encode("utf-8"))
199 with action_helpers.atomic_output(out_path) as output:
201 output.write(content)