Skip to content

Commit 072b887

Browse files
authored
Update link branches to main (#146558)
- Update CS and googlesource.com link branches - Update GitHub /blob/ and /tree/ links Tested links manually and fixes a few broken or deprecated links Added a test that validates that `master` isn't used, except for specified repos. Part of flutter/flutter#121564 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [Features we expect every widget to implement]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat [Data Driven Fixes]: https://github.com/flutter/flutter/wiki/Data-driven-Fixes
1 parent 0207da8 commit 072b887

File tree

41 files changed

+118
-53
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+118
-53
lines changed

.github/workflows/easy-cp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
# TODO(xilaizhang): remove this step once the template is available on release branches.
5454
- name: Get CP Template
5555
run: |
56-
curl -o PULL_REQUEST_CP_TEMPLATE.md https://raw.githubusercontent.com/flutter/flutter/master/.github/PR_TEMPLATE/PULL_REQUEST_CP_TEMPLATE.md
56+
curl -o PULL_REQUEST_CP_TEMPLATE.md https://raw.githubusercontent.com/flutter/flutter/main/.github/PR_TEMPLATE/PULL_REQUEST_CP_TEMPLATE.md
5757
- name: Create PR on CP success
5858
if: ${{ steps.attempt-cp.conclusion == 'success' }}
5959
working-directory: ./flutter

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ open source.
2525
* [Install Flutter](https://flutter.dev/get-started/)
2626
* [Flutter documentation](https://docs.flutter.dev/)
2727
* [Development wiki](https://github.com/flutter/flutter/wiki)
28-
* [Contributing to Flutter](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md)
28+
* [Contributing to Flutter](https://github.com/flutter/flutter/blob/main/CONTRIBUTING.md)
2929

3030
For announcements about new releases, follow the
3131
[flutter-announce@googlegroups.com](https://groups.google.com/forum/#!forum/flutter-announce)
@@ -121,5 +121,5 @@ Information on how to get started can be found in our
121121
[macOS FFI]: https://docs.flutter.dev/development/platform-integration/macos/c-interop
122122
[Windows FFI]: https://docs.flutter.dev/development/platform-integration/windows/building#integrating-with-windows
123123
[platform channels]: https://docs.flutter.dev/development/platform-integration/platform-channels
124-
[interop example]: https://github.com/flutter/flutter/tree/master/examples/platform_channel
124+
[interop example]: https://github.com/flutter/flutter/tree/main/examples/platform_channel
125125
[Impeller]: https://docs.flutter.dev/perf/impeller

dev/bots/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ actions through `recipe_modules`. Searching the builder config in [infra](https:
6161
will indicate the recipe used for a test.
6262

6363
Recipes are just Python with some limitations on what can be imported. They are
64-
[documented](https://github.com/luci/recipes-py/blob/master/doc/user_guide.md)
64+
[documented](https://github.com/luci/recipes-py/blob/main/doc/user_guide.md)
6565
by the [luci/recipes-py GitHub project](https://github.com/luci/recipes-py).
6666

6767
The typical cycle for editing a recipe is:

dev/bots/analyze.dart

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ Future<void> run(List<String> arguments) async {
109109
printProgress('Debug mode instead of checked mode...');
110110
await verifyNoCheckedMode(flutterRoot);
111111

112-
printProgress('Links for creating GitHub issues');
112+
printProgress('Links for creating GitHub issues...');
113113
await verifyIssueLinks(flutterRoot);
114114

115+
printProgress('Links to GitHub...');
116+
await verifyGitHubLinks(flutterRoot);
117+
115118
printProgress('Unexpected binaries...');
116119
await verifyNoBinaries(flutterRoot);
117120

@@ -1220,7 +1223,7 @@ String _bullets(String value) => ' * $value';
12201223
Future<void> verifyIssueLinks(String workingDirectory) async {
12211224
const String issueLinkPrefix = 'https://github.com/flutter/flutter/issues/new';
12221225
const Set<String> stops = <String>{ '\n', ' ', "'", '"', r'\', ')', '>' };
1223-
assert(!stops.contains('.')); // instead of "visit https://foo." say "visit: https://", it copy-pastes better
1226+
assert(!stops.contains('.')); // instead of "visit https://foo." say "visit: https://foo", it copy-pastes better
12241227
const String kGiveTemplates =
12251228
'Prefer to provide a link either to $issueLinkPrefix/choose (the list of issue '
12261229
'templates) or to a specific template directly ($issueLinkPrefix?template=...).\n';
@@ -1291,6 +1294,68 @@ Future<void> verifyIssueLinks(String workingDirectory) async {
12911294
}
12921295
}
12931296

1297+
Future<void> verifyGitHubLinks(String workingDirectory) async {
1298+
const Set<String> stops = <String>{ '\n', ' ', "'", '"', r'\', ')', '>' };
1299+
assert(!stops.contains('.')); // instead of "visit https://foo." say "visit: https://foo", it copy-pastes better
1300+
1301+
// Repos whose default branch is still 'master'
1302+
const Set<String> repoExceptions = <String>{
1303+
'clojure/clojure',
1304+
'dart-lang/test', // TODO(guidezpl): remove when https://github.com/dart-lang/test/issues/2209 is closed
1305+
'eseidelGoogle/bezier_perf',
1306+
'flutter/devtools', // TODO(guidezpl): remove when https://github.com/flutter/devtools/issues/7551 is closed
1307+
'flutter/flutter_gallery_assets', // TODO(guidezpl): remove when subtask in https://github.com/flutter/flutter/issues/121564 is complete
1308+
'flutter/flutter-intellij', // TODO(guidezpl): remove when https://github.com/flutter/flutter-intellij/issues/7342 is closed
1309+
'flutter/platform_tests', // TODO(guidezpl): remove when subtask in https://github.com/flutter/flutter/issues/121564 is complete
1310+
'glfw/glfw',
1311+
'material-components/material-components-android', // TODO(guidezpl): remove when https://github.com/material-components/material-components-android/issues/4144 is closed
1312+
'torvalds/linux',
1313+
'tpn/winsdk-10',
1314+
};
1315+
1316+
const List<String> linkPrefixes = <String>[
1317+
'https://raw.githubusercontent.com/',
1318+
'https://github.com/',
1319+
];
1320+
1321+
final List<String> problems = <String>[];
1322+
final Set<String> suggestions = <String>{};
1323+
final List<File> files = await _gitFiles(workingDirectory);
1324+
for (final File file in files) {
1325+
for (final String linkPrefix in linkPrefixes) {
1326+
final Uint8List bytes = file.readAsBytesSync();
1327+
// We allow invalid UTF-8 here so that binaries don't trip us up.
1328+
// There's a separate test in this file that verifies that all text
1329+
// files are actually valid UTF-8 (see verifyNoBinaries below).
1330+
final String contents = utf8.decode(bytes, allowMalformed: true);
1331+
int start = 0;
1332+
while ((start = contents.indexOf(linkPrefix, start)) >= 0) {
1333+
int end = start + linkPrefixes.length;
1334+
while (end < contents.length && !stops.contains(contents[end])) {
1335+
end += 1;
1336+
}
1337+
final String url = contents.substring(start, end);
1338+
if (url.startsWith(linkPrefix) && !repoExceptions.any(url.contains)) {
1339+
if (url.contains('master')) {
1340+
problems.add('${file.path} contains $url, which uses the banned "master" branch.');
1341+
suggestions.add('Change the URLs above to the expected pattern by '
1342+
'using the "main" branch if it exists, otherwise adding the '
1343+
'repository to the list of exceptions in analyze.dart.');
1344+
}
1345+
}
1346+
start = end;
1347+
}
1348+
}
1349+
}
1350+
assert(problems.isEmpty == suggestions.isEmpty);
1351+
if (problems.isNotEmpty) {
1352+
foundError(<String>[
1353+
...problems,
1354+
...suggestions,
1355+
]);
1356+
}
1357+
}
1358+
12941359
@immutable
12951360
class Hash256 {
12961361
const Hash256(this.a, this.b, this.c, this.d);

dev/bots/codelabs_build_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if [ ${PIPESTATUS[0]} -eq 0 ] || is_expected_failure "$log_file"; then
2929
rm "$log_file"
3030
else
3131
all_builds_ok=0
32-
echo "View https://github.com/flutter/flutter/blob/master/dev/bots/README.md for steps to resolve this failed build test." >> ${log_file}
32+
echo "View https://github.com/flutter/flutter/blob/main/dev/bots/README.md for steps to resolve this failed build test." >> ${log_file}
3333
echo
3434
echo "Log left in $log_file."
3535
echo

dev/conductor/core/bin/cli.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import 'package:file/local.dart';
1313
import 'package:platform/platform.dart';
1414
import 'package:process/process.dart';
1515

16-
const String readmeUrl = 'https://github.com/flutter/flutter/tree/master/dev/conductor/README.md';
16+
const String readmeUrl = 'https://github.com/flutter/flutter/tree/main/dev/conductor/README.md';
1717

1818
Future<void> main(List<String> args) async {
1919
const FileSystem fileSystem = LocalFileSystem();

dev/customer_testing/run_tests.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Future<bool> run(List<String> arguments) async {
6060
void printHelp() {
6161
print('run_tests.dart [options...] path/to/file1.test path/to/file2.test...');
6262
print('For details on the test registry format, see:');
63-
print(' https://github.com/flutter/tests/blob/master/registry/template.test');
63+
print(' https://github.com/flutter/tests/blob/main/registry/template.test');
6464
print('');
6565
print(argParser.usage);
6666
print('');

dev/devicelab/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ _TASK_- the name of your test that also matches the name of the
217217
file in `bin/tasks` without the `.dart` extension.
218218

219219
1. Add target to
220-
[.ci.yaml](https://github.com/flutter/flutter/blob/master/.ci.yaml)
220+
[.ci.yaml](https://github.com/flutter/flutter/blob/main/.ci.yaml)
221221
* Mirror an existing one that has the recipe `devicelab_drone`
222222

223223
If your test needs to run on multiple operating systems, create a separate
@@ -237,7 +237,7 @@ and the test will run based on the artifact against a testbed with a device.
237237

238238
Steps:
239239

240-
1. Update the task class to extend [`BuildTestTask`](https://github.com/flutter/flutter/blob/master/dev/devicelab/lib/tasks/build_test_task.dart)
240+
1. Update the task class to extend [`BuildTestTask`](https://github.com/flutter/flutter/blob/main/dev/devicelab/lib/tasks/build_test_task.dart)
241241
- Override function `getBuildArgs`
242242
- Override function `getTestArgs`
243243
- Override function `parseTaskResult`

dev/devicelab/lib/framework/devices.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ class AndroidDevice extends Device {
649649

650650
/// Retrieves device's wakefulness state.
651651
///
652-
/// See: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/os/PowerManagerInternal.java
652+
/// See: https://android.googlesource.com/platform/frameworks/base/+/main/core/java/android/os/PowerManagerInternal.java
653653
Future<String> _getWakefulness() async {
654654
final String powerInfo = await shellEval('dumpsys', <String>['power']);
655655
// A motoG4 phone returns `mWakefulness=Awake`.

dev/integration_tests/deferred_components_test/run_release_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
# In CI, this script currently depends on a modified version of bundletool because
1111
# ddmlib which bundletool depends on does not yet support detecting QEMU emulator device
12-
# density system properties. See https://android.googlesource.com/platform/tools/base/+/refs/heads/master/ddmlib/src/main/java/com/android/ddmlib/IDevice.java#46
12+
# density system properties. See https://android.googlesource.com/platform/tools/base/+/refs/heads/main/ddmlib/src/main/java/com/android/ddmlib/IDevice.java#46
1313
#
1414
# The modified bundletool which waives the density requirement is at:
1515
# https://chrome-infra-packages.appspot.com/p/flutter/android/bundletool/+/vFt1jA0cUeZLmUCVR5NG2JVB-SgJ18GH_pVYKMOlfUIC

0 commit comments

Comments
 (0)