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
52efc7fb
Commit
52efc7fb
authored
Mar 06, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement --watch for flutter analyze
parent
b193854b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
381 additions
and
1 deletion
+381
-1
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+286
-1
sdk.dart
packages/flutter_tools/lib/src/dart/sdk.dart
+8
-0
analyze_test.dart
packages/flutter_tools/test/analyze_test.dart
+87
-0
No files found.
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
52efc7fb
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/dart/sdk.dart
0 → 100644
View file @
52efc7fb
// Copyright 2016 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:io'
;
/// Locate the Dart SDK by finding the Dart VM and going up two directories.
String
get
dartSdkPath
=>
new
File
(
Platform
.
executable
).
parent
.
parent
.
path
;
packages/flutter_tools/test/analyze_test.dart
0 → 100644
View file @
52efc7fb
// Copyright 2016 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
'dart:io'
;
import
'package:flutter_tools/src/base/os.dart'
;
import
'package:flutter_tools/src/commands/analyze.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
main
()
=>
defineTests
();
defineTests
()
{
AnalysisServer
server
;
Directory
tempDir
;
setUp
(()
{
tempDir
=
Directory
.
systemTemp
.
createTempSync
(
'analysis_test'
);
});
tearDown
(()
{
tempDir
?.
deleteSync
(
recursive:
true
);
return
server
?.
dispose
();
});
group
(
'analyze'
,
()
{
testUsingContext
(
'AnalysisServer success'
,
()
async
{
_createSampleProject
(
tempDir
);
await
pubGet
(
directory:
tempDir
.
path
);
server
=
new
AnalysisServer
(
dartSdkPath
,
<
String
>[
tempDir
.
path
]);
int
errorCount
=
0
;
Future
onDone
=
server
.
onAnalyzing
.
where
((
bool
analyzing
)
=>
analyzing
==
false
).
first
;
server
.
onErrors
.
listen
((
FileAnalysisErrors
errors
)
=>
errorCount
+=
errors
.
errors
.
length
);
await
server
.
start
();
await
onDone
;
expect
(
errorCount
,
0
);
},
overrides:
<
Type
,
dynamic
>{
OperatingSystemUtils:
os
});
testUsingContext
(
'AnalysisServer errors'
,
()
async
{
_createSampleProject
(
tempDir
,
brokenCode:
true
);
await
pubGet
(
directory:
tempDir
.
path
);
server
=
new
AnalysisServer
(
dartSdkPath
,
<
String
>[
tempDir
.
path
]);
int
errorCount
=
0
;
Future
onDone
=
server
.
onAnalyzing
.
where
((
bool
analyzing
)
=>
analyzing
==
false
).
first
;
server
.
onErrors
.
listen
((
FileAnalysisErrors
errors
)
=>
errorCount
+=
errors
.
errors
.
length
);
await
server
.
start
();
await
onDone
;
expect
(
errorCount
,
2
);
},
overrides:
<
Type
,
dynamic
>{
OperatingSystemUtils:
os
});
});
}
void
_createSampleProject
(
Directory
directory
,
{
bool
brokenCode:
false
})
{
File
pubspecFile
=
new
File
(
path
.
join
(
directory
.
path
,
'pubspec.yaml'
));
pubspecFile
.
writeAsStringSync
(
'''
name: foo_project
'''
);
File
dartFile
=
new
File
(
path
.
join
(
directory
.
path
,
'lib'
,
'main.dart'
));
dartFile
.
parent
.
createSync
();
dartFile
.
writeAsStringSync
(
'''
void main() {
print('
hello
world
');
${brokenCode ? 'prints("hello world");' : ''}
}
'''
);
}
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