Commit Graph

81 Commits

Author SHA1 Message Date
林洵锋
f340d207f6
Adjust the position of require File.expand_path (#141521)
On `Podfile`:

```ruby
flutter_application_path = '../flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'OCProject' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for OCProject
  # install_all_flutter_pods(flutter_application_path)
  # install_flutter_engine_pod(flutter_application_path)
  # install_flutter_application_pod(flutter_application_path)
  install_flutter_plugin_pods(flutter_application_path)

end

post_install do |installer|
  flutter_post_install(installer)
end
```
Encountering the following error after executing `pod install`:

```shell
pod install

[!] Invalid `Podfile` file: undefined method `flutter_relative_path_from_podfile' for #<Pod::Podfile:0x000000010e74c520 @defined_in_file=#<Pathname:/Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile>, @internal_hash={}, @root_target_definitions=[#<Pod::Podfile::TargetDefinition label=Pods>], @current_target_definition=#<Pod::Podfile::TargetDefinition label=Pods>>

  relative = flutter_relative_path_from_podfile(export_script_directory)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.

 #  from /Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile:17
 #  -------------------------------------------
 #    # install_flutter_plugin_pods(flutter_application_path)
 >    install_flutter_application_pod(flutter_application_path)
 #
 #  -------------------------------------------
```

The `flutter_relative_path_from_podfile` method is in `flutter_tools/bin/podhelper.rb`, but now `flutter_tools/bin/podhelper.rb` is only required in `install_all_flutter_pods` in `podhelper.rb.tmpl`.

Sometimes we only need to use the `install_flutter_plugin_pods` method in podhelper.rb. For example, using `Shorebird` in an iOS hybird app scenario, we need to build `Flutter.xcframework` and `App.xcframework` and embed them into the iOS native project. In order to avoid unnecessary conflicts, use `install_flutter_plugin_pods` method to install Flutter plugin pods.

[Shorebird - Code Push In Hybrid Apps](https://docs.shorebird.dev/guides/hybrid-app/ios)

So I adjust the position of `require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)`.
2024-01-21 06:18:26 +00:00
Daco Harkes
2e229be2ff
Native assets: package in framework on iOS and MacOS (#140907)
Packages the native assets for iOS and MacOS in frameworks.

Issue:

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

## Details

* [x] This packages dylibs from the native assets feature in frameworks. It packages every dylib in a separate framework.
* [x] The dylib name is updated to use `@rpath` instead of `@executable_path`.
* [x] The dylibs for flutter-tester are no longer modified to change the install name. (Previously it was wrongly updating the install name to the location the dylib would have once deployed in an app.)
* [x] Use symlinking on MacOS.
2024-01-19 20:29:13 +00:00
Daco Harkes
6ad755536e
Native assets support for Android (#135148)
Support for FFI calls with `@Native external` functions through Native assets on Android. 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 Android.

Mainly follows the design of the previous PRs.

For Android, we detect the compilers inside the NDK inside SDK.

And bundling of the assets is done by the flutter.groovy file.

The `minSdkVersion` is propagated from the flutter.groovy file as well.

The NDK is not part of `flutter doctor`, and users can omit it if no native assets have to be build.
However, if any native assets must be built, flutter throws a tool exit if the NDK is not installed.

Add 2 app is not part of this PR yet, instead `flutter build aar` will tool exit if there are any native assets.
2023-12-07 16:29:11 +00:00
Daco Harkes
7634609062
Pin dart-lang/native dependencies (#137601)
Pin the dependencies from dart-lang/native to a specific version during testing (rather than having them auto-upgrade during pub resolution). This will prevent tests using the template to start failing if a bad version is published to pub.

Closes: https://github.com/flutter/flutter/issues/137418

Also bumps dep in flutter_tools.
2023-11-03 22:16:04 +00:00
Victoria Ashworth
ddc9b40a98
Fix typo in function name (#136273)
Rename `removeIOSimulator` to `removeIOSSimulator`.
2023-10-12 15:53:00 +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
Daco Harkes
fceaa005cd
[doc] Fix module_test_ios comments (#131470) 2023-07-31 11:05:11 +00:00
Siva
7c8e171320
Manual Roll of Flutter Engine from 67254d6e4b03 to 8d83b98c55b3 (#116635)
* Roll Flutter Engine from 67254d6e4b03 to 8d83b98c55b3

* Roll Dart SDK from 35a9facce191 to e517487c5679 (Dart 3.0) (#38105)

* Bump SDK versions.

* Bump Dart SDK version constraints

* Update shrine package to 2.0.1 (null safe version)

* Fix more tests.

* Include patches from Jason for min android sdk version

* Fix analyzer warning
2022-12-08 18:03:51 -08:00
Jenn Magder
f059dd40ea
Show Xcode compilation errors at end of build, suppress stdout and stderr from Xcode (#113302) 2022-10-17 17:47:25 +00:00
Jenn Magder
7714a8d034
Do not codesign transitive dependency iOS pod resource bundles (#111714) 2022-09-16 18:02:12 +00:00
Jenn Magder
489094ad98
Quiet iOS native test result zipping (#111434) 2022-09-13 23:08:41 +00:00
Ivan Dlugos
723b82e4f0
Feat: dSYM debug info for iOS & macOS builds (#101586) 2022-09-05 18:16:16 +00:00
Jenn Magder
a4530b7c12
Make module tests pass on Xcode 14 (#110556) 2022-08-30 18:51:20 +00:00
Jenn Magder
dce355d801
Remove google_sign_in plugin from module test (#104657) 2022-05-25 16:13:10 -07:00
Jenn Magder
c6ced845e3
Remove custom unawaited, prefer dart:async version (#103212) 2022-05-07 08:49:04 -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
Jenn Magder
88eca6c1ce
Fail integration test if expected bitcode markers not found (#102016) 2022-04-19 13:29:06 -07:00
Jenn Magder
1756ccc541
Set template and migrate apps to iOS 11 minimum (#101963) 2022-04-15 11:34:08 -07:00
Jenn Magder
5b58d5c58f
Exclude armv7 from iOS add-to-app plugins (#101943) 2022-04-14 18:24:08 -07:00
Jenn Magder
b3d1f71d5d
Update module_test_ios google_sign_in version (#101729) 2022-04-12 14:34:10 -07:00
Jenn Magder
1dd4613b5f
Add verbose flag to iOS module test (#100724) 2022-03-25 16:40:13 -07:00
Jenn Magder
47a5b18e14
Handle hidden dot files in iOS framework bundles (#99771) 2022-03-08 15:05:22 -08:00
Jenn Magder
57d5222876
Include -isysroot -arch and -miphoneos-version-min when creating dummy module App.framework (#97689) 2022-02-04 14:50:11 -08:00
stuartmorgan
2df7dca858
Fully support Dart-only mobile and macOS plugins (#96183) 2022-01-13 08:30:22 -08:00
Emmanuel Garcia
f01556ab75
Bump Android dependencies that rely on Jcenter (#96558)
* Bump video_player in flutter gallery

* Update packages

* Update dependencies

* Bump device_info

* Update dev/devicelab/bin/tasks/build_ios_framework_module_test.dart

Co-authored-by: Jenn Magder <magder@google.com>

* Update dev/devicelab/bin/tasks/module_custom_host_app_name_test.dart

Co-authored-by: Jenn Magder <magder@google.com>

* Update dev/devicelab/bin/tasks/module_test.dart

Co-authored-by: Jenn Magder <magder@google.com>

* Remove deprecated device_info from ios-frameworks test

Co-authored-by: Jenn Magder <magder@google.com>
2022-01-12 20:13:32 -08:00
Christopher Fujino
6054eda86b
fix lateinitialization error in devicelab-runner (#94957) 2021-12-28 18:19:16 -08:00
Darren Austin
0c81077582
Migrate devicelab tasks i-z to null safety. (#85998) 2021-07-13 16:41:06 -07:00
Jenn Magder
03034e9e4a
Audit devicelab log streaming for nullability (#84820) 2021-06-18 00:14:03 -07:00
Jenn Magder
94a41cde83
Mixed null safety in dev/devicelab (#84017) 2021-06-05 02:29:03 -07:00
Jenn Magder
2d86249435
rsync Flutter.framework for add to app (#83315) 2021-05-25 10:49:02 -07:00
gaaclarke
7cdd33fe99
added unawaited function for devicelab and turned on unawaited_futures linter (#82833) 2021-05-18 14:19:03 -07:00
Ian Hickson
6beafa7b16
Apply style guide regarding createTempSync pattern (#81090) 2021-04-27 14:59:03 -07:00
xster
ff2dde2c7f
Reland double gzip wrapping NOTICES to reduce on-disk installed space (#80897) 2021-04-26 22:35:45 -07:00
Jenn Magder
050d49ae42
Upload logs before failing module_test_ios (#76341) 2021-02-18 15:38:24 -08:00
Jenn Magder
3cbe0ff1b1
Output unexpected Podfile.lock contents on test failure (#76223) 2021-02-17 12:56:03 -08:00
Jenn Magder
4329bea900
Compress module_test_ios xcresult (#75736) 2021-02-09 16:10:40 -08:00
Jenn Magder
f4f33fd108
Dump logs on failing devicelab test to recipe artifact location (#74378) 2021-02-01 15:00:38 -08:00
Jenn Magder
b29a6bc56b
Use SDK podhelper in add-to-app module Podfile (#73072) 2021-01-14 10:15:24 -08:00
Jenn Magder
4d5db88998
Default add-to-app xcode_backend script to be verbose (#73110) 2021-01-11 10:29:26 -08:00
xster
ca82c572b7
Revert "let NOTICES be double gzip wrapped to reduce on-disk installed space (#71899)" (#72438) 2020-12-16 10:58:19 -08:00
xster
4ed3432e8f
let NOTICES be double gzip wrapped to reduce on-disk installed space (#71899) 2020-12-15 13:29:14 -08:00
Casey Hillers
9e206a0c93
Refactor devicelab logic to use TaskResult instead of JSON (#67550) 2020-10-07 16:37:09 -07:00
Michael R Fairhurst
7f3c9b6bda
Remove unused 'dart:async' imports. (#65568) 2020-09-16 14:14:06 -07:00
Jenn Magder
6b2ef0df7b
Fix App.framework path in Podfile (#63412) 2020-08-12 13:36:12 -07:00
Jenn Magder
0fe1adadd2
Pin iOS module test plugin versions (#63445) 2020-08-11 06:26:05 -07:00
Jenn Magder
e8e5de44ec
Parse .flutter-plugins-dependencies for add-to-app iOS modules (#61269) 2020-07-28 10:16:09 -07:00
Jenn Magder
1e510ff636
Turn on add-to-app iOS platform unit tests (#61007) 2020-07-09 15:52:49 -07:00
Jonah Williams
de7908f9e9
[flutter_tools] Reland flutter assemble for iOS (#50229) 2020-02-05 17:44:06 -08:00
Jonah Williams
cb3b7ab487
[flutter_tools] simplify symbol logic for iOS (#49628) 2020-01-29 13:43:23 -08:00