From 3e5f1cc5f0b92de049b8b5b6fe34d9b066e936e9 Mon Sep 17 00:00:00 2001 From: Zach Anderson Date: Wed, 12 May 2021 13:55:39 -0700 Subject: [PATCH] Get android_lint deps using gclient rather than pub. --- DEPS | 9 +++++++ ci/licenses_golden/tool_signature | 2 +- tools/android_lint/bin/main.dart | 5 ++-- tools/android_lint/bin/sound_main.dart | 26 +++++++++++--------- tools/android_lint/pubspec.yaml | 33 +++++++++++++++++++++++--- tools/licenses/lib/main.dart | 5 +++- tools/pub_get_offline.py | 1 + 7 files changed, 62 insertions(+), 19 deletions(-) diff --git a/DEPS b/DEPS index 01289b82efa0a..ad1f9fd4a1771 100644 --- a/DEPS +++ b/DEPS @@ -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', diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index 5c6d3ec7db051..953a12ba755fb 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: dd0af3be798528c3303ec68043c4785c +Signature: 7af516b6fef310e37406f37cc6da30ae diff --git a/tools/android_lint/bin/main.dart b/tools/android_lint/bin/main.dart index 328f1542c5c5b..c3d22c689b595 100644 --- a/tools/android_lint/bin/main.dart +++ b/tools/android_lint/bin/main.dart @@ -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 main(List args) => m.main(args); diff --git a/tools/android_lint/bin/sound_main.dart b/tools/android_lint/bin/sound_main.dart index 1ca23f288ab9b..e71e3d64832d7 100644 --- a/tools/android_lint/bin/sound_main.dart +++ b/tools/android_lint/bin/sound_main.dart @@ -33,8 +33,9 @@ Future main(List args) async { } Future 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 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 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 runLint(ArgParser argParser, ArgResults argResults) async { } print('Preparing project.xml...'); final IOSink projectXml = File(projectXmlPath).openWrite(); - projectXml.write( - ''' + projectXml.write(''' + @@ -82,7 +84,8 @@ Future runLint(ArgParser argParser, ArgResults argResults) async { projectXml.writeln(' '); } - projectXml.write(''' + projectXml.write(''' + '''); await projectXml.close(); @@ -99,8 +102,9 @@ Future runLint(ArgParser argParser, ArgResults argResults) async { '--baseline', baselineXmlPath, ]; - if (argResults['html']) { - lintArgs.addAll(['--html', argResults['out']]); + final bool html = argResults['html'] as bool; + if (html) { + lintArgs.addAll(['--html', argResults['out'] as String]); } final String? javaHome = await getJavaHome(); final Process lintProcess = await processManager.start( @@ -113,7 +117,7 @@ Future 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 getJavaHome() async { ['/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 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.'); diff --git a/tools/android_lint/pubspec.yaml b/tools/android_lint/pubspec.yaml index 1fb8a75441c74..c7c069489acf6 100644 --- a/tools/android_lint/pubspec.yaml +++ b/tools/android_lint/pubspec.yaml @@ -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 diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index 937a8db7955c0..20a9c64411204 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -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 diff --git a/tools/pub_get_offline.py b/tools/pub_get_offline.py index 59b2f8de3b4e1..f93a9f06bae1b 100644 --- a/tools/pub_get_offline.py +++ b/tools/pub_get_offline.py @@ -16,6 +16,7 @@ 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"), ]