1. 15 Feb, 2024 1 commit
  2. 07 Feb, 2024 1 commit
  3. 01 Feb, 2024 1 commit
  4. 26 Jan, 2024 2 commits
  5. 25 Jan, 2024 1 commit
  6. 24 Jan, 2024 3 commits
    • godofredoc's avatar
      Migrate android views to devicelab. (#142081) · d51858c2
      godofredoc authored
      Migrate android view out of recipes.
      d51858c2
    • auto-submit[bot]'s avatar
      Reverts "Refactor `external_ui` → `external_textures`" (#142173) · 54e9f2db
      auto-submit[bot] authored
      Reverts flutter/flutter#142062
      Initiated by: eliasyishak
      This change reverts the following previous change:
      Original Description:
      This PR makes no _behavioral_ changes to executed code, and instead focuses on organization and naming:
      
      1. Almost[^1] anything named `external_ui` is renamed `external_textures`
      1. Extended the README to explain the intent of the test, as well as how to run it
      1. Renamed `main.dart` and `main_test.dart` to `frame_rate_main.dart` and `frame_rate_test.dart` (we'll add more)
      1. Did some refactoring of the test to make it more obvious what is being asserted (i.e. `widgetBuilds` and friends)
      
      Given how complex (and in-flux) this directory is, I'm also requesting either John, Jonah or I review any changes.
      
      [^1]: Except the name of the `.ci.yaml` task, i.e. `name: Linux_pixel_7pro external_ui_integration_test` because I'm apparently not able to change that without creating a new task as `bringup: true` and playing a bit of a dance. Maybe that's worth doing though (in future PRs)?
      54e9f2db
    • Matan Lurey's avatar
      Refactor `external_ui` → `external_textures` (#142062) · 2e2042ff
      Matan Lurey authored
      This PR makes no _behavioral_ changes to executed code, and instead
      focuses on organization and naming:
      
      1. Almost[^1] anything named `external_ui` is renamed
      `external_textures`
      1. Extended the README to explain the intent of the test, as well as how
      to run it
      1. Renamed `main.dart` and `main_test.dart` to `frame_rate_main.dart`
      and `frame_rate_test.dart` (we'll add more)
      1. Did some refactoring of the test to make it more obvious what is
      being asserted (i.e. `widgetBuilds` and friends)
      
      Given how complex (and in-flux) this directory is, I'm also requesting
      either John, Jonah or I review any changes.
      
      [^1]: Except the name of the `.ci.yaml` task, i.e. `name:
      Linux_pixel_7pro external_ui_integration_test` because I'm apparently
      not able to change that without creating a new task as `bringup: true`
      and playing a bit of a dance. Maybe that's worth doing though (in future
      PRs)?
      2e2042ff
  7. 21 Jan, 2024 1 commit
    • 林洵锋's avatar
      Adjust the position of require File.expand_path (#141521) · f340d207
      林洵锋 authored
      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)`.
      f340d207
  8. 19 Jan, 2024 1 commit
  9. 16 Jan, 2024 2 commits
  10. 09 Jan, 2024 1 commit
  11. 03 Jan, 2024 2 commits
  12. 02 Jan, 2024 2 commits
  13. 21 Dec, 2023 1 commit
  14. 19 Dec, 2023 1 commit
  15. 18 Dec, 2023 1 commit
    • Andrew Kolos's avatar
      Restore and fix flavors_test_macos (#139841) · f8b97486
      Andrew Kolos authored
      Partially resolves[^1] https://github.com/flutter/flutter/issues/139774.
      
      Effectively reverts https://github.com/flutter/flutter/pull/125581.
      
      The main change here is that I deleted and recreated the macos Xcode project for this integration test (hence the large diff). I tried fixing the existing project first, but it was set up quite differently, and—for whatever reason—the integration test would get stuck trying to load `dev/integration_tests/flavors/integration_test/integration_test.dart`.
      
      I verified that this works locally, but I don't know if it's possible to run this on the devicelab try pool to verify that it works on devicelab hardware.
      
      [^1]: I would not close the issue until 1) this PR lands, 2) the integration test consistently passes on CI, and 3) macOS support for flavors is publicly documented.
      f8b97486
  16. 14 Dec, 2023 2 commits
  17. 13 Dec, 2023 1 commit
  18. 08 Dec, 2023 1 commit
    • auto-submit[bot]'s avatar
      Reverts "Support conditional bundling of assets based on `--flavor`" (#139787) · 21766a4f
      auto-submit[bot] authored
      Reverts flutter/flutter#132985
      Initiated by: christopherfujino
      This change reverts the following previous change:
      Original Description:
      Provides support for conditional bundling of assets through the existing `--flavor` option for `flutter build` and `flutter run`. Closes https://github.com/flutter/flutter/issues/21682. Resolves https://github.com/flutter/flutter/issues/136092
      
      ## Change
      Within the `assets` section pubspec.yaml, the user can now specify one or more `flavors` that an asset belongs to. Consider this example:
      
      ```yaml
      # pubspec.yaml
      flutter:
        assets:
          - assets/normal-asset.png
          - path: assets/vanilla/ice-cream.png
            flavors: 
              - vanilla
          - path: assets/strawberry/ice-cream.png
            flavors:
              - strawberry
      ```
      
      With this pubspec,
      * `flutter run --flavor vanilla` will not include `assets/strawberry/ice-cream.png` in the build output.
      * `flutter run --flavor strawberry` will not include `assets/vanilla/ice-cream.png`.
      * `flutter run` will only include `assets/normal-asset.png`.
      
      ## Open questions
      
      * Should this be supported for all platforms, or should this change be limited to ones with documented `--flavor` support (Android, iOS, and (implicitly) MacOS)? This PR currently only enables this feature for officially supported platforms.
      
      ## Design thoughts, what this PR does not do, etc.
      
      ### This does not provide an automatic mapping/resolution of asset keys/paths to others based on flavor at runtime.
      
      The implementation in this PR represents a simplest approach. Notably, it does not give Flutter the ability to dynamically choose an asset based on flavor using a single asset key. For example, one can't use `Image.asset('config.json')` to dynamically choose between different "flavors" of `config.json` (such as `dev-flavor/config.json` or `prod-flavor/config.json`). However, a user could always implement such a mechanism in their project or in a library by examining the flavor at runtime.
      
      ### When multiple entries affect the same file and 1) at least one of these entries have a `flavors` list provided and 2) these lists are not equivalent, we always consider the manifest to be ambiguous and will throw a `ToolExit`. 
      
      <details>
      For example, these manifests would all be considered ambiguous:
      
      ```yaml
      assets:
        - assets/
        - path: assets/vanilla.png
          flavors: 
            - vanilla
      
      assets:
        - path: assets/vanilla/
          flavors: 
            - vanilla
        - path: assets/vanilla/cherry.png
           flavor:
            - cherry
      
      # Thinking towards the future where we might add glob/regex support and more conditions other than flavor:
      assets:
        - path: assets/vanilla/**
          flavors:
            - vanilla
        - path: assets/**/ios/**
          platforms: 
             - ios
      
      # Ambiguous in the case of assets like "assets/vanilla/ios/icon.svg" since we 
      # don't know if flavor `vanilla` and platform `ios` should be combined using or-logic or and-logic.
      ```
      
      See [this review comment thread](https://github.com/flutter/flutter/pull/132985#discussion_r1381909942) for the full story on how I arrived at this decision.
      </details>
      
      ### This does not support Android's multidimensional flavors feature (in an intuitive way)
      
      <details>
      
      Conder this excerpt from a Flutter project's android/app/build.gradle file:
      
      ```groovy
      android {
          // ...
      
          flavorDimensions "mode", "api"
      
          productFlavors {
              free {
                  dimension "mode"
                  applicationIdSuffix ".free"
              }
      
              premium {
                  dimension "mode"
                  applicationIdSuffix ".premium"
              }
      
              minApi23 {
                  dimension "api"
                  versionNameSuffix "-minApi23"
              }
      
              minApi21 {
                  dimension "api"
                  versionNameSuffix "-minApi21"
              }
          }
      }
      ```
      
      In this setup, the following values are valid `--flavor` are valid `freeMinApi21`, `freeMinApi23`, `premiumMinApi21`, and `premiumMinApi23`. We call these values "flavor combinations". Consider the following from the Android documentation[^1]:
      
      > In addition to the source set directories you can create for each individual product flavor and build variant, you can also create source set directories for each combination of product flavors. For example, you can create and add Java sources to the src/demoMinApi24/java/ directory, and Gradle uses those sources only when building a variant that combines those two product flavors.
      > 
      > Source sets you create for product flavor combinations have a higher priority than source sets that belong to each individual product flavor. To learn more about source sets and how Gradle merges resources, read the section about how to [create source sets](https://developer.android.com/build/build-variants#sourcesets).
      
      This feature will not behave in this way. If a user utilizes this feature and also Android's multidimensional flavors feature, they will have to list out all flavor combinations that contain the flavor they want to limit an asset to:
      
      ```yaml
      assets:
        - assets/free/
          flavors:
            - freeMinApi21
            - freeMinApi23
      ```
      
      This is mostly due to a technical limitation in the hot-reload feature of `flutter run`. During a hot reload, the tool will try to update the asset bundle on the device, but the tool does not know the flavors contained within the flavor combination (that the user passes to `--flavor`). Gradle is the source of truth of what flavors were involved in the build, and `flutter run` currently does not access to that information since it's an implementation detail of the build process. We could bubble up this information, but it would require a nontrivial amount of engineering work, and it's unclear how desired this functionality is. It might not be worth implementing.
      
      </details>
      
      See https://flutter.dev/go/flavor-specific-assets for the (outdated) design document. 
      
      <summary>Pre-launch Checklist</summary>
      
      </details>
      
      [^1]: https://developer.android.com/build/build-variants#flavor-dimensions
      21766a4f
  19. 07 Dec, 2023 2 commits
    • Andrew Kolos's avatar
      Support conditional bundling of assets based on `--flavor` (#132985) · 016eb851
      Andrew Kolos authored
      Provides support for conditional bundling of assets through the existing `--flavor` option for `flutter build` and `flutter run`. Closes https://github.com/flutter/flutter/issues/21682. Resolves https://github.com/flutter/flutter/issues/136092
      
      ## Change
      Within the `assets` section pubspec.yaml, the user can now specify one or more `flavors` that an asset belongs to. Consider this example:
      
      ```yaml
      # pubspec.yaml
      flutter:
        assets:
          - assets/normal-asset.png
          - path: assets/vanilla/ice-cream.png
            flavors: 
              - vanilla
          - path: assets/strawberry/ice-cream.png
            flavors:
              - strawberry
      ```
      
      With this pubspec,
      * `flutter run --flavor vanilla` will not include `assets/strawberry/ice-cream.png` in the build output.
      * `flutter run --flavor strawberry` will not include `assets/vanilla/ice-cream.png`.
      * `flutter run` will only include `assets/normal-asset.png`.
      
      ## Open questions
      
      * Should this be supported for all platforms, or should this change be limited to ones with documented `--flavor` support (Android, iOS, and (implicitly) MacOS)? This PR currently only enables this feature for officially supported platforms.
      
      ## Design thoughts, what this PR does not do, etc.
      
      ### This does not provide an automatic mapping/resolution of asset keys/paths to others based on flavor at runtime.
      
      The implementation in this PR represents a simplest approach. Notably, it does not give Flutter the ability to dynamically choose an asset based on flavor using a single asset key. For example, one can't use `Image.asset('config.json')` to dynamically choose between different "flavors" of `config.json` (such as `dev-flavor/config.json` or `prod-flavor/config.json`). However, a user could always implement such a mechanism in their project or in a library by examining the flavor at runtime.
      
      ### When multiple entries affect the same file and 1) at least one of these entries have a `flavors` list provided and 2) these lists are not equivalent, we always consider the manifest to be ambiguous and will throw a `ToolExit`. 
      
      <details>
      For example, these manifests would all be considered ambiguous:
      
      ```yaml
      assets:
        - assets/
        - path: assets/vanilla.png
          flavors: 
            - vanilla
      
      assets:
        - path: assets/vanilla/
          flavors: 
            - vanilla
        - path: assets/vanilla/cherry.png
           flavor:
            - cherry
      
      # Thinking towards the future where we might add glob/regex support and more conditions other than flavor:
      assets:
        - path: assets/vanilla/**
          flavors:
            - vanilla
        - path: assets/**/ios/**
          platforms: 
             - ios
      
      # Ambiguous in the case of assets like "assets/vanilla/ios/icon.svg" since we 
      # don't know if flavor `vanilla` and platform `ios` should be combined using or-logic or and-logic.
      ```
      
      See [this review comment thread](https://github.com/flutter/flutter/pull/132985#discussion_r1381909942) for the full story on how I arrived at this decision.
      </details>
      
      ### This does not support Android's multidimensional flavors feature (in an intuitive way)
      
      <details>
      
      Conder this excerpt from a Flutter project's android/app/build.gradle file:
      
      ```groovy
      android {
          // ...
      
          flavorDimensions "mode", "api"
      
          productFlavors {
              free {
                  dimension "mode"
                  applicationIdSuffix ".free"
              }
      
              premium {
                  dimension "mode"
                  applicationIdSuffix ".premium"
              }
      
              minApi23 {
                  dimension "api"
                  versionNameSuffix "-minApi23"
              }
      
              minApi21 {
                  dimension "api"
                  versionNameSuffix "-minApi21"
              }
          }
      }
      ```
      
      In this setup, the following values are valid `--flavor` are valid `freeMinApi21`, `freeMinApi23`, `premiumMinApi21`, and `premiumMinApi23`. We call these values "flavor combinations". Consider the following from the Android documentation[^1]:
      
      > In addition to the source set directories you can create for each individual product flavor and build variant, you can also create source set directories for each combination of product flavors. For example, you can create and add Java sources to the src/demoMinApi24/java/ directory, and Gradle uses those sources only when building a variant that combines those two product flavors.
      > 
      > Source sets you create for product flavor combinations have a higher priority than source sets that belong to each individual product flavor. To learn more about source sets and how Gradle merges resources, read the section about how to [create source sets](https://developer.android.com/build/build-variants#sourcesets).
      
      This feature will not behave in this way. If a user utilizes this feature and also Android's multidimensional flavors feature, they will have to list out all flavor combinations that contain the flavor they want to limit an asset to:
      
      ```yaml
      assets:
        - assets/free/
          flavors:
            - freeMinApi21
            - freeMinApi23
      ```
      
      This is mostly due to a technical limitation in the hot-reload feature of `flutter run`. During a hot reload, the tool will try to update the asset bundle on the device, but the tool does not know the flavors contained within the flavor combination (that the user passes to `--flavor`). Gradle is the source of truth of what flavors were involved in the build, and `flutter run` currently does not access to that information since it's an implementation detail of the build process. We could bubble up this information, but it would require a nontrivial amount of engineering work, and it's unclear how desired this functionality is. It might not be worth implementing.
      
      </details>
      
      See https://flutter.dev/go/flavor-specific-assets for the (outdated) design document. 
      
      <summary>Pre-launch Checklist</summary>
      
      </details>
      
      [^1]: https://developer.android.com/build/build-variants#flavor-dimensions
      016eb851
    • Daco Harkes's avatar
      Native assets support for Android (#135148) · 6ad75553
      Daco Harkes authored
      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.
      6ad75553
  20. 04 Dec, 2023 2 commits
  21. 29 Nov, 2023 1 commit
  22. 03 Nov, 2023 1 commit
  23. 25 Oct, 2023 1 commit
  24. 12 Oct, 2023 1 commit
  25. 10 Oct, 2023 1 commit
  26. 20 Sep, 2023 1 commit
  27. 14 Sep, 2023 1 commit
  28. 13 Sep, 2023 1 commit
  29. 12 Sep, 2023 1 commit
  30. 10 Sep, 2023 1 commit
    • Daco Harkes's avatar
      Native assets support for MacOS and iOS (#130494) · aa36db1d
      Daco Harkes authored
      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.
      aa36db1d
  31. 07 Sep, 2023 1 commit