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
889e606c
Unverified
Commit
889e606c
authored
Feb 24, 2020
by
Dan Field
Committed by
GitHub
Feb 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Script to find Flutter earliest Flutter revision that contains an engine revision (#50948)
parent
59cc3cdf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
130 additions
and
0 deletions
+130
-0
find_engine_commit.dart
dev/tools/find_engine_commit.dart
+130
-0
No files found.
dev/tools/find_engine_commit.dart
0 → 100644
View file @
889e606c
// 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
'dart:io'
;
void
_validate
(
List
<
String
>
args
)
{
bool
errors
=
false
;
if
(!
File
(
'bin/internal/engine.version'
).
existsSync
())
{
errors
=
true
;
print
(
'This program must be run from the root of your flutter repository.'
);
}
if
(!
File
(
'../engine/src/flutter/DEPS'
).
existsSync
())
{
errors
=
true
;
print
(
'This program assumes the engine directory is a sibling to the flutter repository directory.'
);
}
if
(
args
.
length
!=
1
)
{
errors
=
true
;
print
(
'This program takes the engine revision as a single argument.'
);
}
if
(
errors
)
{
exit
(-
1
);
}
}
const
String
engineRepo
=
'../engine/src/flutter'
;
Future
<
void
>
main
(
List
<
String
>
args
)
async
{
_validate
(
args
);
await
_fetchUpstream
();
await
_fetchUpstream
(
engineRepo
);
String
flutterRevision
;
await
for
(
final
FlutterEngineRevision
revision
in
_logEngineVersions
())
{
if
(!
await
containsRevision
(
args
[
0
],
revision
.
engineRevision
))
{
if
(
flutterRevision
==
null
)
{
print
(
'Revision not found.'
);
exit
(-
1
);
}
print
(
'earliest revision:
$flutterRevision
'
);
print
(
'Tags that contain this engine revision:'
);
print
(
await
_tagsForRevision
(
flutterRevision
));
exit
(
0
);
}
flutterRevision
=
revision
.
flutterRevision
;
}
}
Future
<
void
>
_fetchUpstream
([
String
workingDirectory
=
'.'
])
async
{
print
(
'Fetching remotes for "
$workingDirectory
" - you may be prompted for SSH credentials by git.'
);
final
ProcessResult
fetchResult
=
await
Process
.
run
(
'git'
,
<
String
>[
'fetch'
,
'--all'
,
],
workingDirectory:
workingDirectory
,
);
if
(
fetchResult
.
exitCode
!=
0
)
{
throw
Exception
(
'Failed to fetch upstream in repository
$workingDirectory
'
);
}
}
Future
<
String
>
_tagsForRevision
(
String
flutterRevision
)
async
{
final
ProcessResult
tagResult
=
await
Process
.
run
(
'git'
,
<
String
>[
'tag'
,
'--contains'
,
flutterRevision
,
],
);
return
tagResult
.
stdout
as
String
;
}
Future
<
bool
>
containsRevision
(
String
ancestorRevision
,
String
revision
)
async
{
final
ProcessResult
result
=
await
Process
.
run
(
'git'
,
<
String
>[
'merge-base'
,
'--is-ancestor'
,
ancestorRevision
,
revision
,
],
workingDirectory:
engineRepo
,
);
return
result
.
exitCode
==
0
;
}
Stream
<
FlutterEngineRevision
>
_logEngineVersions
()
async
*
{
final
ProcessResult
result
=
await
Process
.
run
(
'git'
,
<
String
>[
'log'
,
'--oneline'
,
'-p'
,
'--'
,
'bin/internal/engine.version'
,
],
);
if
(
result
.
exitCode
!=
0
)
{
print
(
result
.
stderr
);
throw
Exception
(
'Failed to log bin/internal/engine.version'
);
}
final
List
<
String
>
lines
=
(
result
.
stdout
as
String
).
split
(
'
\n
'
);
int
index
=
0
;
while
(
index
<
lines
.
length
-
1
)
{
final
String
flutterRevision
=
lines
[
index
].
split
(
' '
).
first
;
index
+=
1
;
while
(!
lines
[
index
].
startsWith
(
'+'
)
||
lines
[
index
].
startsWith
(
'+++'
))
{
index
+=
1
;
}
if
(
index
>=
lines
.
length
)
{
break
;
}
final
String
engineRevision
=
lines
[
index
].
substring
(
1
);
yield
FlutterEngineRevision
(
flutterRevision
,
engineRevision
);
index
+=
lines
[
index
+
1
].
startsWith
(
r'\ '
)
?
2
:
1
;
}
}
class
FlutterEngineRevision
{
const
FlutterEngineRevision
(
this
.
flutterRevision
,
this
.
engineRevision
);
final
String
flutterRevision
;
final
String
engineRevision
;
@override
String
toString
()
=>
'
$flutterRevision
:
$engineRevision
'
;
}
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