Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Reland "[ios] Fix app extension not able to find assets from… #46329

Merged
merged 4 commits into from
Sep 28, 2023

Conversation

cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented Sep 27, 2023

Relands #46283

The original PR had a bug where the relative assets path is reset after not being found in the bundle. It should not be reset unless it was not found inside the info.plist in bundle

Fixes flutter/flutter#124292

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@cyanglaz
Copy link
Contributor Author

cc @CaseyHillers

@cyanglaz
Copy link
Contributor Author

cyanglaz commented Sep 27, 2023

Internal tests in http://CL/568990022

@cyanglaz cyanglaz force-pushed the reland_nsbundle_util_fix branch from 3a21a38 to 72acccc Compare September 27, 2023 23:02
Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved it since the original PR was already stamped

@cyanglaz cyanglaz force-pushed the reland_nsbundle_util_fix branch from 72acccc to df074be Compare September 27, 2023 23:13
@@ -8,8 +8,8 @@

FLUTTER_ASSERT_ARC

const NSString* kDefaultAssetPath = @"Frameworks/App.framework/flutter_assets";
static NSString* GetFlutterAssetPathFromBundle(NSBundle* bundle);
NSString* kDefaultAssetPath = @"Frameworks/App.framework/flutter_assets";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious -- why is it this couldn't remain const?

