Commit Graph

36 Commits

Author SHA1 Message Date
Victoria Ashworth
5a63b1df95
Add create app and plugin templates for Swift Package Manager (#147082)
When Swift Package Manager feature is enabled, create app and create plugin will have Swift Package Manager integration already added and will not need to undergo a migration.

Fixes https://github.com/flutter/flutter/issues/146371.

```
flutter config --enable-swift-package-manager

flutter create --ios-language swift --platforms ios,macos swift_app_name

flutter create --ios-language objc --platforms ios objc_app_name

flutter create --template=plugin --ios-language swift --platforms ios,macos swift_plugin_name

flutter create --template=plugin --ios-language objc --platforms ios objc_plugin_name
```
2024-04-24 22:46:20 +00:00
Camille Simon
594ff98a65
[Android] Add Java/AGP/Gradle incompatibility warning to flutter create (#131444)
Adds warning to `flutter create` command that checks if detected Java version is compatible with the template AGP and template Gradle versions. If a developer is building for Android and their Java version is incompatible with either the AGP or Gradle versions that Flutter currently supports by default for new Flutter projects, then

- a warning will show noting the incompatibility and
- steps will be shown to fix the issue, the recommended option being to configure a new compatible Java version given that Flutter knows we can support the template Gradle/AGP versions and updating them manually may be risky (feedback on this approach would be greatly appreciated!)

Given that the template AGP and Gradle versions are compatible, this PR assumes that the detected Java version may only conflict with one of the template AGP or Gradle versions because:
 - the minimum Java version for a given AGP version is less than the maximum Java version compatible for the minimum Gradle version required for that AGP version (too low a Java version will fail AGP compatibility test, but not Gradle compatibility).
- the maximum Java version compatible with minimum Gradle version for a given AGP version is higher than minimum Java version required for that AGP version (too high a Java version will fail Gradle compatibility test, but not AGP compatibility test).

Fixes https://github.com/flutter/flutter/issues/130515 in the sense that `flutter create foo`; `cd foo`; `flutter run` should always be successful.
2023-09-20 16:01:04 +00:00
Daco Harkes
aa36db1d29
Native assets support for MacOS and iOS (#130494)
Support for FFI calls with `@Native external` functions through Native assets on MacOS and iOS. This enables bundling native code without any build-system boilerplate code.

For more info see:

* https://github.com/flutter/flutter/issues/129757

### Implementation details for MacOS and iOS.

Dylibs are bundled by (1) making them fat binaries if multiple architectures are targeted, (2) code signing these, and (3) copying them to the frameworks folder. These steps are done manual rather than via CocoaPods. CocoaPods would have done the same steps, but (a) needs the dylibs to be there before the `xcodebuild` invocation (we could trick it, by having a minimal dylib in the place and replace it during the build process, that works), and (b) can't deal with having no dylibs to be bundled (we'd have to bundle a dummy dylib or include some dummy C code in the build file).

The dylibs are build as a new target inside flutter assemble, as that is the moment we know what build-mode and architecture to target.

The mapping from asset id to dylib-path is passed in to every kernel compilation path. The interesting case is hot-restart where the initial kernel file is compiled by the "inner" flutter assemble, while after hot restart the "outer" flutter run compiled kernel file is pushed to the device. Both kernel files need to contain the mapping. The "inner" flutter assemble gets its mapping from the NativeAssets target which builds the native assets. The "outer" flutter run get its mapping from a dry-run invocation. Since this hot restart can be used for multiple target devices (`flutter run -d all`) it contains the mapping for all known targets.

### Example vs template

The PR includes a new template that uses the new native assets in a package and has an app importing that. Separate discussion in: https://github.com/flutter/flutter/issues/131209.

### Tests

This PR adds new tests to cover the various use cases.

* dev/devicelab/bin/tasks/native_assets_ios.dart
  * Runs an example app with native assets in all build modes, doing hot reload and hot restart in debug mode.
* dev/devicelab/bin/tasks/native_assets_ios_simulator.dart
  * Runs an example app with native assets, doing hot reload and hot restart.
* packages/flutter_tools/test/integration.shard/native_assets_test.dart
  * Runs (incl hot reload/hot restart), builds, builds frameworks for iOS, MacOS and flutter-tester.
* packages/flutter_tools/test/general.shard/build_system/targets/native_assets_test.dart
  * Unit tests the new Target in the backend.
* packages/flutter_tools/test/general.shard/ios/native_assets_test.dart
* packages/flutter_tools/test/general.shard/macos/native_assets_test.dart
  * Unit tests the native assets being packaged on a iOS/MacOS build.

It also extends various existing tests:

* dev/devicelab/bin/tasks/module_test_ios.dart
   * Exercises the add2app scenario.
* packages/flutter_tools/test/general.shard/features_test.dart
   * Unit test the new feature flag.
2023-09-10 08:07:13 +00:00
Michael Goderbauer
55b6f049a6
Enable unreachable_from_main lint - it is stable now!!1 (#129854)
PLUS: clean-up of all the unreachable stuff.
2023-07-06 00:09:01 +00:00
Michael Goderbauer
5e1ba701ed
enable no_literal_bool_comparisons lint (#126647) 2023-05-16 16:14:23 +00:00
Andrew Kolos
ee1c59d462
reduce pub output from flutter create (#118285)
* reduce pub output from flutter create

* fix fake Pub implementations

* fix tests

* Update pub.dart

* replace enum with simpler boolean

* fix tests

* Revert "fix tests"

This reverts commit 8a3182d3b9.

* Revert "replace enum with simpler boolean"

This reverts commit 445dbc443d.

* go back to using an enum
2023-01-12 21:42:02 +00:00
Sigurd Meldgaard
b7881e5b64
Align flutter pub get/upgrade/add/remove/downgrade (#117896)
* Align `flutter pub get/upgrade/add/remove/downgrade`

* Add final . to command description

* Remove trailing whitespace

* Don't print message that command is being run

* Update expectations

* Use relative path

* Remove duplicated line

* Improve function dartdoc
2023-01-10 23:29:09 +00:00
stuartmorgan
f1d157bc29
Add an integration test to plugin template example (#117062)
* Add an integration test to plugin template example

Dart unit tests don't exercise host-side plugin code at all, so the
example tests in the plugin template currently have very little
meaningful coverage. This adds an integration test to the example app
when creating a plugin, so that there's an example of how to actually
test that a complete round-trip plugin call works.

This is done as a separate template that's currently only used by the
plugin template because I don't know what a good example for a
non-plugin case would be that isn't largely just a duplicate of the
widget tests. However, the integration test pre-includes conditionals
around the parts that are plugin-specific so that it can more easily be
expanded to other use cases later (e.g., in
https://github.com/flutter/flutter/issues/68818).

Part of https://github.com/flutter/flutter/issues/82458

* Add integration test to expected dependencies of a plugin app

* Test fixes

* Make an explicit test case
2022-12-15 19:49:14 +00:00
Sigurd Meldgaard
d80e994a62
Reland: Show output from pub get in flutter pub get (#110851) 2022-09-08 15:13:23 +02:00
Liam Appelbe
22cef4898a
Null safety migration of packages/flutter_tools/test/commands.shard/hermetic, part 2/3 (#110708)
* Migrate packages/flutter_tools/test/commands.shard/hermetic, part 2/3

* Fix tests

* Fix analysis

* Chris's comments
2022-09-06 10:39:18 -07:00
Zachary Anderson
0e195e9d46
Revert "Show output from pub get in flutter pub get (#106300)" (#110478)
This reverts commit 3802eb627e.
2022-08-29 08:02:50 -07:00
Sigurd Meldgaard
3802eb627e
Show output from pub get in flutter pub get (#106300) 2022-08-29 07:37:19 +00:00
Alexandre Ardhuin
07f1c20474
add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
Jesús S Guerrero
2302daa3aa
Create when offline style (#101589) 2022-04-11 12:14:05 -07:00
Jesús S Guerrero
3394fb4a58
[flutter_tools] fix flutter create --offline (#100941)
Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
2022-04-07 17:05:49 -07:00
Gary Qian
63ff7a199b
MigrateConfig and migrate integration testing base (#99092) 2022-03-16 11:10:22 -07:00
Daco Harkes
0e2f51dfd0
FFI plugins (#96225) 2022-01-26 23:44:45 +01:00
Zachary Anderson
65c6e88223
Revert "FFI plugins (#94101)" (#96122)
This reverts commit 5257f0290c.
2022-01-04 08:09:12 -08:00
Daco Harkes
5257f0290c
FFI plugins (#94101)
* Building shared C source code as part of the native build for platforms Android, iOS, Linux desktop, MacOS desktop, and Windows desktop.
* Sample code doing a synchronous FFI call.
* Sample code doing a long running synchronous FFI call on a helper isolate.
* Use of `package:ffigen` to generate the bindings.
2022-01-04 10:14:27 +01:00
Jenn Magder
9e88fe328e
Remove globals_null_migrated.dart, move into globals.dart (#92861) 2021-11-01 17:18:03 -07:00
Filip Hracek
76d5e62f42
Add a more complete app template for Flutter (skeleton) (#83530) 2021-06-28 15:26:04 -07:00
Lau Ching Jun
2acd0007d6
Refactor CustomDimensions in analytics to be type safe (#82531) 2021-05-18 20:29:03 -07:00
Sam Rawlins
133a55ae51
Remove "unnecessary" imports. (#81003) 2021-05-06 16:19:07 -07:00
Phil Quitslund
61c30c41b2
fix sort_directives violations (#80817) 2021-04-21 13:49:03 -07:00
Jenn Magder
a2f67720ef
Migrate test/src/common to null safety (#79907) 2021-04-06 22:55:03 -07:00
Jenn Magder
79f1689f6a
Migrate doctor_validator to null safety (#79682) 2021-04-05 11:54:54 -07:00
Jenn Magder
8ddc27e607
Split globals.dart into null sound and unsound libraries (#79016) 2021-03-31 16:55:20 -07:00
Jonah Williams
74bd7b6f6d
[flutter_tools] opt all flutter tool libraries and tests out of null safety. (#74832)
* opt out the flutter tool

* oops EOF

* fix import

* Update tool_backend.dart

* Update daemon_client.dart

* fix more
2021-01-27 15:17:53 -08:00
Jonah Williams
a40ee8a3fb
[flutter_tools] migrate .packages to package_config, partial (#70200) 2020-11-11 13:50:41 -08:00
Jonah Williams
dd8820bcc1
[flutter_tool] initialize flutter root in executable (#69549)
initialize the flutter root as early as possible. This allows all interfaces to be normally injected into commands, even if those objects might read from the flutter root.
2020-11-05 15:21:05 -08:00
Jonah Williams
a0334fb500
[flutter_tools] maintain file manifest for create (#59706)
First pass at fixing #57985 and implementing #59602

This doesn't have enough metadata to be useful for IDEs yet, but it prevents the issue from getting worse while we iterate on it.
2020-06-24 16:20:21 -07:00
stuartmorgan
685e9d1e47
Add pre-stable support for create on Windows (#51895)
Adds initial support for flutter create of apps and plugins. This is derived from the current FDE example app and sample plugin, adding template values where relevant.

Since the APIs/tooling/template aren't stable yet, the app template includes a version marker, which will be updated each time there's a breaking change. The build now checks that the template version matches the version known by that version of the tool, and gives a specific error message when there's a mismatch, which improves over the current breaking change experience of hitting whatever build failure the breaking change causes and having to figure out that the problem is that the runner is out of date. It also adds a warning to the create output about the fact that it won't be stable.

Plugins don't currently have a version marker since in practice this is not a significant problem for plugins yet the way it is for runners; we can add it later if that changes.

Fixes #30704
2020-03-23 10:42:26 -07:00
Alexandre Ardhuin
4f9b6cf017
enable lint prefer_final_in_for_each (#47724) 2020-01-07 16:32:04 +01:00
Jonah Williams
ee7a37f1d3
[flutter_tools] Ensure that global variables are easily identifiable (#47398) 2020-01-06 11:04:20 -08:00
Ian Hickson
449f4a6673
License update (#45373)
* Update project.pbxproj files to say Flutter rather than Chromium

Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.

* Update the copyright notice checker to require a standard notice on all files

* Update copyrights on Dart files. (This was a mechanical commit.)

* Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.

Some were already marked "The Flutter Authors", not clear why. Their
dates have been normalized. Some were missing the blank line after the
license. Some were randomly different in trivial ways for no apparent
reason (e.g. missing the trailing period).

* Clean up the copyrights in non-Dart files. (Manual edits.)

Also, make sure templates don't have copyrights.

* Fix some more ORGANIZATIONNAMEs
2019-11-27 15:04:02 -08:00
Ian Hickson
8c6d60bcfd
Move commands into their own shard (#39140) 2019-10-02 12:46:51 -07:00