-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Show output from pub get in flutter pub get
#106300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
271395f
1e2ec47
188cba6
1a10c02
36b6432
6704dfc
db28008
4dbce1d
53d4055
2f072c7
50069c5
e2594b3
7288008
01f63a6
6d7af54
6bf560b
08c085b
dab15aa
17a6c81
114d160
a5052aa
9acf615
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,7 +192,6 @@ class CreateCommand extends CreateBase { | |
| } | ||
|
|
||
| validateOutputDirectoryArg(); | ||
|
|
||
| String? sampleCode; | ||
| final String? sampleArgument = stringArg('sample'); | ||
| if (sampleArgument != null) { | ||
|
|
@@ -255,7 +254,29 @@ class CreateCommand extends CreateBase { | |
| } | ||
|
|
||
| final String dartSdk = globals.cache.dartSdkBuild; | ||
| final bool includeIos = featureFlags.isIOSEnabled && platforms.contains('ios'); | ||
| final bool includeIos; | ||
| final bool includeAndroid; | ||
| final bool includeWeb; | ||
| final bool includeLinux; | ||
| final bool includeMacos; | ||
| final bool includeWindows; | ||
| if (template == FlutterProjectType.module) { | ||
| // The module template only supports iOS and Android. | ||
| includeIos = true; | ||
| includeAndroid = true; | ||
| includeWeb = false; | ||
| includeLinux = false; | ||
| includeMacos = false; | ||
| includeWindows = false; | ||
| } else { | ||
| includeIos = featureFlags.isIOSEnabled && platforms.contains('ios'); | ||
| includeAndroid = featureFlags.isAndroidEnabled && platforms.contains('android'); | ||
| includeWeb = featureFlags.isWebEnabled && platforms.contains('web'); | ||
| includeLinux = featureFlags.isLinuxEnabled && platforms.contains('linux'); | ||
| includeMacos = featureFlags.isMacOSEnabled && platforms.contains('macos'); | ||
| includeWindows = featureFlags.isWindowsEnabled && platforms.contains('windows'); | ||
| } | ||
|
|
||
| String? developmentTeam; | ||
| if (includeIos) { | ||
| developmentTeam = await getCodeSigningIdentityDevelopmentTeam( | ||
|
|
@@ -282,11 +303,11 @@ class CreateCommand extends CreateBase { | |
| iosLanguage: stringArgDeprecated('ios-language'), | ||
| iosDevelopmentTeam: developmentTeam, | ||
| ios: includeIos, | ||
| android: featureFlags.isAndroidEnabled && platforms.contains('android'), | ||
| web: featureFlags.isWebEnabled && platforms.contains('web'), | ||
| linux: featureFlags.isLinuxEnabled && platforms.contains('linux'), | ||
| macos: featureFlags.isMacOSEnabled && platforms.contains('macos'), | ||
| windows: featureFlags.isWindowsEnabled && platforms.contains('windows'), | ||
| android: includeAndroid, | ||
| web: includeWeb, | ||
| linux: includeLinux, | ||
| macos: includeMacos, | ||
| windows: includeWindows, | ||
| // Enable null safety everywhere. | ||
| dartSdkVersionBounds: "'>=$dartSdk <3.0.0'", | ||
| implementationTests: boolArgDeprecated('implementation-tests'), | ||
|
|
@@ -309,6 +330,7 @@ class CreateCommand extends CreateBase { | |
|
|
||
| final Directory relativeDir = globals.fs.directory(projectDirPath); | ||
| int generatedFileCount = 0; | ||
| final PubContext pubContext; | ||
| switch (template) { | ||
| case FlutterProjectType.app: | ||
| generatedFileCount += await generateApp( | ||
|
|
@@ -319,6 +341,7 @@ class CreateCommand extends CreateBase { | |
| printStatusWhenWriting: !creatingNewProject, | ||
| projectType: template, | ||
| ); | ||
| pubContext = PubContext.create; | ||
| break; | ||
| case FlutterProjectType.skeleton: | ||
| generatedFileCount += await generateApp( | ||
|
|
@@ -329,6 +352,7 @@ class CreateCommand extends CreateBase { | |
| printStatusWhenWriting: !creatingNewProject, | ||
| generateMetadata: false, | ||
| ); | ||
| pubContext = PubContext.create; | ||
| break; | ||
| case FlutterProjectType.module: | ||
| generatedFileCount += await _generateModule( | ||
|
|
@@ -337,6 +361,7 @@ class CreateCommand extends CreateBase { | |
| overwrite: overwrite, | ||
| printStatusWhenWriting: !creatingNewProject, | ||
| ); | ||
| pubContext = PubContext.create; | ||
| break; | ||
| case FlutterProjectType.package: | ||
| generatedFileCount += await _generatePackage( | ||
|
|
@@ -345,6 +370,7 @@ class CreateCommand extends CreateBase { | |
| overwrite: overwrite, | ||
| printStatusWhenWriting: !creatingNewProject, | ||
| ); | ||
| pubContext = PubContext.createPackage; | ||
| break; | ||
| case FlutterProjectType.plugin: | ||
| generatedFileCount += await _generateMethodChannelPlugin( | ||
|
|
@@ -354,6 +380,7 @@ class CreateCommand extends CreateBase { | |
| printStatusWhenWriting: !creatingNewProject, | ||
| projectType: template, | ||
| ); | ||
| pubContext = PubContext.createPlugin; | ||
| break; | ||
| case FlutterProjectType.ffiPlugin: | ||
| generatedFileCount += await _generateFfiPlugin( | ||
|
|
@@ -363,8 +390,26 @@ class CreateCommand extends CreateBase { | |
| printStatusWhenWriting: !creatingNewProject, | ||
| projectType: template, | ||
| ); | ||
| pubContext = PubContext.createPlugin; | ||
| break; | ||
| } | ||
|
|
||
| if (boolArgDeprecated('pub')) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These commands are hard to read--can you explain why you're adding this here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, did this used to be called earlier in the _generateModule() and such helper functions?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this is moved from the helper-functions. |
||
| final FlutterProject project = FlutterProject.fromDirectory(relativeDir); | ||
| await pub.get( | ||
| context: pubContext, | ||
| project: project, | ||
| offline: boolArgDeprecated('offline'), | ||
| ); | ||
| await project.ensureReadyForPlatformSpecificTooling( | ||
| androidPlatform: includeAndroid, | ||
| iosPlatform: includeIos, | ||
| linuxPlatform: includeLinux, | ||
| macOSPlatform: includeMacos, | ||
| windowsPlatform: includeWindows, | ||
| webPlatform: includeWeb, | ||
| ); | ||
| } | ||
| if (sampleCode != null) { | ||
| generatedFileCount += _applySample(relativeDir, sampleCode); | ||
| } | ||
|
|
@@ -447,18 +492,6 @@ Your $application code is in $relativeAppMain. | |
| overwrite: overwrite, | ||
| printStatusWhenWriting: printStatusWhenWriting, | ||
| ); | ||
| if (boolArgDeprecated('pub')) { | ||
| await pub.get( | ||
| context: PubContext.create, | ||
| directory: directory.path, | ||
| offline: boolArgDeprecated('offline'), | ||
| ); | ||
| final FlutterProject project = FlutterProject.fromDirectory(directory); | ||
| await project.ensureReadyForPlatformSpecificTooling( | ||
| androidPlatform: true, | ||
| iosPlatform: true, | ||
| ); | ||
| } | ||
| return generatedCount; | ||
| } | ||
|
|
||
|
|
@@ -480,13 +513,6 @@ Your $application code is in $relativeAppMain. | |
| overwrite: overwrite, | ||
| printStatusWhenWriting: printStatusWhenWriting, | ||
| ); | ||
| if (boolArgDeprecated('pub')) { | ||
| await pub.get( | ||
| context: PubContext.createPackage, | ||
| directory: directory.path, | ||
| offline: boolArgDeprecated('offline'), | ||
| ); | ||
| } | ||
| return generatedCount; | ||
| } | ||
|
|
||
|
|
@@ -526,14 +552,6 @@ Your $application code is in $relativeAppMain. | |
| printStatusWhenWriting: printStatusWhenWriting, | ||
| ); | ||
|
|
||
| if (boolArgDeprecated('pub')) { | ||
| await pub.get( | ||
| context: PubContext.createPlugin, | ||
| directory: directory.path, | ||
| offline: boolArgDeprecated('offline'), | ||
| ); | ||
| } | ||
|
|
||
| final FlutterProject project = FlutterProject.fromDirectory(directory); | ||
| final bool generateAndroid = templateContext['android'] == true; | ||
| if (generateAndroid) { | ||
|
|
@@ -604,14 +622,6 @@ Your $application code is in $relativeAppMain. | |
| printStatusWhenWriting: printStatusWhenWriting, | ||
| ); | ||
|
|
||
| if (boolArgDeprecated('pub')) { | ||
| await pub.get( | ||
| context: PubContext.createPlugin, | ||
| directory: directory.path, | ||
| offline: boolArgDeprecated('offline'), | ||
| ); | ||
| } | ||
|
|
||
| final FlutterProject project = FlutterProject.fromDirectory(directory); | ||
| final bool generateAndroid = templateContext['android'] == true; | ||
| if (generateAndroid) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we still check if platforms.contains('ios') (and ditto for android)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could - but it would change the current behaviour: https://github.com/flutter/flutter/pull/106300/files#diff-fa49e752dc7aba132fcab72c29e71c50541d612363171837a4658e0317fb7c9aL457