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
dd65a546
Unverified
Commit
dd65a546
authored
Jan 25, 2019
by
Gary Qian
Committed by
GitHub
Jan 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warn when building on master channel (#25007)
parent
1237ee8f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
123 additions
and
0 deletions
+123
-0
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+18
-0
build_aot.dart
packages/flutter_tools/lib/src/commands/build_aot.dart
+2
-0
build_apk.dart
packages/flutter_tools/lib/src/commands/build_apk.dart
+2
-0
build_appbundle.dart
packages/flutter_tools/lib/src/commands/build_appbundle.dart
+2
-0
build_bundle.dart
packages/flutter_tools/lib/src/commands/build_bundle.dart
+2
-0
build_flx.dart
packages/flutter_tools/lib/src/commands/build_flx.dart
+2
-0
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+2
-0
build_test.dart
packages/flutter_tools/test/commands/build_test.dart
+93
-0
No files found.
packages/flutter_tools/lib/src/commands/build.dart
View file @
dd65a546
...
...
@@ -4,7 +4,13 @@
import
'dart:async'
;
import
'package:meta/meta.dart'
;
import
'../base/terminal.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../version.dart'
;
import
'build_aot.dart'
;
import
'build_apk.dart'
;
import
'build_appbundle.dart'
;
...
...
@@ -36,4 +42,16 @@ abstract class BuildSubCommand extends FlutterCommand {
BuildSubCommand
()
{
requiresPubspecYaml
();
}
@override
@mustCallSuper
Future
<
FlutterCommandResult
>
runCommand
()
async
{
// Warn if building a release app on Master channel
final
String
channel
=
FlutterVersion
.
instance
.
channel
;
if
(
channel
==
'master'
)
{
printStatus
(
'🐉'
,
newline:
false
,
color:
TerminalColor
.
red
);
printStatus
(
' This is the
$channel
channel. Shipping apps from this channel is not recommended as it has not been as heavily tested as the stable channel. To build using the stable channel, consider using:
\n
flutter channel stable'
);
}
return
null
;
}
}
packages/flutter_tools/lib/src/commands/build_aot.dart
View file @
dd65a546
...
...
@@ -57,6 +57,8 @@ class BuildAotCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
final
String
targetPlatform
=
argResults
[
'target-platform'
];
final
TargetPlatform
platform
=
getTargetPlatformForName
(
targetPlatform
);
if
(
platform
==
null
)
...
...
packages/flutter_tools/lib/src/commands/build_apk.dart
View file @
dd65a546
...
...
@@ -42,6 +42,8 @@ class BuildApkCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
await
buildApk
(
project:
await
FlutterProject
.
current
(),
target:
targetFile
,
...
...
packages/flutter_tools/lib/src/commands/build_appbundle.dart
View file @
dd65a546
...
...
@@ -40,6 +40,8 @@ class BuildAppBundleCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
await
buildAppBundle
(
project:
await
FlutterProject
.
current
(),
target:
targetFile
,
...
...
packages/flutter_tools/lib/src/commands/build_bundle.dart
View file @
dd65a546
...
...
@@ -65,6 +65,8 @@ class BuildBundleCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
final
String
targetPlatform
=
argResults
[
'target-platform'
];
final
TargetPlatform
platform
=
getTargetPlatformForName
(
targetPlatform
);
if
(
platform
==
null
)
...
...
packages/flutter_tools/lib/src/commands/build_flx.dart
View file @
dd65a546
...
...
@@ -20,6 +20,8 @@ class BuildFlxCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
printError
(
"'build flx' is no longer supported. Instead, use 'build "
"bundle' to build and assemble the application code and resources "
'for your app.'
);
...
...
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
dd65a546
...
...
@@ -50,6 +50,8 @@ class BuildIOSCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
final
bool
forSimulator
=
argResults
[
'simulator'
];
defaultBuildMode
=
forSimulator
?
BuildMode
.
debug
:
BuildMode
.
release
;
...
...
packages/flutter_tools/test/commands/build_test.dart
0 → 100644
View file @
dd65a546
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter_tools/src/base/context.dart'
;
import
'package:flutter_tools/src/commands/build.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
void
main
(
)
{
group
(
'Master channel warning'
,
()
{
testUsingContext
(
'warns on master'
,
()
async
{
final
MockBuildCommand
buildCommand
=
MockBuildCommand
();
try
{
await
createTestCommandRunner
(
buildCommand
).
run
(<
String
>[
'build'
,
'test'
]);
}
finally
{}
Cache
.
releaseLockEarly
();
expect
(
testLogger
.
statusText
,
contains
(
'🐉 This is the master channel. Shipping apps from this channel is not recommended as it has not'
));
},
overrides:
<
Type
,
Generator
>{
FlutterVersion:
()
=>
MockVersion
(
'master'
),
});
testUsingContext
(
'no warning on stable'
,
()
async
{
final
MockBuildCommand
buildCommand
=
MockBuildCommand
();
try
{
await
createTestCommandRunner
(
buildCommand
).
run
(<
String
>[
'build'
,
'test'
]);
}
finally
{}
Cache
.
releaseLockEarly
();
expect
(
testLogger
.
statusText
,
''
);
},
overrides:
<
Type
,
Generator
>{
FlutterVersion:
()
=>
MockVersion
(
'stable'
),
});
testUsingContext
(
'no warning on dev'
,
()
async
{
final
MockBuildCommand
buildCommand
=
MockBuildCommand
();
try
{
await
createTestCommandRunner
(
buildCommand
).
run
(<
String
>[
'build'
,
'test'
]);
}
finally
{}
Cache
.
releaseLockEarly
();
expect
(
testLogger
.
statusText
,
''
);
},
overrides:
<
Type
,
Generator
>{
FlutterVersion:
()
=>
MockVersion
(
'dev'
),
});
testUsingContext
(
'no warning on beta'
,
()
async
{
final
MockBuildCommand
buildCommand
=
MockBuildCommand
();
try
{
await
createTestCommandRunner
(
buildCommand
).
run
(<
String
>[
'build'
,
'test'
]);
}
finally
{}
print
(
testLogger
.
statusText
);
Cache
.
releaseLockEarly
();
expect
(
testLogger
.
statusText
,
''
);
},
overrides:
<
Type
,
Generator
>{
FlutterVersion:
()
=>
MockVersion
(
'beta'
),
});
});
}
class
MockVersion
extends
FlutterVersion
{
MockVersion
(
String
channel
)
:
_fakeChannel
=
channel
;
String
_fakeChannel
;
@override
String
get
channel
=>
_fakeChannel
;
}
class
MockBuildCommand
extends
BuildCommand
{
MockBuildCommand
()
{
addSubcommand
(
MockBuildTestCommand
());
}
}
// Avoids command validation
class
MockBuildTestCommand
extends
BuildSubCommand
{
@override
final
String
name
=
'test'
;
@override
final
String
description
=
'This is a test class only.'
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
return
null
;
}
}
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