Unverified Commit 23b7853d authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tool] remove ability to disable Fingerprinter with...

[flutter_tool] remove ability to disable Fingerprinter with DISABLE_FLUTTER_BUILD_CACHE env variable (#46913)
parent 8ca55605
...@@ -10,18 +10,10 @@ import '../convert.dart' show json; ...@@ -10,18 +10,10 @@ import '../convert.dart' show json;
import '../globals.dart'; import '../globals.dart';
import '../version.dart'; import '../version.dart';
import 'file_system.dart'; import 'file_system.dart';
import 'platform.dart';
import 'utils.dart'; import 'utils.dart';
typedef FingerprintPathFilter = bool Function(String path); typedef FingerprintPathFilter = bool Function(String path);
/// Whether to completely disable build caching.
///
/// This is done by always returning false from fingerprinter invocations. This
/// is safe to do generally, because fingerprinting is only a performance
/// improvement.
bool get _disableBuildCache => platform.environment['DISABLE_FLUTTER_BUILD_CACHE']?.toLowerCase() == 'true';
/// A tool that can be used to compute, compare, and write [Fingerprint]s for a /// A tool that can be used to compute, compare, and write [Fingerprint]s for a
/// set of input files and associated build settings. /// set of input files and associated build settings.
/// ///
...@@ -57,9 +49,6 @@ class Fingerprinter { ...@@ -57,9 +49,6 @@ class Fingerprinter {
} }
bool doesFingerprintMatch() { bool doesFingerprintMatch() {
if (_disableBuildCache) {
return false;
}
try { try {
final File fingerprintFile = fs.file(fingerprintPath); final File fingerprintFile = fs.file(fingerprintPath);
if (!fingerprintFile.existsSync()) { if (!fingerprintFile.existsSync()) {
......
...@@ -195,48 +195,6 @@ void main() { ...@@ -195,48 +195,6 @@ void main() {
expect(fingerprinter.doesFingerprintMatch(), isTrue); expect(fingerprinter.doesFingerprintMatch(), isTrue);
}, overrides: contextOverrides); }, overrides: contextOverrides);
final Platform mockPlatformDisabledCache = MockPlatform();
mockPlatformDisabledCache.environment['DISABLE_FLUTTER_BUILD_CACHE'] = 'true';
testUsingContext('can be disabled with an environment variable', () {
fs.file('a.dart').createSync();
fs.file('b.dart').createSync();
final Fingerprinter fingerprinter = Fingerprinter(
fingerprintPath: 'out.fingerprint',
paths: <String>['a.dart', 'b.dart'],
properties: <String, String>{
'bar': 'baz',
'wobble': 'womble',
},
);
fingerprinter.writeFingerprint();
expect(fingerprinter.doesFingerprintMatch(), isFalse);
}, overrides: <Type, Generator>{
Platform: () => mockPlatformDisabledCache,
...contextOverrides,
});
final Platform mockPlatformEnabledCache = MockPlatform();
mockPlatformEnabledCache.environment['DISABLE_FLUTTER_BUILD_CACHE'] = 'false';
testUsingContext('can be not-disabled with an environment variable', () {
fs.file('a.dart').createSync();
fs.file('b.dart').createSync();
final Fingerprinter fingerprinter = Fingerprinter(
fingerprintPath: 'out.fingerprint',
paths: <String>['a.dart', 'b.dart'],
properties: <String, String>{
'bar': 'baz',
'wobble': 'womble',
},
);
fingerprinter.writeFingerprint();
expect(fingerprinter.doesFingerprintMatch(), isTrue);
}, overrides: <Type, Generator>{
Platform: () => mockPlatformEnabledCache,
...contextOverrides,
});
testUsingContext('fails to write fingerprint if inputs are missing', () { testUsingContext('fails to write fingerprint if inputs are missing', () {
final Fingerprinter fingerprinter = Fingerprinter( final Fingerprinter fingerprinter = Fingerprinter(
fingerprintPath: 'out.fingerprint', fingerprintPath: 'out.fingerprint',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment