Skip to content

Commit 367e077

Browse files
authored
SDK selection: do not accept 3.5 Dart SDK for known macros incompatibility. (#8174)
1 parent c16181e commit 367e077

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Important changes to data models, configuration, and migrations between each
22
AppEngine version, listed here to ease deployment and troubleshooting.
33

44
## Next Release (replace with git tag when deployed)
5+
* Bumped runtimeVersion to `2024.10.21`.
56

67
## `20241017t095600-all`
78
* Bumped runtimeVersion to `2024.10.15`.

app/lib/shared/versions.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ final RegExp runtimeVersionPattern = RegExp(r'^\d{4}\.\d{2}\.\d{2}$');
2424
/// when the version switch happens.
2525
const _acceptedRuntimeVersions = <String>[
2626
// The current [runtimeVersion].
27-
'2024.10.15',
27+
'2024.10.21',
2828
// Fallback runtime versions.
29+
'2024.10.15',
2930
'2024.09.17',
30-
'2024.09.10',
3131
];
3232

3333
/// Sets the current runtime versions.

pkg/pub_worker/lib/src/bin/pana_wrapper.dart

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import 'package:pub_worker/src/bin/dartdoc_wrapper.dart';
1818
import 'package:pub_worker/src/fetch_pubspec.dart';
1919
import 'package:pub_worker/src/sdks.dart';
2020
import 'package:pub_worker/src/utils.dart';
21+
import 'package:pubspec_parse/pubspec_parse.dart' as pubspek;
2122
import 'package:retry/retry.dart';
2223

2324
final _log = Logger('pana');
@@ -207,6 +208,8 @@ Future<({String configKind, String? dartSdkPath, String? flutterSdkPath})>
207208
flutterSdks.firstWhereOrNull((sdk) => !sdk.version.isPreRelease) ??
208209
flutterSdks.firstOrNull;
209210

211+
final minMacrosVersion = pubspec.getDependencyContraintRangeMin('macros');
212+
210213
bool matchesSdks({
211214
required Version? dart,
212215
required Version? flutter,
@@ -237,6 +240,20 @@ Future<({String configKind, String? dartSdkPath, String? flutterSdkPath})>
237240
return false;
238241
}
239242

243+
// temporary exception for macros on 3.5 SDK
244+
// TODO: remove after 3.6 SDK gets released
245+
if (minMacrosVersion != null &&
246+
minMacrosVersion.compareTo(Version.parse('0.1.3-main.0')) >= 0) {
247+
if (dart != null && dart.major == 3 && dart.minor == 5) {
248+
return false;
249+
}
250+
if (flutterDartSdk != null &&
251+
flutterDartSdk.major == 3 &&
252+
flutterDartSdk.minor == 5) {
253+
return false;
254+
}
255+
}
256+
240257
// Otherwise accepting the analysis SDK bundle.
241258
return true;
242259
}
@@ -402,3 +419,17 @@ Future<List<_SdkBundle>> _detectSdkBundles() async {
402419
),
403420
];
404421
}
422+
423+
extension on Pubspec {
424+
Version? getDependencyContraintRangeMin(String package) {
425+
final dep = dependencies[package] ?? devDependencies[package];
426+
if (dep is! pubspek.HostedDependency) {
427+
return null;
428+
}
429+
final vc = dep.version;
430+
if (vc is! VersionRange) {
431+
return null;
432+
}
433+
return vc.min;
434+
}
435+
}

0 commit comments

Comments
 (0)