mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
e0c42c6e38
14 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
![]() |
5fd7aa2ed7
|
Reverts "Make build_android_host_app_with_module_aar build using an aar (#169171)" (#169287)
<!-- start_original_pr_link --> Reverts: flutter/flutter#169171 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: gmackall <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: this is failing on presubmits of prs that make engine changes, presumably due to some missing gradle configuration to handle that special case in resolving the engine binaries. <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: gmackall <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {mboetger} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: Fixes https://github.com/flutter/flutter/issues/169165. `build_android_host_app_with_module_aar` was unfortunately not depending on the module as an aar, but as source (something we have a different test for, and something that you would not expect given the name of the test 🤦 ) ## 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. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [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 <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com> |
||
![]() |
f9795d6f2d
|
Make build_android_host_app_with_module_aar build using an aar (#169171)
Fixes https://github.com/flutter/flutter/issues/169165. `build_android_host_app_with_module_aar` was unfortunately not depending on the module as an aar, but as source (something we have a different test for, and something that you would not expect given the name of the test 🤦 ) ## 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. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [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 --------- Co-authored-by: Gray Mackall <mackall@google.com> |
||
![]() |
16fc684886
|
Fix build_android_host_app_with_module_source device lab tests (#166077)
Fixes a type error where String was expected but JavaVersion was inferred. |
||
![]() |
7cb926a33d
|
Reapply "[ Device Lab ] Upgrade Device Lab projects to Java 18" (#166016) (#166059)
This reverts commit
|
||
![]() |
8dccbc33df
|
Revert "[ Device Lab ] Upgrade Device Lab projects to Java 18" (#166016)
Reverts flutter/flutter#165987 Reason for revert: multiple gradlew failures on devicelab tests |
||
![]() |
c376ca22dd
|
[ Device Lab ] Upgrade Device Lab projects to Java 18 (#165987)
Should resolve issues related to the following messages being output on stderr: ``` warning: [options] source value 8 is obsolete and will be removed in a future release" warning: [options] target value 8 is obsolete and will be removed in a future release warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. ``` Fixes https://github.com/flutter/flutter/issues/165973 |
||
![]() |
72c2447307
|
android_host_app_v2_embedding update dependencies and documentation (#164195)
Related to #149836 Last of the non api 35 references in flutter/flutter for targetSdk and compileSdk. `find . -type f -name "build.gradle" | xargs grep -e "targetSdk" | tr -d '=' | tr -s ' ' | grep -v flutter\.targetSdkVersion | grep -v engine/src/flutter/third_party/ | grep -v "targetSdk 35"` `find . -type f -name "build.gradle" | xargs grep -e "compileSdk" | tr -d '=' | tr -s ' ' | grep -v flutter\.compileSdkVersion | grep -v engine/src/flutter/third_party/ | grep -v "compileSdk 35"` rewrite of https://github.com/flutter/flutter/pull/163622 after this test was updated to run against a newer version of gradle and agp in https://github.com/flutter/flutter/pull/163849/files#diff-83b6ad7c016bffbb682664eb65c576a7ebf9c312fc60727c0e0e20f5641cbc2aR462 Android-API-And-Related-Versions.md was updated to reflect that after further investigation that android is using "=" in their documentation and that the space syntax is discouraged. Equals is setting a property and space is the equivalent to a function call like `compileSdk(35)` and assignment is prefered. The use of equals for proprty assignment also aligns with https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html#prepare_your_groovy_scripts ## 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. |
||
![]() |
1f257c4a85
|
pure_android_host_apps/android_host_app_v2_embedding multiple gradle and AGP versions (#163849)
Fixes #163750 Adds local.properties in any directory to the repo wide gitignore. Test changes to make the test easier to debug, specifically identifying the difference between a debug and release failure. ## 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. |
||
![]() |
e2c4ba31b8
|
pure_android_host_apps android versions update (#163617)
- **update pure_android_host_apps/android_custom_host_app to compileSdk/targetSdk 35, newest stable agp and gradle versions, update source compatibility to java 17, updated dependencies** - **Update documentation and migrate compileSdkVersion to compileSdk** - **Update gitignore to ignore specific module folder name and local.properties repo wide** Related to #149836 ## 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. [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 |
||
![]() |
404655aae1
|
Update gradle memory properties in example and test projects (#163798)
Match the example and integration test apps to the the properties in the `flutter create` template, updated in https://github.com/flutter/flutter/pull/156201. We discussed perhaps making this an auto-migration for existing Flutter apps (if they've never edited the template from the old values), but it probably makes sense for devs to manage this themselves depending on how beefy the machine they are running on is. Filed https://github.com/flutter/flutter/issues/163801 to show a nicer message when the user hits this so they can manage `java.lang.OutOfMemoryError: Java heap space` errors themselves. Speculatively hoping this helps with the `Java heap space` build test flakes https://github.com/flutter/flutter/issues/163121#issuecomment-2665783740 ## 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]. <!-- Links --> [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 |
||
![]() |
2948917a47
|
[Reland] Force automatic ndk download when building for Android (#160260)
Relands https://github.com/flutter/flutter/pull/159756. The original caused some stderr because 1. the configurable `ndkVersion` value that AGP provides used to be null by default. 2. Now it is not, instead it has a default value 3. `integration_test` doesn't actually use the NDK, but default for `integration_test` was higher that `flutter.ndkVersion` 4. We have code that checks if a plugin uses a higher ndk version and tells you to consider upgrading https://github.com/flutter/flutter/blob/master/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy#L921 This reverts the revert, and then aligns `integration_test`'s NDK version (which again, it doesn't actually use, so I'm not too concerned about the downgrade) with `flutter.ndkVersion`. It also starts using the `flutter.min/compile/ndkVersion` values in `integration_test`, which was unrelated to the original pr. Can remove if you think it should land separately. ## 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]. - [ ] 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. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [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 --------- Co-authored-by: Gray Mackall <mackall@google.com> |
||
![]() |
5cd440f6ec
|
Reverts "Force automatic ndk download when building for Android (#159756)" (#160205)
<!-- start_original_pr_link --> Reverts: flutter/flutter#159756 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: gmackall <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: Made the tree red due to some std out. <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: gmackall <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {reidbaker} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: In preparation for changing engine builds to be unstripped by default https://github.com/flutter/engine/pull/52852, which will allow us to make progress towards resolving https://github.com/flutter/flutter/issues/60240. Tricks AGP in to downloading the NDK when building a flutter app (that uses the FGP, which to my knowledge is all ways of building flutter apk/aab/aar). I want to follow this up by modifying the tool to search for the log line that the NDK is missing (making it throw an error in that case) as a safeguard, because that would be the last line of defense before we accidentally build a bloated app. The safeguard won't work for add to app, from what I understand, because while they use the FGP (so they should be forced to be download the NDK) they don't invoke the flutter tool, and therefore won't invoke the custom error handling of [`gradle_errors.dart`](https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle_errors.dart) Some details 1. Respects existing values for `externalNativeBuild.cmake.path` for apps that actually use it. 2. Silences some warnings that would otherwise appear for add to app builds or builds that manually invoke gradle: ``` C/C++: CMake Warning (dev) in CMakeLists.txt: C/C++: No project() command is present. The top-level CMakeLists.txt file must C/C++: contain a literal, direct call to the project() command. Add a line of C/C++: code such as C/C++: project(ProjectName) C/C++: near the top of the file, but after cmake_minimum_required(). C/C++: CMake is pretending there is a "project(Project)" command on the first C/C++: line. C/C++: This warning is for project developers. Use -Wno-dev to suppress it. C/C++: CMake Warning: C/C++: Manually-specified variables were not used by the project: C/C++: CMAKE_EXPORT_COMPILE_COMMANDS C/C++: CMAKE_LIBRARY_OUTPUT_DIRECTORY C/C++: CMAKE_RUNTIME_OUTPUT_DIRECTORY ``` 3. Our ci installs the NDK at an abnormal place that AGP can't find without help. I've modified all the `build.gradle`s that we have checked in to point to the pre-installed path. **But some of our tests make a new app from the templates, and those tests will now start downloading the NDK** (as they won't be able to find it at it's current path from templates). We could resolve this by actually fixing https://github.com/flutter/flutter/issues/136666. This would be a very significant lift from what I understand - we rely on this hardcoding in a lot of places in our infra. Fixes https://github.com/flutter/flutter/issues/155576 ## 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. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [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 <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com> |
||
![]() |
99786b413f
|
Force automatic ndk download when building for Android (#159756)
In preparation for changing engine builds to be unstripped by default https://github.com/flutter/engine/pull/52852, which will allow us to make progress towards resolving https://github.com/flutter/flutter/issues/60240. Tricks AGP in to downloading the NDK when building a flutter app (that uses the FGP, which to my knowledge is all ways of building flutter apk/aab/aar). I want to follow this up by modifying the tool to search for the log line that the NDK is missing (making it throw an error in that case) as a safeguard, because that would be the last line of defense before we accidentally build a bloated app. The safeguard won't work for add to app, from what I understand, because while they use the FGP (so they should be forced to be download the NDK) they don't invoke the flutter tool, and therefore won't invoke the custom error handling of [`gradle_errors.dart`](https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle_errors.dart) Some details 1. Respects existing values for `externalNativeBuild.cmake.path` for apps that actually use it. 2. Silences some warnings that would otherwise appear for add to app builds or builds that manually invoke gradle: ``` C/C++: CMake Warning (dev) in CMakeLists.txt: C/C++: No project() command is present. The top-level CMakeLists.txt file must C/C++: contain a literal, direct call to the project() command. Add a line of C/C++: code such as C/C++: project(ProjectName) C/C++: near the top of the file, but after cmake_minimum_required(). C/C++: CMake is pretending there is a "project(Project)" command on the first C/C++: line. C/C++: This warning is for project developers. Use -Wno-dev to suppress it. C/C++: CMake Warning: C/C++: Manually-specified variables were not used by the project: C/C++: CMAKE_EXPORT_COMPILE_COMMANDS C/C++: CMAKE_LIBRARY_OUTPUT_DIRECTORY C/C++: CMAKE_RUNTIME_OUTPUT_DIRECTORY ``` 3. Our ci installs the NDK at an abnormal place that AGP can't find without help. I've modified all the `build.gradle`s that we have checked in to point to the pre-installed path. **But some of our tests make a new app from the templates, and those tests will now start downloading the NDK** (as they won't be able to find it at it's current path from templates). We could resolve this by actually fixing https://github.com/flutter/flutter/issues/136666. This would be a very significant lift from what I understand - we rely on this hardcoding in a lot of places in our infra. Fixes https://github.com/flutter/flutter/issues/155576 ## 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. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [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 --------- Co-authored-by: Gray Mackall <mackall@google.com> |
||
![]() |
d1d9954c45
|
Support host android apps with kts gradle files for add to app (#156502)
Allows applying of `include_flutter.groovy` via the `apply from:` syntax, which allows using a host app that is using the Gradle Kotlin DSL (the default these days when creating an Android app in AS). Explanation: The `include_flutter.groovy` script is currently not able to be called by Kotlin gradle files, because it is [intended to be invoked with the following lines](https://docs.flutter.dev/add-to-app/android/project-setup#depend-on-the-modules-source-code): ``` setBinding(new Binding([gradle: this])) // new evaluate(new File( // new settingsDir.parentFile, // new 'flutter_module/.android/include_flutter.groovy' // new )) ``` `setBinding` isn't part of the Kotlin gradle DSL, and there isn't (that I can find) an easy Kotlin equivalent. If this binding isn't set, the reference to `gradle` in `include_flutter.groovy` is wrong, which breaks the script. This PR modifies `include_flutter.groovy` to also support being invoked through the standard way of invoking a script via the Gradle Groovy/Kotlin DSLs, which is `apply from:` (or it's slightly different Kotlin syntax). The start of the script identifies which of the two approaches is being used by checking if the binding is set, and then initializes some variables differently depending on the case. If we land this, I believe we should update the example Gradle files for both the `kts` and `groovy` cases to prefer the `apply from` syntax as I think this is the syntax most developers would be more familiar with already seeing in their Gradle files. |