@@ -18,6 +18,7 @@ import 'package:pub_worker/src/bin/dartdoc_wrapper.dart';
1818import 'package:pub_worker/src/fetch_pubspec.dart' ;
1919import 'package:pub_worker/src/sdks.dart' ;
2020import 'package:pub_worker/src/utils.dart' ;
21+ import 'package:pubspec_parse/pubspec_parse.dart' as pubspek;
2122import 'package:retry/retry.dart' ;
2223
2324final _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