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
a3d80269
Unverified
Commit
a3d80269
authored
Mar 25, 2022
by
Casey Hillers
Committed by
GitHub
Mar 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_conductor] Add candidate branch version to releases (#100781)
parent
48d1372c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
5 deletions
+110
-5
next.dart
dev/conductor/core/lib/src/next.dart
+14
-2
repository.dart
dev/conductor/core/lib/src/repository.dart
+33
-0
next_test.dart
dev/conductor/core/test/next_test.dart
+46
-3
repository_test.dart
dev/conductor/core/test/repository_test.dart
+17
-0
No files found.
dev/conductor/core/lib/src/next.dart
View file @
a3d80269
...
...
@@ -196,9 +196,21 @@ class NextContext extends Context {
upstreamRemote:
upstream
,
previousCheckoutLocation:
state
.
framework
.
checkoutPath
,
);
stdio
.
printStatus
(
'Writing candidate branch...'
);
bool
needsCommit
=
await
framework
.
updateCandidateBranchVersion
(
state
.
releaseVersion
);
if
(
needsCommit
)
{
final
String
revision
=
await
framework
.
commit
(
'Create candidate branch version
${state.engine.candidateBranch}
for
${state.releaseChannel}
'
,
addFirst:
true
,
);
// append to list of cherrypicks so we know a PR is required
state
.
framework
.
cherrypicks
.
add
(
pb
.
Cherrypick
(
appliedRevision:
revision
,
state:
pb
.
CherrypickState
.
COMPLETED
,
));
}
stdio
.
printStatus
(
'Rolling new engine hash
$engineRevision
to framework checkout...'
);
final
bool
needsCommit
=
await
framework
.
updateEngineRevision
(
engineRevision
);
needsCommit
=
await
framework
.
updateEngineRevision
(
engineRevision
);
if
(
needsCommit
)
{
final
String
revision
=
await
framework
.
commit
(
'Update Engine revision to
$engineRevision
for
${state.releaseChannel}
release
${state.releaseVersion}
'
,
...
...
dev/conductor/core/lib/src/repository.dart
View file @
a3d80269
...
...
@@ -620,6 +620,39 @@ class FrameworkRepository extends Repository {
return
Version
.
fromString
(
versionJson
[
'frameworkVersion'
]
as
String
);
}
/// Create a release candidate branch version file.
///
/// This file allows for easily traversing what candidadate branch was used
/// from a release channel.
///
/// Returns [true] if the version file was updated and a commit is needed.
Future
<
bool
>
updateCandidateBranchVersion
(
String
branch
,
{
@visibleForTesting
File
?
versionFile
,
})
async
{
assert
(
branch
.
isNotEmpty
);
versionFile
??=
(
await
checkoutDirectory
)
.
childDirectory
(
'bin'
)
.
childDirectory
(
'internal'
)
.
childFile
(
'release-candidate-branch.version'
);
if
(
versionFile
.
existsSync
())
{
final
String
oldCandidateBranch
=
versionFile
.
readAsStringSync
();
if
(
oldCandidateBranch
.
trim
()
==
branch
.
trim
())
{
stdio
.
printTrace
(
'Tried to update the candidate branch but version file is already up to date at:
$branch
'
,
);
return
false
;
}
}
stdio
.
printStatus
(
'Create
${versionFile.path}
containing
$branch
'
);
versionFile
.
writeAsStringSync
(
// Version files have trailing newlines
'
${branch.trim()}
\n
'
,
flush:
true
,
);
return
true
;
}
/// Update this framework's engine version file.
///
/// Returns [true] if the version file was updated and a commit is needed.
...
...
dev/conductor/core/test/next_test.dart
View file @
a3d80269
...
...
@@ -25,6 +25,7 @@ void main() {
const
String
remoteUrl
=
'https://github.com/org/repo.git'
;
const
String
revision1
=
'd3af60d18e01fcb36e0c0fa06c8502e4935ed095'
;
const
String
revision2
=
'f99555c1e1392bf2a8135056b9446680c2af4ddf'
;
const
String
revision3
=
'ffffffffffffffffffffffffffffffffffffffff'
;
const
String
revision4
=
'280e23318a0d8341415c66aa32581352a421d974'
;
const
String
releaseVersion
=
'1.2.0-3.0.pre'
;
const
String
releaseChannel
=
'beta'
;
...
...
@@ -495,7 +496,21 @@ void main() {
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'status'
,
'--porcelain'
],
stdout:
'MM /path/to/engine.version'
,
stdout:
'MM bin/internal/release-candidate-branch.version'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'add'
,
'--all'
]),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'commit'
,
"--message='Create candidate branch version
$candidateBranch
for
$releaseChannel
'"
,
]),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'rev-parse'
,
'HEAD'
],
stdout:
revision3
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'status'
,
'--porcelain'
],
stdout:
'MM bin/internal/engine.version'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'add'
,
'--all'
]),
const
FakeCommand
(
command:
<
String
>[
...
...
@@ -571,7 +586,21 @@ void main() {
const
FakeCommand
(
command:
<
String
>[
'git'
,
'checkout'
,
workingBranch
]),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'status'
,
'--porcelain'
],
stdout:
'MM path/to/engine.version'
,
stdout:
'MM bin/internal/release-candidate-branch.version'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'add'
,
'--all'
]),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'commit'
,
"--message='Create candidate branch version
$candidateBranch
for
$releaseChannel
'"
,
]),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'rev-parse'
,
'HEAD'
],
stdout:
revision3
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'status'
,
'--porcelain'
],
stdout:
'MM bin/internal/engine.version'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'add'
,
'--all'
]),
const
FakeCommand
(
command:
<
String
>[
...
...
@@ -635,7 +664,21 @@ void main() {
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'status'
,
'--porcelain'
],
stdout:
'MM path/to/.ci.yaml'
,
stdout:
'MM bin/internal/release-candidate-branch.version'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'add'
,
'--all'
]),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'commit'
,
"--message='Create candidate branch version
$candidateBranch
for
$releaseChannel
'"
,
]),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'rev-parse'
,
'HEAD'
],
stdout:
revision3
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'status'
,
'--porcelain'
],
stdout:
'MM bin/internal/engine.version'
,
),
const
FakeCommand
(
command:
<
String
>[
'git'
,
'add'
,
'--all'
]),
const
FakeCommand
(
command:
<
String
>[
...
...
dev/conductor/core/test/repository_test.dart
View file @
a3d80269
...
...
@@ -340,6 +340,23 @@ vars = {
expect
(
processManager
.
hasRemainingExpectations
,
false
);
});
test
(
'updateCandidateBranchVersion() returns false if branch is the same as version file'
,
()
async
{
const
String
branch
=
'flutter-2.15-candidate.3'
;
final
File
versionFile
=
fileSystem
.
file
(
'/release-candidate-branch.version'
)..
writeAsStringSync
(
branch
);
final
Checkouts
checkouts
=
Checkouts
(
fileSystem:
fileSystem
,
parentDirectory:
fileSystem
.
directory
(
rootDir
),
platform:
platform
,
processManager:
processManager
,
stdio:
stdio
,
);
final
FrameworkRepository
repo
=
FrameworkRepository
(
checkouts
);
final
bool
didUpdate
=
await
repo
.
updateCandidateBranchVersion
(
branch
,
versionFile:
versionFile
);
expect
(
didUpdate
,
false
);
});
test
(
'updateEngineRevision() returns false if newCommit is the same as version file'
,
()
async
{
const
String
commit1
=
'abc123'
;
const
String
commit2
=
'def456'
;
...
...
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