Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
31aa7c1a
D
deno
项目概览
张重言
/
deno
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
deno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
31aa7c1a
编写于
8月 09, 2019
作者:
B
Bert Belder
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
build: support rust crates that generate sources in their build script
上级
6c7d3379
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
2 deletion
+25
-2
build_extra/rust/run.py
build_extra/rust/run.py
+12
-1
build_extra/rust/rust.gni
build_extra/rust/rust.gni
+13
-1
未找到文件。
build_extra/rust/run.py
浏览文件 @
31aa7c1a
...
...
@@ -7,6 +7,7 @@ import sys
import
os
import
re
args
=
sys
.
argv
[
1
:]
env
=
os
.
environ
.
copy
()
if
sys
.
platform
==
'win32'
:
...
...
@@ -26,9 +27,19 @@ if sys.platform == 'win32':
env
[
"GN_OUT_DIR"
]
=
os
.
path
.
abspath
(
"."
)
assert
os
.
path
.
isdir
(
env
[
"GN_OUT_DIR"
])
# Some crates (e.g. 'typenum') generate source files and place them in the
# directory indicated by the 'OUT_DIR' environment variable, which is normally
# set by Cargo. We pre-generate these files and store them in the source repo.
# Therefore, set 'OUT_DIR' so these crates can find their generated sources.
for
i
,
arg
in
enumerate
(
args
):
match
=
re
.
search
(
'--generated-source-dir=(.*)'
,
arg
)
if
match
:
env
[
"OUT_DIR"
]
=
os
.
path
.
abspath
(
match
.
group
(
1
))
del
args
[
i
]
break
# Set the CARGO_PKG_VERSION env variable if provided as an argument
# When building with Cargo this variable is set automatically
args
=
sys
.
argv
[
1
:]
for
i
,
arg
in
enumerate
(
args
):
match
=
re
.
search
(
'--cargo-pkg-version="?([^"]*)"?'
,
arg
)
if
match
:
...
...
build_extra/rust/rust.gni
浏览文件 @
31aa7c1a
...
...
@@ -62,8 +62,9 @@ template("_rust_crate") {
"crate_version",
"deps",
"edition",
"inputs",
"features",
"generated_source_dir",
"inputs",
"is_test",
"libs",
"source_root",
...
...
@@ -237,6 +238,17 @@ template("_rust_crate") {
"--color=always",
]
if (defined(generated_source_dir)) {
args += [
# Some crates (e.g. 'typenum') generate source files and place them in
# the directory indicated by the 'OUT_DIR' environment variable, which
# is normally set by Cargo. This flag tells run.py to set 'OUT_DIR' to
# the path where the current crate can find its generated sources.
"--generated-source-dir=" +
rebase_path(generated_source_dir, root_build_dir),
]
}
if (defined(crate_version)) {
args += [
# This is used to set env variables for Cargo build compatibility
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录