Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
badad33d
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
badad33d
编写于
7月 23, 2015
作者:
E
Eric Seidel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix gn --ios --simulator to use the right out directory.
R=abarth@google.com
上级
d219e6d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
60 addition
and
25 deletion
+60
-25
sky/tools/gn
sky/tools/gn
+33
-25
sky/tools/gn_test.py
sky/tools/gn_test.py
+27
-0
未找到文件。
sky/tools/gn
浏览文件 @
badad33d
...
...
@@ -9,46 +9,53 @@ import sys
import
os
def
get_out_dir
(
args
):
target_dir
=
'Release'
if
args
.
debug
:
target_dir
=
'Debug'
target_dir
=
''
if
args
.
target_os
==
'android'
:
target_dir
=
'android_'
+
target_dir
target_dir
+=
'android_'
elif
args
.
target_os
==
'ios'
:
target_dir
=
'ios_'
+
target_dir
target_dir
+=
'ios_'
if
args
.
simulator
:
target_dir
+=
'sim_'
if
args
.
debug
:
target_dir
+=
'Debug'
else
:
target_dir
+=
'Release'
return
os
.
path
.
join
(
'out'
,
target_dir
)
def
to_command_line
(
gn_args
):
def
merge
(
key
,
value
):
if
type
(
value
)
is
bool
:
return
"%s=%s"
%
(
key
,
"true"
if
value
else
"false"
)
return
"%s=
\"
%s
\"
"
%
(
key
,
value
)
return
'%s=%s'
%
(
key
,
'true'
if
value
else
'false'
)
return
'%s="%s"'
%
(
key
,
value
)
return
[
merge
(
x
,
y
)
for
x
,
y
in
gn_args
.
iteritems
()]
def
to_gn_args
(
args
):
gn_args
=
{}
gn_args
[
"is_debug"
]
=
args
.
debug
gn_args
[
"is_clang"
]
=
args
.
clang
and
args
.
target_os
not
in
[
'android'
]
gn_args
[
'is_debug'
]
=
args
.
debug
gn_args
[
'is_clang'
]
=
args
.
clang
and
args
.
target_os
not
in
[
'android'
]
if
args
.
target_os
==
'android'
:
gn_args
[
"target_os"
]
=
"android"
gn_args
[
'target_os'
]
=
'android'
elif
args
.
target_os
==
'ios'
:
gn_args
[
"target_os"
]
=
"ios"
gn_args
[
"ios_deployment_target"
]
=
"7.0"
gn_args
[
"clang_use_chrome_plugins"
]
=
False
gn_args
[
'target_os'
]
=
'ios'
gn_args
[
'ios_deployment_target'
]
=
'7.0'
gn_args
[
'clang_use_chrome_plugins'
]
=
False
if
args
.
simulator
:
gn_args
[
"use_libjpeg_turbo"
]
=
False
gn_args
[
"use_ios_simulator"
]
=
args
.
simulator
gn_args
[
'use_libjpeg_turbo'
]
=
False
gn_args
[
'use_ios_simulator'
]
=
args
.
simulator
else
:
gn_args
[
"use_aura"
]
=
False
gn_args
[
"use_glib"
]
=
False
gn_args
[
"use_system_harfbuzz"
]
=
False
gn_args
[
'use_aura'
]
=
False
gn_args
[
'use_glib'
]
=
False
gn_args
[
'use_system_harfbuzz'
]
=
False
if
args
.
target_os
in
[
'android'
,
'ios'
]:
gn_args
[
"target_cpu"
]
=
'arm'
gn_args
[
'target_cpu'
]
=
'arm'
else
:
gn_args
[
"target_cpu"
]
=
'x64'
gn_args
[
'target_cpu'
]
=
'x64'
goma_dir
=
os
.
environ
.
get
(
'GOMA_DIR'
)
goma_home_dir
=
os
.
path
.
join
(
os
.
getenv
(
'HOME'
,
''
),
'goma'
)
...
...
@@ -64,14 +71,13 @@ def to_gn_args(args):
return
gn_args
def
main
():
def
parse_args
(
args
):
parser
=
argparse
.
ArgumentParser
(
description
=
'A script run` gn gen`.'
)
parser
.
add_argument
(
'--debug'
,
default
=
True
,
action
=
'store_true'
)
parser
.
add_argument
(
'--release'
,
default
=
False
,
dest
=
'debug'
,
action
=
'store_false'
)
parser
.
add_argument
(
'--target-os'
,
type
=
str
)
parser
.
add_argument
(
'--target-os'
,
type
=
str
,
choices
=
[
'android'
,
'ios'
]
)
parser
.
add_argument
(
'--android'
,
dest
=
'target_os'
,
action
=
'store_const'
,
const
=
'android'
)
parser
.
add_argument
(
'--ios'
,
dest
=
'target_os'
,
action
=
'store_const'
,
const
=
'ios'
)
parser
.
add_argument
(
'--simulator'
,
action
=
'store_true'
,
default
=
False
)
...
...
@@ -82,8 +88,10 @@ def main():
parser
.
add_argument
(
'--clang'
,
default
=
True
,
action
=
'store_true'
)
parser
.
add_argument
(
'--no-clang'
,
dest
=
'clang'
,
action
=
'store_false'
)
args
=
parser
.
parse_args
(
)
return
parser
.
parse_args
(
args
)
def
main
(
argv
):
args
=
parse_args
(
argv
)
command
=
[
'gn'
,
'gen'
,
'--check'
]
gn_args
=
to_command_line
(
to_gn_args
(
args
))
out_dir
=
get_out_dir
(
args
)
...
...
@@ -93,4 +101,4 @@ def main():
if
__name__
==
'__main__'
:
sys
.
exit
(
main
())
sys
.
exit
(
main
(
sys
.
argv
))
sky/tools/gn_test.py
0 → 100644
浏览文件 @
badad33d
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import
unittest
import
os
import
imp
SKY_TOOLS
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
gn
=
imp
.
load_source
(
'gn'
,
os
.
path
.
join
(
SKY_TOOLS
,
'gn'
))
class
GNTestCase
(
unittest
.
TestCase
):
def
_expect_build_dir
(
self
,
arg_list
,
expected_build_dir
):
args
=
gn
.
parse_args
(
arg_list
)
self
.
assertEquals
(
gn
.
get_out_dir
(
args
),
expected_build_dir
)
def
test_get_out_dir
(
self
):
self
.
_expect_build_dir
([
'--debug'
],
'out/Debug'
)
self
.
_expect_build_dir
([
'--release'
],
'out/Release'
)
self
.
_expect_build_dir
([
'--ios'
],
'out/ios_Debug'
)
self
.
_expect_build_dir
([
'--ios'
,
'--release'
],
'out/ios_Release'
)
self
.
_expect_build_dir
([
'--android'
],
'out/android_Debug'
)
self
.
_expect_build_dir
([
'--android'
,
'--release'
],
'out/android_Release'
)
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录