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
05f496ab
Commit
05f496ab
authored
Feb 23, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2105 from devoncarew/validate_atom
add a validator for Atom
parents
3f8fdb66
9367b86a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
41 deletions
+94
-41
android_workflow.dart
packages/flutter_tools/lib/src/android/android_workflow.dart
+4
-4
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+1
-2
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+75
-21
ios_workflow.dart
packages/flutter_tools/lib/src/ios/ios_workflow.dart
+14
-14
No files found.
packages/flutter_tools/lib/src/android/android_workflow.dart
View file @
05f496ab
...
...
@@ -7,7 +7,7 @@ import '../globals.dart';
import
'android_sdk.dart'
;
class
AndroidWorkflow
extends
Workflow
{
AndroidWorkflow
()
:
super
(
'Android'
)
;
String
get
label
=>
'Android toolchain'
;
bool
get
appliesToHostPlatform
=>
true
;
...
...
@@ -17,11 +17,11 @@ class AndroidWorkflow extends Workflow {
ValidationResult
validate
()
{
Validator
androidValidator
=
new
Validator
(
'
$name
toolchain'
,
label
,
description:
'develop for Android devices'
);
Function
_sdkExists
=
()
{
ValidationType
sdkExists
()
{
return
androidSdk
==
null
?
ValidationType
.
missing
:
ValidationType
.
installed
;
};
...
...
@@ -29,7 +29,7 @@ class AndroidWorkflow extends Workflow {
'Android SDK'
,
description:
'enable development for Android devices'
,
resolution:
'Download at https://developer.android.com/sdk/'
,
validatorFunction:
_
sdkExists
validatorFunction:
sdkExists
));
return
androidValidator
.
validate
();
...
...
packages/flutter_tools/lib/src/application_package.dart
View file @
05f496ab
...
...
@@ -146,8 +146,7 @@ class ApplicationPackageStore {
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOSSimulator
:
if
(
iOS
==
null
)
iOS
=
new
IOSApp
.
fromBuildConfiguration
(
config
);
iOS
??=
new
IOSApp
.
fromBuildConfiguration
(
config
);
break
;
case
TargetPlatform
.
mac
:
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
05f496ab
...
...
@@ -2,20 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
;
import
'android/android_workflow.dart'
;
import
'base/context.dart'
;
import
'base/process.dart'
;
import
'globals.dart'
;
import
'ios/ios_workflow.dart'
;
// TODO(devoncarew): Make it easy to add version information to the `doctor` printout.
class
Doctor
{
Doctor
()
{
_iosWorkflow
=
new
IOSWorkflow
();
if
(
_iosWorkflow
.
appliesToHostPlatform
)
_
workflow
s
.
add
(
_iosWorkflow
);
_
validator
s
.
add
(
_iosWorkflow
);
_androidWorkflow
=
new
AndroidWorkflow
();
if
(
_androidWorkflow
.
appliesToHostPlatform
)
_workflows
.
add
(
_androidWorkflow
);
_validators
.
add
(
_androidWorkflow
);
_validators
.
add
(
new
_AtomValidator
());
}
static
void
initGlobal
()
{
...
...
@@ -30,9 +37,9 @@ class Doctor {
AndroidWorkflow
get
androidWorkflow
=>
_androidWorkflow
;
List
<
Workflow
>
_workflows
=
<
Workflow
>[];
List
<
DoctorValidator
>
_validators
=
<
DoctorValidator
>[];
List
<
Workflow
>
get
workflows
=>
_workflows
;
Iterable
<
Workflow
>
get
workflows
=>
_validators
.
where
((
DoctorValidator
validator
)
=>
validator
is
Workflow
)
;
/// Print a summary of the state of the tooling, as well as how to get more info.
void
summary
()
=>
printStatus
(
summaryText
);
...
...
@@ -42,9 +49,9 @@ class Doctor {
bool
allGood
=
true
;
for
(
Workflow
workflow
in
workflow
s
)
{
ValidationResult
result
=
workflow
.
validate
();
buffer
.
write
(
'
${result.leadingBox}
The
${
workflow.name}
toolchain
is '
);
for
(
DoctorValidator
validator
in
_validator
s
)
{
ValidationResult
result
=
validator
.
validate
();
buffer
.
write
(
'
${result.leadingBox}
The
${
validator.label}
is '
);
if
(
result
.
type
==
ValidationType
.
missing
)
buffer
.
writeln
(
'not installed.'
);
else
if
(
result
.
type
==
ValidationType
.
partial
)
...
...
@@ -65,10 +72,12 @@ class Doctor {
/// Print verbose information about the state of installed tooling.
void
diagnose
()
{
for
(
int
i
=
0
;
i
<
workflows
.
length
;
i
++)
{
if
(
i
>
0
)
bool
firstLine
=
true
;
for
(
DoctorValidator
validator
in
_validators
)
{
if
(!
firstLine
)
printStatus
(
''
);
workflows
[
i
].
diagnose
();
firstLine
=
false
;
validator
.
diagnose
();
}
}
...
...
@@ -77,12 +86,17 @@ class Doctor {
bool
get
canLaunchAnything
=>
workflows
.
any
((
Workflow
workflow
)
=>
workflow
.
canLaunchDevices
);
}
/// A series of tools and required install steps for a target platform (iOS or Android).
abstract
class
Workflow
{
Workflow
(
this
.
name
);
abstract
class
DoctorValidator
{
String
get
label
;
final
String
name
;
ValidationResult
validate
()
;
/// Print verbose information about the state of the workflow.
void
diagnose
();
}
/// A series of tools and required install steps for a target platform (iOS or Android).
abstract
class
Workflow
extends
DoctorValidator
{
/// Whether the workflow applies to this platform (as in, should we ever try and use it).
bool
get
appliesToHostPlatform
;
...
...
@@ -91,13 +105,6 @@ abstract class Workflow {
/// Could this thing launch *something*? It may still have minor issues.
bool
get
canLaunchDevices
;
ValidationResult
validate
();
/// Print verbose information about the state of the workflow.
void
diagnose
();
String
toString
()
=>
name
;
}
enum
ValidationType
{
...
...
@@ -206,3 +213,50 @@ class ValidationResult {
return
results
;
}
}
class
_AtomValidator
extends
DoctorValidator
{
String
get
label
=>
'Atom development environment'
;
ValidationResult
validate
()
{
Validator
atomValidator
=
new
Validator
(
label
,
description:
'a lightweight development environment for Flutter'
);
ValidationType
atomExists
()
{
return
exitsHappy
(<
String
>[
'atom'
,
'--version'
])
?
ValidationType
.
installed
:
ValidationType
.
missing
;
};
ValidationType
flutterPluginExists
()
{
try
{
// apm list -b -p -i
ProcessResult
result
=
Process
.
runSync
(
'apm'
,
<
String
>[
'list'
,
'-b'
,
'-p'
,
'-i'
]);
if
(
result
.
exitCode
!=
0
)
return
ValidationType
.
missing
;
bool
available
=
(
result
.
stdout
as
String
).
split
(
'
\n
'
).
any
((
String
line
)
{
return
line
.
startsWith
(
'flutter@'
);
});
return
available
?
ValidationType
.
installed
:
ValidationType
.
missing
;
}
catch
(
error
)
{
return
ValidationType
.
missing
;
}
};
atomValidator
.
addValidator
(
new
Validator
(
'Atom editor'
,
resolution:
'Download at https://atom.io'
,
validatorFunction:
atomExists
));
atomValidator
.
addValidator
(
new
Validator
(
'Flutter plugin'
,
description:
'adds Flutter specific functionality to Atom'
,
resolution:
"Install the 'flutter' plugin in Atom or run 'apm install flutter'"
,
validatorFunction:
flutterPluginExists
));
return
atomValidator
.
validate
();
}
void
diagnose
()
=>
validate
().
print
();
}
packages/flutter_tools/lib/src/ios/ios_workflow.dart
View file @
05f496ab
...
...
@@ -10,7 +10,7 @@ import '../globals.dart';
import
'mac.dart'
;
class
IOSWorkflow
extends
Workflow
{
IOSWorkflow
()
:
super
(
'iOS'
)
;
String
get
label
=>
'iOS toolchain'
;
bool
get
appliesToHostPlatform
=>
Platform
.
isMacOS
;
...
...
@@ -23,33 +23,33 @@ class IOSWorkflow extends Workflow {
ValidationResult
validate
()
{
Validator
iosValidator
=
new
Validator
(
'
$name
toolchain'
,
label
,
description:
'develop for iOS devices'
);
Function
_xcodeExists
=
()
{
ValidationType
xcodeExists
()
{
return
xcode
.
isInstalled
?
ValidationType
.
installed
:
ValidationType
.
missing
;
};
Function
_xcodeVersionSatisfactory
=
()
{
ValidationType
xcodeVersionSatisfactory
()
{
return
xcode
.
isInstalledAndMeetsVersionCheck
?
ValidationType
.
installed
:
ValidationType
.
missing
;
};
Function
_xcodeEulaSigned
=
()
{
ValidationType
xcodeEulaSigned
()
{
return
xcode
.
eulaSigned
?
ValidationType
.
installed
:
ValidationType
.
missing
;
};
Function
_brewExists
=
()
{
ValidationType
brewExists
()
{
return
exitsHappy
(<
String
>[
'brew'
,
'-v'
])
?
ValidationType
.
installed
:
ValidationType
.
missing
;
};
Function
_ideviceinstallerExists
=
()
{
ValidationType
ideviceinstallerExists
()
{
return
exitsHappy
(<
String
>[
'ideviceinstaller'
,
'-h'
])
?
ValidationType
.
installed
:
ValidationType
.
missing
;
};
Function
_iosdeployExists
=
()
{
ValidationType
iosdeployExists
()
{
return
hasIdeviceId
?
ValidationType
.
installed
:
ValidationType
.
missing
;
};
...
...
@@ -57,7 +57,7 @@ class IOSWorkflow extends Workflow {
'XCode'
,
description:
'enable development for iOS devices'
,
resolution:
'Download at https://developer.apple.com/xcode/download/'
,
validatorFunction:
_
xcodeExists
validatorFunction:
xcodeExists
);
iosValidator
.
addValidator
(
xcodeValidator
);
...
...
@@ -66,21 +66,21 @@ class IOSWorkflow extends Workflow {
'version'
,
description:
'Xcode minimum version of
$kXcodeRequiredVersionMajor
.
$kXcodeRequiredVersionMinor
.0'
,
resolution:
'Download the latest version or update via the Mac App Store'
,
validatorFunction:
_
xcodeVersionSatisfactory
validatorFunction:
xcodeVersionSatisfactory
));
xcodeValidator
.
addValidator
(
new
Validator
(
'EULA'
,
description:
'XCode end user license agreement'
,
resolution:
"Open XCode or run the command 'sudo xcodebuild -license'"
,
validatorFunction:
_
xcodeEulaSigned
validatorFunction:
xcodeEulaSigned
));
Validator
brewValidator
=
new
Validator
(
'brew'
,
description:
'install additional development packages'
,
resolution:
'Download at http://brew.sh/'
,
validatorFunction:
_
brewExists
validatorFunction:
brewExists
);
iosValidator
.
addValidator
(
brewValidator
);
...
...
@@ -89,14 +89,14 @@ class IOSWorkflow extends Workflow {
'ideviceinstaller'
,
description:
'discover connected iOS devices'
,
resolution:
"Install via 'brew install ideviceinstaller'"
,
validatorFunction:
_
ideviceinstallerExists
validatorFunction:
ideviceinstallerExists
));
brewValidator
.
addValidator
(
new
Validator
(
'ios-deploy'
,
description:
'deploy to connected iOS devices'
,
resolution:
"Install via 'brew install ios-deploy'"
,
validatorFunction:
_
iosdeployExists
validatorFunction:
iosdeployExists
));
return
iosValidator
.
validate
();
...
...
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