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
f3a389c4
Unverified
Commit
f3a389c4
authored
Dec 15, 2021
by
Paul Berry
Committed by
GitHub
Dec 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respect `--dart-sdk` parameter when running analyze.dart tests. (#95174)
parent
7e1e98c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
2 deletions
+38
-2
analyze.dart
dev/bots/analyze.dart
+38
-2
No files found.
dev/bots/analyze.dart
View file @
f3a389c4
...
...
@@ -25,8 +25,13 @@ final String flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(P
final
String
flutter
=
path
.
join
(
flutterRoot
,
'bin'
,
Platform
.
isWindows
?
'flutter.bat'
:
'flutter'
);
final
String
flutterPackages
=
path
.
join
(
flutterRoot
,
'packages'
);
final
String
flutterExamples
=
path
.
join
(
flutterRoot
,
'examples'
);
final
String
dart
=
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
,
'bin'
,
Platform
.
isWindows
?
'dart.exe'
:
'dart'
);
final
String
pub
=
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
,
'bin'
,
Platform
.
isWindows
?
'pub.bat'
:
'pub'
);
/// The path to the `dart` executable; set at the top of `main`
late
final
String
dart
;
/// The path to the `pub` executable; set at the top of `main`
late
final
String
pub
;
final
String
pubCache
=
path
.
join
(
flutterRoot
,
'.pub-cache'
);
/// When you call this, you can pass additional arguments to pass custom
...
...
@@ -36,6 +41,12 @@ final String pubCache = path.join(flutterRoot, '.pub-cache');
/// For example:
/// bin/cache/dart-sdk/bin/dart dev/bots/analyze.dart --dart-sdk=/tmp/dart-sdk
Future
<
void
>
main
(
List
<
String
>
arguments
)
async
{
final
String
dartSdk
=
path
.
join
(
Directory
.
current
.
absolute
.
path
,
_getDartSdkFromArguments
(
arguments
)
??
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
),
);
dart
=
path
.
join
(
dartSdk
,
'bin'
,
Platform
.
isWindows
?
'dart.exe'
:
'dart'
);
pub
=
path
.
join
(
dartSdk
,
'bin'
,
Platform
.
isWindows
?
'pub.bat'
:
'pub'
);
print
(
'
$clock
STARTING ANALYSIS'
);
try
{
await
run
(
arguments
);
...
...
@@ -45,6 +56,31 @@ Future<void> main(List<String> arguments) async {
print
(
'
$clock
${bold}
Analysis successful.
$reset
'
);
}
/// Scans [arguments] for an argument of the form `--dart-sdk` or
/// `--dart-sdk=...` and returns the configured SDK, if any.
String
?
_getDartSdkFromArguments
(
List
<
String
>
arguments
)
{
String
?
result
;
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
+=
1
)
{
if
(
arguments
[
i
]
==
'--dart-sdk'
)
{
if
(
result
!=
null
)
{
exitWithError
(<
String
>[
'The --dart-sdk argument must not be used more than once.'
]);
}
if
(
i
+
1
<
arguments
.
length
)
{
result
=
arguments
[
i
+
1
];
}
else
{
exitWithError
(<
String
>[
'--dart-sdk must be followed by a path.'
]);
}
}
if
(
arguments
[
i
].
startsWith
(
'--dart-sdk='
))
{
if
(
result
!=
null
)
{
exitWithError
(<
String
>[
'The --dart-sdk argument must not be used more than once.'
]);
}
result
=
arguments
[
i
].
substring
(
'--dart-sdk='
.
length
);
}
}
return
result
;
}
Future
<
void
>
run
(
List
<
String
>
arguments
)
async
{
bool
assertsEnabled
=
false
;
assert
(()
{
assertsEnabled
=
true
;
return
true
;
}());
...
...
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