Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
984527f7
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
984527f7
编写于
2月 06, 2022
作者:
J
Joshua Nelson
提交者:
Mark Rousskov
3月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix weird bug when `out` would get overridden by unit tests
上级
62b522ec
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
10 deletion
+27
-10
src/bootstrap/bin/main.rs
src/bootstrap/bin/main.rs
+1
-1
src/bootstrap/builder/tests.rs
src/bootstrap/builder/tests.rs
+2
-2
src/bootstrap/config.rs
src/bootstrap/config.rs
+21
-6
src/bootstrap/flags.rs
src/bootstrap/flags.rs
+1
-1
src/bootstrap/test.rs
src/bootstrap/test.rs
+2
-0
未找到文件。
src/bootstrap/bin/main.rs
浏览文件 @
984527f7
...
...
@@ -11,7 +11,7 @@
fn
main
()
{
let
args
=
env
::
args
()
.skip
(
1
)
.collect
::
<
Vec
<
_
>>
();
let
config
=
Config
::
parse
(
&
args
);
let
config
=
Config
::
parse
(
&
args
,
false
);
// check_version warnings are not printed during setup
let
changelog_suggestion
=
...
...
src/bootstrap/builder/tests.rs
浏览文件 @
984527f7
...
...
@@ -3,15 +3,15 @@
use
std
::
thread
;
fn
configure
(
cmd
:
&
str
,
host
:
&
[
&
str
],
target
:
&
[
&
str
])
->
Config
{
let
mut
config
=
Config
::
parse
(
&
[
cmd
.to_owned
()]);
let
mut
config
=
Config
::
parse
(
&
[
cmd
.to_owned
()]
,
true
);
// don't save toolstates
config
.save_toolstates
=
None
;
config
.dry_run
=
true
;
config
.ninja_in_file
=
false
;
// try to avoid spurious failures in dist where we create/delete each others file
config
.out
=
PathBuf
::
from
(
env
::
var_os
(
"BOOTSTRAP_OUTPUT_DIRECTORY"
)
.unwrap
());
config
.initial_rustc
=
PathBuf
::
from
(
env
::
var_os
(
"RUSTC"
)
.unwrap
());
config
.initial_cargo
=
PathBuf
::
from
(
env
::
var_os
(
"BOOTSTRAP_INITIAL_CARGO"
)
.unwrap
());
// try to avoid spurious failures in dist where we create/delete each others file
let
dir
=
config
.out
.join
(
"tmp-rustbuild-tests"
)
...
...
src/bootstrap/config.rs
浏览文件 @
984527f7
...
...
@@ -619,7 +619,7 @@ pub fn default_opts() -> Config {
config
}
pub
fn
parse
(
args
:
&
[
String
])
->
Config
{
pub
fn
parse
(
args
:
&
[
String
]
,
unit_test
:
bool
)
->
Config
{
let
flags
=
Flags
::
parse
(
&
args
);
let
mut
config
=
Config
::
default_opts
();
...
...
@@ -682,11 +682,26 @@ pub fn parse(args: &[String]) -> Config {
let
build
=
toml
.build
.unwrap_or_default
();
set
(
&
mut
config
.out
,
build
.build_dir
.map
(
String
::
into
));
t!
(
fs
::
create_dir_all
(
&
config
.out
));
config
.out
=
t!
(
config
.out
.canonicalize
(),
format!
(
"failed to canonicalize {}"
,
config
.out
.display
())
);
// NOTE: Bootstrap spawns various commands with different working directories.
// To avoid writing to random places on the file system, `config.out` needs to be an absolute path.
// FIXME: using `canonicalize()` makes this a lot more complicated than it needs to be -
// if/when `std::path::absolute` lands, we should use that instead.
// HACK: in tests, we override the build directory manually.
// Avoid creating a directory we won't actually need.
// (The original motivation for this is that CI uses read-only directories.)
if
!
config
.out
.is_absolute
()
&&
!
unit_test
{
// canonicalize() gives a hard error if the directory doesn't exist
t!
(
fs
::
create_dir_all
(
&
config
.out
),
format!
(
"failed to create build dir: {}"
,
config
.out
.display
())
);
config
.out
=
t!
(
config
.out
.canonicalize
(),
format!
(
"failed to canonicalize {}"
,
config
.out
.display
())
);
}
if
config
.dry_run
{
let
dir
=
config
.out
.join
(
"tmp-dry-run"
);
...
...
src/bootstrap/flags.rs
浏览文件 @
984527f7
...
...
@@ -343,7 +343,7 @@ pub fn parse(args: &[String]) -> Flags {
// All subcommands except `clean` can have an optional "Available paths" section
if
verbose
{
let
config
=
Config
::
parse
(
&
[
"build"
.to_string
()]);
let
config
=
Config
::
parse
(
&
[
"build"
.to_string
()]
,
false
);
let
build
=
Build
::
new
(
config
);
let
maybe_rules_help
=
Builder
::
get_help
(
&
build
,
subcommand
.as_str
());
...
...
src/bootstrap/test.rs
浏览文件 @
984527f7
...
...
@@ -2346,6 +2346,8 @@ fn run(self, builder: &Builder<'_>) {
.current_dir
(
builder
.src
.join
(
"src/bootstrap"
))
.env
(
"RUSTFLAGS"
,
"-Cdebuginfo=2"
)
.env
(
"CARGO_TARGET_DIR"
,
builder
.out
.join
(
"bootstrap"
))
// HACK: bootstrap's tests want to know the output directory, but there's no way to set
// it except through config.toml. Set it through an env variable instead.
.env
(
"BOOTSTRAP_OUTPUT_DIRECTORY"
,
&
builder
.config.out
)
.env
(
"BOOTSTRAP_INITIAL_CARGO"
,
&
builder
.config.initial_cargo
)
.env
(
"RUSTC_BOOTSTRAP"
,
"1"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录