Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
/pluginsPublic archive

[flutter_plugin_tool] Add support for building UWP plugins#4047

Merged
stuartmorgan-g merged 20 commits intoflutter:masterfrom
stuartmorgan-g:uwp-build-example
Aug 26, 2021
Merged

[flutter_plugin_tool] Add support for building UWP plugins#4047
stuartmorgan-g merged 20 commits intoflutter:masterfrom
stuartmorgan-g:uwp-build-example

Conversation

@stuartmorgan-g
Copy link
Contributor

@stuartmorgan-gstuartmorgan-g commentedJun 11, 2021
edited
Loading

This allows building UWP plugin examples withbuild-examples --winuwp. As with previous pre-stable-template desktop support, this avoids the issue of unstable app templates by runningflutter create on the fly before trying to build, so a template that will bitrot doesn't need to be checked in.

Also adds no-op "support" fordrive-examples --winuwp, with warnings about it not doing anything. This is to handle the fact that the LUCI recipe is shared between Win32 and UWP, and didn't conditionalizedrive. Rather than change that, then change it back later, this just adds the no-op support now (since changing the tooling is much easier than changing LUCI recipes currently).

This required some supporting tool changes:

  • Adds the ability to check for the new platform variants in a pubspec
  • Adds the ability to write test pubspecs that include variants, for testing

Part offlutter/flutter#82817

Pre-launch Checklist

  • I read theContributor Guide and followed the process outlined there for submitting PRs.
  • I read theTree Hygiene wiki page, which explains my responsibilities.
  • I read and followed therelevant style guides and ranthe auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does usedart format.)
  • I signed theCLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g.[shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to thepub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

@stuartmorgan-g
Copy link
ContributorAuthor

Sorry this turned into a yak-shave; once I was changing that test utility method it was very hard to stop...

@stuartmorgan-g
Copy link
ContributorAuthor

Hold off on reviewing; I re-implemented most of the yak as a prequel PR.

@stuartmorgan-gstuartmorgan-g marked this pull request as draftJune 17, 2021 16:07
@stuartmorgan-gstuartmorgan-g marked this pull request as ready for reviewJune 21, 2021 20:36
@stuartmorgan-g
Copy link
ContributorAuthor

Now with 100% less yak.

Copy link
Member

@cbrackencbracken left a comment

Choose a reason for hiding this comment

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

lgtm modulo a few nits.

// needs to be created on the fly with 'flutter create .'
Directory? temporaryPlatformDirectory;
if (flutterBuildType == 'winuwp') {
final Directory uwpFolder = example.childDirectory('winuwp');
Copy link
Member

Choose a reason for hiding this comment

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

pedantic nit: consideruwpDirectory for consistent naming with the APIs, unless folder is used consistently throughout the tool already.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Fixed (that's my macOS showing).

if (!uwpFolder.existsSync()) {
print('Creating temporary winuwp folder');
final int exitCode = await processRunner.runAndStream(
flutterCommand, <String>['create', '--platforms=winuwp', '.'],
Copy link
Member

Choose a reason for hiding this comment

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

Is thiswinuwp the same as theplatformVariantWinUwp orkPlatformWinUwp const incore.dart? If so consider using a string interpolation here both to indicate the connection, and because it'll break this code if we ever removed that const.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Is thiswinuwp the same as theplatformVariantWinUwp orkPlatformWinUwp const incore.dart?

Hm. I guess it's probably the same as kPlatformWinUwp now that you mention it ("UWP is a platform for the purposes of flutter commands likebuild andrun"); presumably the fact thatbuild andcreate are using the same string influtter isn't an accident.

The "platform" situation is kind of a disaster. I think the thing to do is to explore doing a follow-up PR that makes a tool-wide platform class that's based on the_PlatformDetails I had to define here, because it's a more general problem (as indicated by the constant names we have globally). That can have accessors for each different usage; mostly that will be the same thing in each case, but not always, and we can pass around that object internally everywhere instead of strings (and only convert to strings at the last minute when interfacing with things outside the tool).

PlatformSupport? requiredMode,
String? variant,
}) {
assert(platform == kPlatformIos ||
Copy link
Member

Choose a reason for hiding this comment

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

Should this be updated to includekPlatformWinUwp or is that always passed askPlatformWindows with the uwp variant?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The latter; from the standpoint of a plugin, UWP isn't a platform.

(But see my other comment; I think I could avoid this kind of confusion with a generic platform class.)

cbracken reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

Agreed; the backward compatibility makes this a bit of a pain. As you say, modelling this with classes might result in better readability than with logic in various bits of the tool. Agree that approach is worth exploring.

// The UWP template is not yet stable, so the UWP directory
// needs to be created on the fly with 'flutter create .'
Directory? temporaryPlatformDirectory;
if (flutterBuildType == 'winuwp') {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like these are currently literals for all the platforms; consider extracting them to build type consts.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

]));
});

test('driving UWP is a no-op', () async {
Copy link
Member

Choose a reason for hiding this comment

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

Might be useful to add a TODO here and elsewhere with a link to a bug.

@stuartmorgan-g
Copy link
ContributorAuthor

The red is a flaky test that I have a PR out for review to disable, so I'm going to land without wasting the resources of re-running it until it's green.

@stuartmorgan-gstuartmorgan-g merged commita011b30 intoflutter:masterAug 26, 2021
@stuartmorgan-gstuartmorgan-g deleted the uwp-build-example branchAugust 26, 2021 19:07
fotiDim pushed a commit to fotiDim/plugins that referenced this pull requestSep 13, 2021
)This allows building UWP plugin examples with `build-examples --winuwp`. As with previous pre-stable-template desktop support, this avoids the issue of unstable app templates by running `flutter create` on the fly before trying to build, so a template that will bitrot doesn't need to be checked in.Also adds no-op "support" for `drive-examples --winuwp`, with warnings about it not doing anything. This is to handle the fact that the LUCI recipe is shared between Win32 and UWP, and didn't conditionalize `drive`. Rather than change that, then change it back later, this just adds the no-op support now (since changing the tooling is much easier than changing LUCI recipes currently).This required some supporting tool changes:- Adds the ability to check for the new platform variants in a pubspec- Adds the ability to write test pubspecs that include variants, for testingPart offlutter/flutter#82817
amantoux pushed a commit to amantoux/plugins that referenced this pull requestSep 27, 2021
)This allows building UWP plugin examples with `build-examples --winuwp`. As with previous pre-stable-template desktop support, this avoids the issue of unstable app templates by running `flutter create` on the fly before trying to build, so a template that will bitrot doesn't need to be checked in.Also adds no-op "support" for `drive-examples --winuwp`, with warnings about it not doing anything. This is to handle the fact that the LUCI recipe is shared between Win32 and UWP, and didn't conditionalize `drive`. Rather than change that, then change it back later, this just adds the no-op support now (since changing the tooling is much easier than changing LUCI recipes currently).This required some supporting tool changes:- Adds the ability to check for the new platform variants in a pubspec- Adds the ability to write test pubspecs that include variants, for testingPart offlutter/flutter#82817
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

1 more reviewer

@cbrackencbrackencbracken approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@stuartmorgan-g@cbracken

Comments


[8]ページ先頭

©2009-2026 Movatter.jp