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
5e3e5a2a
Unverified
Commit
5e3e5a2a
authored
Jun 09, 2020
by
Jonah Williams
Committed by
GitHub
Jun 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "[flutter_tools] use correct sdk path for analysis (#58871)" (#59035)
This reverts commit
9ed3e5be
.
parent
c5a78210
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
69 additions
and
217 deletions
+69
-217
executable.dart
packages/flutter_tools/lib/executable.dart
+0
-1
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+7
-11
build_runner.dart
...ages/flutter_tools/lib/src/build_runner/build_runner.dart
+2
-8
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+3
-9
analyze_base.dart
packages/flutter_tools/lib/src/commands/analyze_base.dart
+1
-5
analyze_continuously.dart
.../flutter_tools/lib/src/commands/analyze_continuously.dart
+3
-6
analyze_once.dart
packages/flutter_tools/lib/src/commands/analyze_once.dart
+3
-6
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+4
-2
sdk.dart
packages/flutter_tools/lib/src/dart/sdk.dart
+22
-0
analyze_continuously_test.dart
...st/commands.shard/hermetic/analyze_continuously_test.dart
+11
-137
analyze_once_test.dart
...ools/test/commands.shard/permeable/analyze_once_test.dart
+0
-16
create_test.dart
...tter_tools/test/commands.shard/permeable/create_test.dart
+10
-14
test_test.dart
...lutter_tools/test/commands.shard/permeable/test_test.dart
+3
-2
No files found.
packages/flutter_tools/lib/executable.dart
View file @
5e3e5a2a
...
...
@@ -75,7 +75,6 @@ Future<void> main(List<String> args) async {
processManager:
globals
.
processManager
,
logger:
globals
.
logger
,
terminal:
globals
.
terminal
,
artifacts:
globals
.
artifacts
,
),
AssembleCommand
(),
AttachCommand
(
verboseHelp:
verboseHelp
),
...
...
packages/flutter_tools/lib/src/artifacts.dart
View file @
5e3e5a2a
...
...
@@ -10,6 +10,7 @@ import 'base/platform.dart';
import
'base/utils.dart'
;
import
'build_info.dart'
;
import
'cache.dart'
;
import
'dart/sdk.dart'
;
import
'globals.dart'
as
globals
;
enum
Artifact
{
...
...
@@ -338,9 +339,9 @@ class CachedArtifacts extends Artifacts {
final
String
platformDirName
=
getNameForTargetPlatform
(
platform
);
return
_fileSystem
.
path
.
join
(
engineArtifactsPath
,
platformDirName
,
_artifactToFileName
(
artifact
,
platform
,
mode
));
case
Artifact
.
engineDartSdkPath
:
return
_dartSdkPath
(
_fileSystem
)
;
return
dartSdkPath
;
case
Artifact
.
engineDartBinary
:
return
_fileSystem
.
path
.
join
(
_dartSdkPath
(
_fileSystem
)
,
'bin'
,
_artifactToFileName
(
artifact
,
platform
));
return
_fileSystem
.
path
.
join
(
dartSdkPath
,
'bin'
,
_artifactToFileName
(
artifact
,
platform
));
case
Artifact
.
platformKernelDill
:
return
_fileSystem
.
path
.
join
(
_getFlutterPatchedSdkPath
(
mode
),
_artifactToFileName
(
artifact
));
case
Artifact
.
platformLibrariesJson
:
...
...
@@ -354,11 +355,11 @@ class CachedArtifacts extends Artifacts {
case
Artifact
.
webPlatformKernelDill
:
return
_fileSystem
.
path
.
join
(
_getFlutterWebSdkPath
(),
'kernel'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
dart2jsSnapshot
:
return
_fileSystem
.
path
.
join
(
_dartSdkPath
(
_fileSystem
)
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
return
_fileSystem
.
path
.
join
(
dartSdkPath
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
dartdevcSnapshot
:
return
_fileSystem
.
path
.
join
(
_dartSdkPath
(
_fileSystem
)
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
return
_fileSystem
.
path
.
join
(
dartSdkPath
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
kernelWorkerSnapshot
:
return
_fileSystem
.
path
.
join
(
_dartSdkPath
(
_fileSystem
)
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
return
_fileSystem
.
path
.
join
(
dartSdkPath
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
flutterMacOSFramework
:
case
Artifact
.
linuxDesktopPath
:
case
Artifact
.
windowsDesktopPath
:
...
...
@@ -527,7 +528,7 @@ class LocalEngineArtifacts extends Artifacts {
case
Artifact
.
dart2jsSnapshot
:
return
_fileSystem
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
'snapshots'
,
artifactFileName
);
case
Artifact
.
dartdevcSnapshot
:
return
_fileSystem
.
path
.
join
(
_dartSdkPath
(
_fileSystem
)
,
'bin'
,
'snapshots'
,
artifactFileName
);
return
_fileSystem
.
path
.
join
(
dartSdkPath
,
'bin'
,
'snapshots'
,
artifactFileName
);
case
Artifact
.
kernelWorkerSnapshot
:
return
_fileSystem
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
'snapshots'
,
artifactFileName
);
case
Artifact
.
idevicescreenshot
:
...
...
@@ -660,8 +661,3 @@ class OverrideArtifacts implements Artifacts {
@override
bool
get
isLocalEngine
=>
parent
.
isLocalEngine
;
}
/// Locate the Dart SDK.
String
_dartSdkPath
(
FileSystem
fileSystem
)
{
return
fileSystem
.
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
);
}
packages/flutter_tools/lib/src/build_runner/build_runner.dart
View file @
5e3e5a2a
...
...
@@ -19,6 +19,7 @@ import '../base/io.dart';
import
'../base/logger.dart'
;
import
'../codegen.dart'
;
import
'../dart/pub.dart'
;
import
'../dart/sdk.dart'
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
...
...
@@ -110,14 +111,7 @@ class BuildRunner extends CodeGenerator {
}
scriptIdFile
.
writeAsBytesSync
(
appliedBuilderDigest
);
final
ProcessResult
generateResult
=
await
globals
.
processManager
.
run
(<
String
>[
globals
.
fs
.
path
.
join
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
),
'bin'
,
(
globals
.
platform
.
isWindows
)
?
'pub.bat'
:
'pub'
),
'run'
,
'build_runner'
,
'generate-build-script'
,
sdkBinaryName
(
'pub'
),
'run'
,
'build_runner'
,
'generate-build-script'
,
],
workingDirectory:
syntheticPubspec
.
parent
.
path
);
if
(
generateResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Error generating build_script snapshot:
${generateResult.stderr}
'
);
...
...
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
5e3e5a2a
...
...
@@ -7,7 +7,6 @@ import 'dart:async';
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
import
'../artifacts.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/platform.dart'
;
...
...
@@ -22,12 +21,10 @@ class AnalyzeCommand extends FlutterCommand {
this
.
workingDirectory
,
@required
FileSystem
fileSystem
,
@required
Platform
platform
,
@required
Terminal
terminal
,
@required
Ansi
Terminal
terminal
,
@required
Logger
logger
,
@required
ProcessManager
processManager
,
@required
Artifacts
artifacts
,
})
:
_artifacts
=
artifacts
,
_fileSystem
=
fileSystem
,
})
:
_fileSystem
=
fileSystem
,
_processManager
=
processManager
,
_logger
=
logger
,
_terminal
=
terminal
,
...
...
@@ -80,10 +77,9 @@ class AnalyzeCommand extends FlutterCommand {
/// The working directory for testing analysis using dartanalyzer.
final
Directory
workingDirectory
;
final
Artifacts
_artifacts
;
final
FileSystem
_fileSystem
;
final
Logger
_logger
;
final
Terminal
_terminal
;
final
Ansi
Terminal
_terminal
;
final
ProcessManager
_processManager
;
final
Platform
_platform
;
...
...
@@ -121,7 +117,6 @@ class AnalyzeCommand extends FlutterCommand {
processManager:
_processManager
,
terminal:
_terminal
,
experiments:
stringsArg
(
'enable-experiment'
),
artifacts:
_artifacts
,
).
analyze
();
}
else
{
await
AnalyzeOnce
(
...
...
@@ -135,7 +130,6 @@ class AnalyzeCommand extends FlutterCommand {
processManager:
_processManager
,
terminal:
_terminal
,
experiments:
stringsArg
(
'enable-experiment'
),
artifacts:
_artifacts
,
).
analyze
();
}
return
FlutterCommandResult
.
success
();
...
...
packages/flutter_tools/lib/src/commands/analyze_base.dart
View file @
5e3e5a2a
...
...
@@ -9,7 +9,6 @@ import 'package:meta/meta.dart';
import
'package:process/process.dart'
;
import
'package:yaml/yaml.dart'
as
yaml
;
import
'../artifacts.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
...
...
@@ -30,7 +29,6 @@ abstract class AnalyzeBase {
@required
this
.
processManager
,
@required
this
.
terminal
,
@required
this
.
experiments
,
@required
this
.
artifacts
,
});
/// The parsed argument results for execution.
...
...
@@ -48,11 +46,9 @@ abstract class AnalyzeBase {
@protected
final
Platform
platform
;
@protected
final
Terminal
terminal
;
final
Ansi
Terminal
terminal
;
@protected
final
List
<
String
>
experiments
;
@protected
final
Artifacts
artifacts
;
/// Called by [AnalyzeCommand] to start the analysis process.
Future
<
void
>
analyze
();
...
...
packages/flutter_tools/lib/src/commands/analyze_continuously.dart
View file @
5e3e5a2a
...
...
@@ -8,7 +8,6 @@ import 'package:args/args.dart';
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
import
'../artifacts.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
...
...
@@ -17,17 +16,17 @@ import '../base/platform.dart';
import
'../base/terminal.dart'
;
import
'../base/utils.dart'
;
import
'../dart/analysis.dart'
;
import
'../dart/sdk.dart'
as
sdk
;
import
'analyze_base.dart'
;
class
AnalyzeContinuously
extends
AnalyzeBase
{
AnalyzeContinuously
(
ArgResults
argResults
,
List
<
String
>
repoRoots
,
List
<
Directory
>
repoPackages
,
{
@required
FileSystem
fileSystem
,
@required
Logger
logger
,
@required
Terminal
terminal
,
@required
Ansi
Terminal
terminal
,
@required
Platform
platform
,
@required
ProcessManager
processManager
,
@required
List
<
String
>
experiments
,
@required
Artifacts
artifacts
,
})
:
super
(
argResults
,
repoPackages:
repoPackages
,
...
...
@@ -38,7 +37,6 @@ class AnalyzeContinuously extends AnalyzeBase {
terminal:
terminal
,
processManager:
processManager
,
experiments:
experiments
,
artifacts:
artifacts
,
);
String
analysisTarget
;
...
...
@@ -69,8 +67,7 @@ class AnalyzeContinuously extends AnalyzeBase {
analysisTarget
=
fileSystem
.
currentDirectory
.
path
;
}
final
String
sdkPath
=
argResults
[
'dart-sdk'
]
as
String
??
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
);
final
String
sdkPath
=
argResults
[
'dart-sdk'
]
as
String
??
sdk
.
dartSdkPath
;
final
AnalysisServer
server
=
AnalysisServer
(
sdkPath
,
directories
,
fileSystem:
fileSystem
,
...
...
packages/flutter_tools/lib/src/commands/analyze_once.dart
View file @
5e3e5a2a
...
...
@@ -8,7 +8,6 @@ import 'package:args/args.dart';
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
import
'../artifacts.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
...
...
@@ -16,6 +15,7 @@ import '../base/platform.dart';
import
'../base/terminal.dart'
;
import
'../base/utils.dart'
;
import
'../dart/analysis.dart'
;
import
'../dart/sdk.dart'
as
sdk
;
import
'analyze.dart'
;
import
'analyze_base.dart'
;
...
...
@@ -29,9 +29,8 @@ class AnalyzeOnce extends AnalyzeBase {
@required
Logger
logger
,
@required
Platform
platform
,
@required
ProcessManager
processManager
,
@required
Terminal
terminal
,
@required
Ansi
Terminal
terminal
,
@required
List
<
String
>
experiments
,
@required
Artifacts
artifacts
,
this
.
workingDirectory
,
})
:
super
(
argResults
,
...
...
@@ -43,7 +42,6 @@ class AnalyzeOnce extends AnalyzeBase {
processManager:
processManager
,
terminal:
terminal
,
experiments:
experiments
,
artifacts:
artifacts
,
);
/// The working directory for testing analysis using dartanalyzer.
...
...
@@ -91,8 +89,7 @@ class AnalyzeOnce extends AnalyzeBase {
final
Completer
<
void
>
analysisCompleter
=
Completer
<
void
>();
final
List
<
AnalysisError
>
errors
=
<
AnalysisError
>[];
final
String
sdkPath
=
argResults
[
'dart-sdk'
]
as
String
??
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
);
final
String
sdkPath
=
argResults
[
'dart-sdk'
]
as
String
??
sdk
.
dartSdkPath
;
final
AnalysisServer
server
=
AnalysisServer
(
sdkPath
,
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
5e3e5a2a
...
...
@@ -12,12 +12,12 @@ import 'package:webdriver/async_io.dart' as async_io;
import
'../android/android_device.dart'
;
import
'../application_package.dart'
;
import
'../artifacts.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/process.dart'
;
import
'../build_info.dart'
;
import
'../dart/package_map.dart'
;
import
'../dart/sdk.dart'
;
import
'../device.dart'
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
...
...
@@ -505,9 +505,11 @@ Future<void> _runTests(List<String> testArgs, Map<String, String> environment) a
globals
.
printTrace
(
'Running driver tests.'
);
globalPackagesPath
=
globals
.
fs
.
path
.
normalize
(
globals
.
fs
.
path
.
absolute
(
globalPackagesPath
));
final
String
dartVmPath
=
globals
.
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
);
final
int
result
=
await
processUtils
.
stream
(
<
String
>[
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
dartVmPath
,
...
dartVmFlags
,
...
testArgs
,
'--packages=
$globalPackagesPath
'
,
'-rexpanded'
,
...
...
packages/flutter_tools/lib/src/dart/sdk.dart
0 → 100644
View file @
5e3e5a2a
// Copyright 2014 The Flutter 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
'../cache.dart'
;
import
'../globals.dart'
as
globals
;
/// Locate the Dart SDK.
String
get
dartSdkPath
{
return
globals
.
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
);
}
/// The required Dart language flags
const
List
<
String
>
dartVmFlags
=
<
String
>[];
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
/// ==> `pub.bat`. The default SDK location can be overridden with a specified
/// [sdkLocation].
String
sdkBinaryName
(
String
name
,
{
String
sdkLocation
})
{
return
globals
.
fs
.
path
.
absolute
(
globals
.
fs
.
path
.
join
(
sdkLocation
??
dartSdkPath
,
'bin'
,
globals
.
platform
.
isWindows
?
'
$name
.bat'
:
name
));
}
packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart
View file @
5e3e5a2a
...
...
@@ -4,18 +4,15 @@
import
'dart:async'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
import
'package:flutter_tools/src/commands/analyze.dart'
;
import
'package:flutter_tools/src/dart/analysis.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
import
'package:process/process.dart'
;
...
...
@@ -79,9 +76,7 @@ void main() {
);
await
pub
.
get
(
context:
PubContext
.
flutterTests
,
directory:
tempDir
.
path
);
server
=
AnalysisServer
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
),
<
String
>[
tempDir
.
path
],
server
=
AnalysisServer
(
dartSdkPath
,
<
String
>[
tempDir
.
path
],
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
processManager
,
...
...
@@ -114,9 +109,7 @@ void main() {
);
await
pub
.
get
(
context:
PubContext
.
flutterTests
,
directory:
tempDir
.
path
);
server
=
AnalysisServer
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
),
<
String
>[
tempDir
.
path
],
server
=
AnalysisServer
(
dartSdkPath
,
<
String
>[
tempDir
.
path
],
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
processManager
,
...
...
@@ -140,9 +133,7 @@ void main() {
testUsingContext
(
'Returns no errors when source is error-free'
,
()
async
{
const
String
contents
=
"StringBuffer bar = StringBuffer('baz');"
;
tempDir
.
childFile
(
'main.dart'
).
writeAsStringSync
(
contents
);
server
=
AnalysisServer
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
),
<
String
>[
tempDir
.
path
],
server
=
AnalysisServer
(
dartSdkPath
,
<
String
>[
tempDir
.
path
],
fileSystem:
fileSystem
,
platform:
platform
,
processManager:
processManager
,
...
...
@@ -196,121 +187,4 @@ void main() {
await
server
.
start
();
});
testUsingContext
(
'Can run AnalysisService with customized cache location'
,
()
async
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
StreamController
<
List
<
int
>>
stdin
=
StreamController
<
List
<
int
>>();
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(
<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
'custom-dart-sdk/bin/dart'
,
'custom-dart-sdk/bin/snapshots/analysis_server.dart.snapshot'
,
'--disable-server-feature-completion'
,
'--disable-server-feature-search'
,
'--sdk'
,
'custom-dart-sdk'
,
],
completer:
completer
,
stdin:
IOSink
(
stdin
.
sink
),
),
]);
final
Artifacts
artifacts
=
MockArtifacts
();
when
(
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
))
.
thenReturn
(
'custom-dart-sdk'
);
final
AnalyzeCommand
command
=
AnalyzeCommand
(
terminal:
Terminal
.
test
(),
artifacts:
artifacts
,
logger:
BufferLogger
.
test
(),
platform:
FakePlatform
(
operatingSystem:
'linux'
),
fileSystem:
MemoryFileSystem
.
test
(),
processManager:
processManager
,
);
final
TestFlutterCommandRunner
commandRunner
=
TestFlutterCommandRunner
();
commandRunner
.
addCommand
(
command
);
unawaited
(
commandRunner
.
run
(<
String
>[
'analyze'
,
'--watch'
]));
await
stdin
.
stream
.
first
;
expect
(
processManager
.
hasRemainingExpectations
,
false
);
});
testUsingContext
(
'Can run AnalysisService with customized cache location --watch'
,
()
async
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
StreamController
<
List
<
int
>>
stdin
=
StreamController
<
List
<
int
>>();
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(
<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
'custom-dart-sdk/bin/dart'
,
'custom-dart-sdk/bin/snapshots/analysis_server.dart.snapshot'
,
'--disable-server-feature-completion'
,
'--disable-server-feature-search'
,
'--sdk'
,
'custom-dart-sdk'
,
],
completer:
completer
,
stdin:
IOSink
(
stdin
.
sink
),
),
]);
final
Artifacts
artifacts
=
MockArtifacts
();
when
(
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
))
.
thenReturn
(
'custom-dart-sdk'
);
final
AnalyzeCommand
command
=
AnalyzeCommand
(
terminal:
Terminal
.
test
(),
artifacts:
artifacts
,
logger:
BufferLogger
.
test
(),
platform:
FakePlatform
(
operatingSystem:
'linux'
),
fileSystem:
MemoryFileSystem
.
test
(),
processManager:
processManager
,
);
final
TestFlutterCommandRunner
commandRunner
=
TestFlutterCommandRunner
();
commandRunner
.
addCommand
(
command
);
unawaited
(
commandRunner
.
run
(<
String
>[
'analyze'
,
'--watch'
]));
await
stdin
.
stream
.
first
;
expect
(
processManager
.
hasRemainingExpectations
,
false
);
});
testWithoutContext
(
'Can forward null-safety experiments to the AnalysisServer'
,
()
async
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
StreamController
<
List
<
int
>>
stdin
=
StreamController
<
List
<
int
>>();
const
String
fakeSdkPath
=
'dart-sdk'
;
final
FakeCommand
fakeCommand
=
FakeCommand
(
command:
const
<
String
>[
'dart-sdk/bin/dart'
,
'dart-sdk/bin/snapshots/analysis_server.dart.snapshot'
,
'--enable-experiment'
,
'non-nullable'
,
'--disable-server-feature-completion'
,
'--disable-server-feature-search'
,
'--sdk'
,
'dart-sdk'
,
],
completer:
completer
,
stdin:
IOSink
(
stdin
.
sink
),
);
server
=
AnalysisServer
(
fakeSdkPath
,
<
String
>[
''
],
fileSystem:
MemoryFileSystem
.
test
(),
platform:
FakePlatform
(),
processManager:
FakeProcessManager
.
list
(<
FakeCommand
>[
fakeCommand
,
]),
logger:
BufferLogger
.
test
(),
terminal:
Terminal
.
test
(),
experiments:
<
String
>[
'non-nullable'
],
);
await
server
.
start
();
});
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart
View file @
5e3e5a2a
...
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
...
...
@@ -34,7 +32,6 @@ void main() {
Directory
tempDir
;
String
projectPath
;
File
libMain
;
Artifacts
artifacts
;
Future
<
void
>
runCommand
({
FlutterCommand
command
,
...
...
@@ -95,11 +92,6 @@ flutter_project:lib/
terminal:
terminal
,
);
analyzerSeparator
=
platform
.
isWindows
?
'-'
:
'•'
;
artifacts
=
CachedArtifacts
(
cache:
globals
.
cache
,
fileSystem:
fileSystem
,
platform:
platform
,
);
});
setUp
(()
{
...
...
@@ -130,7 +122,6 @@ flutter_project:lib/
platform:
platform
,
processManager:
processManager
,
terminal:
terminal
,
artifacts:
artifacts
,
),
arguments:
<
String
>[
'analyze'
,
'--no-pub'
],
statusTextContains:
<
String
>[
'No issues found!'
],
...
...
@@ -146,7 +137,6 @@ flutter_project:lib/
logger:
logger
,
processManager:
processManager
,
terminal:
terminal
,
artifacts:
artifacts
,
),
arguments:
<
String
>[
'analyze'
,
'--no-pub'
,
libMain
.
path
],
toolExit:
true
,
...
...
@@ -185,7 +175,6 @@ flutter_project:lib/
logger:
logger
,
processManager:
processManager
,
terminal:
terminal
,
artifacts:
artifacts
,
),
arguments:
<
String
>[
'analyze'
,
'--no-pub'
],
statusTextContains:
<
String
>[
...
...
@@ -231,7 +220,6 @@ flutter_project:lib/
logger:
logger
,
processManager:
processManager
,
terminal:
terminal
,
artifacts:
artifacts
,
),
arguments:
<
String
>[
'analyze'
,
'--no-pub'
],
statusTextContains:
<
String
>[
...
...
@@ -278,7 +266,6 @@ void bar() {
logger:
logger
,
processManager:
processManager
,
terminal:
terminal
,
artifacts:
artifacts
,
),
arguments:
<
String
>[
'analyze'
,
'--no-pub'
],
statusTextContains:
<
String
>[
...
...
@@ -309,7 +296,6 @@ StringBuffer bar = StringBuffer('baz');
logger:
logger
,
processManager:
processManager
,
terminal:
terminal
,
artifacts:
artifacts
,
),
arguments:
<
String
>[
'analyze'
,
'--no-pub'
],
statusTextContains:
<
String
>[
'No issues found!'
],
...
...
@@ -336,7 +322,6 @@ int? bar;
logger:
logger
,
processManager:
processManager
,
terminal:
terminal
,
artifacts:
artifacts
,
),
arguments:
<
String
>[
'analyze'
,
'--no-pub'
,
'--enable-experiment=non-nullable'
],
statusTextContains:
<
String
>[
'No issues found!'
],
...
...
@@ -364,7 +349,6 @@ StringBuffer bar = StringBuffer('baz');
processManager:
processManager
,
logger:
logger
,
fileSystem:
fileSystem
,
artifacts:
artifacts
,
),
arguments:
<
String
>[
'analyze'
,
'--no-pub'
],
statusTextContains:
<
String
>[
'No issues found!'
],
...
...
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
View file @
5e3e5a2a
...
...
@@ -7,7 +7,6 @@ import 'dart:convert';
import
'dart:typed_data'
;
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/net.dart'
;
...
...
@@ -16,6 +15,7 @@ import 'package:flutter_tools/src/build_info.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/project.dart'
;
...
...
@@ -830,11 +830,7 @@ void main() {
final
String
original
=
file
.
readAsStringSync
();
final
Process
process
=
await
Process
.
start
(
globals
.
fs
.
path
.
join
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
),
'bin'
,
globals
.
platform
.
isWindows
?
'dartfmt.bat'
:
'dartfmt'
,
),
sdkBinaryName
(
'dartfmt'
),
<
String
>[
file
.
path
],
workingDirectory:
projectDir
.
path
,
);
...
...
@@ -932,11 +928,7 @@ void main() {
final
String
original
=
file
.
readAsStringSync
();
final
Process
process
=
await
Process
.
start
(
globals
.
fs
.
path
.
join
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartSdkPath
),
'bin'
,
globals
.
platform
.
isWindows
?
'dartfmt.bat'
:
'dartfmt'
,
),
sdkBinaryName
(
'dartfmt'
),
<
String
>[
file
.
path
],
workingDirectory:
projectDir
.
path
,
);
...
...
@@ -1540,6 +1532,7 @@ Future<void> _ensureFlutterToolsSnapshot() async {
}
final
List
<
String
>
snapshotArgs
=
<
String
>[
...
dartVmFlags
,
'--snapshot=
$flutterToolsSnapshotPath
'
,
'--packages=
$dotPackages
'
,
flutterToolsPath
,
...
...
@@ -1583,12 +1576,13 @@ Future<void> _analyzeProject(String workingDir) async {
));
final
List
<
String
>
args
=
<
String
>[
...
dartVmFlags
,
flutterToolsSnapshotPath
,
'analyze'
,
];
final
ProcessResult
exec
=
await
Process
.
run
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
)
,
'
$dartSdkPath
/bin/dart'
,
args
,
workingDirectory:
workingDir
,
);
...
...
@@ -1611,8 +1605,9 @@ Future<void> _runFlutterTest(Directory workingDir, { String target }) async {
// While flutter test does get packages, it doesn't write version
// files anymore.
await
Process
.
run
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
)
,
'
$dartSdkPath
/bin/dart'
,
<
String
>[
...
dartVmFlags
,
flutterToolsSnapshotPath
,
'packages'
,
'get'
,
...
...
@@ -1621,6 +1616,7 @@ Future<void> _runFlutterTest(Directory workingDir, { String target }) async {
);
final
List
<
String
>
args
=
<
String
>[
...
dartVmFlags
,
flutterToolsSnapshotPath
,
'test'
,
'--no-color'
,
...
...
@@ -1628,7 +1624,7 @@ Future<void> _runFlutterTest(Directory workingDir, { String target }) async {
];
final
ProcessResult
exec
=
await
Process
.
run
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
)
,
'
$dartSdkPath
/bin/dart'
,
args
,
workingDirectory:
workingDir
.
path
,
);
...
...
packages/flutter_tools/test/commands.shard/permeable/test_test.dart
View file @
5e3e5a2a
...
...
@@ -5,10 +5,10 @@
import
'dart:async'
;
import
'dart:convert'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'../../src/common.dart'
;
...
...
@@ -302,6 +302,7 @@ Future<ProcessResult> _runFlutterTest(
}
final
List
<
String
>
args
=
<
String
>[
...
dartVmFlags
,
globals
.
fs
.
path
.
absolute
(
globals
.
fs
.
path
.
join
(
'bin'
,
'flutter_tools.dart'
)),
'test'
,
'--no-color'
,
...
...
@@ -318,7 +319,7 @@ Future<ProcessResult> _runFlutterTest(
_testExclusionLock
=
testExclusionCompleter
.
future
;
try
{
return
await
Process
.
run
(
globals
.
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
),
globals
.
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
),
args
,
workingDirectory:
workingDirectory
,
stdoutEncoding:
utf8
,
...
...
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