Get android_lint deps using gclient rather than pub. (flutter/engine#26106)

This commit is contained in:
Zachary Anderson 2021-05-13 09:17:56 -07:00 committed by GitHub
parent 5f4bd9b2e5
commit 197908b0a0
7 changed files with 62 additions and 19 deletions

9
DEPS
View File

@ -398,6 +398,15 @@ deps = {
'src/third_party/pkg/archive':
Var('github_git') + '/brendan-duncan/archive.git' + '@' + '3.1.2',
'src/third_party/pkg/file':
Var('github_git') + '/google/file.dart.git' + '@' + '427bb20ccc852425d67f2880da2a9b4707c266b4', # 6.1.0
'src/third_party/pkg/platform':
Var('github_git') + '/google/platform.dart.git' + '@' + 'f63fd0bc3021354a0687dc935962c9acc003f47e', # 3.0.1
'src/third_party/pkg/process':
Var('github_git') + '/google/process.dart.git' + '@' + '0c9aeac86dcc4e3a6cf760b76fed507107e244d5', # 4.2.1
'src/third_party/pkg/when':
Var('dart_git') + '/when.git' + '@' + '0.2.0',

View File

@ -1,2 +1,2 @@
Signature: dd0af3be798528c3303ec68043c4785c
Signature: 7af516b6fef310e37406f37cc6da30ae

View File

@ -6,8 +6,7 @@
import 'sound_main.dart' as m;
// TODO(#72542):
// Migrate the deps in pubspec.yaml to null-safety versions.
// TODO(dnfield): Migrate the deps in pubspec.yaml to null-safety versions.
// In particular see the ongoing work on package:args here:
// https://github.com/dart-lang/args/issues/153
// https://github.com/flutter/flutter/issues/72542
Future<void> main(List<String> args) => m.main(args);

View File

@ -33,8 +33,9 @@ Future<void> main(List<String> args) async {
}
Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
final String inArgument = argResults['in'] as String;
final Directory androidDir = Directory(path.join(
argResults['in'],
inArgument,
'flutter',
'shell',
'platform',
@ -48,7 +49,7 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
}
final Directory androidSdkDir = Directory(
path.join(argResults['in'], 'third_party', 'android_tools', 'sdk'),
path.join(inArgument, 'third_party', 'android_tools', 'sdk'),
);
if (!androidSdkDir.existsSync()) {
@ -58,7 +59,8 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
return -1;
}
if (argResults['rebaseline']) {
final bool rebaseline = argResults['rebaseline'] as bool;
if (rebaseline) {
print('Removing previous baseline.xml...');
final File baselineXml = File(baselineXmlPath);
if (baselineXml.existsSync()) {
@ -67,8 +69,8 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
}
print('Preparing project.xml...');
final IOSink projectXml = File(projectXmlPath).openWrite();
projectXml.write(
'''<!-- THIS FILE IS GENERATED. PLEASE USE THE INCLUDED DART PROGRAM WHICH -->
projectXml.write('''
<!-- THIS FILE IS GENERATED. PLEASE USE THE INCLUDED DART PROGRAM WHICH -->
<!-- WILL AUTOMATICALLY FIND ALL .java FILES AND INCLUDE THEM HERE -->
<project>
<sdk dir="${androidSdkDir.path}" />
@ -82,7 +84,8 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
projectXml.writeln(' <src file="${entity.path}" />');
}
projectXml.write(''' </module>
projectXml.write('''
</module>
</project>
''');
await projectXml.close();
@ -99,8 +102,9 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
'--baseline',
baselineXmlPath,
];
if (argResults['html']) {
lintArgs.addAll(<String>['--html', argResults['out']]);
final bool html = argResults['html'] as bool;
if (html) {
lintArgs.addAll(<String>['--html', argResults['out'] as String]);
}
final String? javaHome = await getJavaHome();
final Process lintProcess = await processManager.start(
@ -113,7 +117,7 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
);
lintProcess.stdout.pipe(stdout);
lintProcess.stderr.pipe(stderr);
return await lintProcess.exitCode;
return lintProcess.exitCode;
}
/// Prepares an [ArgParser] for this script.
@ -171,7 +175,7 @@ Future<String?> getJavaHome() async {
<String>['/usr/libexec/java_home', '-v', '1.8', '-F'],
);
if (result.exitCode == 0) {
return result.stdout.trim();
return (result.stdout as String).trim();
}
}
return Platform.environment['JAVA_HOME'];
@ -201,7 +205,7 @@ Future<void> checkJava1_8() async {
print(javaResult.stderr);
}
// `java -version` writes to stderr.
final String javaVersionStdout = javaResult.stderr;
final String javaVersionStdout = javaResult.stderr as String;
if (!javaVersionStdout.contains('"1.8')) {
print('The Android SDK tools may not work properly with your Java version. '
'If this process fails, please retry using Java 1.8.');

View File

@ -1,8 +1,35 @@
# Copyright 2013 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.
name: android_lint
environment:
sdk: '>=2.12.0-0.0.dev <3.0.0'
# Do not add any dependencies that require more than what is provided in
# //third_party.pkg, //third_party/dart/pkg, or
# //third_party/dart/third_party/pkg. In particular, package:test is not usable
# here.
# If you do add packages here, make sure you can run `pub get --offline`, and
# check the .packages and .package_config to make sure all the paths are
# relative to this directory into //third_party/dart
dependencies:
args: 1.5.0
path: ^1.6.2
process: ^3.0.9
args: any
path: any
process: any
dependency_overrides:
args:
path: ../../../third_party/dart/third_party/pkg/args
file:
path: ../../../third_party/pkg/file/packages/file
meta:
path: ../../../third_party/dart/pkg/meta
path:
path: ../../../third_party/dart/third_party/pkg/path
platform:
path: ../../../third_party/pkg/platform
process:
path: ../../../third_party/pkg/process

View File

@ -1664,7 +1664,10 @@ class _RepositoryPkgDirectory extends _RepositoryDirectory {
@override
bool shouldRecurse(fs.IoNode entry) {
return entry.name != 'archive'; // contains nothing that ends up in the binary executable
return entry.name != 'archive' // contains nothing that ends up in the binary executable
&& entry.name != 'file'
&& entry.name != 'platform'
&& entry.name != 'process';
}
@override

View File

@ -16,6 +16,7 @@ import sys
ALL_PACKAGES = [
os.path.join("src", "flutter", "flutter_frontend_server"),
os.path.join("src", "flutter", "tools", "android_lint"),
os.path.join("src", "flutter", "tools", "const_finder"),
os.path.join("src", "flutter", "tools", "licenses"),
]