Skip to content

Conversation

@mkustermann
Copy link
Member

Changes to original CL: The code that issues an error on unsupported
operating system in the dry-run case was missing a case for iOS and
Android

Original CL description

tl;dr Removes 50% (>1650 locs) of native asset related code in
packages/flutter_tools

Before this PR the invocation of dart build/link/dry-run was implemented
per OS. This lead to very large code duplication of almost identical,
but slightly different code. It also led to similarly duplicated test
code.

Almost the entire dart build/link/dry-run implementation is identical
across OSes. There's small variations:

  • configuration of the build (e.g. android/macos/ios version, ios sdk, ...)
  • determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
main functions:

* `runFlutterSpecificDartBuild` which is responsible for
  - obtain flutter configuration
  - perform dart build (& link)
  - determine target location & install binaries
  • runFlutterSpecificDartDryRunOnPlatforms which is responsible for a
    similar (but not same):
    • obtain flutter configuration
    • perform dart dry run
    • determine target location

these two functions will call out to helpers for the OS specific
functionality:

  • _assetTargetLocationsForOS for determining the location of the code
    assets

  • _copyNativeCodeAssetsForOS for copying the code assets (and possibly
    overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
single code path for the build/link/dry-run, we can also remove the
duplicated tests that were pretty much identical across OSes.

We also harden the building code by adding asserts, e.g.

* the dry fun functionality should never be used by `flutter test`

* the `build/native_assets/<os>/native_assets.yaml` should only be used
   by `flutter test` and the dry-run of `flutter run`

=> We change the tests to also comply with these invariants (so the
tests are not testing things that cannot happen in reality)

We also rename {,Flutter}NativeAssetsBuildRunner to disambiguate it
from the package:native_asset_builder's NativeAssetsBuildRunner.

… around 50% of the native asset related code) (flutter#155430)"

Changes to original CL: The code that issues an error on unsupported
operating system in the dry-run case was missing a case for iOS and
Android.

Original CL description

  tl;dr Removes 50% (>1650 locs) of native asset related code in
  `packages/flutter_tools`

  Before this PR the invocation of dart build/link/dry-run was implemented
  per OS. This lead to very large code duplication of almost identical,
  but slightly different code. It also led to similarly duplicated test
  code.

  Almost the entire dart build/link/dry-run implementation is identical
  across OSes. There's small variations:

  - configuration of the build (e.g. android/macos/ios version, ios sdk, ...)
  - determining target locations & copying the final shared libraries

  This PR unifies the implementation by reducing the code to basically two
  main functions:

    * `runFlutterSpecificDartBuild` which is responsible for
      - obtain flutter configuration
      - perform dart build (& link)
      - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
  similar (but not same):
      - obtain flutter configuration
      - perform dart dry run
      - determine target location

  these two functions will call out to helpers for the OS specific
  functionality:

  * `_assetTargetLocationsForOS` for determining the location of the code
  assets

  * `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
  overriting the install name, etc)

  => Since we get rid of the code duplication across OSes and have only a
  single code path for the build/link/dry-run, we can also remove the
  duplicated tests that were pretty much identical across OSes.

  We also harden the building code by adding asserts, e.g.

    * the dry fun functionality should never be used by `flutter test`

    * the `build/native_assets/<os>/native_assets.yaml` should only be used
       by `flutter test` and the dry-run of `flutter run`

  => We change the tests to also comply with these invariants (so the
  tests are not testing things that cannot happen in reality)

  We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
  from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
@github-actions github-actions bot added tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop labels Sep 26, 2024
@mkustermann
Copy link
Member Author

Thanks for the quick +1, @dcharkes !

@mkustermann mkustermann merged commit abcba1f into flutter:master Sep 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 26, 2024
…(removes around 50% of the native asset related code) (#155430)" (flutter/flutter#155745)
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 26, 2024
… around 50% of the native asset related code) (flutter#155430)" (flutter#155745)

Changes to original CL: The code that issues an error on unsupported
operating system in the dry-run case was missing a case for iOS and
Android

Original CL description

  tl;dr Removes 50% (>1650 locs) of native asset related code in
  `packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented
  per OS. This lead to very large code duplication of almost identical,
  but slightly different code. It also led to similarly duplicated test
  code.

  Almost the entire dart build/link/dry-run implementation is identical
  across OSes. There's small variations:

- configuration of the build (e.g. android/macos/ios version, ios sdk,
...)
  - determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
  main functions:

    * `runFlutterSpecificDartBuild` which is responsible for
      - obtain flutter configuration
      - perform dart build (& link)
      - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
  similar (but not same):
      - obtain flutter configuration
      - perform dart dry run
      - determine target location

  these two functions will call out to helpers for the OS specific
  functionality:

* `_assetTargetLocationsForOS` for determining the location of the code
  assets

* `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
  overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
  single code path for the build/link/dry-run, we can also remove the
  duplicated tests that were pretty much identical across OSes.

  We also harden the building code by adding asserts, e.g.

    * the dry fun functionality should never be used by `flutter test`

* the `build/native_assets/<os>/native_assets.yaml` should only be used
       by `flutter test` and the dry-run of `flutter run`

  => We change the tests to also comply with these invariants (so the
  tests are not testing things that cannot happen in reality)

  We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
  from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 26, 2024
…(removes around 50% of the native asset related code) (#155430)" (flutter/flutter#155745)
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 26, 2024
… around 50% of the native asset related code) (flutter#155430)" (flutter#155745)

Changes to original CL: The code that issues an error on unsupported
operating system in the dry-run case was missing a case for iOS and
Android

Original CL description

  tl;dr Removes 50% (>1650 locs) of native asset related code in
  `packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented
  per OS. This lead to very large code duplication of almost identical,
  but slightly different code. It also led to similarly duplicated test
  code.

  Almost the entire dart build/link/dry-run implementation is identical
  across OSes. There's small variations:

- configuration of the build (e.g. android/macos/ios version, ios sdk,
...)
  - determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
  main functions:

    * `runFlutterSpecificDartBuild` which is responsible for
      - obtain flutter configuration
      - perform dart build (& link)
      - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
  similar (but not same):
      - obtain flutter configuration
      - perform dart dry run
      - determine target location

  these two functions will call out to helpers for the OS specific
  functionality:

* `_assetTargetLocationsForOS` for determining the location of the code
  assets

* `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
  overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
  single code path for the build/link/dry-run, we can also remove the
  duplicated tests that were pretty much identical across OSes.

  We also harden the building code by adding asserts, e.g.

    * the dry fun functionality should never be used by `flutter test`

* the `build/native_assets/<os>/native_assets.yaml` should only be used
       by `flutter test` and the dry-run of `flutter run`

  => We change the tests to also comply with these invariants (so the
  tests are not testing things that cannot happen in reality)

  We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
  from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 26, 2024
…(removes around 50% of the native asset related code) (#155430)" (flutter/flutter#155745)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 26, 2024
…(removes around 50% of the native asset related code) (#155430)" (flutter/flutter#155745)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 26, 2024
…(removes around 50% of the native asset related code) (#155430)" (flutter/flutter#155745)
LouiseHsu pushed a commit to flutter/packages that referenced this pull request Sep 26, 2024
flutter/flutter@538e742...fa402c8

2024-09-26 [email protected] Roll Flutter Engine from
6328a0597b68 to 9e6133e8d906 (1 revision) (flutter/flutter#155762)
2024-09-26 [email protected] Roll Packages from
7da2374 to f38b780 (2 revisions) (flutter/flutter#155760)
2024-09-26 49699333+dependabot[bot]@users.noreply.github.com Bump
codecov/codecov-action from 4.4.1 to 4.5.0 (flutter/flutter#150229)
2024-09-26 [email protected] Roll Flutter Engine from
08f935236e45 to 6328a0597b68 (1 revision) (flutter/flutter#155750)
2024-09-26 [email protected] Roll Flutter Engine from
3a520a2a4399 to 08f935236e45 (1 revision) (flutter/flutter#155748)
2024-09-26 [email protected] Reland "[flutter_tools] Cleanup of
native asset related code (removes around 50% of the native asset
related code) (#155430)" (flutter/flutter#155745)
2024-09-26 [email protected] Roll Flutter Engine from
896208ee5828 to 3a520a2a4399 (1 revision) (flutter/flutter#155744)
2024-09-26 [email protected] Roll Flutter Engine from
fc6c85292b57 to 896208ee5828 (2 revisions) (flutter/flutter#155743)
2024-09-26 [email protected] Roll Flutter Engine from
3719454a879f to fc6c85292b57 (1 revision) (flutter/flutter#155738)
2024-09-26 [email protected] added ability to configure shadow
in banner (flutter/flutter#155296)
2024-09-26 [email protected] Roll Flutter Engine from
d4850c1ae648 to 3719454a879f (1 revision) (flutter/flutter#155736)
2024-09-26 [email protected] Roll Flutter Engine from
d6d5fdba6ae1 to d4850c1ae648 (18 revisions) (flutter/flutter#155733)
2024-09-25 [email protected] Move the Linux runner into a
subdirectory (flutter/flutter#153812)
2024-09-25 49699333+dependabot[bot]@users.noreply.github.com Bump
actions/checkout from 4.1.7 to 4.2.0 (flutter/flutter#155711)
2024-09-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts
"[flutter_tools] Cleanup of native asset related code (removes around
50% of the native asset related code) (#155430)"
(flutter/flutter#155713)
2024-09-25 [email protected] [flutter_tools] Cleanup of native asset
related code (removes around 50% of the native asset related code)
(flutter/flutter#155430)
2024-09-25 [email protected] reduce warnings inside
flutter.groovy file #2 (flutter/flutter#155628)
2024-09-25 [email protected] [Android] Update
`SystemUiMode` and `setSystemChromeEnabledSystemUIMode ` docs to note
targeting Android 15+ change (flutter/flutter#153466)
2024-09-25 [email protected] mark linux packages autoroller
bringup: true (flutter/flutter#155705)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to
ensure that a human
is aware of the problem.

To file a bug in Packages:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 27, 2024
… around 50% of the native asset related code) (flutter#155430)" (flutter#155745)

Changes to original CL: The code that issues an error on unsupported
operating system in the dry-run case was missing a case for iOS and
Android

Original CL description

  tl;dr Removes 50% (>1650 locs) of native asset related code in
  `packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented
  per OS. This lead to very large code duplication of almost identical,
  but slightly different code. It also led to similarly duplicated test
  code.

  Almost the entire dart build/link/dry-run implementation is identical
  across OSes. There's small variations:

- configuration of the build (e.g. android/macos/ios version, ios sdk,
...)
  - determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
  main functions:

    * `runFlutterSpecificDartBuild` which is responsible for
      - obtain flutter configuration
      - perform dart build (& link)
      - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
  similar (but not same):
      - obtain flutter configuration
      - perform dart dry run
      - determine target location

  these two functions will call out to helpers for the OS specific
  functionality:

* `_assetTargetLocationsForOS` for determining the location of the code
  assets

* `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
  overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
  single code path for the build/link/dry-run, we can also remove the
  duplicated tests that were pretty much identical across OSes.

  We also harden the building code by adding asserts, e.g.

    * the dry fun functionality should never be used by `flutter test`

* the `build/native_assets/<os>/native_assets.yaml` should only be used
       by `flutter test` and the dry-run of `flutter run`

  => We change the tests to also comply with these invariants (so the
  tests are not testing things that cannot happen in reality)

  We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
  from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 27, 2024
… around 50% of the native asset related code) (flutter#155430)" (flutter#155745)

Changes to original CL: The code that issues an error on unsupported
operating system in the dry-run case was missing a case for iOS and
Android

Original CL description

  tl;dr Removes 50% (>1650 locs) of native asset related code in
  `packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented
  per OS. This lead to very large code duplication of almost identical,
  but slightly different code. It also led to similarly duplicated test
  code.

  Almost the entire dart build/link/dry-run implementation is identical
  across OSes. There's small variations:

- configuration of the build (e.g. android/macos/ios version, ios sdk,
...)
  - determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
  main functions:

    * `runFlutterSpecificDartBuild` which is responsible for
      - obtain flutter configuration
      - perform dart build (& link)
      - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
  similar (but not same):
      - obtain flutter configuration
      - perform dart dry run
      - determine target location

  these two functions will call out to helpers for the OS specific
  functionality:

* `_assetTargetLocationsForOS` for determining the location of the code
  assets

* `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
  overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
  single code path for the build/link/dry-run, we can also remove the
  duplicated tests that were pretty much identical across OSes.

  We also harden the building code by adding asserts, e.g.

    * the dry fun functionality should never be used by `flutter test`

* the `build/native_assets/<os>/native_assets.yaml` should only be used
       by `flutter test` and the dry-run of `flutter run`

  => We change the tests to also comply with these invariants (so the
  tests are not testing things that cannot happen in reality)

  We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
  from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 11, 2024
…(removes around 50% of the native asset related code) (#155430)" (flutter/flutter#155745)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 12, 2024
…(removes around 50% of the native asset related code) (#155430)" (flutter/flutter#155745)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants