1. 09 Jan, 2024 1 commit
  2. 05 Jan, 2024 4 commits
  3. 04 Jan, 2024 1 commit
  4. 03 Jan, 2024 4 commits
  5. 02 Jan, 2024 5 commits
  6. 27 Dec, 2023 1 commit
  7. 21 Dec, 2023 1 commit
  8. 20 Dec, 2023 2 commits
  9. 19 Dec, 2023 1 commit
  10. 18 Dec, 2023 1 commit
  11. 15 Dec, 2023 3 commits
  12. 14 Dec, 2023 2 commits
  13. 12 Dec, 2023 1 commit
    • Christopher Fujino's avatar
      [flutter_tools] catch SocketException writing to ios-deploy stdin (#139784) · fac41dde
      Christopher Fujino authored
      Fixes https://github.com/flutter/flutter/issues/139709
      
      This adds a static helper method `ProcessUtils.writelnToStdinGuarded()`, which will asynchronously write to a sub-process's STDIN `IOSink` and catch errors.
      
      In talking with Brian, it sounds like this is the best and most reliable way to catch `SocketException`s during these writes *to sub-process file descriptors* specifically (with a "real" hard drive file, the future returned by `.flush()` should complete with the write error).
      
      Also, as I note in the dartdoc to `writelnToStdinGuarded()`, the behavior seems to be different between macOS and linux.
      
      Moving forward, in any place where we want to catch exceptions writing to STDIN, we will want to use this new helper.
      fac41dde
  14. 08 Dec, 2023 2 commits
    • Victoria Ashworth's avatar
      If one method of finding Dart VM fails for CoreDevice, wait for the other method (#139754) · 82bc9ca3
      Victoria Ashworth authored
      For CoreDevices we use a combination of mDNS and device logs to find the Dart VM url. If mDNS fails first, it will cause the launch to fail even though the device logs may be able to find the url. So if one of the methods fails, wait for the other method before failing the launch.
      
      Fixes https://github.com/flutter/flutter/issues/139685.
      82bc9ca3
    • 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
  15. 07 Dec, 2023 4 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
    • Camille Simon's avatar
      [Android] Bump template & integration test Gradle version to 7.6.4 (#139276) · 1fa54ea9
      Camille Simon authored
      Updates Gradle version for Flutter project templates and integration tests to at least 7.6.3 (changed all of those with versions below it) to fix security vulnerability.
      
      Part of fix for https://github.com/flutter/flutter/issues/138336.
      1fa54ea9
    • 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
    • Elias Yishak's avatar
      Migrate command usage values (#139383) · 2b218fd1
      Elias Yishak authored
      Related to the tracker issue:
      - https://github.com/flutter/flutter/issues/128251
      
      This PR migrates the `Usage.command` static method that sent custom dimensions for each command (if applicable). The screenshot below shows the different places where the `usageValues` getter is overwritten to return the necessary custom dimensions for that command.
      
      <img width="285" alt="image" src="https://github.com/flutter/flutter/assets/42216813/e32d5100-0e17-4a4d-8f21-327a8c113a19">
      2b218fd1
  16. 06 Dec, 2023 1 commit
  17. 05 Dec, 2023 2 commits
  18. 04 Dec, 2023 3 commits
  19. 01 Dec, 2023 1 commit
    • Kristijan Žic's avatar
      Added vscode-insiders path installed via snap (#137117) · cf71a55f
      Kristijan Žic authored
      Closes  #137116
      
      <b>Before</b>
      VS Code Insiders installed via Snap isn't detected.
      
      <b>After</b>
      ```sh
      [✓] VS Code (version 1.84.0-insider)
          • VS Code at /snap/code-insiders/current/usr/share/code-insiders
          • Flutter extension version 3.75.20231002
      ```
      cf71a55f