Commit Graph

117 Commits

Author SHA1 Message Date
Andrew Kolos
5b2f658ff5
Revert "[tool] Move Java functions to their own file" (#126569)
Reverts flutter/flutter#126086.

This PR changed the interfaces of some classes, namely `AndroidSdk`, and deleted a global.

These classes had custom overrides in g3 that were not updated with a g3fix, so this PR has broken tests. See https://b.corp.google.com/issues/281945232 (non-public link)
2023-05-11 17:06:57 +00:00
Andrew Kolos
0a63cd70f1
[tool] Move Java functions to their own file (#126086)
This is the first step in unifying Java-finding logic across the tool. If curious, see #126029 for an example of what all the changes will probably entail.

Moves java-related functionality like `AndroidSdk.findJavaHome` to a new class, `Java`.

See tracking issue https://github.com/flutter/flutter/issues/126126 for more.
2023-05-11 04:32:25 +00:00
chunhtai
b00f1c4599
Adding vmservice to get iOS app settings (#123156)
fixes https://github.com/flutter/flutter/issues/120405
2023-05-04 22:14:11 +00:00
Reid Baker
2383400fe0
Add Java-Gradle-AGP validation to flutter analyze (#123916)
https://github.com/flutter/flutter/issues/123917

Doc covering a broad set of issues related to android studio updating. 

https://docs.google.com/document/d/1hTXkjbUrBnXgu8NQsth1c3aEqo77rWoEj8CcsQ39wwQ/edit?pli=1#

Specifically this pr: 
- Adds new functions to find a projects AGP, Gradle and java versions,
and tests.
- Adds new functions that take versions and parse if the versions are
compatible with each other, and tests.
- Adds validator for `flutter analyze --suggestions` that evaluates the
java/gradle/agp versions and checks if they are compatible, and
integration test.
- Updates the version of gradle used by
dev/integration_tests/flutter_gallery/ to the minimum supported by java
18 so that the integration tests pass (It is unknown why the java
version is 18.9 instead of 11)
- Moves `isWithinVersionRange` to version.dart, and tests. 
- Adds FakeAndroidStudio to fakes to be used in multiple tests but does
not remove existing copies.

Metrics will be included as part of the definition of done for this bug
but not as part of this cl. It is already too big.

Known work still left in this pr: 
* Understand why analyze integration tests are failing. 


Example output if Java and gradle are not compatible: 
```
┌───────────────────────────────────────────────────────────────────┐
│ General Info                                                      │
│ [✓] App Name: espresso_example                                    │
│ [✓] Supported Platforms: android                                  │
│ [✓] Is Flutter Package: yes                                       │
│ [✓] Uses Material Design: yes                                     │
│ [✓] Is Plugin: no                                                 │
│ [✗] Java/Gradle/Android Gradle Plugin:                            │
│                                                                   │
│ Incompatible Java/Gradle versions.                                │
│                                                                   │
│ Java Version: 17.0.6, Gradle Version: 7.0.2                       │
│                                                                   │
│ See the link below for more information.                          │
│ https://docs.gradle.org/current/userguide/compatibility.html#java │
│                                                                   │
└───────────────────────────────────────────────────────────────────┘
```
Example output if Gradle and AGP are not compatible
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ General Info                                                                │
│ [✓] App Name: espresso_example                                              │
│ [✓] Supported Platforms: android                                            │
│ [✓] Is Flutter Package: yes                                                 │
│ [✓] Uses Material Design: yes                                               │
│ [✓] Is Plugin: no                                                           │
│ [✗] Java/Gradle/Android Gradle Plugin: Incompatible Gradle/AGP versions.    │
│                                                                             │
│ Gradle Version: 7.0.2, AGP Version: 7.4.2                                   │
│                                                                             │
│ Update gradle to at least "7.5".                                            │
│ See the link below for more information:                                    │
│ https://developer.android.com/studio/releases/gradle-plugin#updating-gradle │
│                                                                             │
│ Incompatible Java/Gradle versions.                                          │
│                                                                             │
│ Java Version: 17.0.6, Gradle Version: 7.0.2                                 │
│                                                                             │
│ See the link below for more information:                                    │
│ https://docs.gradle.org/current/userguide/compatibility.html#java           │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
```
Example output if Java/Gradle/Agp are not compatible. 
```

┌─────────────────────────────────────────────────────────────────────────────┐
│ General Info                                                                │
│ [✓] App Name: espresso_example                                              │
│ [✓] Supported Platforms: android                                            │
│ [✓] Is Flutter Package: yes                                                 │
│ [✓] Uses Material Design: yes                                               │
│ [✓] Is Plugin: no                                                           │
│ [✗] Java/Gradle/Android Gradle Plugin: Incompatible Gradle/AGP versions.    │
│                                                                             │
│ Gradle Version: 7.0.2, AGP Version: 7.4.2                                   │
│                                                                             │
│ Update gradle to at least "7.5".                                            │
│ See the link below for more information:                                    │
│ https://developer.android.com/studio/releases/gradle-plugin#updating-gradle │
│                                                                             │
│ Incompatible Java/Gradle versions.                                          │
│                                                                             │
│ Java Version: 17.0.6, Gradle Version: 7.0.2                                 │
│                                                                             │
│ See the link below for more information:                                    │
│ https://docs.gradle.org/current/userguide/compatibility.html#java           │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
```

Commit messages
- Add function to gradle_utils.dart that gets the gradle version from
wrapper or system and add a test for each situation
- Add method to get agp version, add method to validate agp against
gradle version, update documentation, add tests for agp validation.
- Update dart doc for validateGradleAndAgp to describe where the info
came from and corner case behavior, create function to validate java and
gradle and hardcode return to false
- Fill out and test java gradle compatibility function in gradle_utils
- Hook up java gradle evaluateion to hasValidJavaGradleAgpVersions with
hardcoded java version
- Add java --version output parsing and tests
- Add getJavaBinary test
- Update comment in android_sdk for mac behavior with java_home -v

## 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].
- [ ] All existing and new tests are passing.
2023-04-05 14:36:05 -04:00
Victoria Ashworth
378387b139
when getting xcworkspace, exclude hidden files (#114099)
* exclude xcworkspace that begins with a period

* fix if spacing, add comment

* add unit test for when no xcworkspace found

* update to use xcodeWorkspace, make it nullable and refactor

* check if hostAppRoot exists before trying to get xcworkspace

* use local variables to take advantage of type promotion

* only check if not null, don't need to check if exists

* readd exist check for migrate

* readd missing line at end of file
2022-11-07 18:48:52 +00:00
Victoria Ashworth
8aad1190b7
Check for watch companion in build settings (#114078) 2022-10-27 22:05:05 +00:00
Jenn Magder
9f5c6553bc
Revert "Check for watch companion in build settings (#113956)" (#114035)
This reverts commit e13372188f.
2022-10-25 13:33:35 -07:00
Victoria Ashworth
e13372188f
Check for watch companion in build settings (#113956) 2022-10-25 20:08:19 +00:00
Alex Wallen
92d8b04bac
[macOS] Flavors project throws no flavor specified for creating a project. (#113979) 2022-10-25 19:50:50 +00:00
Jonah Williams
d6dd832d0f
[flutter_tools] migrate gradle errors and project test to null safety (#110530) 2022-08-29 19:47:16 +00:00
Gary Qian
762c92ead9
Remove doc for --ignore-deprecation and check for pubspec before v1 embedding check (#108523) 2022-07-28 20:48:05 -07:00
Christopher Fujino
cadb264d26
[flutter_tools] Catch more general XmlException rather than XmlParserException (#107574) 2022-07-13 22:38:07 +00:00
Anurag Roy
e6f69add99
[flutter_tools] Replace android v2 embedding broken doc link (#107456) 2022-07-12 20:31:07 +00:00
Jenn Magder
3f1f0a8170
Add flutter build macos-framework command (#105242) 2022-06-03 10:13:08 -07:00
Jenn Magder
36be63ba19
Embed Flutter and App frameworks for add-to-app on iOS (#102538) 2022-05-02 10:44:12 -07:00
Alexandre Ardhuin
07f1c20474
add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
Lau Ching Jun
d7688ca093
Change all instance of throwing strings to throw specific error classes. (#97325) 2022-02-02 10:45:18 -08:00
stuartmorgan
2dd8cb1ca2
Don't use example folder as a project type signal (#97157)
The code to generate platform files used to use the presence of an
'example' folder to determine whether or not a project was a plugin (in
which case that generation is bypassed). Later, robust detection was
added based on the pubspec.yaml `plugin` key, but the old check was left
in place. This creates false positives where people who add an example
folder to their app project start getting mysterious failures.

Since the pubspec check is definitive, there's no reason to continue to
use the presence of `example` as an indicator at all.

Fixes https://github.com/flutter/flutter/issues/87007
2022-01-24 19:28:38 -08:00
Jenn Magder
0287449c14
Do not show v1 Android embedding message for non-Android commands (#96148) 2022-01-05 12:55:10 -08:00
Gary Qian
da4e997ed3
Short circuit v1 deprecation warning on plugin projects (#94769) 2021-12-07 01:53:50 -08:00
Gary Qian
dd6a11b7aa
Add reason logging to v1 embedding warning message (#94636) 2021-12-06 14:21:58 -08:00
Andrei Diaconu
924336fcee
Reland 3: Display Features (#93240) 2021-11-20 15:48:06 -08:00
Gary Qian
02b1146cff
Reland "Exit on deprecated v1 embedding when trying to run or build" (#92901) (#93566) 2021-11-12 15:52:32 -08:00
Yegor
24b9346c9b
Revert "Reland "Exit on deprecated v1 embedding when trying to run or build (#92901)" (#93386)" (#93518)
This reverts commit eabb7cbc34.

It broke multiple tests.
2021-11-11 16:45:40 -08:00
Gary Qian
eabb7cbc34
Reland "Exit on deprecated v1 embedding when trying to run or build (#92901)" (#93386) 2021-11-11 14:49:35 -08:00
Greg Spencer
52ae102f18
Adds tool warning log level and command line options to fail on warning/error output (#92031) 2021-11-10 16:13:04 -08:00
Zachary Anderson
858a328712
Revert "Exit on deprecated v1 embedding when trying to run or build (#92901)" (#93365)
This reverts commit 6153bbef3e.
2021-11-09 22:22:14 -08:00
Gary Qian
6153bbef3e
Exit on deprecated v1 embedding when trying to run or build (#92901) 2021-11-09 17:38:03 -08:00
Zachary Anderson
2468f315e0
Revert "Reland: display features (#93117)" (#93204)
This reverts commit 9038fac960.
2021-11-06 22:46:46 -07:00
Andrei Diaconu
9038fac960
Reland: display features (#93117) 2021-11-05 15:54:25 -07:00
Zachary Anderson
7779ad3c60
Revert "Reland engine display features (#89511)" (#93098)
This reverts commit 058dfd49a0.
2021-11-04 23:05:45 -07:00
Andrei Diaconu
058dfd49a0
Reland engine display features (#89511) 2021-11-04 18:37:55 -07:00
Jenn Magder
9e88fe328e
Remove globals_null_migrated.dart, move into globals.dart (#92861) 2021-11-01 17:18:03 -07:00
Majid Hajian
6c10f19b80
add package_name for consistency across all platforms (#88457) 2021-10-07 17:08:02 -07:00
Jenn Magder
61e2e86611
Add iOS build -destination flag (#90915) 2021-10-04 10:18:03 -07:00
Jonah Williams
fa0782b696
reassign jonahwilliams todos (#88707) 2021-08-23 12:27:07 -07:00
Ahmed Ashour
a3dc90c4f5
Add space before curly parentheses. (#85306) 2021-07-01 13:51:05 -07:00
Mirko Mucaria
bce1706f1c
Fix watchOS build when companion app is configured with xcode variable (#84519) 2021-06-17 14:14:03 -07:00
Greg Spencer
88f3811055
Turn on avoid_dynamic_calls lint, except packages/flutter tests, make appropriate changes. (#84476)
This adds avoid_dynamic_calls to the list of lints, and fixes all instances where it was violated.

Importantly, this lint is NOT turned on for flutter/packages/test, because those changes are happening in another PR: #84478
2021-06-14 14:16:57 -07:00
Alexandre Ardhuin
0ef0f0ba5e
fix lint from an improved unnecessary_parenthesis (#83433) 2021-05-27 13:39:03 -07:00
Jonah Williams
886eb3e634
[flutter_tools] remove mocks from ios_device, project, flutter_command test (#82195) 2021-05-10 17:44:03 -07:00
Jenn Magder
db3f49b1b4
Use cached Xcode build settings during iOS build (#80904) 2021-04-27 17:20:11 -07:00
Emmanuel Garcia
b0a63c4ffe
Reland the Dart plugin registry (#79669) 2021-04-23 15:34:04 -07:00
Phil Quitslund
61c30c41b2
fix sort_directives violations (#80817) 2021-04-21 13:49:03 -07:00
Sam Rawlins
68492c5b69
Remove "unnecessary" imports. (#78664) 2021-04-06 11:19:02 -07:00
Jonah Williams
26b9a01531
[flutter_tools] split cache into API and implementation (#79580) 2021-04-05 14:26:02 -07:00
Jenn Magder
8ddc27e607
Split globals.dart into null sound and unsound libraries (#79016) 2021-03-31 16:55:20 -07:00
Zachary Anderson
5efc7169eb
Reverts "Implement dartPluginClass support for plugins #74469" (#78623)
* Revert "Enable dart_plugin_registry_test (#76645)"

This reverts commit 109e0bb9f5.

* Revert "Apply changes caused by https://github.com/flutter/flutter/pull/76662 (#77093)"

This reverts commit cdca6485f0.

* Revert "Disable clang format in the plugin registrants (#76662)"

This reverts commit dadbd47d09.

* Revert "Disable warnings for the dart plugin registrant (#76561)"

This reverts commit 098ece522d.

* Revert "Remove dart_plugin_registry_test timeouts (#76838)"

This reverts commit 1610a27476.

* Revert "Implement dartPluginClass support for plugins (#74469)"

This reverts commit b7d4806243.

Kick.
2021-03-23 14:28:11 -07:00
Michael Goderbauer
7b251f5f37
Enable use_function_type_syntax_for_parameters lint (#77163) 2021-03-04 08:59:17 -08:00
Jenn Magder
841f2e082e
Do not show plugin embedding warning with missing example app (#76406) 2021-02-19 17:41:02 -08:00