Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 28b0f3e

Browse files
committed
Get android_lint deps using gclient rather than pub.
1 parent a339374 commit 28b0f3e

5 files changed

Lines changed: 58 additions & 17 deletions

File tree

DEPS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,15 @@ deps = {
398398
'src/third_party/pkg/archive':
399399
Var('github_git') + '/brendan-duncan/archive.git' + '@' + '3.1.2',
400400

401+
'src/third_party/pkg/file':
402+
Var('github_git') + '/google/file.dart.git' + '@' + '427bb20ccc852425d67f2880da2a9b4707c266b4', # 6.1.0
403+
404+
'src/third_party/pkg/platform':
405+
Var('github_git') + '/google/platform.dart.git' + '@' + 'f63fd0bc3021354a0687dc935962c9acc003f47e', # 3.0.1
406+
407+
'src/third_party/pkg/process':
408+
Var('github_git') + '/google/process.dart.git' + '@' + '0c9aeac86dcc4e3a6cf760b76fed507107e244d5', # 4.2.1
409+
401410
'src/third_party/pkg/when':
402411
Var('dart_git') + '/when.git' + '@' + '0.2.0',
403412

tools/android_lint/bin/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import 'sound_main.dart' as m;
88

9-
// TODO(#72542):
10-
// Migrate the deps in pubspec.yaml to null-safety versions.
9+
// TODO(dnfield): Migrate the deps in pubspec.yaml to null-safety versions.
1110
// In particular see the ongoing work on package:args here:
12-
// https://github.com/dart-lang/args/issues/153
11+
// https://github.com/dart-lang/args/issues/153,
12+
// https://github.com/flutter/flutter/issues/72542
1313
Future<void> main(List<String> args) => m.main(args);

tools/android_lint/bin/sound_main.dart

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ Future<void> main(List<String> args) async {
3333
}
3434

3535
Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
36+
final String inArgument = argResults['in'] as String;
3637
final Directory androidDir = Directory(path.join(
37-
argResults['in'],
38+
inArgument,
3839
'flutter',
3940
'shell',
4041
'platform',
@@ -48,7 +49,7 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
4849
}
4950

5051
final Directory androidSdkDir = Directory(
51-
path.join(argResults['in'], 'third_party', 'android_tools', 'sdk'),
52+
path.join(inArgument, 'third_party', 'android_tools', 'sdk'),
5253
);
5354

5455
if (!androidSdkDir.existsSync()) {
@@ -58,7 +59,8 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
5859
return -1;
5960
}
6061

61-
if (argResults['rebaseline']) {
62+
final bool rebaseline = argResults['rebaseline'] as bool;
63+
if (rebaseline) {
6264
print('Removing previous baseline.xml...');
6365
final File baselineXml = File(baselineXmlPath);
6466
if (baselineXml.existsSync()) {
@@ -67,8 +69,8 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
6769
}
6870
print('Preparing project.xml...');
6971
final IOSink projectXml = File(projectXmlPath).openWrite();
70-
projectXml.write(
71-
'''<!-- THIS FILE IS GENERATED. PLEASE USE THE INCLUDED DART PROGRAM WHICH -->
72+
projectXml.write('''
73+
<!-- THIS FILE IS GENERATED. PLEASE USE THE INCLUDED DART PROGRAM WHICH -->
7274
<!-- WILL AUTOMATICALLY FIND ALL .java FILES AND INCLUDE THEM HERE -->
7375
<project>
7476
<sdk dir="${androidSdkDir.path}" />
@@ -82,7 +84,8 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
8284
projectXml.writeln(' <src file="${entity.path}" />');
8385
}
8486

85-
projectXml.write(''' </module>
87+
projectXml.write('''
88+
</module>
8689
</project>
8790
''');
8891
await projectXml.close();
@@ -99,8 +102,9 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
99102
'--baseline',
100103
baselineXmlPath,
101104
];
102-
if (argResults['html']) {
103-
lintArgs.addAll(<String>['--html', argResults['out']]);
105+
final bool html = argResults['html'] as bool;
106+
if (html) {
107+
lintArgs.addAll(<String>['--html', argResults['out'] as String]);
104108
}
105109
final String? javaHome = await getJavaHome();
106110
final Process lintProcess = await processManager.start(
@@ -113,7 +117,7 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
113117
);
114118
lintProcess.stdout.pipe(stdout);
115119
lintProcess.stderr.pipe(stderr);
116-
return await lintProcess.exitCode;
120+
return lintProcess.exitCode;
117121
}
118122

119123
/// Prepares an [ArgParser] for this script.
@@ -171,7 +175,7 @@ Future<String?> getJavaHome() async {
171175
<String>['/usr/libexec/java_home', '-v', '1.8', '-F'],
172176
);
173177
if (result.exitCode == 0) {
174-
return result.stdout.trim();
178+
return (result.stdout as String).trim();
175179
}
176180
}
177181
return Platform.environment['JAVA_HOME'];
@@ -201,7 +205,7 @@ Future<void> checkJava1_8() async {
201205
print(javaResult.stderr);
202206
}
203207
// `java -version` writes to stderr.
204-
final String javaVersionStdout = javaResult.stderr;
208+
final String javaVersionStdout = javaResult.stderr as String;
205209
if (!javaVersionStdout.contains('"1.8')) {
206210
print('The Android SDK tools may not work properly with your Java version. '
207211
'If this process fails, please retry using Java 1.8.');

tools/android_lint/pubspec.yaml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
1+
# Copyright 2013 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
15
name: android_lint
26
environment:
37
sdk: '>=2.12.0-0.0.dev <3.0.0'
48

9+
# Do not add any dependencies that require more than what is provided in
10+
# //third_party.pkg, //third_party/dart/pkg, or
11+
# //third_party/dart/third_party/pkg. In particular, package:test is not usable
12+
# here.
13+
14+
# If you do add packages here, make sure you can run `pub get --offline`, and
15+
# check the .packages and .package_config to make sure all the paths are
16+
# relative to this directory into //third_party/dart
17+
518
dependencies:
6-
args: 1.5.0
7-
path: ^1.6.2
8-
process: ^3.0.9
19+
args: any
20+
path: any
21+
process: any
22+
23+
dependency_overrides:
24+
args:
25+
path: ../../../third_party/dart/third_party/pkg/args
26+
file:
27+
path: ../../../third_party/pkg/file/packages/file
28+
meta:
29+
path: ../../../third_party/dart/pkg/meta
30+
path:
31+
path: ../../../third_party/dart/third_party/pkg/path
32+
platform:
33+
path: ../../../third_party/pkg/platform
34+
process:
35+
path: ../../../third_party/pkg/process

tools/pub_get_offline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
ALL_PACKAGES = [
1818
os.path.join("src", "flutter", "flutter_frontend_server"),
19+
os.path.join("src", "flutter", "tools", "android_lint"),
1920
os.path.join("src", "flutter", "tools", "const_finder"),
2021
os.path.join("src", "flutter", "tools", "licenses"),
2122
]

0 commit comments

Comments
 (0)