Remove use of set_sources_assignment_filter

The sources assignment filter is considered a misfeature of gn
and is planned for removal (see discussion at [1]).

Convert dart BUILD.gn rules to manually filter the files that
are build using explicit `if` expressions. Remove obsolete call
to set_sources_assignment_filter() to filter '*_test.*' files
as no such files are present in the variables used to build the
`sources` value.

[1]: https://groups.google.com/a/chromium.org/g/gn-dev/c/oQcYStl_WkI/m/roukYTxSDAAJ

Bug: gn:125
Change-Id: I591fbb746cf694f7d2a5a330f81652380acf5c11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166629
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2020-10-08 20:08:59 +00:00
parent 52370de8fa
commit 4182cbe1a3
6 changed files with 21 additions and 72 deletions

View file

@ -425,9 +425,6 @@ template("component") {
configs = [] # Prevent list overwriting warning.
configs = invoker.configs
# See above call.
set_sources_assignment_filter([])
if (defined(invoker.all_dependent_configs)) {
all_dependent_configs = invoker.all_dependent_configs
}

View file

@ -72,7 +72,6 @@ template("resource_copy_mac") {
_resources = invoker.resources
copy(target_name) {
set_sources_assignment_filter([])
sources = _resources
outputs = [ "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{source_file_part}}" ]

View file

@ -17,8 +17,6 @@
# variables = "app_name=chrome_shell app_version=1"
# }
template("file_template") {
set_sources_assignment_filter([])
if (defined(invoker.testonly)) {
testonly = invoker.testonly
}

View file

@ -51,10 +51,6 @@ template("build_libdart_builtin") {
}
}
include_dirs = [ ".." ]
set_sources_assignment_filter([
"*_test.cc",
"*_test.h",
])
sources = builtin_impl_sources
}
}
@ -325,19 +321,6 @@ template("build_gen_snapshot_dart_io") {
deps = [ "//third_party/zlib" ]
custom_sources_filter = [
"*_test.cc",
"*_test.h",
]
if (!is_mac && !is_ios) {
# Dart tree uses *_macos.* instead of *_mac.*
custom_sources_filter += [
"*_macos.h",
"*_macos.cc",
]
}
set_sources_assignment_filter(custom_sources_filter)
defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ]
sources = io_impl_sources + cli_impl_sources
@ -414,19 +397,6 @@ template("dart_io") {
"..:dart_os_config",
] + extra_configs
public_configs = [ "..:dart_public_config" ]
custom_sources_filter = [
"*_test.cc",
"*_test.h",
"builtin_gen_snapshot.cc",
]
if (!is_mac && !is_ios) {
# Dart tree uses *_macos.* instead of *_mac.*
custom_sources_filter += [
"*_macos.h",
"*_macos.cc",
]
}
set_sources_assignment_filter(custom_sources_filter)
defines = []
deps = [ "//third_party/zlib" ] + extra_deps
@ -1033,10 +1003,7 @@ executable("run_vm_tests") {
shared_library("test_extension") {
deps = [ ":dart" ]
sources = [
"test_extension.c",
"test_extension_dllmain_win.cc",
]
sources = [ "test_extension.c" ]
include_dirs = [ ".." ]
defines = [
# The only effect of DART_SHARED_LIB is to export the Dart API.
@ -1046,6 +1013,7 @@ shared_library("test_extension") {
cflags = [ "-fPIC" ]
}
if (is_win) {
sources += [ "test_extension_dllmain_win.cc" ]
libs = [ "dart.lib" ]
abs_root_out_dir = rebase_path(root_out_dir)
ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
@ -1054,10 +1022,7 @@ shared_library("test_extension") {
shared_library("entrypoints_verification_test_extension") {
deps = [ ":dart" ]
sources = [
"entrypoints_verification_test_extension.cc",
"entrypoints_verification_test_extension_dllmain_win.cc",
]
sources = [ "entrypoints_verification_test_extension.cc" ]
include_dirs = [ ".." ]
defines = [
# The only effect of DART_SHARED_LIB is to export the Dart API.
@ -1067,6 +1032,7 @@ shared_library("entrypoints_verification_test_extension") {
cflags = [ "-fPIC" ]
}
if (is_win) {
sources += [ "entrypoints_verification_test_extension_dllmain_win.cc" ]
libs = [ "dart.lib" ]
abs_root_out_dir = rebase_path(root_out_dir)
ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
@ -1129,10 +1095,7 @@ shared_library("ffi_test_functions") {
shared_library("sample_extension") {
deps = [ ":dart" ]
sources = [
"../../samples/sample_extension/sample_extension.cc",
"../../samples/sample_extension/sample_extension_dllmain_win.cc",
]
sources = [ "../../samples/sample_extension/sample_extension.cc" ]
include_dirs = [ ".." ]
defines = [
# The only effect of DART_SHARED_LIB is to export the Dart API.
@ -1142,6 +1105,8 @@ shared_library("sample_extension") {
cflags = [ "-fPIC" ]
}
if (is_win) {
sources +=
[ "../../samples/sample_extension/sample_extension_dllmain_win.cc" ]
libs = [ "dart.lib" ]
abs_root_out_dir = rebase_path(root_out_dir)
ldflags = [ "/LIBPATH:$abs_root_out_dir" ]

View file

@ -109,10 +109,6 @@ library_for_all_configs("libdart_vm") {
}
}
public_configs = [ ":libdart_vm_config" ]
set_sources_assignment_filter([
"*_test.cc",
"*_test.h",
])
sources = vm_sources + rebase_path(compiler_api_sources, ".", "./compiler/") +
rebase_path(disassembler_sources, ".", "./compiler/") +
rebase_path(heap_sources, ".", "./heap/")
@ -122,10 +118,6 @@ library_for_all_configs("libdart_vm") {
library_for_all_configs_with_compiler("libdart_compiler") {
target_type = "source_set"
public_configs = [ ":libdart_vm_config" ]
set_sources_assignment_filter([
"*_test.cc",
"*_test.h",
])
sources = rebase_path(compiler_sources, ".", "./compiler/")
include_dirs = [ ".." ]
if (is_fuchsia) {

View file

@ -119,22 +119,20 @@ source_set("tcmalloc") {
cflags += [ "-Wno-format" ]
}
set_sources_assignment_filter([
# No debug allocator.
"gperftools/src/debugallocation.cc",
sources = tcmalloc_sources - [
# No debug allocator.
"gperftools/src/debugallocation.cc",
# Not needed when using emergency malloc.
"gperftools/src/fake_stacktrace_scope.cc",
# Not needed when using emergency malloc.
"gperftools/src/fake_stacktrace_scope.cc",
# Not using the cpuprofiler
"gperftools/src/base/thread_lister.c",
"gperftools/src/base/thread_lister.h",
"gperftools/src/profile-handler.cc",
"gperftools/src/profile-handler.h",
"gperftools/src/profiledata.cc",
"gperftools/src/profiledata.h",
"gperftools/src/profiler.cc",
])
sources = tcmalloc_sources
# Not using the cpuprofiler
"gperftools/src/base/thread_lister.c",
"gperftools/src/base/thread_lister.h",
"gperftools/src/profile-handler.cc",
"gperftools/src/profile-handler.h",
"gperftools/src/profiledata.cc",
"gperftools/src/profiledata.h",
"gperftools/src/profiler.cc",
]
}