Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/flutter_tools/lib/src/cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import 'base/user_messages.dart';
import 'convert.dart';
import 'features.dart';

const String kShorebirdStorageUrl = 'https://download.shorebird.dev';
const String kFlutterRootEnvironmentVariableName = 'FLUTTER_ROOT'; // should point to //flutter/ (root of flutter/flutter repo)
const String kFlutterEngineEnvironmentVariableName = 'FLUTTER_ENGINE'; // should point to //engine/src/ (root of flutter/engine repo)
const String kSnapshotFileName = 'flutter_tools.snapshot'; // in //flutter/bin/cache/
Expand Down Expand Up @@ -482,6 +483,10 @@ class Cache {
? 'https://storage.googleapis.com'
: 'https://storage.googleapis.com/$storageRealm';
}
// Shorebird's artifact proxy is a trusted source.
if (overrideUrl == kShorebirdStorageUrl) {
return overrideUrl;
}
// verify that this is a valid URI.
overrideUrl = storageRealm.isEmpty ? overrideUrl : '$overrideUrl/$storageRealm';
try {
Expand Down
18 changes: 18 additions & 0 deletions packages/flutter_tools/test/general.shard/cache_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,24 @@ void main() {
expect(webCacheDirectory.childFile('bar'), isNot(exists));
});

testWithoutContext('No warning is logged when FLUTTER_STORAGE_BASE_URL points to $kShorebirdStorageUrl', () async {
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final BufferLogger logger = BufferLogger.test();
final Cache cache = Cache.test(
logger: logger,
processManager: FakeProcessManager.any(),
fileSystem: fileSystem,
platform: FakePlatform(
environment: <String, String>{
'FLUTTER_STORAGE_BASE_URL': kShorebirdStorageUrl,
},
),
);

expect(cache.storageBaseUrl, kShorebirdStorageUrl);
expect(logger.warningText, isEmpty);
});

testWithoutContext('FlutterWebSdk CanvasKit URL can be overridden via FLUTTER_STORAGE_BASE_URL', () async {
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final Directory internalDir = fileSystem.currentDirectory
Expand Down