Skip to content

Commit

Permalink
Apply formatter to all GN files. (#775)
Browse files Browse the repository at this point in the history
There is no CI hook to check formatting of .gn and .gni files in the
buildroot.

Applies the formatter to all files with no change in behavior.

The same actions were done on the engine and all files were correctly
formatted already which proves the auto-formatter is working there.
  • Loading branch information
chinmaygarde authored Oct 4, 2023
1 parent af04b54 commit 5d60bd2
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 125 deletions.
2 changes: 1 addition & 1 deletion build/compiled_action.gni
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ template("compiled_action") {
"pool",
"outputs",
])

script = "//build/gn_run_binary.py"

if (defined(invoker.inputs)) {
Expand Down
1 change: 0 additions & 1 deletion build/config/android/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

# TODO(dnfield): Patch icu to not depend on this file
import("//build/config/android/config.gni")

assert(is_android)
2 changes: 1 addition & 1 deletion build/config/arm.gni
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (current_cpu == "arm" || current_cpu == "arm64") {
# platforms.
if (current_cpu == "arm") {
arm_version = 7
} else if(current_cpu == "arm64") {
} else if (current_cpu == "arm64") {
arm_version = 8
} else {
assert(false, "Unconfigured arm version")
Expand Down
6 changes: 2 additions & 4 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,7 @@ if (is_win) {
} else {
common_optimize_on_ldflags += [ "-Wl,-O2" ]
}
common_optimize_on_ldflags += [
"-Wl,--gc-sections",
]
common_optimize_on_ldflags += [ "-Wl,--gc-sections" ]

if (!using_sanitizer && !is_wasm) {
# Functions interposed by the sanitizers can make ld think
Expand Down Expand Up @@ -977,7 +975,7 @@ config("symbols") {
ldflags = [ "-g3" ]
} else {
cflags = [ "-gsource-map" ]
ldflags = [ "-gsource-map"]
ldflags = [ "-gsource-map" ]
}
} else {
cflags = [ "-g2" ]
Expand Down
53 changes: 14 additions & 39 deletions build/config/mac/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ template("code_sign_mac") {
assert(defined(invoker.deps))

action(target_name) {
sources = [
invoker.entitlements_path,
]
sources = [ invoker.entitlements_path ]

_application_path = invoker.application_path

script = mac_app_script

outputs = [
"$_application_path/_CodeSignature/CodeResources",
]
outputs = [ "$_application_path/_CodeSignature/CodeResources" ]

args = [
"codesign",
Expand Down Expand Up @@ -51,9 +47,7 @@ template("resource_copy_mac") {

copy(target_name) {
sources = _resources
outputs = [
"$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{source_file_part}}",
]
outputs = [ "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{source_file_part}}" ]

if (defined(invoker.deps)) {
deps = invoker.deps
Expand All @@ -80,9 +74,7 @@ template("mac_app") {
script = mac_app_script

sources = []
outputs = [
"$root_build_dir/$app_name.app",
]
outputs = [ "$root_build_dir/$app_name.app" ]

args = [
"structure",
Expand All @@ -109,12 +101,8 @@ template("mac_app") {
action(plist_gen_target_name) {
script = mac_app_script

sources = [
invoker.info_plist,
]
outputs = [
"$root_build_dir/plist/$app_name/Info.plist",
]
sources = [ invoker.info_plist ]
outputs = [ "$root_build_dir/plist/$app_name/Info.plist" ]

args = [
"plist",
Expand All @@ -129,32 +117,21 @@ template("mac_app") {

copy_plist_gen_target_name = target_name + "_plist_copy"
copy(copy_plist_gen_target_name) {
sources = [
"$root_build_dir/plist/$app_name/Info.plist",
]
sources = [ "$root_build_dir/plist/$app_name/Info.plist" ]

outputs = [
"$root_build_dir/$app_name.app/Contents/{{source_file_part}}",
]
outputs = [ "$root_build_dir/$app_name.app/Contents/{{source_file_part}}" ]

deps = [
":$plist_gen_target_name",
]
deps = [ ":$plist_gen_target_name" ]
}

copy_bin_target_name = target_name + "_bin_copy"
copy(copy_bin_target_name) {
sources = [
"$root_build_dir/$app_name",
]
sources = [ "$root_build_dir/$app_name" ]

outputs = [
"$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}",
]
outputs =
[ "$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}" ]

deps = [
":$bin_gen_target_name",
]
deps = [ ":$bin_gen_target_name" ]
}

copy_all_target_name = target_name + "_all_copy"
Expand All @@ -169,8 +146,6 @@ template("mac_app") {
# Top level group

group(target_name) {
deps = [
":$copy_all_target_name",
]
deps = [ ":$copy_all_target_name" ]
}
}
6 changes: 4 additions & 2 deletions build/config/sysroot.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ if (current_toolchain == default_toolchain && target_sysroot != "") {
} else if (is_linux && !is_chromeos) {
if (use_default_linux_sysroot && !is_fuchsia) {
if (current_cpu == "x64") {
sysroot = rebase_path("//build/linux/debian_sid_amd64-sysroot", root_build_dir)
sysroot =
rebase_path("//build/linux/debian_sid_amd64-sysroot", root_build_dir)
} else {
sysroot = rebase_path("//build/linux/debian_sid_arm64-sysroot", root_build_dir)
sysroot =
rebase_path("//build/linux/debian_sid_arm64-sysroot", root_build_dir)
}
assert(
exec_script("//build/dir_exists.py", [ sysroot ], "string") == "True",
Expand Down
4 changes: 1 addition & 3 deletions build/config/templates/templates.gni
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ template("file_template") {
script = "//build/android/gyp/jinja_template.py"
depfile = "$target_gen_dir/$target_name.d"

sources = [
invoker.input,
]
sources = [ invoker.input ]
outputs = [
invoker.output,
depfile,
Expand Down
2 changes: 1 addition & 1 deletion build/secondary/third_party/glfw/glfw_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# found in the LICENSE file.

declare_args() {
glfw_vulkan_library=""
glfw_vulkan_library = ""
}
71 changes: 36 additions & 35 deletions build/secondary/third_party/vulkan_validation_layers/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,27 @@ config("vulkan_layer_config") {
}

core_validation_sources = [
"$_checkout_dir/layers/utils/android_ndk_types.h",
"$_checkout_dir/layers/utils/convert_to_renderpass2.cpp",
"$_checkout_dir/layers/utils/convert_to_renderpass2.h",
"$_checkout_dir/layers/containers/qfo_transfer.h",
"$_checkout_dir/layers/containers/range_vector.h",
"$_checkout_dir/layers/containers/subresource_adapter.cpp",
"$_checkout_dir/layers/containers/subresource_adapter.h",
"$_checkout_dir/layers/core_checks/cc_android.cpp",
"$_checkout_dir/layers/core_checks/cc_buffer.cpp",
"$_checkout_dir/layers/core_checks/cc_buffer_address.h",
"$_checkout_dir/layers/core_checks/cc_cmd_buffer_dynamic.cpp",
"$_checkout_dir/layers/core_checks/cc_cmd_buffer.cpp",
"$_checkout_dir/layers/core_checks/cc_cmd_buffer_dynamic.cpp",
"$_checkout_dir/layers/core_checks/cc_copy_blit_resolve.cpp",
"$_checkout_dir/layers/core_checks/core_validation.h",
"$_checkout_dir/layers/core_checks/cc_descriptor.cpp",
"$_checkout_dir/layers/core_checks/cc_device_memory.cpp",
"$_checkout_dir/layers/core_checks/cc_device.cpp",
"$_checkout_dir/layers/core_checks/cc_device_memory.cpp",
"$_checkout_dir/layers/core_checks/cc_drawdispatch.cpp",
"$_checkout_dir/layers/core_checks/cc_external_object.cpp",
"$_checkout_dir/layers/core_checks/cc_image.cpp",
"$_checkout_dir/layers/core_checks/cc_image_layout.cpp",
"$_checkout_dir/layers/core_checks/cc_pipeline.cpp",
"$_checkout_dir/layers/core_checks/cc_pipeline_compute.cpp",
"$_checkout_dir/layers/core_checks/cc_pipeline_graphics.cpp",
"$_checkout_dir/layers/core_checks/cc_pipeline_ray_tracing.cpp",
"$_checkout_dir/layers/core_checks/cc_pipeline.cpp",
"$_checkout_dir/layers/core_checks/cc_query.cpp",
"$_checkout_dir/layers/core_checks/cc_queue.cpp",
"$_checkout_dir/layers/core_checks/cc_ray_tracing.cpp",
Expand All @@ -136,6 +136,7 @@ core_validation_sources = [
"$_checkout_dir/layers/core_checks/cc_video.cpp",
"$_checkout_dir/layers/core_checks/cc_wsi.cpp",
"$_checkout_dir/layers/core_checks/cc_ycbcr.cpp",
"$_checkout_dir/layers/core_checks/core_validation.h",
"$_checkout_dir/layers/error_message/core_error_location.cpp",
"$_checkout_dir/layers/error_message/core_error_location.h",
"$_checkout_dir/layers/error_message/validation_error_enums.h",
Expand All @@ -158,8 +159,6 @@ core_validation_sources = [
"$_checkout_dir/layers/gpu_validation/gpu_validation.cpp",
"$_checkout_dir/layers/gpu_validation/gpu_validation.h",
"$_checkout_dir/layers/gpu_validation/gpu_vuids.h",
"$_checkout_dir/layers/containers/qfo_transfer.h",
"$_checkout_dir/layers/containers/range_vector.h",
"$_checkout_dir/layers/state_tracker/base_node.cpp",
"$_checkout_dir/layers/state_tracker/base_node.h",
"$_checkout_dir/layers/state_tracker/buffer_state.cpp",
Expand Down Expand Up @@ -188,22 +187,23 @@ core_validation_sources = [
"$_checkout_dir/layers/state_tracker/render_pass_state.cpp",
"$_checkout_dir/layers/state_tracker/render_pass_state.h",
"$_checkout_dir/layers/state_tracker/sampler_state.h",
"$_checkout_dir/layers/state_tracker/shader_module.cpp",
"$_checkout_dir/layers/state_tracker/shader_module.h",
"$_checkout_dir/layers/state_tracker/shader_instruction.cpp",
"$_checkout_dir/layers/state_tracker/shader_instruction.h",
"$_checkout_dir/layers/state_tracker/shader_module.cpp",
"$_checkout_dir/layers/state_tracker/shader_module.h",
"$_checkout_dir/layers/state_tracker/state_tracker.cpp",
"$_checkout_dir/layers/state_tracker/state_tracker.h",
"$_checkout_dir/layers/state_tracker/video_session_state.cpp",
"$_checkout_dir/layers/state_tracker/video_session_state.h",
"$_checkout_dir/layers/containers/subresource_adapter.cpp",
"$_checkout_dir/layers/containers/subresource_adapter.h",
"$_checkout_dir/layers/sync/sync_utils.cpp",
"$_checkout_dir/layers/sync/sync_utils.h",
"$_checkout_dir/layers/sync/sync_vuid_maps.cpp",
"$_checkout_dir/layers/sync/sync_vuid_maps.h",
"$_checkout_dir/layers/sync/sync_validation.cpp",
"$_checkout_dir/layers/sync/sync_validation.h",
"$_checkout_dir/layers/sync/sync_vuid_maps.cpp",
"$_checkout_dir/layers/sync/sync_vuid_maps.h",
"$_checkout_dir/layers/utils/android_ndk_types.h",
"$_checkout_dir/layers/utils/convert_to_renderpass2.cpp",
"$_checkout_dir/layers/utils/convert_to_renderpass2.h",
]

object_lifetimes_sources = [
Expand All @@ -214,13 +214,13 @@ object_lifetimes_sources = [
]

stateless_validation_sources = [
"$_checkout_dir/layers/generated/enum_flag_bits.h",
"$_checkout_dir/layers/generated/parameter_validation.cpp",
"$_checkout_dir/layers/generated/parameter_validation.h",
"$_checkout_dir/layers/generated/enum_flag_bits.h",
"$_checkout_dir/layers/stateless/parameter_name.h",
"$_checkout_dir/layers/stateless/sl_buffer.cpp",
"$_checkout_dir/layers/stateless/sl_cmd_buffer_dynamic.cpp",
"$_checkout_dir/layers/stateless/sl_cmd_buffer.cpp",
"$_checkout_dir/layers/stateless/sl_cmd_buffer_dynamic.cpp",
"$_checkout_dir/layers/stateless/sl_descriptor.cpp",
"$_checkout_dir/layers/stateless/sl_device_memory.cpp",
"$_checkout_dir/layers/stateless/sl_external_object.cpp",
Expand All @@ -245,6 +245,7 @@ unique_objects_sources = []
best_practices_sources = [
"$_checkout_dir/layers/best_practices/best_practices_error_enums.h",
"$_checkout_dir/layers/best_practices/best_practices_utils.cpp",
"$_checkout_dir/layers/best_practices/best_practices_validation.h",
"$_checkout_dir/layers/best_practices/bp_buffer.cpp",
"$_checkout_dir/layers/best_practices/bp_cmd_buffer.cpp",
"$_checkout_dir/layers/best_practices/bp_copy_blit_resolve.cpp",
Expand All @@ -260,7 +261,6 @@ best_practices_sources = [
"$_checkout_dir/layers/best_practices/bp_synchronization.cpp",
"$_checkout_dir/layers/best_practices/bp_video.cpp",
"$_checkout_dir/layers/best_practices/bp_wsi.cpp",
"$_checkout_dir/layers/best_practices/best_practices_validation.h",
"$_checkout_dir/layers/generated/best_practices.cpp",
"$_checkout_dir/layers/generated/best_practices.h",
]
Expand All @@ -271,21 +271,21 @@ debug_printf_sources = [
]

chassis_sources = [
"$vulkan_headers_dir/include/vulkan/vk_layer.h",
"$vulkan_headers_dir/include/vulkan/vulkan.h",
"$_checkout_dir/layers/generated/chassis.cpp",
"$_checkout_dir/layers/generated/valid_param_values.cpp",
"$_checkout_dir/layers/generated/valid_param_values.h",
"$_checkout_dir/layers/generated/chassis.h",
"$_checkout_dir/layers/generated/chassis_dispatch_helper.h",
"$_checkout_dir/layers/generated/layer_chassis_dispatch.cpp",
"$_checkout_dir/layers/generated/layer_chassis_dispatch.h",
"$_checkout_dir/layers/generated/valid_param_values.cpp",
"$_checkout_dir/layers/generated/valid_param_values.h",
"$_checkout_dir/layers/generated/vk_dispatch_table_helper.h",
"$_checkout_dir/layers/generated/vk_extension_helper.h",
"$_checkout_dir/layers/generated/vk_safe_struct.cpp",
"$_checkout_dir/layers/layer_options.cpp",
"$_checkout_dir/layers/layer_options.h",
"$_checkout_dir/layers/vk_layer_settings_ext.h",
"$vulkan_headers_dir/include/vulkan/vk_layer.h",
"$vulkan_headers_dir/include/vulkan/vulkan.h",
]

layers = [ [
Expand Down Expand Up @@ -351,10 +351,12 @@ source_set("vulkan_layer_utils") {
"$_checkout_dir/layers/generated",
]
sources = [
"$vulkan_headers_dir/include/vulkan/vk_layer.h",
"$vulkan_headers_dir/include/vulkan/vulkan.h",
"$_checkout_dir/layers/utils/android_ndk_types.h",
"$_checkout_dir/layers/utils/cast_utils.h",
"$_checkout_dir/layers/containers/custom_containers.h",
"$_checkout_dir/layers/containers/sparse_containers.h",
"$_checkout_dir/layers/error_message/logging.cpp",
"$_checkout_dir/layers/error_message/logging.h",
"$_checkout_dir/layers/external/xxhash.cpp",
"$_checkout_dir/layers/external/xxhash.h",
"$_checkout_dir/layers/generated/vk_enum_string_helper.h",
"$_checkout_dir/layers/generated/vk_extension_helper.h",
"$_checkout_dir/layers/generated/vk_format_utils.cpp",
Expand All @@ -364,20 +366,18 @@ source_set("vulkan_layer_utils") {
"$_checkout_dir/layers/generated/vk_safe_struct.h",
"$_checkout_dir/layers/generated/vk_typemap_helper.h",
"$_checkout_dir/layers/generated/vk_validation_error_messages.h",
"$_checkout_dir/layers/utils/android_ndk_types.h",
"$_checkout_dir/layers/utils/cast_utils.h",
"$_checkout_dir/layers/utils/hash_util.h",
"$_checkout_dir/layers/utils/hash_vk_types.h",
"$_checkout_dir/layers/containers/sparse_containers.h",
"$_checkout_dir/layers/containers/custom_containers.h",
"$_checkout_dir/layers/vk_layer_config.cpp",
"$_checkout_dir/layers/vk_layer_config.h",
"$_checkout_dir/layers/utils/vk_layer_extension_utils.cpp",
"$_checkout_dir/layers/utils/vk_layer_extension_utils.h",
"$_checkout_dir/layers/error_message/logging.h",
"$_checkout_dir/layers/error_message/logging.cpp",
"$_checkout_dir/layers/utils/vk_layer_utils.cpp",
"$_checkout_dir/layers/utils/vk_layer_utils.h",
"$_checkout_dir/layers/external/xxhash.cpp",
"$_checkout_dir/layers/external/xxhash.h",
"$_checkout_dir/layers/vk_layer_config.cpp",
"$_checkout_dir/layers/vk_layer_config.h",
"$vulkan_headers_dir/include/vulkan/vk_layer.h",
"$vulkan_headers_dir/include/vulkan/vulkan.h",
]
defines = [ "XXH_NO_LONG_LONG" ]
public_configs = [
Expand Down Expand Up @@ -433,6 +433,7 @@ foreach(layer_info, layers) {
} else {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]

# The following line is what has to change to fix chromium compilation.
configs -= [ "//build/config/compiler:no_rtti" ]
configs += [ "//build/config/compiler:rtti" ]
Expand Down Expand Up @@ -463,7 +464,7 @@ foreach(layer_info, layers) {
}
if (is_android) {
libs = [
"c++", # Note: C++ added by Flutter.
"c++", # Note: C++ added by Flutter.
"log",
"nativewindow",
]
Expand Down
Loading

0 comments on commit 5d60bd2

Please sign in to comment.