8 Star 0 Fork 12

src-openEuler/distributed-build

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0027-feat-support-gn-upgrade.patch 8.21 KB
一键复制 编辑 原始数据 按行查看 历史
From 4fa15c6cb583d35026ef0e35b3077a458b4d69fb Mon Sep 17 00:00:00 2001
From: s_c_c <shichuchao@huawei.com>
Date: Mon, 29 Jul 2024 11:00:02 +0800
Subject: [PATCH] feat support gn upgrade
---
config/BUILDCONFIG.gn | 2 +-
config/ohos/copy_ex.gni | 2 +-
config/python.gni | 17 ++++++++++-------
config/sanitizers/BUILD.gn | 2 +-
ohos/ndk/ndk.gni | 7 ++++---
ohos/sdk/sdk.gni | 2 +-
templates/cxx/prebuilt.gni | 8 ++++----
templates/metadata/module_info.gni | 10 ++++++----
8 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index 280894e..2229b1c 100644
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -554,7 +554,7 @@ if (!is_ohos) {
sources_assignment_filter += []
}
-set_sources_assignment_filter(sources_assignment_filter)
+# set_sources_assignment_filter(sources_assignment_filter)
if (is_standard_system) {
file_exist = exec_script("//build/scripts/check_file_exist.py",
[ "${device_build_path}/config.gni" ],
diff --git a/config/ohos/copy_ex.gni b/config/ohos/copy_ex.gni
index 306c452..ff2396c 100644
--- a/config/ohos/copy_ex.gni
+++ b/config/ohos/copy_ex.gni
@@ -22,7 +22,7 @@ import("//build/config/python.gni")
# outputs, testonly, visibility.
#
template("copy_ex") {
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
action_with_pydeps(target_name) {
forward_variables_from(invoker,
[
diff --git a/config/python.gni b/config/python.gni
index 79ddcb5..b59c7c4 100644
--- a/config/python.gni
+++ b/config/python.gni
@@ -44,8 +44,9 @@ template("python_library") {
_py_files = read_file(invoker.pydeps_file, "list lines")
# Filter out comments.
- set_sources_assignment_filter([ "#*" ])
+ # set_sources_assignment_filter([ "#*" ])
sources = _py_files
+ sources = filter_exclude(sources, [ "#*" ])
# Even though the .pydep file is not used at runtime, it must be added
# so that "gn analyze" will mark the target as changed when .py files
@@ -85,10 +86,11 @@ template("action_with_pydeps") {
if (defined(sources)) {
_old_sources = sources
}
- set_sources_assignment_filter([ "#*" ])
- sources = _pydeps_raw
+ # set_sources_assignment_filter([ "#*" ])
+ # sources = _pydeps_raw
+ sources = filter_exclude(_pydeps_raw, [ "#*" ])
_pydeps = sources
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
sources = _old_sources
action(target_name) {
@@ -130,10 +132,11 @@ template("action_foreach_with_pydeps") {
if (defined(sources)) {
_old_sources = sources
}
- set_sources_assignment_filter([ "#*" ])
- sources = _pydeps_raw
+ # set_sources_assignment_filter([ "#*" ])
+ # sources = _pydeps_raw
+ sources = filter_exclude(_pydeps_raw, [ "#*" ])
_pydeps = sources
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
sources = _old_sources
action_foreach(target_name) {
diff --git a/config/sanitizers/BUILD.gn b/config/sanitizers/BUILD.gn
index d2f0863..2fa841d 100644
--- a/config/sanitizers/BUILD.gn
+++ b/config/sanitizers/BUILD.gn
@@ -73,7 +73,7 @@ if ((is_mac || is_win || !use_xcode_clang || is_ohos) && using_sanitizer) {
"$clang_base_path/lib/clang/$clang_version/lib/$_clang_rt_dso_path"
copy("copy_asan_runtime") {
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
sources = [ _clang_rt_dso_full_path ]
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
diff --git a/ohos/ndk/ndk.gni b/ohos/ndk/ndk.gni
index 58148f0..8533224 100644
--- a/ohos/ndk/ndk.gni
+++ b/ohos/ndk/ndk.gni
@@ -262,14 +262,15 @@ template("ohos_ndk_copy") {
}
_dest = invoker.dest_dir
- set_sources_assignment_filter([ "*os-irrelevant*" ])
- sources = [ _dest ]
+ # set_sources_assignment_filter([ "*os-irrelevant*" ])
+ # sources = [ _dest ]
+ sources = filter_exclude([ _dest ], [ "*os-irrelevant*" ])
if (sources == []) {
_notice_rel_dir = ndk_os_irrelevant_out_dir
} else {
_notice_rel_dir = ndk_os_specific_out_dir
}
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
sources = []
_main_target_name = target_name
diff --git a/ohos/sdk/sdk.gni b/ohos/sdk/sdk.gni
index bc0c851..03a0c7e 100644
--- a/ohos/sdk/sdk.gni
+++ b/ohos/sdk/sdk.gni
@@ -133,7 +133,7 @@ template("make_sdk_modules") {
_sdk_modules += [ "${_target_label}(${invoker.sdk_toolchain})" ]
}
sources = []
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
}
not_needed(invoker, [ "sdk_toolchain" ])
diff --git a/templates/cxx/prebuilt.gni b/templates/cxx/prebuilt.gni
index 74fe7fc..01f924b 100644
--- a/templates/cxx/prebuilt.gni
+++ b/templates/cxx/prebuilt.gni
@@ -42,7 +42,7 @@ template("ohos_prebuilt_executable") {
"license_file",
"license_as_sources",
])
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
sources = [ invoker.source ]
outputs = [ _copy_output ]
module_type = "bin"
@@ -90,7 +90,7 @@ template("ohos_prebuilt_shared_library") {
"license_file",
"license_as_sources",
])
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
sources = [ invoker.source ]
outputs = [ _copy_output ]
module_type = "lib"
@@ -136,7 +136,7 @@ template("ohos_prebuilt_static_library") {
"license_file",
"license_as_sources",
])
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
sources = [ invoker.source ]
outputs = [ _copy_output ]
bypass_module_info_generation = true
@@ -176,7 +176,7 @@ template("ohos_prebuilt_etc") {
"license_file",
"license_as_sources",
])
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
sources = [ invoker.source ]
outputs = [ _copy_output ]
module_type = "etc"
diff --git a/templates/metadata/module_info.gni b/templates/metadata/module_info.gni
index f4d4e54..412a1ea 100644
--- a/templates/metadata/module_info.gni
+++ b/templates/metadata/module_info.gni
@@ -223,8 +223,9 @@ template("write_meta_data") {
_parent_invoker = invoker.invoker
_caller_target_name = get_label_info(":${_parent_invoker.target_name}",
"label_no_toolchain")
- set_sources_assignment_filter(app_target_allowlist)
+ # set_sources_assignment_filter(app_target_allowlist)
sources = [ _caller_target_name ]
+ sources = filter_exclude(sources, app_target_allowlist)
if (sources != []) {
if (type == "js_assets" || type == "ets_assets" ||
type == "unresolved_assets" || type == "assets") {
@@ -237,7 +238,7 @@ template("write_meta_data") {
"Illegal target name: \"${_caller_target_name}\", target name of ohos_resources must endswith res or resources or resource")
}
}
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
}
script = "//build/templates/metadata/write_meta_data.py"
@@ -264,18 +265,19 @@ template("write_meta_data") {
_deps_metadata = []
inputs = []
- set_sources_assignment_filter(app_target_allowlist)
+ # set_sources_assignment_filter(app_target_allowlist)
foreach(d, _possible_deps) {
sources = []
_target_label = get_label_info(d, "label_no_toolchain")
sources += [ _target_label ]
+ sources = filter_exclude(sources, app_target_allowlist)
if (sources == []) {
_deps_metadata += [ get_label_info(d, "target_gen_dir") + "/" +
get_label_info(d, "name") + ".metadata" ]
deps += [ "${_target_label}__metadata" ]
}
}
- set_sources_assignment_filter([])
+ # set_sources_assignment_filter([])
if (_deps_metadata != []) {
args += [ "--deps-metadata" ]
--
2.45.2.windows.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/distributed-build.git
git@gitee.com:src-openeuler/distributed-build.git
src-openeuler
distributed-build
distributed-build
master

搜索帮助