Skip to content

Commit 6a412a5

Browse files
Update conductor to support monorepos (flutter#161704)
Fixes flutter#161616 Tested this PR with the 3.29.0 stable release: - flutter#162899
1 parent 7f783e3 commit 6a412a5

13 files changed

+454
-1271
lines changed

dev/conductor/core/lib/src/next.dart

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -85,79 +85,7 @@ class NextContext extends Context {
8585
CherrypickState.ABANDONED,
8686
];
8787
switch (state.currentPhase) {
88-
case pb.ReleasePhase.APPLY_ENGINE_CHERRYPICKS:
89-
final Remote upstream = Remote.upstream(state.engine.upstream.url);
90-
final EngineRepository engine = EngineRepository(
91-
checkouts,
92-
initialRef: state.engine.workingBranch,
93-
upstreamRemote: upstream,
94-
previousCheckoutLocation: state.engine.checkoutPath,
95-
);
96-
if (!state_import.requiresEnginePR(state)) {
97-
stdio.printStatus('This release has no engine cherrypicks. No Engine PR is necessary.\n');
98-
break;
99-
}
100-
101-
final List<pb.Cherrypick> unappliedCherrypicks = <pb.Cherrypick>[
102-
for (final pb.Cherrypick cherrypick in state.engine.cherrypicks)
103-
if (!finishedStates.contains(cherrypick.state)) cherrypick,
104-
];
105-
106-
if (unappliedCherrypicks.isEmpty) {
107-
stdio.printStatus('All engine cherrypicks have been auto-applied by the conductor.\n');
108-
} else {
109-
if (unappliedCherrypicks.length == 1) {
110-
stdio.printStatus(
111-
'There was ${unappliedCherrypicks.length} cherrypick that was not auto-applied.',
112-
);
113-
} else {
114-
stdio.printStatus(
115-
'There were ${unappliedCherrypicks.length} cherrypicks that were not auto-applied.',
116-
);
117-
}
118-
stdio.printStatus(
119-
'These must be applied manually in the directory '
120-
'${state.engine.checkoutPath} before proceeding.\n',
121-
);
122-
}
123-
if (!autoAccept) {
124-
final bool response = await prompt(
125-
'Are you ready to push your engine branch to the repository '
126-
'${state.engine.mirror.url}?',
127-
);
128-
if (!response) {
129-
stdio.printError('Aborting command.');
130-
updateState(state, stdio.logs);
131-
return;
132-
}
133-
}
134-
135-
await pushWorkingBranch(engine, state.engine);
136-
case pb.ReleasePhase.VERIFY_ENGINE_CI:
137-
stdio.printStatus('You must validate post-submit CI for your engine PR and merge it');
138-
if (!autoAccept) {
139-
final bool response = await prompt(
140-
'Has CI passed for the engine PR?\n\n'
141-
'${state_import.luciConsoleLink(state.engine.candidateBranch, 'engine')}',
142-
);
143-
if (!response) {
144-
stdio.printError('Aborting command.');
145-
updateState(state, stdio.logs);
146-
return;
147-
}
148-
}
14988
case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS:
150-
final Remote engineUpstreamRemote = Remote.upstream(state.engine.upstream.url);
151-
final EngineRepository engine = EngineRepository(
152-
checkouts,
153-
// We explicitly want to check out the merged version from upstream
154-
initialRef: '${engineUpstreamRemote.name}/${state.engine.candidateBranch}',
155-
upstreamRemote: engineUpstreamRemote,
156-
previousCheckoutLocation: state.engine.checkoutPath,
157-
);
158-
159-
final String engineRevision = await engine.reverseParse('HEAD');
160-
16189
final Remote upstream = Remote.upstream(state.framework.upstream.url);
16290
final FrameworkRepository framework = FrameworkRepository(
16391
checkouts,
@@ -166,7 +94,7 @@ class NextContext extends Context {
16694
previousCheckoutLocation: state.framework.checkoutPath,
16795
);
16896
stdio.printStatus('Writing candidate branch...');
169-
bool needsCommit = await framework.updateCandidateBranchVersion(
97+
final bool needsCommit = await framework.updateCandidateBranchVersion(
17098
state.framework.candidateBranch,
17199
);
172100
if (needsCommit) {
@@ -181,20 +109,6 @@ class NextContext extends Context {
181109
..state = pb.CherrypickState.COMPLETED,
182110
);
183111
}
184-
stdio.printStatus('Rolling new engine hash $engineRevision to framework checkout...');
185-
needsCommit = await framework.updateEngineRevision(engineRevision);
186-
if (needsCommit) {
187-
final String revision = await framework.commit(
188-
'Update Engine revision to $engineRevision for ${state.releaseChannel} release ${state.releaseVersion}',
189-
addFirst: true,
190-
);
191-
// append to list of cherrypicks so we know a PR is required
192-
state.framework.cherrypicks.add(
193-
pb.Cherrypick.create()
194-
..appliedRevision = revision
195-
..state = pb.CherrypickState.COMPLETED,
196-
);
197-
}
198112

199113
final List<pb.Cherrypick> unappliedCherrypicks = <pb.Cherrypick>[
200114
for (final pb.Cherrypick cherrypick in state.framework.cherrypicks)

dev/conductor/core/lib/src/proto/compile_proto.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,25 @@
33
# Use of this source code is governed by a BSD-style license that can be
44
# found in the LICENSE file.
55

6-
# //flutter/dev/tools/lib/proto
7-
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
6+
set -euo pipefail
7+
8+
function follow_links() (
9+
cd -P "$(dirname -- "$1")"
10+
file="$PWD/$(basename -- "$1")"
11+
while [[ -h "$file" ]]; do
12+
cd -P "$(dirname -- "$file")"
13+
file="$(readlink -- "$file")"
14+
cd -P "$(dirname -- "$file")"
15+
file="$PWD/$(basename -- "$file")"
16+
done
17+
echo "$file"
18+
)
19+
20+
PROG_NAME="$(follow_links "${BASH_SOURCE[0]}")"
21+
DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
822

923
# Ensure dart-sdk is cached
10-
"$DIR/../../../../bin/dart" --version
24+
"$DIR/../../../../../../bin/dart" --version
1125

1226
if ! type protoc >/dev/null 2>&1; then
1327
PROTOC_LINK='https://grpc.io/docs/protoc-installation/'
@@ -22,13 +36,13 @@ if ! type dart >/dev/null 2>&1; then
2236
fi
2337

2438
# Use null-safe protoc_plugin
25-
dart pub global activate protoc_plugin 20.0.0
39+
dart pub global activate protoc_plugin 21.1.2
2640

2741
protoc --dart_out="$DIR" --proto_path="$DIR" "$DIR/conductor_state.proto"
2842

2943
for SOURCE_FILE in $(ls "$DIR"/*.pb*.dart); do
3044
# Format in place file
31-
dart format --output=write --line-length 120 "$SOURCE_FILE"
45+
dart format --output=write "$SOURCE_FILE"
3246

3347
# Create temp copy with the license header prepended
3448
cp "$DIR/license_header.txt" "${SOURCE_FILE}.tmp"

0 commit comments

Comments
 (0)