Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ad308264
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
ad308264
编写于
5月 24, 2021
作者:
M
Mark Rousskov
提交者:
GitHub
5月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Move llvm submodule updates to rustbuild"
上级
126561cb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
98 deletion
+13
-98
src/bootstrap/bootstrap.py
src/bootstrap/bootstrap.py
+12
-4
src/bootstrap/lib.rs
src/bootstrap/lib.rs
+0
-10
src/bootstrap/native.rs
src/bootstrap/native.rs
+1
-83
src/build_helper/lib.rs
src/build_helper/lib.rs
+0
-1
未找到文件。
src/bootstrap/bootstrap.py
浏览文件 @
ad308264
...
...
@@ -991,20 +991,28 @@ class RustBuild(object):
).
decode
(
default_encoding
).
splitlines
()]
filtered_submodules
=
[]
submodules_names
=
[]
llvm_checked_out
=
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
rust_root
,
"src/llvm-project/.git"
))
external_llvm_provided
=
self
.
get_toml
(
'llvm-config'
)
or
self
.
downloading_llvm
()
llvm_needed
=
not
self
.
get_toml
(
'codegen-backends'
,
'rust'
)
\
or
"llvm"
in
self
.
get_toml
(
'codegen-backends'
,
'rust'
)
for
module
in
submodules
:
# This is handled by native::Llvm in rustbuild, not here
if
module
.
endswith
(
"llvm-project"
):
continue
# Don't sync the llvm-project submodule if an external LLVM was
# provided, if we are downloading LLVM or if the LLVM backend is
# not being built. Also, if the submodule has been initialized
# already, sync it anyways so that it doesn't mess up contributor
# pull requests.
if
external_llvm_provided
or
not
llvm_needed
:
if
self
.
get_toml
(
'lld'
)
!=
'true'
and
not
llvm_checked_out
:
continue
check
=
self
.
check_submodule
(
module
,
slow_submodules
)
filtered_submodules
.
append
((
module
,
check
))
submodules_names
.
append
(
module
)
recorded
=
subprocess
.
Popen
([
"git"
,
"ls-tree"
,
"HEAD"
]
+
submodules_names
,
cwd
=
self
.
rust_root
,
stdout
=
subprocess
.
PIPE
)
recorded
=
recorded
.
communicate
()[
0
].
decode
(
default_encoding
).
strip
().
splitlines
()
# { filename: hash }
recorded_submodules
=
{}
for
data
in
recorded
:
# [mode, kind, hash, filename]
data
=
data
.
split
()
recorded_submodules
[
data
[
3
]]
=
data
[
2
]
for
module
in
filtered_submodules
:
...
...
src/bootstrap/lib.rs
浏览文件 @
ad308264
...
...
@@ -472,22 +472,12 @@ pub fn build_triple(&self) -> &[Interned<String>] {
slice
::
from_ref
(
&
self
.build.triple
)
}
/// If the LLVM submodule has been initialized already, sync it unconditionally. This avoids
/// contributors checking in a submodule change by accident.
pub
fn
maybe_update_llvm_submodule
(
&
self
)
{
if
self
.in_tree_llvm_info
.is_git
()
{
native
::
update_llvm_submodule
(
self
);
}
}
/// Executes the entire build, as configured by the flags and configuration.
pub
fn
build
(
&
mut
self
)
{
unsafe
{
job
::
setup
(
self
);
}
self
.maybe_update_llvm_submodule
();
if
let
Subcommand
::
Format
{
check
,
paths
}
=
&
self
.config.cmd
{
return
format
::
format
(
self
,
*
check
,
&
paths
);
}
...
...
src/bootstrap/native.rs
浏览文件 @
ad308264
...
...
@@ -21,7 +21,7 @@
use
crate
::
builder
::{
Builder
,
RunConfig
,
ShouldRun
,
Step
};
use
crate
::
config
::
TargetSelection
;
use
crate
::
util
::{
self
,
exe
};
use
crate
::
{
Build
,
GitRepo
}
;
use
crate
::
GitRepo
;
use
build_helper
::
up_to_date
;
pub
struct
Meta
{
...
...
@@ -91,85 +91,6 @@ pub fn prebuilt_llvm_config(
Err
(
Meta
{
stamp
,
build_llvm_config
,
out_dir
,
root
:
root
.into
()
})
}
// modified from `check_submodule` and `update_submodule` in bootstrap.py
pub
(
crate
)
fn
update_llvm_submodule
(
build
:
&
Build
)
{
let
llvm_project
=
&
Path
::
new
(
"src"
)
.join
(
"llvm-project"
);
fn
dir_is_empty
(
dir
:
&
Path
)
->
bool
{
t!
(
std
::
fs
::
read_dir
(
dir
))
.next
()
.is_none
()
}
// NOTE: The check for the empty directory is here because when running x.py
// the first time, the llvm submodule won't be checked out. Check it out
// now so we can build it.
if
!
build
.in_tree_llvm_info
.is_git
()
&&
!
dir_is_empty
(
&
build
.config.src
.join
(
llvm_project
))
{
return
;
}
// check_submodule
let
checked_out
=
if
build
.config.fast_submodules
{
Some
(
output
(
Command
::
new
(
"git"
)
.args
(
&
[
"rev-parse"
,
"HEAD"
])
.current_dir
(
build
.config.src
.join
(
llvm_project
)),
))
}
else
{
None
};
// update_submodules
let
recorded
=
output
(
Command
::
new
(
"git"
)
.args
(
&
[
"ls-tree"
,
"HEAD"
])
.arg
(
llvm_project
)
.current_dir
(
&
build
.config.src
),
);
let
hash
=
recorded
.split
(
' '
)
.nth
(
2
)
.unwrap_or_else
(||
panic!
(
"unexpected output `{}`"
,
recorded
));
// update_submodule
if
let
Some
(
llvm_hash
)
=
checked_out
{
if
hash
==
llvm_hash
{
// already checked out
return
;
}
}
println!
(
"Updating submodule {}"
,
llvm_project
.display
());
build
.run
(
Command
::
new
(
"git"
)
.args
(
&
[
"submodule"
,
"-q"
,
"sync"
])
.arg
(
llvm_project
)
.current_dir
(
&
build
.config.src
),
);
// Try passing `--progress` to start, then run git again without if that fails.
let
update
=
|
progress
:
bool
|
{
let
mut
git
=
Command
::
new
(
"git"
);
git
.args
(
&
[
"submodule"
,
"update"
,
"--init"
,
"--recursive"
]);
if
progress
{
git
.arg
(
"--progress"
);
}
git
.arg
(
llvm_project
)
.current_dir
(
&
build
.config.src
);
git
};
// NOTE: doesn't use `try_run` because this shouldn't print an error if it fails.
if
!
update
(
true
)
.status
()
.map_or
(
false
,
|
status
|
status
.success
())
{
build
.run
(
&
mut
update
(
false
));
}
build
.run
(
Command
::
new
(
"git"
)
.args
(
&
[
"reset"
,
"-q"
,
"--hard"
])
.current_dir
(
build
.config.src
.join
(
llvm_project
)),
);
build
.run
(
Command
::
new
(
"git"
)
.args
(
&
[
"clean"
,
"-qdfx"
])
.current_dir
(
build
.config.src
.join
(
llvm_project
)),
);
}
#[derive(Debug,
Copy,
Clone,
Hash,
PartialEq,
Eq)]
pub
struct
Llvm
{
pub
target
:
TargetSelection
,
...
...
@@ -207,9 +128,6 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
Err
(
m
)
=>
m
,
};
if
!
builder
.config.dry_run
{
update_llvm_submodule
(
builder
);
}
if
builder
.config.llvm_link_shared
&&
(
target
.contains
(
"windows"
)
||
target
.contains
(
"apple-darwin"
))
{
...
...
src/build_helper/lib.rs
浏览文件 @
ad308264
...
...
@@ -130,7 +130,6 @@ pub fn make(host: &str) -> PathBuf {
}
}
#[track_caller]
pub
fn
output
(
cmd
:
&
mut
Command
)
->
String
{
let
output
=
match
cmd
.stderr
(
Stdio
::
inherit
())
.output
()
{
Ok
(
status
)
=>
status
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录