@cyanglaz cyanglaz added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 27, 2023
@auto-submit auto-submit bot merged commit 7598ab4 into flutter:main Sep 28, 2023
@cyanglaz cyanglaz deleted the reland_nsbundle_util_fix branch September 28, 2023 00:02
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 28, 2023
zanderso pushed a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 28, 2023
zanderso pushed a commit to flutter/flutter that referenced this pull request Sep 28, 2023
…sions) (#135637)

Manual roll Flutter Engine from f70f65f7a622 to be32dcc9117a (31
revisions)

Manual roll requested by [email protected]

Cannot build log URL because revision "be32dcc9117a" is invalid: Luci
builds of "Linux linux_unopt" for
be32dcc9117a462760cb52c18d0d050f067f2463 was STARTED

2023-09-28 [email protected] Rollback Dart SDK to 3.2.0-119.
(flutter/engine#46339)
2023-09-28 [email protected] [canvaskit]
Do not double-apply ImageFilter transform to children
(flutter/engine#46336)
2023-09-28 [email protected] Reland "Reverts "[ios] Fix app extension
not able to find assets from… (flutter/engine#46329)
2023-09-27 [email protected] Revert "[Impeller]
Fixes stroke path geometry that can draw outside o…
(flutter/engine#46334)
2023-09-27 [email protected] Roll Fuchsia Mac SDK from
jQHACBU4Fi2wMElkm... to U334SygIkffMJVmdu... (flutter/engine#46333)
2023-09-27 [email protected] Roll Skia from 952e8dd66560 to
b048b468d641 (1 revision) (flutter/engine#46332)
2023-09-27 [email protected] [Impeller] Destroy all
per-thread command pools tied to a context before deleting the context
(flutter/engine#46286)
2023-09-27 [email protected] Roll Skia from d78aba2524b3 to
952e8dd66560 (1 revision) (flutter/engine#46331)
2023-09-27 [email protected] [Impeller] Match Skia gradient
clamping behavior (and document). (flutter/engine#44825)
2023-09-27 [email protected] Roll Dart SDK from
97647bb1666b to 80a965ee48ab (1 revision) (flutter/engine#46330)
2023-09-27 [email protected] Roll Skia from ff5474eed6b4 to
d78aba2524b3 (3 revisions) (flutter/engine#46327)
2023-09-27 98614782+auto-submit[bot]@users.noreply.github.com Reverts
"[ios] Fix app extension not able to find assets from unloaded bundle"
(flutter/engine#46328)
2023-09-27 [email protected] [Windows] Improve
logic to update swap intervals (flutter/engine#46172)
2023-09-27 [email protected] [Impeller] Fallback to no index
buffer when tesselation count is large, split up nonZero contours.
(flutter/engine#46282)
2023-09-27 [email protected] Roll Skia from 4731ccd6342c to
ff5474eed6b4 (1 revision) (flutter/engine#46325)
2023-09-27 [email protected] Declare native wrapper
classes in Fuchsia packages as base classes (flutter/engine#46305)
2023-09-27 [email protected] Remove fuchsia from recipes cq.
(flutter/engine#46324)
2023-09-27 [email protected] Roll Dart SDK from
c2a455113e39 to 97647bb1666b (1 revision) (flutter/engine#46323)
2023-09-27 [email protected] [macOS] Synchronise modifiers from
mouse events for RawKeyboard (flutter/engine#46230)
2023-09-27 [email protected] Roll Fuchsia Linux SDK from
Lg6FR6iDnZeV6y-E8... to 6Y22MutFhgL7ua18F... (flutter/engine#46322)
2023-09-27 [email protected] Roll Skia from 2991bb799d3f to
4731ccd6342c (1 revision) (flutter/engine#46321)
2023-09-27 [email protected] Declare native wrapper
classes in the GPU package as base classes (flutter/engine#46304)
2023-09-27 [email protected] Do not call
DrawTextBlob for performance overlay text when using Impeller
(flutter/engine#46307)
2023-09-27 [email protected] Update to use
GrDirectContexts::MakeGL (flutter/engine#46308)
2023-09-27 [email protected] Roll Skia from 0f4f31127ac5 to
2991bb799d3f (1 revision) (flutter/engine#46319)
2023-09-27 [email protected] Roll Skia from fc629215398f to
0f4f31127ac5 (1 revision) (flutter/engine#46318)
2023-09-27 [email protected] Roll Dart SDK from
6c4eb86ecd25 to c2a455113e39 (1 revision) (flutter/engine#46317)
2023-09-27 [email protected] Roll Fuchsia Mac SDK from
OMrTgAfDg9PKXTzq0... to jQHACBU4Fi2wMElkm... (flutter/engine#46314)
2023-09-27 [email protected] Roll Skia from 960325c13009 to
fc629215398f (1 revision) (flutter/engine#46313)
2023-09-27 [email protected] Roll Skia from 76aecbaea259 to
960325c13009 (2 revisions) (flutter/engine#46311)
2023-09-27 [email protected] Roll Dart SDK from
7c3588c05f87 to 6c4eb86ecd25 (3 revisions) (flutter/engine#46310)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from Lg6FR6iDnZeV to 6Y22MutFhgL7
  fuchsia/sdk/core/mac-amd64 from OMrTgAfDg9PK to U334SygIkffM

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

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

...
@cyanglaz cyanglaz changed the title Reland "Reverts "[ios] Fix app extension not able to find assets from… Reland "[ios] Fix app extension not able to find assets from… Sep 28, 2023
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…sions) (flutter#135637)

Manual roll Flutter Engine from f70f65f7a622 to be32dcc9117a (31
revisions)

Manual roll requested by [email protected]

Cannot build log URL because revision "be32dcc9117a" is invalid: Luci
builds of "Linux linux_unopt" for
be32dcc9117a462760cb52c18d0d050f067f2463 was STARTED

2023-09-28 [email protected] Rollback Dart SDK to 3.2.0-119.
(flutter/engine#46339)
2023-09-28 [email protected] [canvaskit]
Do not double-apply ImageFilter transform to children
(flutter/engine#46336)
2023-09-28 [email protected] Reland "Reverts "[ios] Fix app extension
not able to find assets from… (flutter/engine#46329)
2023-09-27 [email protected] Revert "[Impeller]
Fixes stroke path geometry that can draw outside o…
(flutter/engine#46334)
2023-09-27 [email protected] Roll Fuchsia Mac SDK from
jQHACBU4Fi2wMElkm... to U334SygIkffMJVmdu... (flutter/engine#46333)
2023-09-27 [email protected] Roll Skia from 952e8dd66560 to
b048b468d641 (1 revision) (flutter/engine#46332)
2023-09-27 [email protected] [Impeller] Destroy all
per-thread command pools tied to a context before deleting the context
(flutter/engine#46286)
2023-09-27 [email protected] Roll Skia from d78aba2524b3 to
952e8dd66560 (1 revision) (flutter/engine#46331)
2023-09-27 [email protected] [Impeller] Match Skia gradient
clamping behavior (and document). (flutter/engine#44825)
2023-09-27 [email protected] Roll Dart SDK from
97647bb1666b to 80a965ee48ab (1 revision) (flutter/engine#46330)
2023-09-27 [email protected] Roll Skia from ff5474eed6b4 to
d78aba2524b3 (3 revisions) (flutter/engine#46327)
2023-09-27 98614782+auto-submit[bot]@users.noreply.github.com Reverts
"[ios] Fix app extension not able to find assets from unloaded bundle"
(flutter/engine#46328)
2023-09-27 [email protected] [Windows] Improve
logic to update swap intervals (flutter/engine#46172)
2023-09-27 [email protected] [Impeller] Fallback to no index
buffer when tesselation count is large, split up nonZero contours.
(flutter/engine#46282)
2023-09-27 [email protected] Roll Skia from 4731ccd6342c to
ff5474eed6b4 (1 revision) (flutter/engine#46325)
2023-09-27 [email protected] Declare native wrapper
classes in Fuchsia packages as base classes (flutter/engine#46305)
2023-09-27 [email protected] Remove fuchsia from recipes cq.
(flutter/engine#46324)
2023-09-27 [email protected] Roll Dart SDK from
c2a455113e39 to 97647bb1666b (1 revision) (flutter/engine#46323)
2023-09-27 [email protected] [macOS] Synchronise modifiers from
mouse events for RawKeyboard (flutter/engine#46230)
2023-09-27 [email protected] Roll Fuchsia Linux SDK from
Lg6FR6iDnZeV6y-E8... to 6Y22MutFhgL7ua18F... (flutter/engine#46322)
2023-09-27 [email protected] Roll Skia from 2991bb799d3f to
4731ccd6342c (1 revision) (flutter/engine#46321)
2023-09-27 [email protected] Declare native wrapper
classes in the GPU package as base classes (flutter/engine#46304)
2023-09-27 [email protected] Do not call
DrawTextBlob for performance overlay text when using Impeller
(flutter/engine#46307)
2023-09-27 [email protected] Update to use
GrDirectContexts::MakeGL (flutter/engine#46308)
2023-09-27 [email protected] Roll Skia from 0f4f31127ac5 to
2991bb799d3f (1 revision) (flutter/engine#46319)
2023-09-27 [email protected] Roll Skia from fc629215398f to
0f4f31127ac5 (1 revision) (flutter/engine#46318)
2023-09-27 [email protected] Roll Dart SDK from
6c4eb86ecd25 to c2a455113e39 (1 revision) (flutter/engine#46317)
2023-09-27 [email protected] Roll Fuchsia Mac SDK from
OMrTgAfDg9PKXTzq0... to jQHACBU4Fi2wMElkm... (flutter/engine#46314)
2023-09-27 [email protected] Roll Skia from 960325c13009 to
fc629215398f (1 revision) (flutter/engine#46313)
2023-09-27 [email protected] Roll Skia from 76aecbaea259 to
960325c13009 (2 revisions) (flutter/engine#46311)
2023-09-27 [email protected] Roll Dart SDK from
7c3588c05f87 to 6c4eb86ecd25 (3 revisions) (flutter/engine#46310)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from Lg6FR6iDnZeV to 6Y22MutFhgL7
  fuchsia/sdk/core/mac-amd64 from OMrTgAfDg9PK to U334SygIkffM

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

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

...
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
#46329)

Relands #46283

The original PR had a bug where the relative assets path is reset after not being found in the `bundle`. It should not be reset unless it was not found inside the info.plist in `bundle`

Fixes flutter/flutter#124292

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
auto-submit bot pushed a commit that referenced this pull request Sep 9, 2024
The iOS golden scenario tests are supposed to run on Skia and Impeller, but are actually running on Skia twice.  

#### Issue 1: script-side

Regression from #46329.
Currently, the tests log "Running simulator tests with Impeller" but then you see that it's not:
```
Running simulator tests with Impeller
...
2024-09-06 13:38:07.692810-0700 Scenarios[73857:470266] [IMPORTANT:flutter/shell/common/shell.cc(456)] [Action Required] The application opted out of Impeller by either using the --no-enable-impeller flag or FLTEnableImpeller=false plist flag. This option is going to go away in an upcoming Flutter release. Remove the explicit opt-out. If you need to opt-out, report a bug describing the issue.
```
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8737514337106072353/+/u/test:_Scenario_App_Integration_Tests/stdout

`INFOPLIST_FILE="Scenarios/Info_Impeller.plist"` isn't passed into the xcodebuild any more.  I confirmed #46329 caused this by inserting a comment in the middle of the `xcodebuild` command, which caused the last argument after the comment to not be passed in.

#### Issue 2: test-side

Regression from #45093.
[The logic deciding whether to use Skia or Impeller goldens is incorrect](https://github.com/flutter/engine/blob/397987aedeb4ed41ec945fcbe9d347e579513bf4/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m#L84-L90) since `FLTEnableImpeller` is set in the app Info.plist, not the UI test, so the bundle should be "dev.flutter.Scenarios". That means even if the script was passing in the right Info.plist, the tests would fail since they would have compared the Skia screenshots.

#### This PR

1. Once #55016 merges (edit: done), these tests will no longer be running with the software renderer.  Remove all the test skips so they all run on Impeller.
2. Add the missing Impeller golden screenshots.
3. Update the default Info.plist to use Impeller, so if another script mishap happens, it will default to testing Impeller twice, and not Skia.  Add a Skia Info.plist variant instead.
4. Update the test logic to check the right bundle ID Info.plist to decide whether to compare against the Skia or Impeller screenshots.  Prefer Impeller so if another test-side mishap happens, it will also default to testing Impeller and not Skia.  It will only use the Skia goldens if the bool is set in the Info.plist, and that bool is NO (not just if it's missing).
5. All this made the now-default Impeller tests pass, but when passing in `INFOPLIST_FILE="Scenarios/Info_Skia.plist"` the app wasn't launching, with the error:

> Scenarios encountered an error (Failed to install or launch the test runner. (Underlying Error: Simulator device returned an error for the requested operation. Failed to create promise. (Underlying Error: Failed to create app extension placeholder for /Users/chrome-bot/Library/Developer/Xcode/DerivedData/Scenarios-aypjgouuxctxctfazxalyegcximf/Build/Products/Debug-iphonesimulator/Scenarios.app/PlugIns/ScenariosShare.appex. Failed to create promise. (Underlying Error: Failed to set placeholder attributes dev.flutter.Scenarios.ScenariosShare. Failed to create promise. (Underlying Error: extensionDictionary must be set in placeholder attributes for an app extension placeholder. Invalid placeholder attributes.)))))

This is identical to the error in #53717. I finally realized it was because the ScenariosShare app extension requires specific extension keys in its plist, which weren't present in the app Info.plist at `Scenarios/Info_Skia.plist`.  So I changed the `INFOPLIST_FILE` path to `$(TARGET_NAME)/Info_Skia.plist` so it would resolve to target-specific copies like `Scenarios/ScenariosShare/Info_Skia.plist`.  That meant I had to add a few more copies where they didn't exist in the target path.

Dependent on #55016 landing.
Fixes flutter/flutter#131888

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
jesswrd pushed a commit to jesswrd/engine that referenced this pull request Sep 11, 2024
The iOS golden scenario tests are supposed to run on Skia and Impeller, but are actually running on Skia twice.  

#### Issue 1: script-side

Regression from flutter#46329.
Currently, the tests log "Running simulator tests with Impeller" but then you see that it's not:
```
Running simulator tests with Impeller
...
2024-09-06 13:38:07.692810-0700 Scenarios[73857:470266] [IMPORTANT:flutter/shell/common/shell.cc(456)] [Action Required] The application opted out of Impeller by either using the --no-enable-impeller flag or FLTEnableImpeller=false plist flag. This option is going to go away in an upcoming Flutter release. Remove the explicit opt-out. If you need to opt-out, report a bug describing the issue.
```
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8737514337106072353/+/u/test:_Scenario_App_Integration_Tests/stdout

`INFOPLIST_FILE="Scenarios/Info_Impeller.plist"` isn't passed into the xcodebuild any more.  I confirmed flutter#46329 caused this by inserting a comment in the middle of the `xcodebuild` command, which caused the last argument after the comment to not be passed in.

#### Issue 2: test-side

Regression from flutter#45093.
[The logic deciding whether to use Skia or Impeller goldens is incorrect](https://github.com/flutter/engine/blob/397987aedeb4ed41ec945fcbe9d347e579513bf4/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m#L84-L90) since `FLTEnableImpeller` is set in the app Info.plist, not the UI test, so the bundle should be "dev.flutter.Scenarios". That means even if the script was passing in the right Info.plist, the tests would fail since they would have compared the Skia screenshots.

#### This PR

1. Once flutter#55016 merges (edit: done), these tests will no longer be running with the software renderer.  Remove all the test skips so they all run on Impeller.
2. Add the missing Impeller golden screenshots.
3. Update the default Info.plist to use Impeller, so if another script mishap happens, it will default to testing Impeller twice, and not Skia.  Add a Skia Info.plist variant instead.
4. Update the test logic to check the right bundle ID Info.plist to decide whether to compare against the Skia or Impeller screenshots.  Prefer Impeller so if another test-side mishap happens, it will also default to testing Impeller and not Skia.  It will only use the Skia goldens if the bool is set in the Info.plist, and that bool is NO (not just if it's missing).
5. All this made the now-default Impeller tests pass, but when passing in `INFOPLIST_FILE="Scenarios/Info_Skia.plist"` the app wasn't launching, with the error:

> Scenarios encountered an error (Failed to install or launch the test runner. (Underlying Error: Simulator device returned an error for the requested operation. Failed to create promise. (Underlying Error: Failed to create app extension placeholder for /Users/chrome-bot/Library/Developer/Xcode/DerivedData/Scenarios-aypjgouuxctxctfazxalyegcximf/Build/Products/Debug-iphonesimulator/Scenarios.app/PlugIns/ScenariosShare.appex. Failed to create promise. (Underlying Error: Failed to set placeholder attributes dev.flutter.Scenarios.ScenariosShare. Failed to create promise. (Underlying Error: extensionDictionary must be set in placeholder attributes for an app extension placeholder. Invalid placeholder attributes.)))))

This is identical to the error in flutter#53717. I finally realized it was because the ScenariosShare app extension requires specific extension keys in its plist, which weren't present in the app Info.plist at `Scenarios/Info_Skia.plist`.  So I changed the `INFOPLIST_FILE` path to `$(TARGET_NAME)/Info_Skia.plist` so it would resolve to target-specific copies like `Scenarios/ScenariosShare/Info_Skia.plist`.  That meant I had to add a few more copies where they didn't exist in the target path.

Dependent on flutter#55016 landing.
Fixes flutter/flutter#131888

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects: desktop autosubmit Merge PR when tree becomes green via auto submit App platform-ios platform-macos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[app_extension_safe] Add integration tests for extension safe framework
3 participants