Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1a36c184
Unverified
Commit
1a36c184
authored
Apr 09, 2021
by
Jenn Magder
Committed by
GitHub
Apr 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tell user how to enable available but disabled features (#79977)
parent
cf27be38
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
90 additions
and
11 deletions
+90
-11
build_linux.dart
packages/flutter_tools/lib/src/commands/build_linux.dart
+1
-1
build_macos.dart
packages/flutter_tools/lib/src/commands/build_macos.dart
+1
-1
build_web.dart
packages/flutter_tools/lib/src/commands/build_web.dart
+1
-1
build_windows.dart
packages/flutter_tools/lib/src/commands/build_windows.dart
+1
-1
build_winuwp.dart
packages/flutter_tools/lib/src/commands/build_winuwp.dart
+2
-2
build_linux_test.dart
..._tools/test/commands.shard/hermetic/build_linux_test.dart
+15
-1
build_macos_test.dart
..._tools/test/commands.shard/hermetic/build_macos_test.dart
+17
-2
build_web_test.dart
...er_tools/test/commands.shard/hermetic/build_web_test.dart
+1
-1
build_windows_test.dart
...ools/test/commands.shard/hermetic/build_windows_test.dart
+51
-1
No files found.
packages/flutter_tools/lib/src/commands/build_linux.dart
View file @
1a36c184
...
@@ -68,7 +68,7 @@ class BuildLinuxCommand extends BuildSubCommand {
...
@@ -68,7 +68,7 @@ class BuildLinuxCommand extends BuildSubCommand {
!=
getNameForTargetPlatformArch
(
targetPlatform
);
!=
getNameForTargetPlatformArch
(
targetPlatform
);
if
(!
featureFlags
.
isLinuxEnabled
)
{
if
(!
featureFlags
.
isLinuxEnabled
)
{
throwToolExit
(
'"build linux" is not currently supported.'
);
throwToolExit
(
'"build linux" is not currently supported.
To enable, run "flutter config --enable-linux-desktop".
'
);
}
}
if
(!
globals
.
platform
.
isLinux
)
{
if
(!
globals
.
platform
.
isLinux
)
{
throwToolExit
(
'"build linux" only supported on Linux hosts.'
);
throwToolExit
(
'"build linux" only supported on Linux hosts.'
);
...
...
packages/flutter_tools/lib/src/commands/build_macos.dart
View file @
1a36c184
...
@@ -44,7 +44,7 @@ class BuildMacosCommand extends BuildSubCommand {
...
@@ -44,7 +44,7 @@ class BuildMacosCommand extends BuildSubCommand {
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
if
(!
featureFlags
.
isMacOSEnabled
)
{
if
(!
featureFlags
.
isMacOSEnabled
)
{
throwToolExit
(
'"build macos" is not currently supported.'
);
throwToolExit
(
'"build macos" is not currently supported.
To enable, run "flutter config --enable-macos-desktop".
'
);
}
}
if
(!
globals
.
platform
.
isMacOS
)
{
if
(!
globals
.
platform
.
isMacOS
)
{
throwToolExit
(
'"build macos" only supported on macOS hosts.'
);
throwToolExit
(
'"build macos" only supported on macOS hosts.'
);
...
...
packages/flutter_tools/lib/src/commands/build_web.dart
View file @
1a36c184
...
@@ -79,7 +79,7 @@ class BuildWebCommand extends BuildSubCommand {
...
@@ -79,7 +79,7 @@ class BuildWebCommand extends BuildSubCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(!
featureFlags
.
isWebEnabled
)
{
if
(!
featureFlags
.
isWebEnabled
)
{
throwToolExit
(
'"build web" is not currently supported.'
);
throwToolExit
(
'"build web" is not currently supported.
To enable, run "flutter config --enable-web".
'
);
}
}
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
String
target
=
stringArg
(
'target'
);
final
String
target
=
stringArg
(
'target'
);
...
...
packages/flutter_tools/lib/src/commands/build_windows.dart
View file @
1a36c184
...
@@ -46,7 +46,7 @@ class BuildWindowsCommand extends BuildSubCommand {
...
@@ -46,7 +46,7 @@ class BuildWindowsCommand extends BuildSubCommand {
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
if
(!
featureFlags
.
isWindowsEnabled
)
{
if
(!
featureFlags
.
isWindowsEnabled
)
{
throwToolExit
(
'"build windows" is not currently supported.'
);
throwToolExit
(
'"build windows" is not currently supported.
To enable, run "flutter config --enable-windows-desktop".
'
);
}
}
if
(!
globals
.
platform
.
isWindows
)
{
if
(!
globals
.
platform
.
isWindows
)
{
throwToolExit
(
'"build windows" only supported on Windows hosts.'
);
throwToolExit
(
'"build windows" only supported on Windows hosts.'
);
...
...
packages/flutter_tools/lib/src/commands/build_winuwp.dart
View file @
1a36c184
...
@@ -46,10 +46,10 @@ class BuildWindowsUwpCommand extends BuildSubCommand {
...
@@ -46,10 +46,10 @@ class BuildWindowsUwpCommand extends BuildSubCommand {
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
if
(!
featureFlags
.
isWindowsUwpEnabled
)
{
if
(!
featureFlags
.
isWindowsUwpEnabled
)
{
throwToolExit
(
'"build win
dows
" is not currently supported.'
);
throwToolExit
(
'"build win
uwp
" is not currently supported.'
);
}
}
if
(!
globals
.
platform
.
isWindows
)
{
if
(!
globals
.
platform
.
isWindows
)
{
throwToolExit
(
'"build win
dows
" only supported on Windows hosts.'
);
throwToolExit
(
'"build win
uwp
" only supported on Windows hosts.'
);
}
}
displayNullSafetyMode
(
buildInfo
);
displayNullSafetyMode
(
buildInfo
);
await
buildWindowsUwp
(
await
buildWindowsUwp
(
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart
View file @
1a36c184
...
@@ -130,7 +130,7 @@ void main() {
...
@@ -130,7 +130,7 @@ void main() {
expect
(
createTestCommandRunner
(
command
).
run
(
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'build'
,
'linux'
,
'--no-pub'
]
const
<
String
>[
'build'
,
'linux'
,
'--no-pub'
]
),
throwsToolExit
());
),
throwsToolExit
(
message:
'"build linux" only supported on Linux hosts.'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
notLinuxPlatform
,
Platform:
()
=>
notLinuxPlatform
,
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
...
@@ -138,6 +138,20 @@ void main() {
...
@@ -138,6 +138,20 @@ void main() {
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
true
),
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
true
),
});
});
testUsingContext
(
'Linux build fails when feature is disabled'
,
()
async
{
final
BuildCommand
command
=
BuildCommand
();
setUpMockProjectFilesForBuild
();
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'build'
,
'linux'
,
'--no-pub'
]
),
throwsToolExit
(
message:
'"build linux" is not currently supported. To enable, run "flutter config --enable-linux-desktop".'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
linuxPlatform
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
false
),
});
testUsingContext
(
'Linux build invokes CMake and ninja, and writes temporary files'
,
()
async
{
testUsingContext
(
'Linux build invokes CMake and ninja, and writes temporary files'
,
()
async
{
final
BuildCommand
command
=
BuildCommand
();
final
BuildCommand
command
=
BuildCommand
();
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart
View file @
1a36c184
...
@@ -131,13 +131,12 @@ void main() {
...
@@ -131,13 +131,12 @@ void main() {
testUsingContext
(
'macOS build fails on non-macOS platform'
,
()
async
{
testUsingContext
(
'macOS build fails on non-macOS platform'
,
()
async
{
final
BuildCommand
command
=
BuildCommand
();
final
BuildCommand
command
=
BuildCommand
();
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'.packages'
).
createSync
();
fileSystem
.
file
(
fileSystem
.
path
.
join
(
'lib'
,
'main.dart'
))
fileSystem
.
file
(
fileSystem
.
path
.
join
(
'lib'
,
'main.dart'
))
.
createSync
(
recursive:
true
);
.
createSync
(
recursive:
true
);
expect
(
createTestCommandRunner
(
command
).
run
(
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'build'
,
'macos'
,
'--no-pub'
]
const
<
String
>[
'build'
,
'macos'
,
'--no-pub'
]
),
throwsToolExit
());
),
throwsToolExit
(
message:
'"build macos" only supported on macOS hosts.'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
notMacosPlatform
,
Platform:
()
=>
notMacosPlatform
,
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
...
@@ -145,6 +144,22 @@ void main() {
...
@@ -145,6 +144,22 @@ void main() {
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
true
),
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
true
),
});
});
testUsingContext
(
'macOS build fails when feature is disabled'
,
()
async
{
final
BuildCommand
command
=
BuildCommand
();
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
fileSystem
.
path
.
join
(
'lib'
,
'main.dart'
))
.
createSync
(
recursive:
true
);
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'build'
,
'macos'
,
'--no-pub'
]
),
throwsToolExit
(
message:
'"build macos" is not currently supported. To enable, run "flutter config --enable-macos-desktop".'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
macosPlatform
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
false
),
});
testUsingContext
(
'macOS build forwards error stdout to status logger error'
,
()
async
{
testUsingContext
(
'macOS build forwards error stdout to status logger error'
,
()
async
{
final
BuildCommand
command
=
BuildCommand
();
final
BuildCommand
command
=
BuildCommand
();
createMinimalMockProjectFiles
();
createMinimalMockProjectFiles
();
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart
View file @
1a36c184
...
@@ -87,7 +87,7 @@ void main() {
...
@@ -87,7 +87,7 @@ void main() {
expect
(
expect
(
()
=>
runner
.
run
(<
String
>[
'build'
,
'web'
]),
()
=>
runner
.
run
(<
String
>[
'build'
,
'web'
]),
throwsToolExit
(
),
throwsToolExit
(
message:
'"build web" is not currently supported. To enable, run "flutter config --enable-web".'
)
);
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
fakePlatform
,
Platform:
()
=>
fakePlatform
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart
View file @
1a36c184
...
@@ -175,7 +175,7 @@ void main() {
...
@@ -175,7 +175,7 @@ void main() {
expect
(
createTestCommandRunner
(
command
).
run
(
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'windows'
,
'--no-pub'
]
const
<
String
>[
'windows'
,
'--no-pub'
]
),
throwsToolExit
());
),
throwsToolExit
(
message:
'"build windows" only supported on Windows hosts.'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
notWindowsPlatform
,
Platform:
()
=>
notWindowsPlatform
,
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
...
@@ -183,6 +183,22 @@ void main() {
...
@@ -183,6 +183,22 @@ void main() {
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsEnabled:
true
),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsEnabled:
true
),
});
});
testUsingContext
(
'Windows build fails when feature is disabled'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
fakeVisualStudio
;
setUpMockProjectFilesForBuild
();
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'windows'
,
'--no-pub'
]
),
throwsToolExit
(
message:
'"build windows" is not currently supported. To enable, run "flutter config --enable-windows-desktop".'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsPlatform
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsEnabled:
false
),
});
testUsingContext
(
'Windows build does not spew stdout to status logger'
,
()
async
{
testUsingContext
(
'Windows build does not spew stdout to status logger'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
...
@@ -474,6 +490,22 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
...
@@ -474,6 +490,22 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsUwpEnabled:
true
),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsUwpEnabled:
true
),
});
});
testUsingContext
(
'Windows UWP uild fails on non windows platform'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsUwpCommand
command
=
BuildWindowsUwpCommand
()
..
visualStudioOverride
=
fakeVisualStudio
;
setUpMockProjectFilesForBuild
();
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'winuwp'
,
'--no-pub'
]
),
throwsToolExit
(
message:
'"build winuwp" only supported on Windows hosts.'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
notWindowsPlatform
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsUwpEnabled:
true
),
});
testUsingContext
(
'Windows UWP build fails when the project version is out of date'
,
()
async
{
testUsingContext
(
'Windows UWP build fails when the project version is out of date'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsUwpCommand
command
=
BuildWindowsUwpCommand
()
final
BuildWindowsUwpCommand
command
=
BuildWindowsUwpCommand
()
...
@@ -491,6 +523,24 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
...
@@ -491,6 +523,24 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsUwpEnabled:
true
),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsUwpEnabled:
true
),
});
});
testUsingContext
(
'Windows UWP build fails when feature is disabled'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsUwpCommand
command
=
BuildWindowsUwpCommand
()
..
visualStudioOverride
=
fakeVisualStudio
;
setUpMockProjectFilesForBuild
();
// This message should include 'To enable, run "flutter config --enable-windows-uwp-desktop"."
// once the `windowsUwpEmbedding` feature is available on all platforms.
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'winuwp'
,
'--no-pub'
]
),
throwsToolExit
(
message:
RegExp
(
r'"build winuwp" is not currently supported\.$'
)));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsPlatform
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsUwpEnabled:
false
),
});
testUsingContext
(
'Windows UWP build fails after writing Cmake file'
,
()
async
{
testUsingContext
(
'Windows UWP build fails after writing Cmake file'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsUwpCommand
command
=
BuildWindowsUwpCommand
()
final
BuildWindowsUwpCommand
command
=
BuildWindowsUwpCommand
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment