From a37466879880f2e9ba862be24ff0ac618a8cbadb Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Tue, 5 Aug 2025 16:06:14 -0700 Subject: [PATCH] licenses_cpp: moved is_minimal_linux to pkgconfig usage (#173248) addresses feedback from https://github.com/flutter/flutter/pull/173139#pullrequestreview-3080740288 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --- .../src/flutter/shell/platform/glfw/BUILD.gn | 2 +- .../src/flutter/shell/platform/linux/BUILD.gn | 24 +++++------ .../shell/platform/linux/config/BUILD.gn | 40 +++++++++++++------ engine/src/flutter/testing/BUILD.gn | 2 +- 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/engine/src/flutter/shell/platform/glfw/BUILD.gn b/engine/src/flutter/shell/platform/glfw/BUILD.gn index 2e16053228b..59735b59763 100644 --- a/engine/src/flutter/shell/platform/glfw/BUILD.gn +++ b/engine/src/flutter/shell/platform/glfw/BUILD.gn @@ -63,7 +63,7 @@ source_set("flutter_glfw") { "//flutter/third_party/rapidjson", ] - if (is_linux && !is_minimal_linux) { + if (is_linux) { libs = [ "GL" ] configs += [ "//flutter/shell/platform/linux/config:x11" ] diff --git a/engine/src/flutter/shell/platform/linux/BUILD.gn b/engine/src/flutter/shell/platform/linux/BUILD.gn index f4e609c0e64..919e807b926 100644 --- a/engine/src/flutter/shell/platform/linux/BUILD.gn +++ b/engine/src/flutter/shell/platform/linux/BUILD.gn @@ -96,9 +96,7 @@ source_set("flutter_linux_sources") { "key_mapping.h", ] - if (!is_minimal_linux) { - configs += [ "//flutter/shell/platform/linux/config:gtk" ] - } + configs += [ "//flutter/shell/platform/linux/config:gtk" ] sources = [ "fl_accessible_node.cc", @@ -184,12 +182,10 @@ source_set("flutter_linux_sources") { } source_set("flutter_linux") { - if (!is_minimal_linux) { - configs += [ - "//flutter/shell/platform/linux/config:gtk", - "//flutter/shell/platform/linux/config:epoxy", - ] - } + configs += [ + "//flutter/shell/platform/linux/config:gtk", + "//flutter/shell/platform/linux/config:epoxy", + ] defines = [ "FLUTTER_ENGINE_NO_PROTOTYPES" ] @@ -275,12 +271,10 @@ executable("flutter_linux_unittests") { public_configs = [ "//flutter:config" ] - if (!is_minimal_linux) { - configs += [ - "//flutter/shell/platform/linux/config:gtk", - "//flutter/shell/platform/linux/config:epoxy", - ] - } + configs += [ + "//flutter/shell/platform/linux/config:gtk", + "//flutter/shell/platform/linux/config:epoxy", + ] defines = [ "FLUTTER_ENGINE_NO_PROTOTYPES", diff --git a/engine/src/flutter/shell/platform/linux/config/BUILD.gn b/engine/src/flutter/shell/platform/linux/config/BUILD.gn index da0ac056bc5..e6f5abbea33 100644 --- a/engine/src/flutter/shell/platform/linux/config/BUILD.gn +++ b/engine/src/flutter/shell/platform/linux/config/BUILD.gn @@ -5,18 +5,32 @@ import("//build/config/linux/pkg_config.gni") import("//flutter/shell/platform/glfw/config.gni") -pkg_config("x11") { - packages = [ "x11" ] -} +_pkg_configs = [ + { + name = "x11" + package = "x11" + }, + { + name = "gtk" + package = "gtk+-3.0" + }, + { + name = "egl" + package = "egl" + }, + { + name = "epoxy" + package = "epoxy" + }, +] -pkg_config("gtk") { - packages = [ "gtk+-3.0" ] -} - -pkg_config("egl") { - packages = [ "egl" ] -} - -pkg_config("epoxy") { - packages = [ "epoxy" ] +foreach(pkg, _pkg_configs) { + if (!is_minimal_linux) { + pkg_config(pkg.name) { + packages = [ pkg.package ] + } + } else { + config(pkg.name) { + } + } } diff --git a/engine/src/flutter/testing/BUILD.gn b/engine/src/flutter/testing/BUILD.gn index 7f612289bb4..1a21ac33669 100644 --- a/engine/src/flutter/testing/BUILD.gn +++ b/engine/src/flutter/testing/BUILD.gn @@ -51,7 +51,7 @@ source_set("testing") { sources = [ "run_all_unittests.cc" ] - if (enable_unittests && is_linux && !is_minimal_linux) { + if (enable_unittests && is_linux) { # So that we can call gtk_init in main(). configs += [ "//flutter/shell/platform/linux/config:gtk" ] }