mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[android] Fix broken --android-skip-build-dependency-validation flag (#172581)
The way I was parsing the boolean previously was just not working. This works. Also restores a set of tests that was deleted in https://github.com/flutter/flutter/pull/171776 that I don't think should have been (missed this in review), and adds a test case for the fix. Added as bringup because the name is changed, but I ran the tests locally and they pass. ## 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/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#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/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Gray Mackall <mackall@google.com>
This commit is contained in:
parent
5d00045ad2
commit
df99f53bc0
7
.ci.yaml
7
.ci.yaml
@ -1528,7 +1528,8 @@ targets:
|
||||
- engine/**
|
||||
- DEPS
|
||||
|
||||
- name: Linux android_java11_tool_integration_tests
|
||||
- name: Linux android_java17_tool_integration_tests
|
||||
bringup: true
|
||||
recipe: flutter/flutter_drone
|
||||
timeout: 60
|
||||
properties:
|
||||
@ -1541,9 +1542,9 @@ targets:
|
||||
{"dependency": "cmake", "version": "build_id:8787856497187628321"},
|
||||
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"},
|
||||
{"dependency": "ninja", "version": "version:1.9.0"},
|
||||
{"dependency": "open_jdk", "version": "version:11"}
|
||||
{"dependency": "open_jdk", "version": "version:17"}
|
||||
]
|
||||
shard: android_java11_tool_integration_tests
|
||||
shard: android_java17_tool_integration_tests
|
||||
tags: >
|
||||
["framework", "hostonly", "shard", "linux"]
|
||||
test_timeout_secs: "2700"
|
||||
|
||||
@ -213,8 +213,7 @@ class FlutterPlugin : Plugin<Project> {
|
||||
val shouldSkipDependencyChecks: Boolean =
|
||||
project.hasProperty("skipDependencyChecks") &&
|
||||
(
|
||||
project.properties["skipDependencyChecks"] as? Boolean
|
||||
?: false
|
||||
project.properties["skipDependencyChecks"].toString().toBoolean()
|
||||
)
|
||||
if (!shouldSkipDependencyChecks) {
|
||||
try {
|
||||
|
||||
@ -0,0 +1,86 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:file/src/interface/file_system_entity.dart';
|
||||
|
||||
import '../integration.shard/test_utils.dart';
|
||||
import '../src/android_common.dart';
|
||||
import '../src/common.dart';
|
||||
import '../src/context.dart';
|
||||
|
||||
void main() {
|
||||
late Directory tempDir;
|
||||
|
||||
setUpAll(() async {
|
||||
tempDir = createResolvedTempDirectorySync('run_test.');
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
tryToDelete(tempDir as FileSystemEntity);
|
||||
});
|
||||
|
||||
testUsingContext('AGP version out of "warn" support band but in "error" band builds '
|
||||
'successfully and prints warning', () async {
|
||||
final versionTuple = VersionTuple(
|
||||
agpVersion: '8.3.0',
|
||||
gradleVersion: '8.12',
|
||||
kotlinVersion: '2.1.0',
|
||||
);
|
||||
final ProcessResult result = await buildFlutterApkWithSpecifiedDependencyVersions(
|
||||
versions: versionTuple,
|
||||
tempDir: tempDir,
|
||||
);
|
||||
expect(result, const ProcessResultMatcher());
|
||||
expect(result.stderr, contains('Please upgrade your Android Gradle Plugin version'));
|
||||
});
|
||||
|
||||
testUsingContext('Gradle version out of "warn" support band but in "error" band builds '
|
||||
'successfully and prints warning', () async {
|
||||
// Create a new flutter project.
|
||||
final versionTuple = VersionTuple(
|
||||
agpVersion: '8.3.0',
|
||||
gradleVersion: '8.4',
|
||||
kotlinVersion: '2.1.0',
|
||||
);
|
||||
final ProcessResult result = await buildFlutterApkWithSpecifiedDependencyVersions(
|
||||
versions: versionTuple,
|
||||
tempDir: tempDir,
|
||||
);
|
||||
expect(result, const ProcessResultMatcher());
|
||||
expect(result.stderr, contains('Please upgrade your Gradle version'));
|
||||
});
|
||||
|
||||
testUsingContext('Kotlin version out of "warn" support band but in "error" band builds '
|
||||
'successfully and prints warning', () async {
|
||||
final versionTuple = VersionTuple(
|
||||
agpVersion: '8.9.1',
|
||||
gradleVersion: '8.12',
|
||||
kotlinVersion: '1.9.25',
|
||||
);
|
||||
final ProcessResult result = await buildFlutterApkWithSpecifiedDependencyVersions(
|
||||
versions: versionTuple,
|
||||
tempDir: tempDir,
|
||||
);
|
||||
|
||||
expect(result, const ProcessResultMatcher());
|
||||
expect(result.stderr, contains('Please upgrade your Kotlin version'));
|
||||
});
|
||||
|
||||
testUsingContext('No logs are printed when suppression flag is passed', () async {
|
||||
final versionTuple = VersionTuple(
|
||||
agpVersion: '8.3.0',
|
||||
gradleVersion: '8.12',
|
||||
kotlinVersion: '2.1.0',
|
||||
);
|
||||
final ProcessResult result = await buildFlutterApkWithSpecifiedDependencyVersions(
|
||||
versions: versionTuple,
|
||||
tempDir: tempDir,
|
||||
skipChecking: true,
|
||||
);
|
||||
expect(result, const ProcessResultMatcher());
|
||||
expect(result.stderr, isNot(contains('Please upgrade your Android Gradle Plugin version')));
|
||||
});
|
||||
}
|
||||
@ -144,6 +144,7 @@ class VersionTuple {
|
||||
Future<ProcessResult> buildFlutterApkWithSpecifiedDependencyVersions({
|
||||
required VersionTuple versions,
|
||||
required Directory tempDir,
|
||||
bool skipChecking = false,
|
||||
}) async {
|
||||
// Create a new flutter project.
|
||||
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
||||
@ -190,6 +191,7 @@ Future<ProcessResult> buildFlutterApkWithSpecifiedDependencyVersions({
|
||||
'build',
|
||||
'apk',
|
||||
'--debug',
|
||||
if (skipChecking) '--android-skip-build-dependency-validation',
|
||||
], workingDirectory: app.path);
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user