Introduce architecture subdirectory for Windows build (#129805, #116196)#131843
Introduce architecture subdirectory for Windows build (#129805, #116196)#131843loic-sharma merged 1 commit intoflutter:masterfrom p-b-o:windows_build_layout_v1
Conversation
|
@loic-sharma Here it is! For now, I focused on a minimal change, with tests working (on x64 and arm64). |
|
Fixed error reported by flutter analyze. |
|
Fixed license message. |
|
@loic-sharma I'm not sure if the failure (windows plugin_test) means that there is something missing, or if the test script itself (located elsewhere?) should be updated to reflect new path to binary plugintest_test.exe. If you could help on this, that would be nice :). |
|
@loic-sharma Would you be interested in reviewing this? |
|
Yup will do! |
There was a problem hiding this comment.
Can we move this to the generated configs in _writeGeneratedFlutterConfig?
flutter/packages/flutter_tools/lib/src/cmake.dart
Lines 101 to 109 in b7acafa
There was a problem hiding this comment.
Linux build adds it directly to the cmake command, and IMHO, it's more explicit that putting it in another function.
FLUTTER_VERSION_* stuff is the same for all architecture, thus it makes sense to factorize it in a single place.
What do you think?
There was a problem hiding this comment.
Hm I agree we should align with Linux. If we move FLUTTER_TARGET_PLATFORM to the generated CMake config file, we would need to also update Linux. That seems out-of-scope for this PR, and we can follow-up with this change later if needed.
That said, I'm curious as to why Linux chose this approach. The generated cmake config file makes it easier to use the CMake project without the Flutter tool. Regardless, I'll close this off!
There was a problem hiding this comment.
Thanks for accepting this.
There was a problem hiding this comment.
What happens if someone directly invokes a build via cmake without providing -DFLUTTER_TARGET_PLATFORM?
packages/flutter_tools/lib/src/windows/migrations/build_architecture_migration.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/windows/migrations/build_architecture_migration.dart
Outdated
Show resolved
Hide resolved
...s/flutter_tools/test/general.shard/windows/migrations/build_architecture_migration_test.dart
Outdated
Show resolved
Hide resolved
...s/flutter_tools/test/general.shard/windows/migrations/build_architecture_migration_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/windows/migrations/build_architecture_migration.dart
Outdated
Show resolved
Hide resolved
It looks like you'll need to update this: flutter/dev/devicelab/lib/tasks/plugin_tests.dart Lines 296 to 300 in 53082f6 You should be able to run this test locally using these instructions: https://github.com/flutter/flutter/tree/master/dev/devicelab#running-tests-locally TLDR, this should work: cd path/to/flutter
cd dev/devicelab
../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t plugin_test_windowsLet me know if you run into any problems! |
|
First fixing failed test, before addressing other comments in review. |
|
Pushed resolved changes. |
|
Fixed analyze not happy with raw cmake strings 'if(...'. |
packages/flutter_tools/templates/app_shared/windows.tmpl/flutter/CMakeLists.txt
Outdated
Show resolved
Hide resolved
|
Added change to hardcode TargetPlatform to getWindowsBuildDirectory. |
There was a problem hiding this comment.
Ideally this should have the same logic as the clean command's deletion:
flutter/packages/flutter_tools/lib/src/commands/clean.dart
Lines 116 to 143 in d9cb50e
Namely:
- Show a progress bar
- If a file in the build directory is in use, show a helpful error message describing how to stop the program using the file
@christopherfujino How would you feel about moving CleanCommand.deleteFile to FileSystemUtils?
There was a problem hiding this comment.
Hmm, this seems to do a lot more than I would expect a generic method named deleteFile. I'm ok with moving htis to FileSystemUtils if we use a more descriptive method name, like recursivelyDeleteEntity({bool showProgress = false})
There was a problem hiding this comment.
Thanks, I'll move it and use that method then.
There was a problem hiding this comment.
After trying to move this, it creates several changes that are not so welcome on this PR. (tests moving, etc).
Would that be acceptable to first use the initial version, and then refactor this in a subsequent PR?
|
Pushed fix for latest comments (cmake file, nit). I left open the discussion about FYI, I'll be off next week, so there will be some delay before I can answer. |
To implement windows-arm64 support, it is needed to add architecture as a subdirectory (#129805).
In short, when performing a flutter windows build, we have:
This convention follows what flutter linux build does.
The old "runner" folder is automatically cleaned to prevent confusion for users not aware of this change, and who could continue to use outdated binaries accidentally.
We didn't introduce any change in ephemeral build folder. This might be required when introducing another architecture, but it won't be a breaking change, as those files are not used by end user.
Since we use a fresh cmake folder, we introduce FLUTTER_TARGET_PLATFORM in flutter cmake file (#116196). This will be needed when targeting another architecture than x64, and will avoid to have to clean existing cmake files. An automatic migration was implemented to automate this change in existing applications.
Finally, we set a specific architecture when calling cmake. This fixes existing build and tests on Windows on Arm, where cmake tries to compile native windows-arm64 binaries by default (which fails to link x64 libraries). In more, it will avoid need to clean existing cmake files when introducing another architecture.
Design doc: flutter.dev/go/windows-arm64
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.